Skip to content

Commit d7ae311

Browse files
authored
Ran black and isort to fix files missed by commit hook (#790)
1 parent c9b70d1 commit d7ae311

File tree

16 files changed

+49
-44
lines changed

16 files changed

+49
-44
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import requests
22

3+
34
def main(url):
45
r = requests.get(url)
56
print(r.text)
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from __init__ import main
22

3-
43
if __name__ == "__main__":
54
main("https://example.com")

examples/pip_install/main.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import boto3
22

3+
34
def the_dir():
45
return dir(boto3)
56

examples/pip_install/pip_install_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def test_dist_info(self):
5252
env.split(" "),
5353
[
5454
"external/pip/pypi__boto3/site-packages/boto3-1.14.51.dist-info/DESCRIPTION.rst",
55-
'external/pip/pypi__boto3/site-packages/boto3-1.14.51.dist-info/INSTALLER',
55+
"external/pip/pypi__boto3/site-packages/boto3-1.14.51.dist-info/INSTALLER",
5656
"external/pip/pypi__boto3/site-packages/boto3-1.14.51.dist-info/METADATA",
5757
"external/pip/pypi__boto3/site-packages/boto3-1.14.51.dist-info/RECORD",
5858
"external/pip/pypi__boto3/site-packages/boto3-1.14.51.dist-info/WHEEL",

examples/pip_parse/pip_parse_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def test_dist_info(self):
4949
self.assertListEqual(
5050
env.split(" "),
5151
[
52-
'external/pypi_requests/site-packages/requests-2.25.1.dist-info/INSTALLER',
52+
"external/pypi_requests/site-packages/requests-2.25.1.dist-info/INSTALLER",
5353
"external/pypi_requests/site-packages/requests-2.25.1.dist-info/LICENSE",
5454
"external/pypi_requests/site-packages/requests-2.25.1.dist-info/METADATA",
5555
"external/pypi_requests/site-packages/requests-2.25.1.dist-info/RECORD",

examples/pip_repository_annotations/pip_repository_annotations_test.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,9 @@ def test_data_exclude_glob(self):
6868
current_wheel_version = "0.37.1"
6969

7070
r = runfiles.Create()
71-
dist_info_dir = (
72-
"pip_repository_annotations_example/external/{}/site-packages/wheel-{}.dist-info".format(
73-
self.wheel_pkg_dir(),
74-
current_wheel_version,
75-
)
71+
dist_info_dir = "pip_repository_annotations_example/external/{}/site-packages/wheel-{}.dist-info".format(
72+
self.wheel_pkg_dir(),
73+
current_wheel_version,
7674
)
7775

7876
# Note: `METADATA` is important as it's consumed by https://docs.python.org/3/library/importlib.metadata.html

gazelle/modules_mapping/generator.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,7 @@ def is_metadata(path):
6868
# Ref: https://peps.python.org/pep-0427/#what-s-the-deal-with-purelib-vs-platlib
6969
def data_has_purelib_or_platlib(path):
7070
maybe_lib = path.split("/")[1].lower()
71-
return is_metadata(path) and (
72-
maybe_lib == "purelib" or maybe_lib == "platlib"
73-
)
74-
71+
return is_metadata(path) and (maybe_lib == "purelib" or maybe_lib == "platlib")
7572

7673

7774
def module_for_path(path, whl, mapping):
@@ -95,7 +92,7 @@ def module_for_path(path, whl, mapping):
9592
if ext == ".so":
9693
# Also remove extra metadata that is embeded as part of
9794
# the file name as an extra extension.
98-
ext = ''.join(pathlib.Path(root).suffixes)
95+
ext = "".join(pathlib.Path(root).suffixes)
9996
module = root[: -len(ext)].replace("/", ".")
10097
mapping[module] = wheel_name
10198

gazelle/parse.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def parse_import_statements(content, filepath):
2121
"name": subnode.name,
2222
"lineno": node.lineno,
2323
"filepath": filepath,
24-
"from": ""
24+
"from": "",
2525
}
2626
modules.append(module)
2727
elif isinstance(node, ast.ImportFrom) and node.level == 0:
@@ -30,7 +30,7 @@ def parse_import_statements(content, filepath):
3030
"name": f"{node.module}.{subnode.name}",
3131
"lineno": node.lineno,
3232
"filepath": filepath,
33-
"from": node.module
33+
"from": node.module,
3434
}
3535
modules.append(module)
3636
return modules
@@ -52,8 +52,9 @@ def parse(repo_root, rel_package_path, filename):
5252
content = file.read()
5353
# From simple benchmarks, 2 workers gave the best performance here.
5454
with concurrent.futures.ThreadPoolExecutor(max_workers=2) as executor:
55-
modules_future = executor.submit(parse_import_statements, content,
56-
rel_filepath)
55+
modules_future = executor.submit(
56+
parse_import_statements, content, rel_filepath
57+
)
5758
comments_future = executor.submit(parse_comments, content)
5859
modules = modules_future.result()
5960
comments = comments_future.result()
@@ -73,12 +74,11 @@ def main(stdin, stdout):
7374
filenames = parse_request["filenames"]
7475
outputs = list()
7576
if len(filenames) == 1:
76-
outputs.append(parse(repo_root, rel_package_path,
77-
filenames[0]))
77+
outputs.append(parse(repo_root, rel_package_path, filenames[0]))
7878
else:
7979
futures = [
80-
executor.submit(parse, repo_root, rel_package_path,
81-
filename) for filename in filenames
80+
executor.submit(parse, repo_root, rel_package_path, filename)
81+
for filename in filenames
8282
if filename != ""
8383
]
8484
for future in concurrent.futures.as_completed(futures):

gazelle/testdata/with_third_party_requirements_from_imports/__main__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
from google.cloud import aiplatform
2-
31
from bar import main
2+
from google.cloud import aiplatform
43

54
if __name__ == "__main__":
65
print(aiplatform)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from google.cloud import aiplatform, storage
22

3+
34
def main():
45
a = dir(aiplatform)
56
b = dir(storage)

0 commit comments

Comments
 (0)