PEP8 fixes.
This commit is contained in:
@@ -16,6 +16,7 @@ from .objects import curses_session
|
|||||||
from .subreddit import SubredditPage
|
from .subreddit import SubredditPage
|
||||||
from .__version__ import __version__
|
from .__version__ import __version__
|
||||||
|
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
# Pycharm debugging note:
|
# Pycharm debugging note:
|
||||||
|
|||||||
@@ -4,10 +4,12 @@ from __future__ import unicode_literals
|
|||||||
import os
|
import os
|
||||||
import codecs
|
import codecs
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
from six.moves import configparser
|
from six.moves import configparser
|
||||||
|
|
||||||
from . import docs, __version__
|
from . import docs, __version__
|
||||||
|
|
||||||
|
|
||||||
HOME = os.path.expanduser('~')
|
HOME = os.path.expanduser('~')
|
||||||
PACKAGE = os.path.dirname(__file__)
|
PACKAGE = os.path.dirname(__file__)
|
||||||
XDG_HOME = os.getenv('XDG_CONFIG_HOME', os.path.join(HOME, '.config'))
|
XDG_HOME = os.getenv('XDG_CONFIG_HOME', os.path.join(HOME, '.config'))
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import requests
|
|||||||
|
|
||||||
from . import exceptions
|
from . import exceptions
|
||||||
|
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ from __future__ import unicode_literals
|
|||||||
import time
|
import time
|
||||||
import curses
|
import curses
|
||||||
|
|
||||||
import six
|
|
||||||
|
|
||||||
from . import docs
|
from . import docs
|
||||||
from .content import SubredditContent
|
from .content import SubredditContent
|
||||||
from .page import Page, PageController, logged_in
|
from .page import Page, PageController, logged_in
|
||||||
|
|||||||
@@ -318,8 +318,7 @@ class Terminal(object):
|
|||||||
with codecs.open(fp.name, 'r', 'utf-8') as fp2:
|
with codecs.open(fp.name, 'r', 'utf-8') as fp2:
|
||||||
text = ''.join(line for line in fp2 if not line.startswith('#'))
|
text = ''.join(line for line in fp2 if not line.startswith('#'))
|
||||||
text = text.rstrip()
|
text = text.rstrip()
|
||||||
|
return text
|
||||||
return text
|
|
||||||
|
|
||||||
def text_input(self, window, allow_resize=False):
|
def text_input(self, window, allow_resize=False):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import pytest
|
|||||||
from vcr import VCR
|
from vcr import VCR
|
||||||
from six.moves.urllib.parse import urlparse, parse_qs
|
from six.moves.urllib.parse import urlparse, parse_qs
|
||||||
|
|
||||||
from rtv.page import Page
|
|
||||||
from rtv.oauth import OAuthHelper
|
from rtv.oauth import OAuthHelper
|
||||||
from rtv.config import Config
|
from rtv.config import Config
|
||||||
from rtv.terminal import Terminal
|
from rtv.terminal import Terminal
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ def test_content_subreddit_load_more(reddit, terminal):
|
|||||||
assert content.get(50)['type'] == 'Submission'
|
assert content.get(50)['type'] == 'Submission'
|
||||||
assert len(content._submission_data) == 51
|
assert len(content._submission_data) == 51
|
||||||
|
|
||||||
for data in islice(content.iterate(0, 1, 70), 0, 50):
|
for data in islice(content.iterate(0, 1), 0, 50):
|
||||||
assert all(k in data for k in ('object', 'n_rows', 'offset', 'type',
|
assert all(k in data for k in ('object', 'n_rows', 'offset', 'type',
|
||||||
'index', 'title', 'split_title'))
|
'index', 'title', 'split_title'))
|
||||||
# All text should be converted to unicode by this point
|
# All text should be converted to unicode by this point
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import os
|
|
||||||
|
|
||||||
from tornado.web import Application
|
from tornado.web import Application
|
||||||
from tornado.testing import AsyncHTTPTestCase
|
from tornado.testing import AsyncHTTPTestCase
|
||||||
from praw.errors import OAuthException
|
from praw.errors import OAuthException
|
||||||
@@ -155,6 +153,7 @@ def test_oauth_authorize(oauth, reddit, stdscr, refresh_token):
|
|||||||
stdscr.derwin().addstr.assert_called_with(1, 1, message)
|
stdscr.derwin().addstr.assert_called_with(1, 1, message)
|
||||||
assert not oauth.config.save_refresh_token.called
|
assert not oauth.config.save_refresh_token.called
|
||||||
|
|
||||||
|
|
||||||
def test_oauth_clear_data(oauth):
|
def test_oauth_clear_data(oauth):
|
||||||
|
|
||||||
oauth.config.refresh_token = 'secrettoken'
|
oauth.config.refresh_token = 'secrettoken'
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ def test_page_logged_in(terminal):
|
|||||||
page.term = terminal
|
page.term = terminal
|
||||||
|
|
||||||
@logged_in
|
@logged_in
|
||||||
def func(page):
|
def func(_):
|
||||||
raise RuntimeError()
|
raise RuntimeError()
|
||||||
|
|
||||||
# Logged in runs the function
|
# Logged in runs the function
|
||||||
@@ -45,7 +45,7 @@ def test_page_unauthenticated(reddit, terminal, config, oauth):
|
|||||||
mock.patch.object(page, 'draw'):
|
mock.patch.object(page, 'draw'):
|
||||||
|
|
||||||
# Loop
|
# Loop
|
||||||
def func(ch):
|
def func(_):
|
||||||
page.active = False
|
page.active = False
|
||||||
with mock.patch.object(page, 'controller'):
|
with mock.patch.object(page, 'controller'):
|
||||||
page.controller.trigger = mock.MagicMock(side_effect=func)
|
page.controller.trigger = mock.MagicMock(side_effect=func)
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ def test_submission_unauthenticated(submission_page, terminal):
|
|||||||
|
|
||||||
def test_submission_open(submission_page, terminal):
|
def test_submission_open(submission_page, terminal):
|
||||||
|
|
||||||
# Open the selected link with the web browser
|
# Open the selected link with the web browser
|
||||||
with mock.patch.object(terminal, 'open_browser'):
|
with mock.patch.object(terminal, 'open_browser'):
|
||||||
submission_page.controller.trigger(terminal.RETURN)
|
submission_page.controller.trigger(terminal.RETURN)
|
||||||
assert terminal.open_browser.called
|
assert terminal.open_browser.called
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from rtv.subreddit import SubredditPage
|
from rtv.subreddit import SubredditPage
|
||||||
from rtv.content import SubmissionContent
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|||||||
Reference in New Issue
Block a user