Skip to content

Commit

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

updates:
- [github.com/charliermarsh/ruff-pre-commit: v0.0.272 → v0.0.275](astral-sh/ruff-pre-commit@v0.0.272...v0.0.275)
- [github.com/pre-commit/mirrors-mypy: v1.3.0 → v1.4.1](pre-commit/mirrors-mypy@v1.3.0...v1.4.1)

* style: pre-commit fixes

* Fixed issues found by Ruff

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Eduardo Rodrigues <[email protected]>
  • Loading branch information
pre-commit-ci[bot] and eduardo-rodrigues authored Jun 28, 2023
1 parent 8f52f3e commit d0b0576
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ repos:
- id: end-of-file-fixer

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: "v0.0.272"
rev: "v0.0.275"
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.3.0
rev: v1.4.1
hooks:
- id: mypy
files: '^src/decaylanguage/(decay|dec|utils)/'
Expand Down
5 changes: 3 additions & 2 deletions src/decaylanguage/modeling/amplitudechain.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from copy import copy
from enum import Enum
from itertools import product
from typing import ClassVar

import attr
import numpy as np
Expand Down Expand Up @@ -55,8 +56,8 @@ class AmplitudeChain(ModelDecay):
name = attr.ib(None)

# Class members keep track of additions
all_particles = set()
final_particles = set()
all_particles: ClassVar[Particle] = set()
final_particles: ClassVar[Particle] = set()

# This is set class-wide, and only used when a line is made
cartesian = False
Expand Down
4 changes: 2 additions & 2 deletions tests/dec/test_dec.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ def test_decay_model_parsing():
# Simple decay model without model parameters
dl = p._parsed_decays[2].children[1] # 'MySecondD*+' Tree
assert get_model_name(dl) == "VSS"
assert get_model_parameters(dl) == "" # noqa: PLC1901
assert get_model_parameters(dl) == ""

# Decay model with a set of floating-point model parameters
dl = p._parsed_decays[0].children[1] # 'B0sig' Tree
Expand Down Expand Up @@ -671,7 +671,7 @@ def test_Lark_DecayModelParamValueReplacement_Visitor_no_params():
# The visitor should do nothing in this case
tree_decayline = list(t.find_data("decayline"))[0]
assert get_model_name(tree_decayline) == "PHSP"
assert get_model_parameters(tree_decayline) == "" # noqa: PLC1901
assert get_model_parameters(tree_decayline) == ""


def test_Lark_DecayModelParamValueReplacement_Visitor_single_value():
Expand Down
6 changes: 4 additions & 2 deletions tests/test_dec_full.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

from __future__ import annotations

from typing import ClassVar

import pytest
from lark import Lark, Transformer, Tree
from particle import ParticleNotFound
Expand Down Expand Up @@ -74,8 +76,8 @@ def setlspw(transformed):


class TreeToDec2(Transformer):
missing = set()
keyerrs = set()
missing: ClassVar[str] = set()
keyerrs: ClassVar[str] = set()

def __init__(self, alias_dict):
self.alias_dict = alias_dict
Expand Down

0 comments on commit d0b0576

Please sign in to comment.