Switched to relative imports for python3.

This commit is contained in:
Michael Lazar
2015-02-03 22:09:19 -08:00
parent cafc08dafa
commit 31529a9770
8 changed files with 21 additions and 22 deletions

View File

@@ -2,10 +2,10 @@ import argparse
import praw import praw
from requests.exceptions import ConnectionError from requests.exceptions import ConnectionError
from errors import SubmissionURLError, SubredditNameError from rtv.errors import SubmissionURLError, SubredditNameError
from utils import curses_session from rtv.utils import curses_session
from subreddit import SubredditPage from rtv.subreddit import SubredditPage
from submission import SubmissionPage from rtv.submission import SubmissionPage
parser = argparse.ArgumentParser(description='Reddit Terminal Viewer') parser = argparse.ArgumentParser(description='Reddit Terminal Viewer')
parser.add_argument('-s', dest='subreddit', default='front', help='subreddit name') parser.add_argument('-s', dest='subreddit', default='front', help='subreddit name')

View File

@@ -1 +0,0 @@
from main import main

View File

@@ -5,7 +5,7 @@ from contextlib import contextmanager
import praw import praw
import six import six
from errors import SubmissionURLError, SubredditNameError from .errors import SubmissionURLError, SubredditNameError
def clean(unicode_string): def clean(unicode_string):
""" """
@@ -69,7 +69,7 @@ class BaseContent(object):
while True: while True:
try: try:
yield self.get(index, n_cols) yield self.get(index, n_cols=n_cols)
except IndexError: except IndexError:
break break
index += step index += step
@@ -231,7 +231,7 @@ class SubmissionContent(BaseContent):
return data return data
def toggle(self, index): def toggle(self, index, n_cols=70):
""" """
Toggle the state of the object at the given index. Toggle the state of the object at the given index.
@@ -244,7 +244,7 @@ class SubmissionContent(BaseContent):
if data['type'] == 'Comment': if data['type'] == 'Comment':
cache = [data] cache = [data]
count = 1 count = 1
for d in self.iterate(index+1, 1): for d in self.iterate(index+1, 1, n_cols):
if d['level'] <= data['level']: if d['level'] <= data['level']:
break break
@@ -256,7 +256,7 @@ class SubmissionContent(BaseContent):
comment['cache'] = cache comment['cache'] = cache
comment['count'] = count comment['count'] = count
comment['level'] = data['level'] comment['level'] = data['level']
comment['body'] = 'Hidden [{}]'.format(count) comment['body'] = 'Hidden'.format(count)
self._comment_data[index:index+len(cache)] = [comment] self._comment_data[index:index+len(cache)] = [comment]
elif data['type'] == 'HiddenComment': elif data['type'] == 'HiddenComment':

View File

@@ -1,6 +1,6 @@
import curses import curses
from utils import Color from .utils import Color
class Navigator(object): class Navigator(object):
""" """

View File

@@ -3,9 +3,9 @@ import sys
import six import six
from content import SubmissionContent from .content import SubmissionContent
from page import BasePage from .page import BasePage
from utils import LoadScreen, Color from .utils import LoadScreen, Color
class SubmissionPage(BasePage): class SubmissionPage(BasePage):

View File

@@ -1,11 +1,11 @@
import curses import curses
import sys import sys
from errors import SubredditNameError from .errors import SubredditNameError
from page import BasePage from .page import BasePage
from submission import SubmissionPage from .submission import SubmissionPage
from content import SubredditContent from .content import SubredditContent
from utils import LoadScreen, text_input, display_message, Color from .utils import LoadScreen, text_input, display_message, Color
class SubredditPage(BasePage): class SubredditPage(BasePage):

View File

@@ -5,7 +5,7 @@ import threading
from curses import textpad from curses import textpad
from contextlib import contextmanager from contextlib import contextmanager
from errors import EscapePressed from .errors import EscapePressed
class Color(object): class Color(object):

View File

@@ -13,5 +13,5 @@ setup(
keywords='reddit terminal praw', keywords='reddit terminal praw',
packages=['rtv'], packages=['rtv'],
install_requires=['praw', 'six'], install_requires=['praw', 'six'],
entry_points={'console_scripts': ['rtv=rtv:main']} entry_points={'console_scripts': ['rtv=main:main']}
) )