diff --git a/benchmarks/skimage/_image_bench.py b/benchmarks/skimage/_image_bench.py index abb2ffbbb..6b8417e28 100644 --- a/benchmarks/skimage/_image_bench.py +++ b/benchmarks/skimage/_image_bench.py @@ -23,7 +23,7 @@ def product_dict(**kwargs): yield dict(zip(keys, instance)) -class ImageBench(object): +class ImageBench: def __init__( self, function_name, diff --git a/benchmarks/skimage/cucim_color_bench.py b/benchmarks/skimage/cucim_color_bench.py index 8f394daef..133b13f44 100644 --- a/benchmarks/skimage/cucim_color_bench.py +++ b/benchmarks/skimage/cucim_color_bench.py @@ -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 diff --git a/benchmarks/skimage/cucim_exposure_bench.py b/benchmarks/skimage/cucim_exposure_bench.py index 558a2282f..6d4b3ec2f 100644 --- a/benchmarks/skimage/cucim_exposure_bench.py +++ b/benchmarks/skimage/cucim_exposure_bench.py @@ -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()) diff --git a/benchmarks/skimage/cucim_feature_bench.py b/benchmarks/skimage/cucim_feature_bench.py index 4142d7965..eee282608 100644 --- a/benchmarks/skimage/cucim_feature_bench.py +++ b/benchmarks/skimage/cucim_feature_bench.py @@ -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()) diff --git a/benchmarks/skimage/cucim_filters_bench.py b/benchmarks/skimage/cucim_filters_bench.py index 09a47e346..5c5256fbc 100644 --- a/benchmarks/skimage/cucim_filters_bench.py +++ b/benchmarks/skimage/cucim_filters_bench.py @@ -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()) diff --git a/benchmarks/skimage/cucim_measure_bench.py b/benchmarks/skimage/cucim_measure_bench.py index e7e7b40df..0ea985596 100644 --- a/benchmarks/skimage/cucim_measure_bench.py +++ b/benchmarks/skimage/cucim_measure_bench.py @@ -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()) diff --git a/benchmarks/skimage/cucim_metrics_bench.py b/benchmarks/skimage/cucim_metrics_bench.py index 585dd7be8..b292afb97 100644 --- a/benchmarks/skimage/cucim_metrics_bench.py +++ b/benchmarks/skimage/cucim_metrics_bench.py @@ -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()) diff --git a/benchmarks/skimage/cucim_morphology_bench.py b/benchmarks/skimage/cucim_morphology_bench.py index 68c5aeefc..2a8a741c4 100644 --- a/benchmarks/skimage/cucim_morphology_bench.py +++ b/benchmarks/skimage/cucim_morphology_bench.py @@ -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 diff --git a/benchmarks/skimage/cucim_registration_bench.py b/benchmarks/skimage/cucim_registration_bench.py index be5b94594..e02e669c6 100644 --- a/benchmarks/skimage/cucim_registration_bench.py +++ b/benchmarks/skimage/cucim_registration_bench.py @@ -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 diff --git a/benchmarks/skimage/cucim_restoration_bench.py b/benchmarks/skimage/cucim_restoration_bench.py index c876cae12..8933213c2 100644 --- a/benchmarks/skimage/cucim_restoration_bench.py +++ b/benchmarks/skimage/cucim_restoration_bench.py @@ -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 diff --git a/benchmarks/skimage/cucim_segmentation_bench.py b/benchmarks/skimage/cucim_segmentation_bench.py index 77bbae630..e2b718f55 100644 --- a/benchmarks/skimage/cucim_segmentation_bench.py +++ b/benchmarks/skimage/cucim_segmentation_bench.py @@ -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 diff --git a/benchmarks/skimage/cucim_transform_bench.py b/benchmarks/skimage/cucim_transform_bench.py index 6cc007af9..32bb6d459 100644 --- a/benchmarks/skimage/cucim_transform_bench.py +++ b/benchmarks/skimage/cucim_transform_bench.py @@ -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 diff --git a/benchmarks/skimage/cupyx_scipy_ndimage_filter_bench.py b/benchmarks/skimage/cupyx_scipy_ndimage_filter_bench.py index a820c699e..451040bf5 100644 --- a/benchmarks/skimage/cupyx_scipy_ndimage_filter_bench.py +++ b/benchmarks/skimage/cupyx_scipy_ndimage_filter_bench.py @@ -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()) diff --git a/benchmarks/skimage/cupyx_scipy_ndimage_fourier_bench.py b/benchmarks/skimage/cupyx_scipy_ndimage_fourier_bench.py index 92a4795e0..c2e4160e7 100644 --- a/benchmarks/skimage/cupyx_scipy_ndimage_fourier_bench.py +++ b/benchmarks/skimage/cupyx_scipy_ndimage_fourier_bench.py @@ -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()) diff --git a/benchmarks/skimage/cupyx_scipy_ndimage_interp_bench.py b/benchmarks/skimage/cupyx_scipy_ndimage_interp_bench.py index 63773732c..c6977cef4 100644 --- a/benchmarks/skimage/cupyx_scipy_ndimage_interp_bench.py +++ b/benchmarks/skimage/cupyx_scipy_ndimage_interp_bench.py @@ -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()) diff --git a/benchmarks/skimage/cupyx_scipy_ndimage_measurements_bench.py b/benchmarks/skimage/cupyx_scipy_ndimage_measurements_bench.py index 61b3de5a4..e3975972b 100644 --- a/benchmarks/skimage/cupyx_scipy_ndimage_measurements_bench.py +++ b/benchmarks/skimage/cupyx_scipy_ndimage_measurements_bench.py @@ -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()) diff --git a/benchmarks/skimage/cupyx_scipy_ndimage_morphology_bench.py b/benchmarks/skimage/cupyx_scipy_ndimage_morphology_bench.py index a177c99f9..a2e509a72 100644 --- a/benchmarks/skimage/cupyx_scipy_ndimage_morphology_bench.py +++ b/benchmarks/skimage/cupyx_scipy_ndimage_morphology_bench.py @@ -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()) diff --git a/cpp/plugins/cucim.kit.cuslide/src/cuslide/jpeg2k/gen_color_table.py b/cpp/plugins/cucim.kit.cuslide/src/cuslide/jpeg2k/gen_color_table.py index 9d9de21f3..2b1d1b366 100644 --- a/cpp/plugins/cucim.kit.cuslide/src/cuslide/jpeg2k/gen_color_table.py +++ b/cpp/plugins/cucim.kit.cuslide/src/cuslide/jpeg2k/gen_color_table.py @@ -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 diff --git a/docs/source/conf.py b/docs/source/conf.py index a7d832627..211a4b1d9 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- # # Copyright (c) 2018, NVIDIA CORPORATION. # @@ -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__) diff --git a/examples/python/gds_whole_slide/lz4_nvcomp.py b/examples/python/gds_whole_slide/lz4_nvcomp.py index 19fc5f3d9..c4b519909 100644 --- a/examples/python/gds_whole_slide/lz4_nvcomp.py +++ b/examples/python/gds_whole_slide/lz4_nvcomp.py @@ -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 diff --git a/experiments/Supporting_Aperio_SVS_Format/benchmark.py b/experiments/Supporting_Aperio_SVS_Format/benchmark.py index db5deac70..f5905a537 100644 --- a/experiments/Supporting_Aperio_SVS_Format/benchmark.py +++ b/experiments/Supporting_Aperio_SVS_Format/benchmark.py @@ -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): diff --git a/experiments/Using_Cache/benchmark.py b/experiments/Using_Cache/benchmark.py index b1f69c5dc..0ae0d3dc2 100644 --- a/experiments/Using_Cache/benchmark.py +++ b/experiments/Using_Cache/benchmark.py @@ -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):