Skip to content

Commit

Permalink
#dropTheComma
Browse files Browse the repository at this point in the history
Also known as fixing flake8's E231 errors. :)
  • Loading branch information
pradyunsg committed Aug 25, 2020
1 parent 0d5c09b commit 47af22b
Show file tree
Hide file tree
Showing 34 changed files with 76 additions and 84 deletions.
4 changes: 2 additions & 2 deletions src/pip/_internal/cli/cmdoptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def check_dist_restriction(options, check_target=False):
:param check_target: Whether or not to check if --target is being used.
"""
dist_restriction_set = any(
[options.python_version, options.platform, options.abi, options.implementation,]
[options.python_version, options.platform, options.abi, options.implementation]
)

binary_only = FormatControl(set(), {":all:"})
Expand Down Expand Up @@ -996,5 +996,5 @@ def check_list_path_option(options):

index_group = {
"name": "Package Index Options",
"options": [index_url, extra_index_url, no_index, find_links,],
"options": [index_url, extra_index_url, no_index, find_links],
} # type: Dict[str, Any]
2 changes: 1 addition & 1 deletion src/pip/_internal/cli/progress_bars.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def update(self):
phase = self.next_phase()
suffix = self.suffix % self
line = "".join(
[message, " " if message else "", phase, " " if suffix else "", suffix,]
[message, " " if message else "", phase, " " if suffix else "", suffix]
)

self.writeln(line)
Expand Down
4 changes: 1 addition & 3 deletions src/pip/_internal/commands/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -723,9 +723,7 @@ def create_env_error_message(error, show_traceback, using_user_site):
permissions_part = "Check the permissions"

if not using_user_site:
parts.extend(
[user_option_part, " or ", permissions_part.lower(),]
)
parts.extend([user_option_part, " or ", permissions_part.lower()])
else:
parts.append(permissions_part)
parts.append(".\n")
Expand Down
2 changes: 1 addition & 1 deletion src/pip/_internal/network/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def user_agent():
data = {
"installer": {"name": "pip", "version": __version__},
"python": platform.python_version(),
"implementation": {"name": platform.python_implementation(),},
"implementation": {"name": platform.python_implementation()},
}

if data["implementation"]["name"] == "CPython":
Expand Down
2 changes: 1 addition & 1 deletion src/pip/_internal/operations/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
if PY2:
CopytreeKwargs = TypedDict(
"CopytreeKwargs",
{"ignore": Callable[[str, List[str]], List[str]], "symlinks": bool,},
{"ignore": Callable[[str, List[str]], List[str]], "symlinks": bool},
total=False,
)
else:
Expand Down
2 changes: 1 addition & 1 deletion src/pip/_internal/req/req_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ def _set_requirement(self):
op = "==="

self.req = Requirement(
"".join([self.metadata["Name"], op, self.metadata["Version"],])
"".join([self.metadata["Name"], op, self.metadata["Version"]])
)

def warn_on_mismatching_name(self):
Expand Down
4 changes: 2 additions & 2 deletions src/pip/_internal/utils/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ def setup_logging(verbosity, no_color, user_log_file):
},
},
"formatters": {
"indent": {"()": IndentingFormatter, "format": "%(message)s",},
"indent": {"()": IndentingFormatter, "format": "%(message)s"},
"indent_with_timestamp": {
"()": IndentingFormatter,
"format": "%(message)s",
Expand Down Expand Up @@ -385,7 +385,7 @@ def setup_logging(verbosity, no_color, user_log_file):
"formatter": "indent_with_timestamp",
},
},
"root": {"level": root_level, "handlers": handlers,},
"root": {"level": root_level, "handlers": handlers},
"loggers": {"pip._vendor": {"level": vendored_log_level}},
}
)
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def isolate(tmpdir):
# Note: this will only take effect in subprocesses...
home_drive, home_path = os.path.splitdrive(home_dir)
os.environ.update(
{"USERPROFILE": home_dir, "HOMEDRIVE": home_drive, "HOMEPATH": home_path,}
{"USERPROFILE": home_dir, "HOMEDRIVE": home_drive, "HOMEPATH": home_path}
)
for env_var, sub_path in (
("APPDATA", "AppData/Roaming"),
Expand Down
2 changes: 1 addition & 1 deletion tests/data/packages/LocalEnvironMarker/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ def path_to_url(path):
name="LocalEnvironMarker",
version="0.0.1",
packages=find_packages(),
extras_require={":python_version == '2.7'": ["simple"],},
extras_require={":python_version == '2.7'": ["simple"]},
)
4 changes: 2 additions & 2 deletions tests/functional/test_debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def test_debug__library_versions(script):
assert "{}=={}".format(name, value) in result.stdout


@pytest.mark.parametrize("args", [[], ["--verbose"],])
@pytest.mark.parametrize("args", [[], ["--verbose"]])
def test_debug__tags(script, args):
"""
Check the compatible tag output.
Expand All @@ -65,7 +65,7 @@ def test_debug__tags(script, args):


@pytest.mark.parametrize(
"args, expected", [(["--python-version", "3.7"], "(target: version_info='3.7')"),]
"args, expected", [(["--python-version", "3.7"], "(target: version_info='3.7')")]
)
def test_debug__target_options(script, args, expected):
"""
Expand Down
4 changes: 2 additions & 2 deletions tests/functional/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -1896,7 +1896,7 @@ def test_install_yanked_file_and_print_warning(script, data):
assert "Successfully installed simple-3.0\n" in result.stdout, str(result)


@pytest.mark.parametrize("install_args", [(), ("--trusted-host", "localhost"),])
@pytest.mark.parametrize("install_args", [(), ("--trusted-host", "localhost")])
def test_install_sends_client_cert(install_args, script, cert_factory, data):
cert_path = cert_factory()
ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
Expand All @@ -1906,7 +1906,7 @@ def test_install_sends_client_cert(install_args, script, cert_factory, data):

server = make_mock_server(ssl_context=ctx)
server.mock.side_effect = [
package_page({"simple-3.0.tar.gz": "/files/simple-3.0.tar.gz",}),
package_page({"simple-3.0.tar.gz": "/files/simple-3.0.tar.gz"}),
file_response(str(data.packages / "simple-3.0.tar.gz")),
]

Expand Down
4 changes: 2 additions & 2 deletions tests/functional/test_install_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ def test_prompt_for_authentication(script, data, cert_factory):

server = make_mock_server(ssl_context=ctx)
server.mock.side_effect = [
package_page({"simple-3.0.tar.gz": "/files/simple-3.0.tar.gz",}),
package_page({"simple-3.0.tar.gz": "/files/simple-3.0.tar.gz"}),
authorization_response(str(data.packages / "simple-3.0.tar.gz")),
]

Expand Down Expand Up @@ -286,7 +286,7 @@ def test_do_not_prompt_for_authentication(script, data, cert_factory):
server = make_mock_server(ssl_context=ctx)

server.mock.side_effect = [
package_page({"simple-3.0.tar.gz": "/files/simple-3.0.tar.gz",}),
package_page({"simple-3.0.tar.gz": "/files/simple-3.0.tar.gz"}),
authorization_response(str(data.packages / "simple-3.0.tar.gz")),
]

Expand Down
4 changes: 2 additions & 2 deletions tests/functional/test_install_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def test_basic_install_from_unicode_wheel(script, data):
make_wheel(
"unicode_package",
"1.0",
extra_files={"வணக்கம்/__init__.py": b"", "வணக்கம்/નમસ્તે.py": b"",},
extra_files={"வணக்கம்/__init__.py": b"", "வணக்கம்/નમસ્તે.py": b""},
).save_to_dir(script.scratch_path)

result = script.pip(
Expand Down Expand Up @@ -287,7 +287,7 @@ def test_wheel_record_lines_in_deterministic_order(script, data):

def test_wheel_record_lines_have_hash_for_data_files(script):
package = make_wheel(
"simple", "0.1.0", extra_data_files={"purelib/info.txt": "c",},
"simple", "0.1.0", extra_data_files={"purelib/info.txt": "c"},
).save_to_dir(script.scratch_path)
script.pip("install", package)
record_file = script.site_packages_path / "simple-0.1.0.dist-info" / "RECORD"
Expand Down
4 changes: 2 additions & 2 deletions tests/functional/test_new_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def test_new_resolver_ignore_dependencies(script):


@pytest.mark.parametrize(
"root_dep", ["base[add]", "base[add] >= 0.1.0",],
"root_dep", ["base[add]", "base[add] >= 0.1.0"],
)
def test_new_resolver_installs_extras(tmpdir, script, root_dep):
req_file = tmpdir.joinpath("requirements.txt")
Expand Down Expand Up @@ -901,7 +901,7 @@ def _wheel_from_index(script, name, version, requires, extras):
return name

@pytest.mark.parametrize(
"pkg_builder", [_local_with_setup, _direct_wheel, _wheel_from_index,],
"pkg_builder", [_local_with_setup, _direct_wheel, _wheel_from_index],
)
def test_new_resolver_extra_merge_in_package(
self, monkeypatch, script, pkg_builder,
Expand Down
8 changes: 4 additions & 4 deletions tests/functional/test_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ def test_pypi_xml_transformation():
"""
pypi_hits = [
{"name": "foo", "summary": "foo summary", "version": "1.0",},
{"name": "foo", "summary": "foo summary v2", "version": "2.0",},
{"name": "foo", "summary": "foo summary", "version": "1.0"},
{"name": "foo", "summary": "foo summary v2", "version": "2.0"},
{
"_pypi_ordering": 50,
"name": "bar",
Expand All @@ -39,8 +39,8 @@ def test_pypi_xml_transformation():
},
]
expected = [
{"versions": ["1.0", "2.0"], "name": "foo", "summary": "foo summary v2",},
{"versions": ["1.0"], "name": "bar", "summary": "bar summary",},
{"versions": ["1.0", "2.0"], "name": "foo", "summary": "foo summary v2"},
{"versions": ["1.0"], "name": "bar", "summary": "bar summary"},
]
assert transform_hits(pypi_hits) == expected

Expand Down
10 changes: 5 additions & 5 deletions tests/functional/test_uninstall.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def test_uninstall_easy_install_after_import(script):
assert_all_changes(
result,
result2,
[script.venv / "build", "cache", script.site_packages / "easy-install.pth",],
[script.venv / "build", "cache", script.site_packages / "easy-install.pth"],
)


Expand Down Expand Up @@ -198,7 +198,7 @@ def test_uninstall_entry_point_colon_in_name(script, console_scripts):
name=pkg_name,
version="0.1",
entry_points={
"console_scripts": [console_scripts,],
"console_scripts": [console_scripts],
"pip_test.ep": [
"ep:name1 = distutils_install",
"ep:name2 = distutils_install",
Expand Down Expand Up @@ -227,7 +227,7 @@ def test_uninstall_gui_scripts(script):
script,
name=pkg_name,
version="0.1",
entry_points={"gui_scripts": ["test_ = distutils_install",],},
entry_points={"gui_scripts": ["test_ = distutils_install"]},
)
script_name = script.bin_path.joinpath("test_")
if sys.platform == "win32":
Expand Down Expand Up @@ -263,7 +263,7 @@ def test_uninstall_console_scripts_uppercase_name(script):
script,
name="ep_install",
version="0.1",
entry_points={"console_scripts": ["Test = distutils_install",],},
entry_points={"console_scripts": ["Test = distutils_install"]},
)
script_name = script.bin_path.joinpath("Test" + script.exe)

Expand All @@ -287,7 +287,7 @@ def test_uninstall_easy_installed_console_scripts(script):
assert_all_changes(
result,
result2,
[script.venv / "build", "cache", script.site_packages / "easy-install.pth",],
[script.venv / "build", "cache", script.site_packages / "easy-install.pth"],
)


Expand Down
2 changes: 1 addition & 1 deletion tests/functional/test_uninstall_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,5 @@ def test_uninstall_editable_from_usersite(self, script, data):
assert_all_changes(
result1,
result2,
[script.venv / "build", "cache", script.user_site / "easy-install.pth",],
[script.venv / "build", "cache", script.user_site / "easy-install.pth"],
)
2 changes: 1 addition & 1 deletion tests/lib/certs.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def make_tls_cert(hostname):
key = rsa.generate_private_key(
public_exponent=65537, key_size=2048, backend=default_backend()
)
subject = issuer = x509.Name([x509.NameAttribute(NameOID.COMMON_NAME, hostname),])
subject = issuer = x509.Name([x509.NameAttribute(NameOID.COMMON_NAME, hostname)])
cert = (
x509.CertificateBuilder()
.subject_name(subject)
Expand Down
4 changes: 2 additions & 2 deletions tests/lib/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def text_html_response(text):
# type: (Text) -> Responder
def responder(environ, start_response):
# type: (Environ, StartResponse) -> Body
start_response("200 OK", [("Content-Type", "text/html; charset=UTF-8"),])
start_response("200 OK", [("Content-Type", "text/html; charset=UTF-8")])
return [text.encode("utf-8")]

return responder
Expand Down Expand Up @@ -233,7 +233,7 @@ def responder(environ, start_response):
# type: (Environ, StartResponse) -> Body

start_response(
"401 Unauthorized", [("WWW-Authenticate", "Basic"),],
"401 Unauthorized", [("WWW-Authenticate", "Basic")],
)

with open(path, "rb") as f:
Expand Down
4 changes: 2 additions & 2 deletions tests/lib/wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def make_metadata_file(
return File(path, ensure_binary(value))

metadata = CaseInsensitiveDict(
{"Metadata-Version": "2.1", "Name": name, "Version": version,}
{"Metadata-Version": "2.1", "Name": name, "Version": version}
)
if updates is not _default:
metadata.update(updates)
Expand Down Expand Up @@ -244,7 +244,7 @@ def record_file_maker_wrapper(
def wheel_name(name, version, pythons, abis, platforms):
# type: (str, str, str, str, str) -> str
stem = "-".join(
[name, version, ".".join(pythons), ".".join(abis), ".".join(platforms),]
[name, version, ".".join(pythons), ".".join(abis), ".".join(platforms)]
)
return "{}.whl".format(stem)

Expand Down
Loading

0 comments on commit 47af22b

Please sign in to comment.