From 45df86012480a1f73d909f8f49d177008a4d15dc Mon Sep 17 00:00:00 2001 From: Luis San Martin Date: Thu, 22 Oct 2015 14:32:16 -0300 Subject: [PATCH] PEP8 errors --- httpie/cli.py | 2 +- httpie/input.py | 6 +++--- httpie/utils.py | 1 - setup.py | 6 +++--- tests/fixtures.py | 1 - tests/test_auth.py | 1 - tests/test_docs.py | 6 +++--- tests/test_sessions.py | 19 ++++++++++++------- tests/test_uploads.py | 2 +- 9 files changed, 23 insertions(+), 21 deletions(-) diff --git a/httpie/cli.py b/httpie/cli.py index 2b05a883..9a4d92ac 100644 --- a/httpie/cli.py +++ b/httpie/cli.py @@ -4,7 +4,7 @@ NOTE: the CLI interface may change before reaching v1.0. """ from textwrap import dedent, wrap -#noinspection PyCompatibility +# noinspection PyCompatibility from argparse import (RawDescriptionHelpFormatter, FileType, OPTIONAL, ZERO_OR_MORE, SUPPRESS) diff --git a/httpie/input.py b/httpie/input.py index da3cc525..f9e538ef 100644 --- a/httpie/input.py +++ b/httpie/input.py @@ -303,8 +303,8 @@ class Parser(ArgumentParser): # Infer the method has_data = ( (not self.args.ignore_stdin and not self.env.stdin_isatty) - or any(item.sep in SEP_GROUP_DATA_ITEMS - for item in self.args.items) + or any(item.sep in SEP_GROUP_DATA_ITEMS + for item in self.args.items) ) self.args.method = HTTP_POST if has_data else HTTP_GET @@ -572,7 +572,7 @@ class RequestItemsDict(OrderedDict): else: super(RequestItemsDict, self).__init__(*args, **kwargs) - #noinspection PyMethodOverriding + # noinspection PyMethodOverriding def __setitem__(self, key, value): """ If `key` is assigned more than once, `self[key]` holds a `list` of all the values. diff --git a/httpie/utils.py b/httpie/utils.py index ad2119aa..821fac9f 100644 --- a/httpie/utils.py +++ b/httpie/utils.py @@ -54,4 +54,3 @@ def humanize_bytes(n, precision=2): # noinspection PyUnboundLocalVariable return '%.*f %s' % (precision, n / factor, suffix) - diff --git a/setup.py b/setup.py index cab89c7c..fc19ccf3 100644 --- a/setup.py +++ b/setup.py @@ -40,12 +40,12 @@ install_requires = [ 'Pygments>=1.5' ] -### Conditional dependencies: +# Conditional dependencies: # sdist -if not 'bdist_wheel' in sys.argv: +if 'bdist_wheel' not in sys.argv: try: - #noinspection PyUnresolvedReferences + # noinspection PyUnresolvedReferences import argparse except ImportError: install_requires.append('argparse>=1.2.1') diff --git a/tests/fixtures.py b/tests/fixtures.py index c7b769e6..05737c71 100644 --- a/tests/fixtures.py +++ b/tests/fixtures.py @@ -38,4 +38,3 @@ with open(BIN_FILE_PATH, 'rb') as f: BIN_FILE_CONTENT = f.read() UNICODE = FILE_CONTENT - diff --git a/tests/test_auth.py b/tests/test_auth.py index 6d7cbb49..25006343 100644 --- a/tests/test_auth.py +++ b/tests/test_auth.py @@ -59,4 +59,3 @@ class TestAuth: assert args.auth assert args.auth.key == 'username' assert args.auth.value == '' - diff --git a/tests/test_docs.py b/tests/test_docs.py index ed2ad1e9..a02f6510 100644 --- a/tests/test_docs.py +++ b/tests/test_docs.py @@ -9,7 +9,7 @@ from utils import TESTS_ROOT def has_docutils(): try: - #noinspection PyUnresolvedReferences + # noinspection PyUnresolvedReferences import docutils return True except ImportError: @@ -32,8 +32,8 @@ assert filenames def test_rst_file_syntax(filename): p = subprocess.Popen( ['rst2pseudoxml.py', '--report=1', '--exit-status=1', filename], - stderr=subprocess.PIPE, - stdout=subprocess.PIPE + stderr=subprocess.PIPE, + stdout=subprocess.PIPE ) err = p.communicate()[1] assert p.returncode == 0, err diff --git a/tests/test_sessions.py b/tests/test_sessions.py index 6a0d4b60..966d87b4 100644 --- a/tests/test_sessions.py +++ b/tests/test_sessions.py @@ -64,17 +64,20 @@ class TestSessionFlow(SessionTestBase): def test_session_update(self, httpbin): self.start_session(httpbin) # Get a response to a request from the original session. - r2 = http('--session=test', 'GET', httpbin.url + '/get', env=self.env()) + r2 = http('--session=test', 'GET', httpbin.url + '/get', + env=self.env()) assert HTTP_OK in r2 # Make a request modifying the session data. r3 = http('--follow', '--session=test', '--auth=username:password2', - 'GET', httpbin.url + '/cookies/set?hello=world2', 'Hello:World2', + 'GET', httpbin.url + '/cookies/set?hello=world2', + 'Hello:World2', env=self.env()) assert HTTP_OK in r3 # Get a response to a request from the updated session. - r4 = http('--session=test', 'GET', httpbin.url + '/get', env=self.env()) + r4 = http('--session=test', 'GET', httpbin.url + '/get', + env=self.env()) assert HTTP_OK in r4 assert r4.json['headers']['Hello'] == 'World2' assert r4.json['headers']['Cookie'] == 'hello=world2' @@ -84,7 +87,8 @@ class TestSessionFlow(SessionTestBase): def test_session_read_only(self, httpbin): self.start_session(httpbin) # Get a response from the original session. - r2 = http('--session=test', 'GET', httpbin.url + '/get', env=self.env()) + r2 = http('--session=test', 'GET', httpbin.url + '/get', + env=self.env()) assert HTTP_OK in r2 # Make a request modifying the session data but @@ -96,7 +100,8 @@ class TestSessionFlow(SessionTestBase): assert HTTP_OK in r3 # Get a response from the updated session. - r4 = http('--session=test', 'GET', httpbin.url + '/get', env=self.env()) + r4 = http('--session=test', 'GET', httpbin.url + '/get', + env=self.env()) assert HTTP_OK in r4 # Origin can differ on Travis. @@ -117,8 +122,8 @@ class TestSession(SessionTestBase): 'If-Unmodified-Since: Sat, 29 Oct 1994 19:43:31 GMT', env=self.env()) assert HTTP_OK in r1 - - r2 = http('--session=test', 'GET', httpbin.url + '/get', env=self.env()) + r2 = http('--session=test', 'GET', httpbin.url + '/get', + env=self.env()) assert HTTP_OK in r2 assert no_content_type(r2.json['headers']) assert 'If-Unmodified-Since' not in r2.json['headers'] diff --git a/tests/test_uploads.py b/tests/test_uploads.py index e97bdafb..0bf8457e 100644 --- a/tests/test_uploads.py +++ b/tests/test_uploads.py @@ -30,7 +30,7 @@ class TestMultipartFormDataFileUpload: 'test-file@%s' % FILE_PATH_ARG) assert HTTP_OK in r assert r.count('Content-Disposition: form-data; name="test-file";' - ' filename="%s"' % os.path.basename(FILE_PATH)) == 2 + ' filename="%s"' % os.path.basename(FILE_PATH)) == 2 # Should be 4, but is 3 because httpbin # doesn't seem to support filed field lists assert r.count(FILE_CONTENT) in [3, 4]