Skip to content

Commit

Permalink
chore: update pre-commit hooks (#145)
Browse files Browse the repository at this point in the history
* chore: update pre-commit hooks

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.1.14 → v0.2.0](astral-sh/ruff-pre-commit@v0.1.14...v0.2.0)

* fix ups

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Giordon Stark <kratsg@gmail.com>
  • Loading branch information
pre-commit-ci[bot] and kratsg committed Feb 5, 2024
1 parent 10115ab commit d2ce442
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 25 deletions.
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ updates:
directory: "/"
schedule:
interval: "weekly"
groups:
actions:
patterns:
- "*"
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ci:
autofix_commit_msg: "style: pre-commit fixes"

repos:
- repo: https://github.com/psf/black
- repo: https://github.com/psf/black-pre-commit-mirror
rev: "24.1.1"
hooks:
- id: black-jupyter
Expand Down Expand Up @@ -44,14 +44,14 @@ repos:
types_or: [yaml, markdown, html, css, scss, javascript, json]
args: [--prose-wrap=always]

- repo: https://github.com/asottile/blacken-docs
- repo: https://github.com/adamchainz/blacken-docs
rev: "1.16.0"
hooks:
- id: blacken-docs
additional_dependencies: [black==22.8.0]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.14
rev: v0.2.0
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
Expand Down
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -167,14 +167,14 @@ filterwarnings = ["error"]
testpaths = [
"tests",
]

log_cli_level = "INFO"

[tool.mypy]
files = "src"
python_version = "3.7"
warn_unused_configs = true
strict = true
show_error_codes = true
hide_error_codes = false
enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]
warn_unreachable = true

Expand Down Expand Up @@ -225,12 +225,12 @@ select = [
"UP", # pyupgrade
"YTT", # flake8-2020
]
extend-ignore = ["PLR", "E501"]
ignore = ["PLR", "E501"]
typing-modules = ["mapyde._compat.typing"]
unfixable = ["T20", "F841"]
isort.required-imports = ["from __future__ import annotations"]

[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"tests/**" = ["T20"]
"scripts/**" = ["T20", "PTH", "SIM115"]
"scripts/SAtoJSON.py" = ["T20", "B905"]
Expand Down
4 changes: 1 addition & 3 deletions scripts/FlatAna.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@
# a_weights = []

# Loop through all events in chain
entry = 0
for event in chain:
entry += 1
for entry, event in enumerate(chain, 1):

if entry != 0 and entry % 10000 == 0:
print("%d events processed" % entry)
Expand Down
4 changes: 1 addition & 3 deletions scripts/FlatAna_uproot.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
a_weights = []

# loop over events
entry = 0
for i in range(numevents):
entry += 1
for entry, i in enumerate(range(numevents), 1):

if entry != 0 and entry % 10000 == 0:
print("%d events processed" % entry)
Expand Down
8 changes: 2 additions & 6 deletions scripts/SimpleAna.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,8 @@ def strip_ansi_codes(s):
# There should be a better way to do this....
if reweightEvents:
print("Computing sum of weights")
entry = 0
sumofweights = 0
for event in chain:
entry += 1
for entry, event in enumerate(chain, 1):

if entry != 0 and entry % 10000 == 0:
print("%d events processed for sum of weights" % entry)
Expand All @@ -98,9 +96,7 @@ def strip_ansi_codes(s):

# Loop through all events in chain
print("Processing events")
entry = 0
for event in chain:
entry += 1
for entry, event in enumerate(chain, 1):

if entry != 0 and entry % 10000 == 0:
print("%d events processed" % entry)
Expand Down
4 changes: 1 addition & 3 deletions scripts/lowlevelAna.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@
allev = lowlevelTree("allev", outfile)

# Loop through all events in chain
entry = 0
for event in chain:
entry += 1
for entry, event in enumerate(chain, 1):

if entry != 0 and entry % 10000 == 0:
print("%d events processed" % entry)
Expand Down
4 changes: 1 addition & 3 deletions scripts/tthhAna.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@
allev = tthhTree("allev", outfile)

# Loop through all events in chain
entry = 0
for event in chain:
entry += 1
for entry, event in enumerate(chain, 1):

if entry != 0 and entry % 10000 == 0:
print("%d events processed" % entry)
Expand Down

0 comments on commit d2ce442

Please sign in to comment.