Skip to content

Commit b62e648

Browse files
Thomas Polasekfacebook-github-bot
authored andcommitted
Convert directory fbcode/torchx to use the Ruff Formatter
Summary: Converts the directory specified to use the Ruff formatter in pyfmt ruff_dog If this diff causes merge conflicts when rebasing, please run `hg status -n -0 --change . -I '**/*.{py,pyi}' | xargs -0 arc pyfmt` on your diff, and amend any changes before rebasing onto latest. That should help reduce or eliminate any merge conflicts. allow-large-files Reviewed By: amyreese Differential Revision: D66248087
1 parent 5ad30fe commit b62e648

23 files changed

+43
-29
lines changed

docs/source/conf.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,7 @@ def setup(app):
191191

192192
# In Sphinx 1.8 it was renamed to `add_css_file`, 1.7 and prior it is
193193
# `add_stylesheet` (deprecated in 1.8).
194-
add_css = getattr(
195-
app, "add_css_file", getattr(app, "add_stylesheet", None)
196-
) # noqa B009
194+
add_css = getattr(app, "add_css_file", getattr(app, "add_stylesheet", None)) # noqa B009
197195
for css_file in html_css_files:
198196
add_css(css_file)
199197

scripts/collect_env.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ def run(
3333
args=command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True
3434
)
3535
raw_output, raw_err = p.communicate()
36-
raw_output, raw_err = raw_output.strip().decode("utf-8"), raw_err.strip().decode(
37-
"utf-8"
36+
raw_output, raw_err = (
37+
raw_output.strip().decode("utf-8"),
38+
raw_err.strip().decode("utf-8"),
3839
)
3940
rc = p.returncode
4041
if rc != 0:

scripts/component_integration_tests.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"""
1111
Kubernetes integration tests.
1212
"""
13+
1314
import argparse
1415
import logging
1516
import os

tools/linter/adapters/pyre_linter.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,9 @@ def main() -> None:
109109
level=(
110110
logging.NOTSET
111111
if args.verbose
112-
else logging.DEBUG if len(args.filenames) < 1000 else logging.INFO
112+
else logging.DEBUG
113+
if len(args.filenames) < 1000
114+
else logging.INFO
113115
),
114116
stream=sys.stderr,
115117
)

tools/linter/adapters/ufmt_linter.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,9 @@ def main() -> None:
119119
level=(
120120
logging.NOTSET
121121
if args.verbose
122-
else logging.DEBUG if len(args.filenames) < 1000 else logging.INFO
122+
else logging.DEBUG
123+
if len(args.filenames) < 1000
124+
else logging.INFO
123125
),
124126
stream=sys.stderr,
125127
)

torchx/cli/test/cmd_run_test.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,12 @@ def tearDown(self) -> None:
5151
torchxconfig.called_args = set()
5252

5353
def test_run_with_multiple_scheduler_args(self) -> None:
54-
5554
args = ["--scheduler_args", "first_args", "--scheduler_args", "second_args"]
5655
with self.assertRaises(SystemExit) as cm:
5756
self.parser.parse_args(args)
5857
self.assertEqual(cm.exception.code, 1)
5958

6059
def test_run_with_multiple_schedule_args(self) -> None:
61-
6260
args = [
6361
"--scheduler",
6462
"local_cwd",

torchx/components/dist.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
Components APIs
5757
-----------------
5858
"""
59+
5960
import os
6061
import re
6162
import shlex

torchx/components/structured_arg.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
with an experiment tracker. The ``/`` delimiter is a natural way to group runs within experiments.
2626
2727
"""
28+
2829
import warnings
2930
from dataclasses import dataclass
3031
from pathlib import Path

torchx/runner/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ def my_component(a: int) -> specs.AppDef:
157157
you want to keep personal config overrides on top of a project defined default.
158158
159159
"""
160+
160161
import configparser as configparser
161162
import logging
162163
import os

torchx/schedulers/aws_batch_scheduler.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
https://docs.aws.amazon.com/AmazonECR/latest/userguide/getting-started-cli.html#cli-create-repository
3737
for how to create a image repository.
3838
"""
39+
3940
import getpass
4041
import re
4142
import threading
@@ -155,7 +156,7 @@ def resource_requirements_from_resource(resource: Resource) -> List[Dict[str, st
155156

156157

157158
def resource_from_resource_requirements(
158-
resource_requirements: List[Dict[str, str]]
159+
resource_requirements: List[Dict[str, str]],
159160
) -> Resource:
160161
resrc_req = {
161162
ResourceType.from_str(r["type"]): int(r["value"]) for r in resource_requirements

0 commit comments

Comments
 (0)