Skip to content

Commit 12a04c9

Browse files
committed
Apply ruff autofixes
1 parent d8aab60 commit 12a04c9

File tree

7 files changed

+19
-19
lines changed

7 files changed

+19
-19
lines changed

aarch64_linux/build_aarch64_wheel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ def build_torchvision(host: RemoteHost, *,
301301
# Remove .so files to force static linking
302302
host.run_cmd("rm miniforge3/lib/libpng.so miniforge3/lib/libpng16.so miniforge3/lib/libjpeg.so")
303303
# And patch setup.py to include libz dependency for libpng
304-
host.run_cmd(['sed -i -e \'s/image_link_flags\.append("png")/image_link_flags += ["png", "z"]/\' vision/setup.py'])
304+
host.run_cmd(['sed -i -e \'s/image_link_flags\\.append("png")/image_link_flags += ["png", "z"]/\' vision/setup.py'])
305305

306306
build_vars = ""
307307
if branch == "nightly":

analytics/cubinsizes.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
try:
1313
from elftools.elf.elffile import ELFFile
1414
except ModuleNotFoundError:
15-
print(f'elftools module not found, trying to install it from pip')
15+
print('elftools module not found, trying to install it from pip')
1616
from pip._internal import main as pip_main
1717
try:
1818
pip_main(["install", "pyelftools", "--user"])
@@ -106,7 +106,8 @@ def main():
106106
if os.path.splitext(fname)[1] == '.a':
107107
with ArFileCtx(fname):
108108
for fname in os.listdir("."):
109-
if not fname.endswith(".o"): continue
109+
if not fname.endswith(".o"):
110+
continue
110111
for section_name in section_names:
111112
elf_sizes = compute_cubin_sizes(fname, section_name)
112113
dict_add(results[section_name], elf_sizes)

analytics/download_count_wheels.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def output_results(bytes_cache: dict) -> None:
140140
def download_logs(log_directory: str, since: float):
141141
dt_now = datetime.now(timezone.utc)
142142
dt_end = datetime(dt_now.year, dt_now.month, dt_now.day, tzinfo=timezone.utc)
143-
dt_start = dt_end - timedelta(days=1, hours=1) # Add 1 hour padding to account for potentially missed logs due to timing
143+
dt_start = dt_end - timedelta(days=1, hours=1) # Add 1 hour padding to account for potentially missed logs due to timing
144144
for key in tqdm(BUCKET.objects.filter(Prefix='cflogs')):
145145
remote_fname = key.key
146146
local_fname = os.path.join(log_directory, remote_fname)

analytics/duplicates_analyze.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def print_symbols_overlap(libname1: str, libname2: str) -> None:
8181
sym1 = get_defined_symbols(libname1, verbose=True)
8282
sym2 = get_defined_symbols(libname2, verbose=True)
8383
sym1_size = sum(sym1.values())
84-
sym2_size = sum(sym2.values())
84+
sum(sym2.values())
8585
sym_overlap = set(sym1.keys()).intersection(set(sym2.keys()))
8686
overlap_size = sum(sym1[s] for s in sym_overlap)
8787
if overlap_size == 0:

analytics/s3_test_stats_analyze.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def _get_latests_git_commit_sha_list(lookback: int):
3333
def _json_to_df(data: Dict[str, Any], granularity: str) -> pd.DataFrame:
3434
reformed_data = list()
3535
for fname, fdata in data['files'].items():
36-
if granularity == 'file':
36+
if granularity == 'file':
3737
reformed_data.append({
3838
"job": data['job'],
3939
"sha": data['sha'],
@@ -42,7 +42,7 @@ def _json_to_df(data: Dict[str, Any], granularity: str) -> pd.DataFrame:
4242
})
4343
else:
4444
for sname, sdata in fdata['suites'].items():
45-
if granularity == 'suite':
45+
if granularity == 'suite':
4646
reformed_data.append({
4747
"job": data['job'],
4848
"sha": data['sha'],
@@ -140,8 +140,8 @@ def main():
140140
dataframe = parse_and_export_stats(f'{cache_folder}/test_time/', granularity)
141141
dataframe.to_pickle(output)
142142

143-
143+
144144

145145
if __name__ == "__main__":
146146
main()
147-
147+

manywheel/build_scripts/ssl-check.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@
3030
print("...it DIDN'T!!!!!11!!1one!")
3131
sys.exit(1)
3232
except EXC:
33-
print("...it did, yay.")
33+
print("...it did, yay.")

test/smoke_test/smoke_test.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ def check_nightly_binaries_date(package: str) -> None:
6969
from datetime import datetime, timedelta
7070
format_dt = '%Y%m%d'
7171

72-
torch_str = torch.__version__
73-
date_t_str = re.findall("dev\d+", torch.__version__)
72+
date_t_str = re.findall(r"dev\d+", torch.__version__)
7473
date_t_delta = datetime.now() - datetime.strptime(date_t_str[0][3:], format_dt)
7574
if date_t_delta.days >= NIGHTLY_ALLOWED_DELTA:
7675
raise RuntimeError(
@@ -81,7 +80,7 @@ def check_nightly_binaries_date(package: str) -> None:
8180
for module in MODULES:
8281
imported_module = importlib.import_module(module["name"])
8382
module_version = imported_module.__version__
84-
date_m_str = re.findall("dev\d+", module_version)
83+
date_m_str = re.findall(r"dev\d+", module_version)
8584
date_m_delta = datetime.now() - datetime.strptime(date_m_str[0][3:], format_dt)
8685
print(f"Nightly date check for {module['name']} version {module_version}")
8786
if date_m_delta.days > NIGHTLY_ALLOWED_DELTA:
@@ -102,7 +101,7 @@ def test_cuda_runtime_errors_captured() -> None:
102101
else:
103102
raise e
104103
if(cuda_exception_missed):
105-
raise RuntimeError( f"Expected CUDA RuntimeError but have not received!")
104+
raise RuntimeError( "Expected CUDA RuntimeError but have not received!")
106105

107106
def smoke_test_cuda(package: str, runtime_error_check: str) -> None:
108107
if not torch.cuda.is_available() and is_cuda_system:
@@ -145,27 +144,27 @@ def smoke_test_conv2d() -> None:
145144

146145
print("Testing smoke_test_conv2d")
147146
# With square kernels and equal stride
148-
m = nn.Conv2d(16, 33, 3, stride=2)
147+
nn.Conv2d(16, 33, 3, stride=2)
149148
# non-square kernels and unequal stride and with padding
150-
m = nn.Conv2d(16, 33, (3, 5), stride=(2, 1), padding=(4, 2))
149+
nn.Conv2d(16, 33, (3, 5), stride=(2, 1), padding=(4, 2))
151150
# non-square kernels and unequal stride and with padding and dilation
152151
basic_conv = nn.Conv2d(16, 33, (3, 5), stride=(2, 1), padding=(4, 2), dilation=(3, 1))
153152
input = torch.randn(20, 16, 50, 100)
154-
output = basic_conv(input)
153+
basic_conv(input)
155154

156155
if is_cuda_system:
157156
print("Testing smoke_test_conv2d with cuda")
158157
conv = nn.Conv2d(3, 3, 3).cuda()
159158
x = torch.randn(1, 3, 24, 24).cuda()
160159
with torch.cuda.amp.autocast():
161-
out = conv(x)
160+
conv(x)
162161

163162
supported_dtypes = [torch.float16, torch.float32, torch.float64]
164163
for dtype in supported_dtypes:
165164
print(f"Testing smoke_test_conv2d with cuda for {dtype}")
166165
conv = basic_conv.to(dtype).cuda()
167166
input = torch.randn(20, 16, 50, 100, device="cuda").type(dtype)
168-
output = conv(input)
167+
conv(input)
169168

170169
def smoke_test_linalg() -> None:
171170
print("Testing smoke_test_linalg")

0 commit comments

Comments
 (0)