-
-
Notifications
You must be signed in to change notification settings - Fork 453
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename modaction.py to mod_action.py (#1166)
Rename modaction.py to mod_action.py
- Loading branch information
1 parent
ffefec2
commit abceb30
Showing
6 changed files
with
46 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
"""Provide the ModAction class.""" | ||
|
||
from .base import PRAWBase | ||
|
||
|
||
class ModAction(PRAWBase): | ||
"""Represent a moderator action.""" | ||
|
||
@property | ||
def mod(self): | ||
"""Return the Redditor who the action was issued by.""" | ||
return self._reddit.redditor(self._mod) # pylint: disable=no-member | ||
|
||
@mod.setter | ||
def mod(self, value): | ||
self._mod = value # pylint: disable=attribute-defined-outside-init |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,17 @@ | ||
"""Provide the ModAction class.""" | ||
"""A placeholder for the old modaction.py file. | ||
from .base import PRAWBase | ||
The new file can be found at praw/models/mod_action.py. | ||
Do not import this module, as it is deprecated. | ||
""" | ||
|
||
class ModAction(PRAWBase): | ||
"""Represent a moderator action.""" | ||
import warnings | ||
from .mod_action import * # noqa | ||
|
||
@property | ||
def mod(self): | ||
"""Return the Redditor who the action was issued by.""" | ||
return self._reddit.redditor(self._mod) # pylint: disable=no-member | ||
|
||
@mod.setter | ||
def mod(self, value): | ||
self._mod = value # pylint: disable=attribute-defined-outside-init | ||
warnings.warn( | ||
"The name modaction has been deprecated. " | ||
"Please import modaction as mod_action. " | ||
"This feature will be removed on the next major version release.", | ||
DeprecationWarning, | ||
stacklevel=2, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
"""This file should be updated as files/classes/functions are deprecated.""" | ||
|
||
import pytest | ||
from . import UnitTest | ||
import warnings | ||
|
||
|
||
class TestDeprecation(UnitTest): | ||
def test_deprecation_modaction(self): | ||
warnings.filterwarnings("error", category=DeprecationWarning) | ||
with pytest.raises(DeprecationWarning): | ||
import praw.models.modaction # noqa | ||
warnings.filterwarnings("default", category=DeprecationWarning) |