Skip to content

Commit

Permalink
Update file contents for the new package name.
Browse files Browse the repository at this point in the history
  • Loading branch information
bboe committed Jul 1, 2012
1 parent add35a9 commit adaf89f
Show file tree
Hide file tree
Showing 13 changed files with 230 additions and 231 deletions.
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
tags
.coverage
*.pyc
*~
*.egg
*.pyc
.coverage
*.egg-info/
_build/
build/
dist/
reddit.egg-info/
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
include COPYING
include reddit/*.cfg
include praw/praw.ini
2 changes: 1 addition & 1 deletion deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ if [ $lines -ne 2 ]; then
exit 1
fi

version=$(python -c "import reddit; print reddit.__version__")
version=$(python -c "import praw; print praw.__version__")

read -p "Do you want to deploy $version? [y/n] " input
case $input in
Expand Down
6 changes: 3 additions & 3 deletions lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
dir=$(dirname $0)

# pep8
output=$(find $dir/reddit -name [A-Za-z_]\*.py -exec pep8 {} \;)
output=$(find $dir/praw -name [A-Za-z_]\*.py -exec pep8 {} \;)
if [ -n "$output" ]; then
echo "---pep8---"
echo -e "$output"
exit 1
fi

# pylint
output=$(pylint --rcfile=$dir/.pylintrc $dir/reddit 2> /dev/null)
output=$(pylint --rcfile=$dir/.pylintrc $dir/praw 2> /dev/null)
if [ -n "$output" ]; then
echo "--pylint--"
echo -e "$output"
fi

echo "---pyflakes---"
find $dir/reddit -name [A-Za-z_]\*.py -exec pyflakes {} \;
find $dir/praw -name [A-Za-z_]\*.py -exec pyflakes {} \;

exit 0
198 changes: 98 additions & 100 deletions praw/__init__.py

Large diffs are not rendered by default.

21 changes: 10 additions & 11 deletions praw/backport.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
# This file is part of reddit_api.
# This file is part of PRAW.
#
# reddit_api is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# PRAW is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# reddit_api is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# PRAW is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with reddit_api. If not, see <http://www.gnu.org/licenses/>.
# You should have received a copy of the GNU General Public License along with
# PRAW. If not, see <http://www.gnu.org/licenses/>.

from six import MovedAttribute, add_move

Expand Down
35 changes: 17 additions & 18 deletions praw/decorators.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
# This file is part of reddit_api.
# This file is part of PRAW.
#
# reddit_api is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# PRAW is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# reddit_api is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# PRAW is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with reddit_api. If not, see <http://www.gnu.org/licenses/>.
# You should have received a copy of the GNU General Public License along with
# PRAW. If not, see <http://www.gnu.org/licenses/>.

import reddit.backport # pylint: disable-msg=W0611
from . import backport # pylint: disable-msg=W0611

import six
import sys
Expand All @@ -22,7 +21,7 @@
from functools import wraps
from six.moves import urljoin

from reddit import errors
from . import errors


class Memoize(object):
Expand Down Expand Up @@ -153,9 +152,9 @@ def function_wrapper(self, *args, **kwargs):


def parse_api_json_response(function): # pylint: disable-msg=R0912
"""Decorator to look at the Reddit API response to an API POST request like
vote, subscribe, login, etc. Basically, it just looks for certain errors in
the return string. If it doesn't find one, then it just returns True.
"""Decorator to look at the response to an API POST request like vote,
subscribe, login, etc. Basically, it just looks for certain errors in the
return string. If it doesn't find one, then it just returns True.
"""
@wraps(function)
def error_checked_function(self, *args, **kwargs):
Expand Down Expand Up @@ -229,5 +228,5 @@ def moderator_required_function(self, subreddit, *args, **kwargs):


# Avoid circular import: http://effbot.org/zone/import-confusion.htm
from reddit.objects import RedditContentObject
from reddit.helpers import _request
from .objects import RedditContentObject
from .helpers import _request
21 changes: 10 additions & 11 deletions praw/errors.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
# This file is part of reddit_api.
# This file is part of PRAW.
#
# reddit_api is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# PRAW is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# reddit_api is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# PRAW is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with reddit_api. If not, see <http://www.gnu.org/licenses/>.
# You should have received a copy of the GNU General Public License along with
# PRAW. If not, see <http://www.gnu.org/licenses/>.

import inspect
import six
Expand Down
29 changes: 14 additions & 15 deletions praw/helpers.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# This file is part of reddit_api.
# This file is part of PRAW.
#
# reddit_api is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# PRAW is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# reddit_api is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# PRAW is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with reddit_api. If not, see <http://www.gnu.org/licenses/>.
# You should have received a copy of the GNU General Public License along with
# PRAW. If not, see <http://www.gnu.org/licenses/>.

from . import backport # pylint: disable-msg=W0611

import reddit.backport # pylint: disable-msg=W0611
import six
from six.moves import Request, quote, urlencode, urljoin
from reddit.decorators import Memoize, SleepAfter, require_login
from .decorators import Memoize, SleepAfter, require_login


def _get_section(subpath=''):
Expand All @@ -38,8 +38,7 @@ def _section(self, sort='new', time='all', *args, **kw):

def _get_sorter(subpath='', **defaults):
"""
Used by the Reddit Page classes to generate each of the currently supported
sorts (hot, top, new, best).
Used to generate the various Submission listings.
"""
def _sorted(self, *args, **kw):
if 'url_data' in kw and kw['url_data']:
Expand Down
49 changes: 24 additions & 25 deletions praw/objects.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
# This file is part of reddit_api.
# This file is part of PRAW.
#
# reddit_api is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# PRAW is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# reddit_api is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# PRAW is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with reddit_api. If not, see <http://www.gnu.org/licenses/>.
# You should have received a copy of the GNU General Public License along with
# PRAW. If not, see <http://www.gnu.org/licenses/>.

import reddit.backport # pylint: disable-msg=W0611
from . import backport # pylint: disable-msg=W0611

import six
import warnings
from six.moves import urljoin

from reddit.decorators import limit_chars, require_login
from reddit.errors import ClientException
from reddit.helpers import (_get_section, _get_sorter, _modify_relationship,
_request)
from .decorators import limit_chars, require_login
from .errors import ClientException
from .helpers import (_get_section, _get_sorter, _modify_relationship,
_request)

REDDITOR_KEYS = ('approved_by', 'author', 'banned_by', 'redditor')

Expand Down Expand Up @@ -165,7 +164,7 @@ def edit(self, text):
response = self.reddit_session.request_json(url, params)
# pylint: disable-msg=E1101
_request.evict([self.reddit_session.config['user']])
# REDDIT: Reddit's end should only ever return a single comment
# REDDIT: reddit's end should only ever return a single comment
return response['data']['things'][0]


Expand Down Expand Up @@ -193,13 +192,13 @@ def reply(self, text):


class Messageable(RedditContentObject):
"""Interface for Reddit content objects that can be messaged."""
"""Interface for RedditContentObjects that can be messaged."""
def compose_message(self, subject, message):
return self.reddit_session.compose_message(self, subject, message)


class Reportable(RedditContentObject):
"""Interface for Reddit content objects that can be reported."""
"""Interface for RedditContentObjects that can be reported."""
@require_login
def report(self):
url = self.reddit_session.config['report']
Expand All @@ -211,7 +210,7 @@ def report(self):


class Saveable(RedditContentObject):
"""Interface for Reddit content objects that can be saved."""
"""Interface for RedditContentObjects that can be saved."""
@require_login
def save(self, unsave=False):
"""If logged in, save the content."""
Expand All @@ -228,7 +227,7 @@ def unsave(self):


class Voteable(RedditContentObject):
"""Interface for Reddit content objects that can be voted on."""
"""Interface for RedditContentObjects that can be voted on."""
def clear_vote(self):
return self.vote()

Expand Down Expand Up @@ -354,7 +353,7 @@ def comments(self, update=True):


class Redditor(Messageable):
"""A class for Redditor methods."""
"""A class representing the users of reddit."""
get_overview = _get_section('')
get_comments = _get_section('comments')
get_submitted = _get_section('submitted')
Expand Down Expand Up @@ -403,7 +402,7 @@ def unfriend(self):


class LoggedInRedditor(Redditor):
"""A class for a currently logged in redditor"""
"""A class for a currently logged in Redditor"""
@require_login
def get_inbox(self, limit=0):
"""Return a generator for inbox messages."""
Expand Down Expand Up @@ -443,7 +442,7 @@ def my_reddits(self, limit=0):

class Submission(Approvable, Deletable, Distinguishable, Editable, Reportable,
Saveable, Voteable):
"""A class for submissions to Reddit."""
"""A class for submissions to reddit."""
@staticmethod
def get_info(reddit_session, url, comments_only=False):
url_data = {}
Expand Down Expand Up @@ -771,7 +770,7 @@ class UserList(RedditContentObject):
def __init__(self, reddit_session, json_dict=None, fetch=False):
super(UserList, self).__init__(reddit_session, json_dict, fetch)

# HACK: Convert children to RedditorObjects
# HACK: Convert children to Redditor instances
for i in range(len(self.children)):
tmp = self.children[i]
redditor = Redditor(reddit_session, tmp['name'], fetch=False)
Expand Down
30 changes: 15 additions & 15 deletions praw/settings.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# This file is part of reddit_api.
# This file is part of PRAW.
#
# reddit_api is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# PRAW is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# reddit_api is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# PRAW is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with reddit_api. If not, see <http://www.gnu.org/licenses/>.
# You should have received a copy of the GNU General Public License along with
# PRAW. If not, see <http://www.gnu.org/licenses/>.

import reddit.backport # pylint: disable-msg=W0611
from . import backport # pylint: disable-msg=W0611

import os
import sys
from six.moves import configparser
from warnings import warn_explicit


def _load_configuration():
Expand All @@ -29,9 +29,9 @@ def _load_configuration():
os_config_path = os.environ['XDG_CONFIG_HOME']
else: # Legacy Linux
os_config_path = os.path.join(os.environ['HOME'], '.config')
locations = [os.path.join(module_dir, 'reddit_api.cfg'),
os.path.join(os_config_path, 'reddit_api', 'reddit_api.cfg'),
'reddit_api.cfg']
locations = [os.path.join(module_dir, 'praw.ini'),
os.path.join(os_config_path, 'praw.ini'),
'praw.ini']
if not config.read(locations):
raise Exception('Could not find config file in any of: %s' % locations)
return config
Expand Down
Loading

0 comments on commit adaf89f

Please sign in to comment.