Skip to content

Commit

Permalink
ruff auto-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jameslamb committed Aug 21, 2024
1 parent 6d756c7 commit 13ab21a
Show file tree
Hide file tree
Showing 22 changed files with 22 additions and 25 deletions.
2 changes: 1 addition & 1 deletion benchmarks/skimage/_image_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def product_dict(**kwargs):
yield dict(zip(keys, instance))


class ImageBench(object):
class ImageBench:
def __init__(
self,
function_name,
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/skimage/cucim_color_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def main(args):
try:
import tabular # noqa: F401

with open(fbase + ".md", "wt") as f:
with open(fbase + ".md", "w") as f:
f.write(all_results.to_markdown())
except ImportError:
pass
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/skimage/cucim_exposure_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def main(args):
fbase = os.path.splitext(pfile)[0]
all_results.to_csv(fbase + ".csv")
all_results.to_pickle(pfile)
with open(fbase + ".md", "wt") as f:
with open(fbase + ".md", "w") as f:
f.write(all_results.to_markdown())


Expand Down
2 changes: 1 addition & 1 deletion benchmarks/skimage/cucim_feature_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def main(args):
fbase = os.path.splitext(pfile)[0]
all_results.to_csv(fbase + ".csv")
all_results.to_pickle(pfile)
with open(fbase + ".md", "wt") as f:
with open(fbase + ".md", "w") as f:
f.write(all_results.to_markdown())


Expand Down
2 changes: 1 addition & 1 deletion benchmarks/skimage/cucim_filters_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def main(args):
fbase = os.path.splitext(pfile)[0]
all_results.to_csv(fbase + ".csv")
all_results.to_pickle(pfile)
with open(fbase + ".md", "wt") as f:
with open(fbase + ".md", "w") as f:
f.write(all_results.to_markdown())


Expand Down
2 changes: 1 addition & 1 deletion benchmarks/skimage/cucim_measure_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ def main(args):
fbase = os.path.splitext(pfile)[0]
all_results.to_csv(fbase + ".csv")
all_results.to_pickle(pfile)
with open(fbase + ".md", "wt") as f:
with open(fbase + ".md", "w") as f:
f.write(all_results.to_markdown())


Expand Down
2 changes: 1 addition & 1 deletion benchmarks/skimage/cucim_metrics_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def main(args):
fbase = os.path.splitext(pfile)[0]
all_results.to_csv(fbase + ".csv")
all_results.to_pickle(pfile)
with open(fbase + ".md", "wt") as f:
with open(fbase + ".md", "w") as f:
f.write(all_results.to_markdown())


Expand Down
2 changes: 1 addition & 1 deletion benchmarks/skimage/cucim_morphology_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ def main(args):
try:
import tabular # noqa: F401

with open(fbase + ".md", "wt") as f:
with open(fbase + ".md", "w") as f:
f.write(all_results.to_markdown())
except ImportError:
pass
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/skimage/cucim_registration_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def main(args):
try:
import tabular # noqa: F401

with open(fbase + ".md", "wt") as f:
with open(fbase + ".md", "w") as f:
f.write(all_results.to_markdown())
except ImportError:
pass
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/skimage/cucim_restoration_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def main(args):
try:
import tabular # noqa: F401

with open(fbase + ".md", "wt") as f:
with open(fbase + ".md", "w") as f:
f.write(all_results.to_markdown())
except ImportError:
pass
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/skimage/cucim_segmentation_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def main(args):
try:
import tabular # noqa: F401

with open(fbase + ".md", "wt") as f:
with open(fbase + ".md", "w") as f:
f.write(all_results.to_markdown())
except ImportError:
pass
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/skimage/cucim_transform_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def main(args):
try:
import tabular # noqa: F401

with open(fbase + ".md", "wt") as f:
with open(fbase + ".md", "w") as f:
f.write(all_results.to_markdown())
except ImportError:
pass
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/skimage/cupyx_scipy_ndimage_filter_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,5 +129,5 @@ def set_args(self, dtype):
fbase = os.path.splitext(pfile)[0]
all_results.to_csv(fbase + ".csv")
all_results.to_pickle(pfile)
with open(fbase + ".md", "wt") as f:
with open(fbase + ".md", "w") as f:
f.write(all_results.to_markdown())
2 changes: 1 addition & 1 deletion benchmarks/skimage/cupyx_scipy_ndimage_fourier_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ def set_args(self, dtype):
fbase = os.path.splitext(pfile)[0]
all_results.to_csv(fbase + ".csv")
all_results.to_pickle(pfile)
with open(fbase + ".md", "wt") as f:
with open(fbase + ".md", "w") as f:
f.write(all_results.to_markdown())
2 changes: 1 addition & 1 deletion benchmarks/skimage/cupyx_scipy_ndimage_interp_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,5 +153,5 @@ def set_args(self, dtype):
fbase = os.path.splitext(pfile)[0]
all_results.to_csv(fbase + ".csv")
all_results.to_pickle(pfile)
with open(fbase + ".md", "wt") as f:
with open(fbase + ".md", "w") as f:
f.write(all_results.to_markdown())
Original file line number Diff line number Diff line change
Expand Up @@ -185,5 +185,5 @@ def set_args(self, dtype):
fbase = os.path.splitext(pfile)[0]
all_results.to_csv(fbase + ".csv")
all_results.to_pickle(pfile)
with open(fbase + ".md", "wt") as f:
with open(fbase + ".md", "w") as f:
f.write(all_results.to_markdown())
2 changes: 1 addition & 1 deletion benchmarks/skimage/cupyx_scipy_ndimage_morphology_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,5 +152,5 @@ def set_args(self, dtype):
fbase = os.path.splitext(pfile)[0]
all_results.to_csv(fbase + ".csv")
all_results.to_pickle(pfile)
with open(fbase + ".md", "wt") as f:
with open(fbase + ".md", "w") as f:
f.write(all_results.to_markdown())
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def gen_b_cb():
"""
b_cb = [0] * 256
for i in range(256):
b_cb[i] = int((1.77204 * (i - 128)))
b_cb[i] = int(1.77204 * (i - 128))
return b_cb


Expand Down
3 changes: 1 addition & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (c) 2018, NVIDIA CORPORATION.
#
Expand All @@ -21,9 +20,9 @@
#
import os
import sys
from packaging.version import Version

import cucim
from packaging.version import Version

sys.path.insert(0, os.path.abspath("../.."))
curpath = os.path.dirname(__file__)
Expand Down
4 changes: 1 addition & 3 deletions examples/python/gds_whole_slide/lz4_nvcomp.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ def ensure_contiguous_ndarray(buf, max_buffer_size=None, flatten=True):
raise ValueError("an array with contiguous memory is required")

if max_buffer_size is not None and arr.nbytes > max_buffer_size:
msg = "Codec does not support buffers of > {} bytes".format(
max_buffer_size
)
msg = f"Codec does not support buffers of > {max_buffer_size} bytes"
raise ValueError(msg)

return arr
Expand Down
2 changes: 1 addition & 1 deletion experiments/Supporting_Aperio_SVS_Format/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def __enter__(self):
def __exit__(self, exc_type, exc, exc_tb):
if not self.end:
self.elapsed_time()
print("{} : {}".format(self.message, self.end - self.start))
print(f"{self.message} : {self.end - self.start}")


def load_tile_openslide(slide, start_loc, patch_size):
Expand Down
2 changes: 1 addition & 1 deletion experiments/Using_Cache/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def __enter__(self):
def __exit__(self, exc_type, exc, exc_tb):
if not self.end:
self.elapsed_time()
print("{} : {}".format(self.message, self.end - self.start))
print(f"{self.message} : {self.end - self.start}")


def load_tile_openslide(slide, start_loc, patch_size):
Expand Down

0 comments on commit 13ab21a

Please sign in to comment.