Skip to content

Commit

Permalink
coercion to Fraction in create_edge_properties
Browse files Browse the repository at this point in the history
  • Loading branch information
grayson-helmholz committed Nov 11, 2024
1 parent a4bcc95 commit a6ab1f8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/qrules/system_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import logging
import operator
from abc import ABC, abstractmethod
from fractions import Fraction
from typing import TYPE_CHECKING, Callable

import attrs
Expand Down Expand Up @@ -35,7 +36,7 @@

def create_edge_properties(
particle: Particle,
spin_projection: float | None = None,
spin_projection: Fraction | None = None,
) -> GraphEdgePropertyMap:
edge_qn_mapping: dict[str, type[EdgeQuantumNumber]] = {
qn_name: qn_type
Expand Down Expand Up @@ -108,7 +109,7 @@ def find_particle( # noqa: D417
if spin_projection is None:
msg = f"{GraphEdgePropertyMap.__name__} does not contain a spin projection"
raise ValueError(msg)
return particle, spin_projection
return particle, Fraction(spin_projection)


def create_interaction_properties(
Expand Down

0 comments on commit a6ab1f8

Please sign in to comment.