1
-
# This file is part of reddit_api.
1
+
# This file is part of PRAW.
2
2
#
3
-
# reddit_api is free software: you can redistribute it and/or modify
4
-
# it under the terms of the GNU General Public License as published by
5
-
# the Free Software Foundation, either version 3 of the License, or
6
-
# (at your option) any later version.
3
+
# PRAW is free software: you can redistribute it and/or modify it under the
4
+
# terms of the GNU General Public License as published by the Free Software
5
+
# Foundation, either version 3 of the License, or (at your option) any later
6
+
# version.
7
7
#
8
-
# reddit_api is distributed in the hope that it will be useful,
9
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
-
# GNU General Public License for more details.
8
+
# PRAW is distributed in the hope that it will be useful, but WITHOUT ANY
9
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
10
+
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
11
#
13
-
# You should have received a copy of the GNU General Public License
14
-
# along with reddit_api. If not, see <http://www.gnu.org/licenses/>.
12
+
# You should have received a copy of the GNU General Public License along with
13
+
# PRAW. If not, see <http://www.gnu.org/licenses/>.
15
14
16
-
import reddit.backport # pylint: disable-msg=W0611
15
+
from . import backport # pylint: disable-msg=W0611
17
16
18
17
import six
19
18
import warnings
20
19
from six.moves import urljoin
21
20
22
-
from reddit.decorators import limit_chars, require_login
23
-
from reddit.errors import ClientException
24
-
from reddit.helpers import (_get_section, _get_sorter, _modify_relationship,
25
-
_request)
21
+
from .decorators import limit_chars, require_login
22
+
from .errors import ClientException
23
+
from .helpers import (_get_section, _get_sorter, _modify_relationship,
24
+
_request)
26
25
27
26
REDDITOR_KEYS = ('approved_by', 'author', 'banned_by', 'redditor')
28
27
@@ -165,7 +164,7 @@ def edit(self, text):
165
164
response = self.reddit_session.request_json(url, params)
166
165
# pylint: disable-msg=E1101
167
166
_request.evict([self.reddit_session.config['user']])
168
-
# REDDIT: Reddit's end should only ever return a single comment
167
+
# REDDIT: reddit's end should only ever return a single comment
169
168
return response['data']['things'][0]
170
169
171
170
@@ -193,13 +192,13 @@ def reply(self, text):
193
192
194
193
195
194
class Messageable(RedditContentObject):
196
-
"""Interface for Reddit content objects that can be messaged."""
195
+
"""Interface for RedditContentObjects that can be messaged."""
197
196
def compose_message(self, subject, message):
198
197
return self.reddit_session.compose_message(self, subject, message)
199
198
200
199
201
200
class Reportable(RedditContentObject):
202
-
"""Interface for Reddit content objects that can be reported."""
201
+
"""Interface for RedditContentObjects that can be reported."""
203
202
@require_login
204
203
def report(self):
205
204
url = self.reddit_session.config['report']
@@ -211,7 +210,7 @@ def report(self):
211
210
212
211
213
212
class Saveable(RedditContentObject):
214
-
"""Interface for Reddit content objects that can be saved."""
213
+
"""Interface for RedditContentObjects that can be saved."""
215
214
@require_login
216
215
def save(self, unsave=False):
217
216
"""If logged in, save the content."""
@@ -228,7 +227,7 @@ def unsave(self):
228
227
229
228
230
229
class Voteable(RedditContentObject):
231
-
"""Interface for Reddit content objects that can be voted on."""
230
+
"""Interface for RedditContentObjects that can be voted on."""
232
231
def clear_vote(self):
233
232
return self.vote()
234
233
@@ -354,7 +353,7 @@ def comments(self, update=True):
354
353
355
354
356
355
class Redditor(Messageable):
357
-
"""A class for Redditor methods."""
356
+
"""A class representing the users of reddit."""
358
357
get_overview = _get_section('')
359
358
get_comments = _get_section('comments')
360
359
get_submitted = _get_section('submitted')
@@ -403,7 +402,7 @@ def unfriend(self):
403
402
404
403
405
404
class LoggedInRedditor(Redditor):
406
-
"""A class for a currently logged in redditor"""
405
+
"""A class for a currently logged in Redditor"""
407
406
@require_login
408
407
def get_inbox(self, limit=0):
409
408
"""Return a generator for inbox messages."""
@@ -443,7 +442,7 @@ def my_reddits(self, limit=0):
443
442
444
443
class Submission(Approvable, Deletable, Distinguishable, Editable, Reportable,
445
444
Saveable, Voteable):
446
-
"""A class for submissions to Reddit."""
445
+
"""A class for submissions to reddit."""
447
446
@staticmethod
448
447
def get_info(reddit_session, url, comments_only=False):
449
448
url_data = {}
@@ -771,7 +770,7 @@ class UserList(RedditContentObject):
771
770
def __init__(self, reddit_session, json_dict=None, fetch=False):
772
771
super(UserList, self).__init__(reddit_session, json_dict, fetch)
773
772
774
-
# HACK: Convert children to RedditorObjects
773
+
# HACK: Convert children to Redditor instances
775
774
for i in range(len(self.children)):
776
775
tmp = self.children[i]
777
776
redditor = Redditor(reddit_session, tmp['name'], fetch=False)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4