Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit.ci] pre-commit autoupdate #71

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ repos:

- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.8.1
rev: v0.9.1
hooks:
# Run the linter.
- id: ruff
Expand Down
6 changes: 3 additions & 3 deletions sharrow/digital_encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,9 +359,9 @@ def multivalue_digitize_by_dictionary(ds, encode_vars=None, encoding_name=None):

encode_var_dims = ds[encode_vars[0]].dims
for v in encode_vars[1:]:
assert (
encode_var_dims == ds[v].dims
), f"dims must match, {encode_var_dims} != {ds[v].dims}"
assert encode_var_dims == ds[v].dims, (
f"dims must match, {encode_var_dims} != {ds[v].dims}"
)
logger.info("assembling data stack")
conjoined = np.stack(
[array_decode(ds[v].compute(), aux_data=ds) for v in encode_vars], axis=-1
Expand Down
8 changes: 4 additions & 4 deletions sharrow/flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -1749,7 +1749,7 @@ def __initialize_2(
textwrap.dedent(
f"""
# this module generated automatically using sharrow version {__version__}
# generation time: {time.strftime('%d %B %Y %I:%M:%S %p')}
# generation time: {time.strftime("%d %B %Y %I:%M:%S %p")}
"""
)[1:]
)
Expand Down Expand Up @@ -1830,7 +1830,7 @@ def __initialize_2(
if f_args_j:
f_args_j += ", "
meta_code.append(
f"{clean(k)}_dim{n_root_dims+1}_filler(result, {n}, {f_name_tokens})"
f"{clean(k)}_dim{n_root_dims + 1}_filler(result, {n}, {f_name_tokens})"
)
meta_code_dot.append(
f"intermediate[{n}] = ({clean(k)}({f_args_j}intermediate, {f_name_tokens})).item()"
Expand Down Expand Up @@ -2268,9 +2268,9 @@ def check_cache_misses(self, *funcs, fresh=True, log_details=True):
)
if isinstance(timers, float):
if timers < 1e-3:
timers = f"{timers/1e-6:.0f} µs"
timers = f"{timers / 1e-6:.0f} µs"
elif timers < 1:
timers = f"{timers/1e-3:.1f} ms"
timers = f"{timers / 1e-3:.1f} ms"
else:
timers = f"{timers:.2f} s"
logger.warning(
Expand Down
2 changes: 1 addition & 1 deletion sharrow/shared_memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def si_units(x, kind="B", digits=3, shift=1000):
while x < 1 and tier >= 0:
x *= shift
tier -= 1
return f"{sign}{round(x,digits)} {tiers[tier]}{kind}"
return f"{sign}{round(x, digits)} {tiers[tier]}{kind}"


def _hexhash(t, size=10, prefix="sharr"):
Expand Down
4 changes: 2 additions & 2 deletions sharrow/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def make_graph(datatree, fontname="Arial", fontsize=12, ignore_joined_dims=True)
if viz is None:
raise ModuleNotFoundError("pygraphviz is not installed")

small = f"{fontsize * .7:.1f}"
small = f"{fontsize * 0.7:.1f}"
g = viz.AGraph(rankdir="LR", strict=False, fontname=fontname, fontsize=fontsize)

connected_nodes = set()
Expand Down Expand Up @@ -117,7 +117,7 @@ def node_label(k, v):

out = f"""< <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" >
<TR><TD PORT="f0" COLSPAN="2" BGCOLOR="gray80"><B>{k}</B></TD></TR>
{''.join(cells)}
{"".join(cells)}
</TABLE> >"""
return out

Expand Down
18 changes: 9 additions & 9 deletions sharrow/wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,16 @@ def set_df(self, df):
-------
self (to facilitate chaining)
"""
assert (
self.orig_key in df
), f"orig_key '{self.orig_key}' not in df columns: {list(df.columns)}"
assert (
self.dest_key in df
), f"dest_key '{self.dest_key}' not in df columns: {list(df.columns)}"
assert self.orig_key in df, (
f"orig_key '{self.orig_key}' not in df columns: {list(df.columns)}"
)
assert self.dest_key in df, (
f"dest_key '{self.dest_key}' not in df columns: {list(df.columns)}"
)
if self.time_key:
assert (
self.time_key in df
), f"time_key '{self.time_key}' not in df columns: {list(df.columns)}"
assert self.time_key in df, (
f"time_key '{self.time_key}' not in df columns: {list(df.columns)}"
)
self.df = df

# TODO allow non-1 offsets
Expand Down
Loading