Skip to content

Commit 5d23aa5

Browse files
Thomas Polasekfacebook-github-bot
Thomas Polasek
authored andcommitted
Convert FBCODE to use the Ruff Formatter
Summary: Converts the directory specified to use the Ruff formatter. This is the last big diff to convert all of Fbcode to Ruff. pomsky_fix_bugs drop-conflicts bypass-github-export-checks allow-large-files Reviewed By: amyreese Differential Revision: D66886610 fbshipit-source-id: 8276a7f6164efec189ca0b87e535543ed5bc3615
1 parent 8e0454d commit 5d23aa5

13 files changed

+31
-18
lines changed

multipy/runtime/example/generate_examples.py

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"""
88
Generate the example files that torchpy_test uses.
99
"""
10+
1011
import argparse
1112
from pathlib import Path
1213

multipy/runtime/test_compat.py

-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ def test_hf_tokenizers(self):
2424
import tokenizers # noqa: F401
2525

2626
def test_torchdynamo_eager(self):
27-
2827
torch._dynamo.reset()
2928

3029
def fn(x, y):
@@ -36,7 +35,6 @@ def fn(x, y):
3635
c_fn(torch.randn(10), torch.randn(10))
3736

3837
def test_torchdynamo_ofi(self):
39-
4038
torch._dynamo.reset()
4139

4240
def fn(x, y):
@@ -48,7 +46,6 @@ def fn(x, y):
4846
c_fn(torch.randn(10), torch.randn(10))
4947

5048
def test_torchdynamo_inductor(self):
51-
5249
torch._dynamo.reset()
5350

5451
def fn(x, y):

scripts/auto_copyright.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,21 @@
99
import sys
1010
from typing import List, Tuple
1111

12-
COPYRIGHT_NOTICE_PYTHON: str = (
13-
"""
12+
COPYRIGHT_NOTICE_PYTHON: str = """
1413
# Copyright (c) Meta Platforms, Inc. and affiliates.
1514
# All rights reserved.
1615
#
1716
# This source code is licensed under the BSD-style license found in the
1817
# LICENSE file in the root directory of this source tree.
1918
""".strip()
20-
)
2119

22-
COPYRIGHT_NOTICE_C: str = (
23-
"""
20+
COPYRIGHT_NOTICE_C: str = """
2421
// Copyright (c) Meta Platforms, Inc. and affiliates.
2522
// All rights reserved.
2623
//
2724
// This source code is licensed under the BSD-style license found in the
2825
// LICENSE file in the root directory of this source tree.
2926
""".strip()
30-
)
3127

3228

3329
def get_all_files_with_extension(directories: List[str], extensions: Tuple[str]):

scripts/linter/adapters/black_linter.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,9 @@ def main() -> None:
202202
level=(
203203
logging.NOTSET
204204
if args.verbose
205-
else logging.DEBUG if len(args.filenames) < 1000 else logging.INFO
205+
else logging.DEBUG
206+
if len(args.filenames) < 1000
207+
else logging.INFO
206208
),
207209
stream=sys.stderr,
208210
)

scripts/linter/adapters/clangformat_linter.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,9 @@ def main() -> None:
204204
level=(
205205
logging.NOTSET
206206
if args.verbose
207-
else logging.DEBUG if len(args.filenames) < 1000 else logging.INFO
207+
else logging.DEBUG
208+
if len(args.filenames) < 1000
209+
else logging.INFO
208210
),
209211
stream=sys.stderr,
210212
)

scripts/linter/adapters/clangtidy_linter.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,9 @@ def main() -> None:
232232
level=(
233233
logging.NOTSET
234234
if args.verbose
235-
else logging.DEBUG if len(args.filenames) < 1000 else logging.INFO
235+
else logging.DEBUG
236+
if len(args.filenames) < 1000
237+
else logging.INFO
236238
),
237239
stream=sys.stderr,
238240
)

scripts/linter/adapters/exec_linter.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ def check_file(filename: str) -> Optional[LintMessage]:
7272
level=(
7373
logging.NOTSET
7474
if args.verbose
75-
else logging.DEBUG if len(args.filenames) < 1000 else logging.INFO
75+
else logging.DEBUG
76+
if len(args.filenames) < 1000
77+
else logging.INFO
7678
),
7779
stream=sys.stderr,
7880
)

scripts/linter/adapters/flake8_linter.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,9 @@ def main() -> None:
348348
level=(
349349
logging.NOTSET
350350
if args.verbose
351-
else logging.DEBUG if len(args.filenames) < 1000 else logging.INFO
351+
else logging.DEBUG
352+
if len(args.filenames) < 1000
353+
else logging.INFO
352354
),
353355
stream=sys.stderr,
354356
)

scripts/linter/adapters/grep_linter.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,9 @@ def main() -> None:
213213
level=(
214214
logging.NOTSET
215215
if args.verbose
216-
else logging.DEBUG if len(args.filenames) < 1000 else logging.INFO
216+
else logging.DEBUG
217+
if len(args.filenames) < 1000
218+
else logging.INFO
217219
),
218220
stream=sys.stderr,
219221
)

scripts/linter/adapters/mypy_linter.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,9 @@ def main() -> None:
162162
level=(
163163
logging.NOTSET
164164
if args.verbose
165-
else logging.DEBUG if len(args.filenames) < 1000 else logging.INFO
165+
else logging.DEBUG
166+
if len(args.filenames) < 1000
167+
else logging.INFO
166168
),
167169
stream=sys.stderr,
168170
)

scripts/linter/adapters/newlines_linter.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,9 @@ def check_file(filename: str) -> Optional[LintMessage]:
149149
level=(
150150
logging.NOTSET
151151
if args.verbose
152-
else logging.DEBUG if len(args.filenames) < 1000 else logging.INFO
152+
else logging.DEBUG
153+
if len(args.filenames) < 1000
154+
else logging.INFO
153155
),
154156
stream=sys.stderr,
155157
)

scripts/linter/adapters/testowners_linter.py

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- Each owner label actually exists in PyTorch
99
- Each owner label starts with "module: " or "oncall: " or is in ACCEPTABLE_OWNER_LABELS
1010
"""
11+
1112
import argparse
1213
import json
1314
from enum import Enum

scripts/linter/adapters/ufmt_linter.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ def main() -> None:
118118
level=(
119119
logging.NOTSET
120120
if args.verbose
121-
else logging.DEBUG if len(args.filenames) < 1000 else logging.INFO
121+
else logging.DEBUG
122+
if len(args.filenames) < 1000
123+
else logging.INFO
122124
),
123125
stream=sys.stderr,
124126
)

0 commit comments

Comments
 (0)