From 3b55cb143ad0d158a4733ca28e8f32acf27012e5 Mon Sep 17 00:00:00 2001 From: Travis Adrian Dantzer <47285626+dantzert@users.noreply.github.com> Date: Sat, 25 Jul 2026 11:02:28 -0400 Subject: [PATCH] fix: correct typos, add codespell CI gate, add pytest-xdist/cov/junitxml - Fix typos in modpods/lti.py: accross->across, trnasformation->transformation, gaurantee->guarantee, stabilty->stability - Fix typo in test_fixed.py: funcionality->functionality - Remove suppressed typo words from .codespellrc - Add codespell to requirements.txt and CI workflow - Add pytest-xdist, pytest-cov to requirements.txt - Add --junitxml, --cov, -n auto to pytest CI step --- .codespellrc | 3 +++ .github/workflows/ci.yml | 5 ++++- modpods/lti.py | 10 +++++----- requirements.txt | 3 +++ test_fixed.py | 2 +- 5 files changed, 16 insertions(+), 7 deletions(-) create mode 100644 .codespellrc diff --git a/.codespellrc b/.codespellrc new file mode 100644 index 0000000..2d1b301 --- /dev/null +++ b/.codespellrc @@ -0,0 +1,3 @@ +[codespell] +skip = .git,*.svg,*.png,*.jpg,*.jpeg,*.gif,*.ico,*.pdf,*.zip,*.tar.gz,*.whl,.venv,.vs,__pycache__ +ignore-words-list = Bu,gage,Gage,modpods,sindy,SINDy,pysindy,NSE,HFV,LFV,FDC,LTI,SWMM,pystorms,pyswmm,RAIM,PET,PRCP,CAMELS,USGS,configparser,argparse diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 93f5872..460f104 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,8 +28,11 @@ jobs: - name: Lint with ruff run: ruff check . + - name: Lint with codespell + run: codespell . + - name: Type-check with mypy run: mypy . --ignore-missing-imports - name: Run tests with pytest - run: pytest tests/ -v + run: pytest tests/ -v --junitxml=junit.xml --cov=modpods --cov-report=xml -n auto diff --git a/modpods/lti.py b/modpods/lti.py index 6c0b367..75a8ed6 100644 --- a/modpods/lti.py +++ b/modpods/lti.py @@ -108,8 +108,8 @@ def lti_from_gamma( # search across the C vector for i in range( C.shape[1] - 1, int(-1), int(-1) - ): # accross the columns # start at the end and come back - # for i in range(int(0),C.shape[1],int(1)): # accross the columns, start at the beginning and go forward + ): # across the columns # start at the end and come back + # for i in range(int(0),C.shape[1],int(1)): # across the columns, start at the beginning and go forward og_approx = control.ss(A, B, C, 0) og_y = np.ndarray.flatten(control.impulse_response(og_approx, t).y) @@ -437,7 +437,7 @@ def lti_system_gen( for row in original_A.index: if delay_models[row] is None: pass - else: # we want the model with the most transformations where the last trnasformation added at least 0.5% to the R2 score + else: # we want the model with the most transformations where the last transformation added at least 0.5% to the R2 score for num_transforms in range(1, max_transforms + 1): if num_transforms == 1: optimal_number_transforms = num_transforms @@ -654,7 +654,7 @@ def lti_system_gen( C = C.apply(pd.to_numeric, errors="coerce").fillna(0.0) # if bibo_stable is specified and A not hurwitz, make A hurwitz by defining A' = A - I*max(real(eig(A))) - # this will gaurantee stability (max eigenvalue will have real part < 0) + # this will guarantee stability (max eigenvalue will have real part < 0) if bibo_stable: orig_eigs, _ = np.linalg.eig(A) if any(np.real(orig_eigs) > 0): @@ -662,7 +662,7 @@ def lti_system_gen( epsilon = 10e-4 A_stab = A - np.eye(len(A)) * (1 + epsilon) * max( np.real(orig_eigs) - ) # add factor of (1+epsilon) for stability, not marginal stabilty + ) # add factor of (1+epsilon) for stability, not marginal stability stab_eigs, _ = np.linalg.eig(A_stab) A = A_stab.copy(deep=True) diff --git a/requirements.txt b/requirements.txt index 5e2d8e5..53287c7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,8 +10,11 @@ networkx>=3.0 # Testing pytest>=7.0 +pytest-xdist>=3.0 +pytest-cov>=4.0 # Linting black>=23.0 ruff>=0.1 mypy>=1.0 +codespell>=2.0 diff --git a/test_fixed.py b/test_fixed.py index 2415cc5..b617b1b 100644 --- a/test_fixed.py +++ b/test_fixed.py @@ -3,7 +3,7 @@ import modpods -# basic funcionality tests and a bit of a tutorial +# basic functionality tests and a bit of a tutorial # some data from the CAMELS dataset # change the filepath to wherever you have modpods at