PEP8 fixes.

This commit is contained in:
Michael Lazar
2015-12-03 00:20:20 -08:00
parent a7b789bfd9
commit 5a0932f6d3
11 changed files with 10 additions and 12 deletions

View File

@@ -16,6 +16,7 @@ from .objects import curses_session
from .subreddit import SubredditPage
from .__version__ import __version__
_logger = logging.getLogger(__name__)
# Pycharm debugging note:

View File

@@ -4,10 +4,12 @@ from __future__ import unicode_literals
import os
import codecs
import argparse
from six.moves import configparser
from . import docs, __version__
HOME = os.path.expanduser('~')
PACKAGE = os.path.dirname(__file__)
XDG_HOME = os.getenv('XDG_CONFIG_HOME', os.path.join(HOME, '.config'))

View File

@@ -17,6 +17,7 @@ import requests
from . import exceptions
_logger = logging.getLogger(__name__)

View File

@@ -4,8 +4,6 @@ from __future__ import unicode_literals
import time
import curses
import six
from . import docs
from .content import SubredditContent
from .page import Page, PageController, logged_in

View File

@@ -318,8 +318,7 @@ class Terminal(object):
with codecs.open(fp.name, 'r', 'utf-8') as fp2:
text = ''.join(line for line in fp2 if not line.startswith('#'))
text = text.rstrip()
return text
return text
def text_input(self, window, allow_resize=False):
"""

View File

@@ -11,7 +11,6 @@ import pytest
from vcr import VCR
from six.moves.urllib.parse import urlparse, parse_qs
from rtv.page import Page
from rtv.oauth import OAuthHelper
from rtv.config import Config
from rtv.terminal import Terminal

View File

@@ -173,7 +173,7 @@ def test_content_subreddit_load_more(reddit, terminal):
assert content.get(50)['type'] == 'Submission'
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',
'index', 'title', 'split_title'))
# All text should be converted to unicode by this point

View File

@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
from tornado.web import Application
from tornado.testing import AsyncHTTPTestCase
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)
assert not oauth.config.save_refresh_token.called
def test_oauth_clear_data(oauth):
oauth.config.refresh_token = 'secrettoken'

View File

@@ -17,7 +17,7 @@ def test_page_logged_in(terminal):
page.term = terminal
@logged_in
def func(page):
def func(_):
raise RuntimeError()
# Logged in runs the function
@@ -45,7 +45,7 @@ def test_page_unauthenticated(reddit, terminal, config, oauth):
mock.patch.object(page, 'draw'):
# Loop
def func(ch):
def func(_):
page.active = False
with mock.patch.object(page, 'controller'):
page.controller.trigger = mock.MagicMock(side_effect=func)

View File

@@ -80,7 +80,7 @@ def test_submission_unauthenticated(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'):
submission_page.controller.trigger(terminal.RETURN)
assert terminal.open_browser.called

View File

@@ -2,7 +2,6 @@
from __future__ import unicode_literals
from rtv.subreddit import SubredditPage
from rtv.content import SubmissionContent
try:
from unittest import mock