Skip to content

Commit 8d35a12

Browse files
authored
Fix several issues found with flake8 (httpie#1081)
1 parent 8374a9e commit 8d35a12

10 files changed

Lines changed: 18 additions & 17 deletions

File tree

‎httpie/cli/definition.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ def __iter__(self):
709709
ssl.add_argument(
710710
'--ssl',
711711
dest='ssl_version',
712-
choices=list(sorted(AVAILABLE_SSL_VERSION_ARG_MAPPING.keys())),
712+
choices=sorted(AVAILABLE_SSL_VERSION_ARG_MAPPING.keys()),
713713
help='''
714714
The desired protocol version to use. This will default to
715715
SSL v2.3 which will negotiate the highest protocol that both

‎httpie/config.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import errno
21
import json
32
import os
43
from pathlib import Path

‎setup.cfg‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,13 @@ addopts = --tb=native --doctest-modules
1717
exclude = .git,.idea,__pycache__,build,dist,.pytest_cache,*.egg-info
1818

1919
# <http://pycodestyle.pycqa.org/en/latest/intro.html#error-codes>
20-
# E241 - multiple spaces after ','
2120
# E501 - line too long
2221
# W503 - line break before binary operator
23-
ignore = E241,E501,W503
22+
ignore = E501,W503
23+
24+
25+
[flake8]
26+
# <https://flake8.pycqa.org/en/latest/user/error-codes.html>
27+
# E501 - line too long
28+
# W503 - line break before binary operator
29+
ignore = E501,W503

‎setup.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def run_tests(self):
5959

6060
# bdist_wheel
6161
extras_require = {
62-
'test': tests_require,
62+
'test': tests_require,
6363
# https://wheel.readthedocs.io/en/latest/#defining-conditional-dependencies
6464
':sys_platform == "win32"': install_requires_win_only,
6565
}

‎tests/test_docs.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
def has_docutils():
1919
try:
2020
# noinspection PyUnresolvedReferences,PyPackageRequirements
21-
import docutils
21+
import docutils # noqa
2222
return True
2323
except ImportError:
2424
return False
@@ -35,7 +35,7 @@ def rst_filenames():
3535
os.chdir(cwd)
3636

3737

38-
filenames = list(sorted(rst_filenames()))
38+
filenames = sorted(rst_filenames())
3939
assert filenames
4040

4141

‎tests/test_httpie.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def test_form_POST_file_redirected_stdin(httpbin):
130130
<https://github.com/httpie/httpie/issues/840>
131131
132132
"""
133-
with open(FILE_PATH) as f:
133+
with open(FILE_PATH):
134134
r = http(
135135
'--form',
136136
'POST',

‎tests/test_output.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import json
66
import os
7-
import tempfile
87
import io
98
from urllib.request import urlopen
109

‎tests/test_sessions.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ def test_cookie_storage_priority(self, cli_cookie, set_cookie, expected, httpbin
479479
2. command line arg
480480
3. cookie already stored in session file
481481
"""
482-
r = http(
482+
http(
483483
'--session', str(self.session_path),
484484
httpbin.url + set_cookie,
485485
'Cookie:' + cli_cookie,

‎tests/test_windows.py‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
import os
2-
import tempfile
3-
41
import pytest
52
from httpie.context import Environment
63

‎tests/utils/matching/test_matching.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,19 +69,19 @@ def test_assert_output_matches_body_and_separator():
6969

7070

7171
def test_assert_output_matches_body_r():
72-
assert_output_matches(f'AAA\r', [Expect.BODY])
72+
assert_output_matches('AAA\r', [Expect.BODY])
7373

7474

7575
def test_assert_output_matches_body_n():
76-
assert_output_matches(f'AAA\n', [Expect.BODY])
76+
assert_output_matches('AAA\n', [Expect.BODY])
7777

7878

7979
def test_assert_output_matches_body_r_body():
80-
assert_output_matches(f'AAA\rBBB', [Expect.BODY])
80+
assert_output_matches('AAA\rBBB', [Expect.BODY])
8181

8282

8383
def test_assert_output_matches_body_n_body():
84-
assert_output_matches(f'AAA\nBBB', [Expect.BODY])
84+
assert_output_matches('AAA\nBBB', [Expect.BODY])
8585

8686

8787
def test_assert_output_matches_headers_and_body():

0 commit comments

Comments
 (0)