diff --git a/docs/conf.py b/docs/conf.py index 25fffee7..e9ffff96 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -49,7 +49,7 @@ def pick_newtype_attrs(some_type: type) -> list: api_target_substitutions: dict[str, str | tuple[str, str]] = { "EdgeQuantumNumberTypes": ("obj", "qrules.quantum_numbers.EdgeQuantumNumberTypes"), "EdgeType": "typing.TypeVar", - "Fraction": "fraction.Fraction", + "Fraction": ("obj", "fractions.Fraction"), "GraphEdgePropertyMap": ("obj", "qrules.argument_handling.GraphEdgePropertyMap"), "GraphElementProperties": ("obj", "qrules.solving.GraphElementProperties"), "GraphNodePropertyMap": ("obj", "qrules.argument_handling.GraphNodePropertyMap"), @@ -296,7 +296,6 @@ def pick_newtype_attrs(some_type: type) -> list: (r"py:(class|obj)", r"qrules\.topology\.NewNodeType"), (r"py:(class|obj)", r"qrules\.topology\.NodeType"), (r"py:(class|obj)", r"qrules\.topology\.VT"), - (r"py:(class|obj)", r"fraction\.Fraction"), *nitpick_temp_patterns, ] nitpicky = True diff --git a/src/qrules/combinatorics.py b/src/qrules/combinatorics.py index e8603981..fa29f6f1 100644 --- a/src/qrules/combinatorics.py +++ b/src/qrules/combinatorics.py @@ -233,8 +233,8 @@ def fill_spin_projections(state: StateDefinition) -> StateWithSpins: particle_name = state particle = particle_db[particle_name] spin_projections = set(arange(-particle.spin, particle.spin + 1)) - if particle.mass == 0.0 and Fraction(0, 1) in spin_projections: - spin_projections.remove(Fraction(0, 1)) + if particle.mass == 0.0 and Fraction(0) in spin_projections: + spin_projections.remove(Fraction(0)) return particle_name, sorted(spin_projections) return state diff --git a/src/qrules/conservation_rules.py b/src/qrules/conservation_rules.py index 57d17c73..457f582c 100644 --- a/src/qrules/conservation_rules.py +++ b/src/qrules/conservation_rules.py @@ -855,7 +855,7 @@ def calculate_hypercharge( or edge_qns.tau_lepton_number ): return True - isospin_3 = Fraction(0, 1) + isospin_3 = Fraction(0) if edge_qns.isospin_projection: isospin_3 = edge_qns.isospin_projection return float(edge_qns.charge) == isospin_3 + 0.5 * calculate_hypercharge(edge_qns) diff --git a/src/qrules/particle.py b/src/qrules/particle.py index 8bea7e4e..8ac2b853 100644 --- a/src/qrules/particle.py +++ b/src/qrules/particle.py @@ -56,11 +56,11 @@ def _validate_fraction_for_spin( attribute: Attribute, # noqa: ARG001 value: Fraction, # noqa: ARG001 ) -> Any: - if instance.magnitude % Fraction(1, 2) != Fraction(0, 1): + if instance.magnitude % Fraction(1, 2) != Fraction(0): msg = f"Spin magnitude {instance.magnitude} has to be a multitude of 0.5" raise ValueError(msg) if abs(instance.projection) > instance.magnitude: - if instance.magnitude < Fraction(0, 1): + if instance.magnitude < Fraction(0): msg = f"Spin magnitude has to be positive, but is {instance.magnitude}" raise ValueError(msg) msg = ( diff --git a/src/qrules/quantum_numbers.py b/src/qrules/quantum_numbers.py index 9e6d3163..cdf124fb 100644 --- a/src/qrules/quantum_numbers.py +++ b/src/qrules/quantum_numbers.py @@ -234,7 +234,7 @@ class InteractionProperties: def arange( - x_1: Fraction, x_2: Fraction, delta: Fraction = Fraction(1, 1) + x_1: Fraction, x_2: Fraction, delta: Fraction = Fraction(1) ) -> Generator[Fraction, None, None]: current = Fraction(x_1) delta = Fraction(delta)