Skip to content

Commit

Permalink
ruff formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
will-moore committed Aug 8, 2024
1 parent 2823ec3 commit 9d0b99b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/ome2024_ngff_challenge/resave.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
# Helpers
#


class SafeEncoder(json.JSONEncoder):
# Handle any TypeErrors so we are safe to use this for logging
# E.g. dtype obj is not JSON serializable
Expand All @@ -37,6 +38,7 @@ def default(self, obj):
except TypeError:
return str(obj)


def guess_shards(shape: list, chunks: list):
"""
Method to calculate best shard sizes. These values can be written to
Expand All @@ -60,7 +62,7 @@ def csv_int(vstr, sep=",") -> list:
values.append(v)
except ValueError as ve:
raise argparse.ArgumentError(
message=f'Invalid value {v0}, values must be a number'
message=f"Invalid value {v0}, values must be a number"
) from ve
return values

Expand Down Expand Up @@ -244,7 +246,9 @@ def check_or_delete_path(self):
else:
shutil.rmtree(self.path)
else:
raise Exception(f"{self.path} exists. Use --output-overwrite to overwrite")
raise Exception(
f"{self.path} exists. Use --output-overwrite to overwrite"
)

def open_group(self):
# Needs zarr_format=2 or we get ValueError("store mode does not support writing")
Expand Down Expand Up @@ -697,8 +701,7 @@ def cli(args=sys.argv[1:]):
parser.add_argument("--rocrate-organism", type=str)
parser.add_argument("--rocrate-modality", type=str)
parser.add_argument("--rocrate-skip", action="store_true")
parser.add_argument("--log", default="warn",
help="warn, 'info' or 'debug'")
parser.add_argument("--log", default="warn", help="warn, 'info' or 'debug'")
group_ex = parser.add_mutually_exclusive_group()
group_ex.add_argument(
"--output-write-details",
Expand Down

0 comments on commit 9d0b99b

Please sign in to comment.