Skip to content

Commit

Permalink
Merge pull request #77 from legend-exp/pre-commit-ci-update-config
Browse files Browse the repository at this point in the history
chore: update pre-commit hooks
  • Loading branch information
gipert authored Jan 20, 2025
2 parents 0c9a5f7 + 9f88820 commit ced1987
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 25 deletions.
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,38 +25,38 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/psf/black
rev: "24.8.0"
rev: "24.10.0"
hooks:
- id: black-jupyter
args: ["--line-length", "99"]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.6.9"
rev: "v0.8.6"
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]

- repo: https://github.com/asottile/setup-cfg-fmt
rev: "v2.5.0"
rev: "v2.7.0"
hooks:
- id: setup-cfg-fmt

- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.11.2"
rev: "v1.14.1"
hooks:
- id: mypy
files: src
stages: [manual]

- repo: https://github.com/kynan/nbstripout
rev: "0.7.1"
rev: "0.8.1"
hooks:
- id: nbstripout
args: ["--drop-empty-cells",
"--extra-keys", "metadata.kernelspec metadata.language_info"]

- repo: https://github.com/mgedmin/check-manifest
rev: "0.49"
rev: "0.50"
hooks:
- id: check-manifest
stages: [manual]
Expand Down
4 changes: 2 additions & 2 deletions scripts/build_tcm.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
fcid_channels[fcid].append(f"/{ch}/raw")

# make a hardware_tcm_[fcid] for each fcid
for fcid in fcid_channels:
for fcid, fcid_dict in fcid_channels.items():
build_tcm(
[(args.input, fcid_channels[fcid])],
[(args.input, fcid_dict)],
out_file=temp_output,
out_name=f"hardware_tcm_{fcid}",
wo_mode="o",
Expand Down
2 changes: 1 addition & 1 deletion scripts/check_blinding.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
# check for peaks within +- 5keV of 2614 and 583 to ensure blinding still
# valid and if so create file else raise error. if detector is in ac mode it
# will always pass this check
if np.any(np.abs(maxs - 2614) < 5) and np.any(np.abs(maxs - 583) < 5) or det_status is False:
if (np.any(np.abs(maxs - 2614) < 5) and np.any(np.abs(maxs - 583) < 5)) or det_status is False:
pathlib.Path(os.path.dirname(args.output)).mkdir(parents=True, exist_ok=True)
Props.write_to(args.output, {})
else:
Expand Down
14 changes: 7 additions & 7 deletions scripts/par_psp.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,16 @@
for field in ave_fields:
keys = field.split(".")
vals = []
for tstamp in in_dicts:
val = in_dicts[tstamp]
for _tstamp, tstamp_dict in in_dicts.items():
val = tstamp_dict.copy()
for key in keys:
val = val[key]
vals.append(val)
if "dsp" in in_dicts[tstamp]:
tmp_dict = in_dicts[tstamp]["dsp"]
if "dsp" in tstamp_dict:
tmp_dict = tstamp_dict["dsp"]
else:
tmp_dict = {}
in_dicts[tstamp]["dsp"] = tmp_dict
tstamp_dict["dsp"] = tmp_dict
for i, key in enumerate(keys):
if i == len(keys) - 1:
tmp_dict[key] = val
Expand All @@ -86,8 +86,8 @@
mean_val = np.nan if len(vals[~np.isnan(vals)]) == 0 else np.nanmedian(vals)
mean = f"{round(mean_val, rounding)}*{unit}" if unit is not None else mean_val

for tstamp in in_dicts:
val = in_dicts[tstamp]
for _tstamp, tstamp_dict in in_dicts.items():
val = tstamp_dict
for i, key in enumerate(keys):
if i == len(keys) - 1:
val[key] = mean
Expand Down
4 changes: 2 additions & 2 deletions scripts/util/CalibCatalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ def read_from(file_name):
entries[system] = []
entries[system].append(CalibCatalog.Entry(unix_time(timestamp), file_key))

for system in entries:
entries[system] = sorted(entries[system], key=lambda entry: entry.valid_from)
for system, system_dict in entries.items():
entries[system] = sorted(system_dict, key=lambda entry: entry.valid_from)
return CalibCatalog(entries)

def calib_for(self, timestamp, category="all", allow_none=False):
Expand Down
14 changes: 7 additions & 7 deletions scripts/util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@
)

__all__ = [
"Props",
"PropsStream",
"CalibCatalog",
"pars_key_resolve",
"dataset_file",
"ChannelProcKey",
"FileKey",
"ProcessingFileKey",
"ChannelProcKey",
"Props",
"PropsStream",
"dataset_file",
"pars_catalog",
"unix_time",
"pars_key_resolve",
"runcmd",
"subst_vars_impl",
"subst_vars",
"subst_vars_impl",
"subst_vars_in_snakemake_config",
"unix_time",
]

0 comments on commit ced1987

Please sign in to comment.