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

chore: update pre-commit hooks #36

Merged
merged 2 commits into from
Apr 5, 2024
Merged
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
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ repos:
- id: trailing-whitespace

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

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.1.9"
rev: "v0.3.4"
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
Expand All @@ -42,14 +42,14 @@ repos:
- id: setup-cfg-fmt

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

- repo: https://github.com/kynan/nbstripout
rev: "0.6.1"
rev: "0.7.1"
hooks:
- id: nbstripout
args: ["--drop-empty-cells",
Expand All @@ -68,7 +68,7 @@ repos:
args: ["-L", "nd,unparseable,compiletime,livetime,fom,puls"]

- repo: https://github.com/shellcheck-py/shellcheck-py
rev: "v0.9.0.6"
rev: "v0.10.0.1"
hooks:
- id: shellcheck

Expand All @@ -86,7 +86,7 @@ repos:
types_or: [json]

- repo: https://github.com/snakemake/snakefmt
rev: v0.8.5
rev: v0.10.0
hooks:
- id: snakefmt
files: Snakefile*|\.smk
1 change: 1 addition & 0 deletions rules/common.smk
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Helper functions for running data production
"""

import pathlib, os
from scripts.util.patterns import (
par_overwrite_path,
Expand Down
1 change: 1 addition & 0 deletions rules/dsp.smk
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Snakemake rules for processing dsp tier. This is done in 4 steps:
- combining of all channels into single pars files with associated plot and results files
- running dsp over all channels using par file
"""

from scripts.util.pars_loading import pars_catalog
from scripts.util.patterns import (
get_pattern_pars_tmp_channel,
Expand Down
8 changes: 4 additions & 4 deletions scripts/pars_hit_aoe.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def eres_func(x):
pkl.dump(out_plot_dict, w, protocol=pkl.HIGHEST_PROTOCOL)

pathlib.Path(os.path.dirname(args.hit_pars)).mkdir(parents=True, exist_ok=True)
results_dict = dict(**ecal_dict["results"], aoe = out_dict)
results_dict = dict(**ecal_dict["results"], aoe=out_dict)
with open(args.hit_pars, "w") as w:
final_hit_dict = {
"pars": {"operations": cal_dict},
Expand All @@ -231,8 +231,8 @@ def eres_func(x):

pathlib.Path(os.path.dirname(args.aoe_results)).mkdir(parents=True, exist_ok=True)
final_object_dict = dict(
**object_dict,
aoe=obj,
)
**object_dict,
aoe=obj,
)
with open(args.aoe_results, "wb") as w:
pkl.dump(final_object_dict, w, protocol=pkl.HIGHEST_PROTOCOL)
6 changes: 3 additions & 3 deletions scripts/pars_hit_ecal.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,19 +283,19 @@ def energy_cal_th(
if plot in item:
param_dict.update({plot: item[plot]})
common_dict.update({key: param_dict})
plot_dict = {"ecal":plot_dict}
plot_dict = {"ecal": plot_dict}
plot_dict["common"] = common_dict

with open(args.plot_path, "wb") as f:
pkl.dump(plot_dict, f, protocol=pkl.HIGHEST_PROTOCOL)

# save output dictionary
output_dict = {"pars": out_dict, "results": {"ecal":result_dict}}
output_dict = {"pars": out_dict, "results": {"ecal": result_dict}}
with open(args.save_path, "w") as fp:
pathlib.Path(os.path.dirname(args.save_path)).mkdir(parents=True, exist_ok=True)
json.dump(output_dict, fp, indent=4)

# save calibration objects
with open(args.results_path, "wb") as fp:
pathlib.Path(os.path.dirname(args.results_path)).mkdir(parents=True, exist_ok=True)
pkl.dump({"ecal":ecal_object}, fp, protocol=pkl.HIGHEST_PROTOCOL)
pkl.dump({"ecal": ecal_object}, fp, protocol=pkl.HIGHEST_PROTOCOL)
8 changes: 4 additions & 4 deletions scripts/pars_hit_lq.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def eres_func(x):
pkl.dump(out_plot_dict, w, protocol=pkl.HIGHEST_PROTOCOL)


results_dict = dict(**eres_dict,lq = out_dict)
results_dict = dict(**eres_dict, lq=out_dict)
pathlib.Path(os.path.dirname(args.hit_pars)).mkdir(parents=True, exist_ok=True)
with open(args.hit_pars, "w") as w:
final_hit_dict = {
Expand All @@ -231,8 +231,8 @@ def eres_func(x):

pathlib.Path(os.path.dirname(args.lq_results)).mkdir(parents=True, exist_ok=True)
final_object_dict = dict(
**object_dict,
lq=obj,
)
**object_dict,
lq=obj,
)
with open(args.lq_results, "wb") as w:
pkl.dump(final_object_dict, w, protocol=pkl.HIGHEST_PROTOCOL)