Skip to content
Open
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
17 changes: 10 additions & 7 deletions cvtModel/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@
"scipy",
"matplotlib",
"pandas",
"pydantic"
"pydantic",
"numba"
],
extras_require={"dev": [
"black",
"flake8",
"pytest",
"coverage"
]},
extras_require={
"dev": [
"black",
"flake8",
"pytest",
"coverage"
],
},
)
4 changes: 3 additions & 1 deletion cvtModel/src/cvt_simulator/models/slip_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from cvt_simulator.constants.constants import (
RUBBER_ALUMINUM_STATIC_FRICTION,
)
from cvt_simulator.utils.numba_utils import maybe_njit


class SlipModel:
Expand Down Expand Up @@ -152,8 +153,9 @@ def calculate_t_max(self, state: SystemState) -> tuple[float, float]:
secondary_t_max = max(0, secondary_t_max)
return primary_t_max, secondary_t_max

@staticmethod
@maybe_njit(cache=True, fastmath=True)
def _relative_speed(
self,
primary_angular_velocity: float,
secondary_angular_velocity: float,
cvt_ratio: float,
Expand Down
16 changes: 16 additions & 0 deletions cvtModel/src/cvt_simulator/utils/numba_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
try:
from numba import njit

NUMBA_ENABLED = True

def maybe_njit(*args, **kwargs):
return njit(*args, **kwargs)

except ImportError: # pragma: no cover - exercised when numba is installed
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pragma comment is misleading. It states "exercised when numba is installed" but this is the except ImportError block, which executes when numba is NOT installed. The comment should either be "exercised when numba is not installed" or be moved to line 1-7 which is exercised when numba is installed.

Suggested change
except ImportError: # pragma: no cover - exercised when numba is installed
except ImportError: # pragma: no cover - exercised when numba is not installed

Copilot uses AI. Check for mistakes.
NUMBA_ENABLED = False

def maybe_njit(*args, **kwargs):
def decorator(func):
return func

return decorator