Skip to content

Commit e8e2842

Browse files
committed
realized warnings in all the __init__ files were redundant, because the module-level init always gets executed either way
1 parent d326a42 commit e8e2842

6 files changed

Lines changed: 4 additions & 52 deletions

File tree

.github/workflows/test.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ jobs:
1717
- name: tests and coverage
1818
run: |
1919
pip install -e .[advanced,dev] coveralls
20-
coverage run --source=pynumdiff --omit="pynumdiff/_version.py,pynumdiff/tests/*,pynumdiff/utils/old_pi_cruise_control.py" -m pytest -s --ignore=pynumdiff/tests/test_imports.py
21-
pip uninstall -y cvxpy
22-
coverage run -a --source=pynumdiff -m pytest pynumdiff/tests/test_imports.py
20+
coverage run --source=pynumdiff --omit="pynumdiff/_version.py,pynumdiff/tests/*,pynumdiff/utils/old_pi_cruise_control.py" -m pytest -s
2321
coverage xml
2422
- uses: coverallsapp/github-action@v2
2523
with:
Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
11
"""This module implements constant-derivative model-based smoothers based on Kalman filtering and its generalization.
22
"""
3-
try:
4-
import cvxpy
5-
except:
6-
from warnings import warn
7-
warn("CVXPY is not installed; robustdiff and l1_solve not available.")
8-
else: # runs if try was successful
9-
from ._kalman_smooth import robustdiff, convex_smooth
10-
11-
from ._kalman_smooth import kalman_filter, rts_smooth, rtsdiff, constant_velocity, constant_acceleration, constant_jerk
3+
from ._kalman_smooth import kalman_filter, rts_smooth, rtsdiff, constant_velocity, constant_acceleration, constant_jerk, robustdiff, convex_smooth

pynumdiff/linear_model/__init__.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
1-
try:
2-
import cvxpy
3-
from ._linear_model import lineardiff
4-
except:
5-
from warnings import warn
6-
warn("Limited Linear Model Support Detected! CVXPY is not installed. " +
7-
"Install CVXPY to use lineardiff derivatives. You can still use other methods.")
8-
9-
from ._linear_model import savgoldiff, polydiff, spectraldiff
1+
from ._linear_model import lineardiff, savgoldiff, polydiff, spectraldiff
102

113
__all__ = ['lineardiff'] # Things in this list get treated as direct members of the module by sphinx
124
# polydiff and savgoldiff are still imported for now for backwards compatibility but are not documented

pynumdiff/optimize/__init__.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
"""Import functions from the optimize module
22
"""
3-
try:
4-
import cvxpy
5-
except ImportError:
6-
from warnings import warn
7-
warn("Limited support for total variation regularization and linear model detected! " +
8-
"Some functions in the `total_variation_regularization` and `linear_model` modules require " +
9-
"CVXPY to be installed. You can still pynumdiff.optimize for other functions.")
10-
113
from ._optimize import optimize, suggest_method
124

135
__all__ = ['optimize', 'suggest_method'] # So these get treated as direct members of the module by sphinx

pynumdiff/tests/test_imports.py

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
11
"""This module implements some common total variation regularization methods
22
"""
3-
try:
4-
import cvxpy
5-
except:
6-
from warnings import warn
7-
warn("Limited Total Variation Regularization Support Detected! CVXPY is not installed. " +
8-
"Many Total Variation Methods require CVXPY including: velocity, acceleration, jerk, jerk_sliding, smooth_acceleration. " +
9-
"Please install CVXPY to use these methods. You can still use: total_variation_regularization.iterative_velocity.")
10-
else: # executes if try is successful
11-
from ._total_variation_regularization import tvrdiff, velocity, acceleration, jerk, jerk_sliding, smooth_acceleration
12-
13-
from ._total_variation_regularization import iterative_velocity
3+
from ._total_variation_regularization import tvrdiff, velocity, acceleration, jerk, jerk_sliding, smooth_acceleration, iterative_velocity

0 commit comments

Comments
 (0)