Skip to content

Commit 64300b1

Browse files
committed
Run black on all python files
1 parent 218f6c0 commit 64300b1

File tree

47 files changed

+84
-56
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+84
-56
lines changed

examples/build_file_generation/__init__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,14 @@
1818

1919
app = Flask(__name__)
2020

21-
@app.route('/random-number', methods=['GET'])
21+
22+
@app.route("/random-number", methods=["GET"])
2223
def get_random_number():
23-
return jsonify({'number': generate_random_number.generate_random_number()})
24+
return jsonify({"number": generate_random_number.generate_random_number()})
25+
2426

2527
"""Start the python web server"""
28+
29+
2630
def main():
2731
app.run()

examples/build_file_generation/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@
1414

1515
from __init__ import main
1616

17-
if __name__ == '__main__':
17+
if __name__ == "__main__":
1818
main()

examples/build_file_generation/__test__.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@
2020
class TestServer(unittest.TestCase):
2121
def setUp(self):
2222
self.app = app.test_client()
23-
23+
2424
def test_get_random_number(self):
25-
response = self.app.get('/random-number')
25+
response = self.app.get("/random-number")
2626
self.assertEqual(response.status_code, 200)
27-
self.assertIn('number', response.json)
28-
29-
if __name__ == '__main__':
27+
self.assertIn("number", response.json)
28+
29+
30+
if __name__ == "__main__":
3031
unittest.main()

examples/build_file_generation/random_number_generator/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,3 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-

examples/build_file_generation/random_number_generator/__test__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ def test_generate_random_number(self):
2222
number = generate_random_number.generate_random_number()
2323
self.assertGreaterEqual(number, 1)
2424
self.assertLessEqual(number, 10)
25-
26-
if __name__ == '__main__':
25+
26+
27+
if __name__ == "__main__":
2728
unittest.main()

examples/build_file_generation/random_number_generator/generate_random_number.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,7 @@
1515
import random
1616

1717
"""Generate a random number"""
18+
19+
1820
def generate_random_number():
1921
return random.randint(1, 10)

examples/bzlmod_build_file_generation/runfiles/runfiles_test.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ def testCurrentRepository(self):
2626
self.assertEqual(runfiles.Create().CurrentRepository(), "")
2727

2828
def testRunfilesWithRepoMapping(self):
29-
data_path = runfiles.Create().Rlocation("example_bzlmod_build_file_generation/runfiles/data/data.txt")
29+
data_path = runfiles.Create().Rlocation(
30+
"example_bzlmod_build_file_generation/runfiles/data/data.txt"
31+
)
3032
with open(data_path) as f:
3133
self.assertEqual(f.read().strip(), "Hello, example_bzlmod!")
3234

examples/multi_python_versions/tests/my_lib_test.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323
if not my_lib.websockets_is_for_python_version(
2424
workspace_version
2525
) and not my_lib.websockets_is_for_python_version(bzlmod_version):
26-
print("expected package for Python version is different than returned\n"
27-
f"expected either {workspace_version} or {bzlmod_version}\n"
28-
f"but got {my_lib.websockets.__file__}")
26+
print(
27+
"expected package for Python version is different than returned\n"
28+
f"expected either {workspace_version} or {bzlmod_version}\n"
29+
f"but got {my_lib.websockets.__file__}"
30+
)
2931
sys.exit(1)

examples/pip_parse/pip_parse_test.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,7 @@ class PipInstallTest(unittest.TestCase):
2828
def _remove_leading_dirs(self, paths):
2929
# Removes the first two directories (external/<reponame>)
3030
# to normalize what workspace and bzlmod produce.
31-
return [
32-
'/'.join(v.split('/')[2:])
33-
for v in paths
34-
]
31+
return ["/".join(v.split("/")[2:]) for v in paths]
3532

3633
def test_entry_point(self):
3734
entry_point_path = os.environ.get("YAMLLINT_ENTRY_POINT")

examples/py_proto_library/message_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
class TestCase(unittest.TestCase):
88
def test_message(self):
99
got = message_pb2.TestMessage(
10-
index = 5,
10+
index=5,
1111
)
1212
self.assertIsNotNone(got)
1313

1414

1515
if __name__ == "__main__":
16-
sys.exit(unittest.main())
16+
sys.exit(unittest.main())

examples/wheel/private/directory_writer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def main() -> None:
4848

4949
args.output.mkdir(parents=True, exist_ok=True)
5050

51-
for (path, content) in args.files:
51+
for path, content in args.files:
5252
new_file = args.output / path
5353
new_file.parent.mkdir(parents=True, exist_ok=True)
5454
new_file.write_text(content)

examples/wheel/wheel_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def assertAllEntriesHasReproducibleMetadata(self, zf):
6262
self.assertEqual(
6363
zinfo.external_attr,
6464
(stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO | stat.S_IFREG) << 16,
65-
msg=zinfo.filename
65+
msg=zinfo.filename,
6666
)
6767
self.assertEqual(
6868
zinfo.compress_type, zipfile.ZIP_DEFLATED, msg=zinfo.filename
@@ -486,7 +486,7 @@ def test_minimal_data_files(self):
486486
"minimal_data_files-0.0.1.data/data/target/path/README.md",
487487
"minimal_data_files-0.0.1.data/scripts/NOTICE",
488488
"minimal_data_files-0.0.1.dist-info/RECORD",
489-
]
489+
],
490490
)
491491

492492

gazelle/manifest/copy_to_source.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def copy_to_source(generated_relative_path: Path, target_relative_path: Path) ->
2626
target_absolute_path.parent.mkdir(parents=True, exist_ok=True)
2727
shutil.copy(generated_absolute_path, target_absolute_path)
2828

29-
target_absolute_path.chmod(0O664)
29+
target_absolute_path.chmod(0o664)
3030

3131

3232
if __name__ == "__main__":

gazelle/python/parse.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def parse_main(content):
7272
if token_type != OP or token_val != "==":
7373
continue
7474
token_type, token_val, start, _, _ = next(g)
75-
if token_type != STRING or token_val.strip("\"'") != '__main__':
75+
if token_type != STRING or token_val.strip("\"'") != "__main__":
7676
continue
7777
token_type, token_val, start, _, _ = next(g)
7878
if token_type != OP or token_val != ":":
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
import numpy
22

33
if __name__ == "__main__":
4-
run()
4+
run()

gazelle/python/testdata/binary_without_entrypoint/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
import pandas
33

44
if __name__ == "__main__":
5-
run()
5+
run()

gazelle/python/testdata/binary_without_entrypoint/main_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
class TestMain(unittest.unittest):
55
pass
66

7+
78
if __name__ == "__main__":
89
unittest.main()

gazelle/python/testdata/dont_rename_target/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,3 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-

gazelle/python/testdata/first_party_file_and_directory_modules/baz.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
1516
def baz():
1617
return "baz from baz.py"

gazelle/python/testdata/first_party_file_and_directory_modules/foo.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
1516
def foo():
1617
print("foo")

gazelle/python/testdata/first_party_file_and_directory_modules/one/two.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
1516
def two():
1617
return "two"

gazelle/python/testdata/first_party_file_and_directory_modules/undiscoverable/package1/subpackage1/module1.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
1516
def find_me():
1617
return "found"

gazelle/python/testdata/generated_test_entrypoint/foo.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
1516
def foo():
1617
return "foo"

gazelle/python/testdata/monorepo/coarse_grained/_boundary/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,3 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-

gazelle/python/testdata/naming_convention/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# limitations under the License.
1414

1515
# For test purposes only.
16-
import __init__
16+
import __init__

gazelle/python/testdata/naming_convention/__test__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# limitations under the License.
1414

1515
# For test purposes only.
16-
import __init__
16+
import __init__

gazelle/python/testdata/naming_convention/dont_rename/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# limitations under the License.
1414

1515
# For test purposes only.
16-
import __init__
16+
import __init__

gazelle/python/testdata/naming_convention/dont_rename/__test__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# limitations under the License.
1414

1515
# For test purposes only.
16-
import __init__
16+
import __init__

gazelle/python/testdata/naming_convention/resolve_conflict/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# limitations under the License.
1414

1515
# For test purposes only.
16-
import __init__
16+
import __init__

gazelle/python/testdata/naming_convention/resolve_conflict/__test__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# limitations under the License.
1414

1515
# For test purposes only.
16-
import __init__
16+
import __init__

gazelle/python/testdata/per_file_subdirs/bar/foo.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
1516
def func():
1617
pass

gazelle/python/testdata/python_target_with_test_in_name/test_reality.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# limitations under the License.
1414

1515
# For test purposes only.
16-
import __init__
16+
import __init__

gazelle/python/testdata/relative_imports/package1/module2.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
1516
def function2():
1617
return "function2"

gazelle/python/testdata/relative_imports/package2/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
1516
class Class1:
1617
def method1(self):
1718
return "method1"

gazelle/python/testdata/relative_imports/package2/module4.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
1516
def function4():
1617
return "function4"

gazelle/python/testdata/respect_kind_mapping/foo.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
1516
def foo():
1617
return "foo"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
def run():
2-
pass
2+
pass

gazelle/python/testdata/simple_test/foo.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
1516
def foo():
1617
return "foo"

gazelle/python/testdata/simple_test_with_conftest/conftest.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,3 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-

gazelle/python/testdata/simple_test_with_conftest/foo.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
1516
def foo():
1617
return "foo"

gazelle/python/testdata/subdir_sources/foo/has_main/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# limitations under the License.
1414

1515
# For test purposes only.
16-
import foo.has_main.python.my_module
16+
import foo.has_main.python.my_module

gazelle/python/testdata/subdir_sources/foo/has_test/__test__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# limitations under the License.
1414

1515
# For test purposes only.
16-
import foo.has_test.python.my_module
16+
import foo.has_test.python.my_module

python/pip_install/tools/dependency_resolver/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,3 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-

python/pip_install/tools/dependency_resolver/dependency_resolver.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,10 @@ def main(
9999
bazel_runfiles = runfiles.Create()
100100

101101
requirements_file = _select_golden_requirements_file(
102-
requirements_txt=requirements_txt, requirements_linux=requirements_linux,
103-
requirements_darwin=requirements_darwin, requirements_windows=requirements_windows
102+
requirements_txt=requirements_txt,
103+
requirements_linux=requirements_linux,
104+
requirements_darwin=requirements_darwin,
105+
requirements_windows=requirements_windows,
104106
)
105107

106108
resolved_requirements_in = _locate(bazel_runfiles, requirements_in)
@@ -120,8 +122,8 @@ def main(
120122
# use the runfiles file first. Thus, we need to compute the relative path
121123
# from the execution root.
122124
# Note: Windows cannot reference generated files without runfiles support enabled.
123-
requirements_in_relative = requirements_in[len(repository_prefix):]
124-
requirements_file_relative = requirements_file[len(repository_prefix):]
125+
requirements_in_relative = requirements_in[len(repository_prefix) :]
126+
requirements_file_relative = requirements_file[len(repository_prefix) :]
125127

126128
# Before loading click, set the locale for its parser.
127129
# If it leaks through to the system setting, it may fail:
@@ -157,7 +159,9 @@ def main(
157159
os.environ["CUSTOM_COMPILE_COMMAND"] = update_command
158160
os.environ["PIP_CONFIG_FILE"] = os.getenv("PIP_CONFIG_FILE") or os.devnull
159161

160-
argv.append(f"--output-file={requirements_file_relative if UPDATE else requirements_out}")
162+
argv.append(
163+
f"--output-file={requirements_file_relative if UPDATE else requirements_out}"
164+
)
161165
argv.append(
162166
requirements_in_relative
163167
if Path(requirements_in_relative).exists()

python/private/repack_whl.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,9 @@ def main(sys_argv):
152152
record_contents = record_path.read_text() if record_path.exists() else ""
153153
distribution_prefix = distinfo_dir.with_suffix("").name
154154

155-
with _WhlFile(args.output, mode="w", distribution_prefix=distribution_prefix) as out:
155+
with _WhlFile(
156+
args.output, mode="w", distribution_prefix=distribution_prefix
157+
) as out:
156158
for p in _files_to_pack(patched_wheel_dir, record_contents):
157159
rel_path = p.relative_to(patched_wheel_dir)
158160
out.add_file(str(rel_path), p)

0 commit comments

Comments
 (0)