Skip to content

Commit b0e0d8b

Browse files
committed
Remove star imports
1 parent ff16e90 commit b0e0d8b

File tree

8 files changed

+37
-26
lines changed

8 files changed

+37
-26
lines changed

mrestimator/__init__.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
from importlib import metadata as importlib_metadata
22

33
from . import utility as ut
4-
5-
ut.initialize()
6-
log = ut.log
7-
84
from .coefficients import CoefficientResult, coefficients
95
from .fit import *
106
from .input_output import *
117
from .simulate import *
128
from .utility import disable_progressbar, enable_progressbar
139
from .wrapper import *
1410

11+
ut.initialize()
12+
log = ut.log
13+
1514

1615
def _get_version():
1716
try:

mrestimator/fit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
import scipy.optimize
77
import scipy.stats
88

9+
from mrestimator import CoefficientResult
910
from mrestimator import utility as ut
1011

1112
log = ut.log
1213
tqdm = ut.tqdm
13-
from mrestimator import CoefficientResult
1414

1515

1616
def f_linear(k, A, O):

mrestimator/input_output.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@
33
import os
44
import re
55

6+
import matplotlib
7+
import matplotlib.pyplot as plt
8+
import numpy as np
9+
610
from mrestimator import utility as ut
711
from mrestimator._version import __version__
812
from mrestimator.coefficients import CoefficientResult
913
from mrestimator.fit import FitResult
1014

1115
log = ut.log
12-
import matplotlib
13-
import matplotlib.pyplot as plt
14-
import numpy as np
1516

1617

1718
def input_handler(items, **kwargs):

mrestimator/wrapper.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,27 @@
11
import logging
22
import os
33

4+
import matplotlib.pyplot as plt
45
import numpy as np
56
from matplotlib import rc_context
7+
from matplotlib.axes import Axes
68

79
from mrestimator import utility as ut
10+
from mrestimator.coefficients import coefficients
11+
from mrestimator.fit import (
12+
f_complex,
13+
f_exponential,
14+
f_exponential_offset,
15+
fit,
16+
fitfunc_check,
17+
)
18+
from mrestimator.input_output import (
19+
OutputHandler,
20+
input_handler,
21+
overview,
22+
)
823

924
log = ut.log
10-
from mrestimator.coefficients import coefficients
11-
from mrestimator.fit import *
12-
from mrestimator.input_output import *
1325

1426

1527
def full_analysis(
@@ -342,7 +354,7 @@ def full_analysis(
342354
)
343355
raise TypeError
344356

345-
if targetplot is not None and not isinstance(targetplot, matplotlib.axes.Axes):
357+
if targetplot is not None and not isinstance(targetplot, Axes):
346358
log.exception(
347359
"Optional argument 'targetplot' needs "
348360
+ "to be an instance of 'matplotlib.axes.Axes'"

pyproject.toml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,7 @@ ignore = [
6868
"E741", # ignore ambiguous variable names, because of the example of the S,I,R model
6969
"UP007", # don't reformat Optional[...] to ... | None as it isn't supported by
7070
# autodoc
71-
"F405",
72-
"F403",
73-
"F402",
7471
"E722", # bare excepts
75-
"E402", # module level import not at top of file
7672
]
7773
select = [
7874
"E", # pycodestyle
@@ -84,7 +80,8 @@ select = [
8480

8581
[tool.ruff.lint.per-file-ignores]
8682
# Ignore `F401` (unused imports) in all `__init__.py` files.
87-
"__init__.py" = ["F401"]
83+
"__init__.py" = ["F401", "F403", "F405"]
84+
"tests/__init__.py" = ["F401", "F403", "F405", "E402"]
8885

8986

9087
[tool.ruff.lint.pydocstyle]

tests/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
2+
import sys
23

34
os.chdir(os.path.dirname(__file__))
4-
import sys
55

66
sys.path.append("../../")
77

tests/test_coefficients.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@
55
import numpy as np
66

77
import mrestimator as mre
8+
from mrestimator.coefficients import (
9+
coefficients,
10+
sm_method,
11+
sm_precompute,
12+
ts_method,
13+
ts_precompute,
14+
)
15+
from mrestimator.simulate import simulate_branching
816
from mrestimator.utility import log
917

1018

@@ -140,10 +148,6 @@ def test_separate(self):
140148
)
141149

142150

143-
from mrestimator.coefficients import *
144-
from mrestimator.simulate import simulate_branching
145-
146-
147151
class TestCCKnownMean(unittest.TestCase):
148152
def test_sm(self):
149153
print("Testing knownmean argument to sm_method")

tests/test_mr_estimator.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,15 @@
44
import numpy as np
55
import scipy.optimize
66

7-
print(__name__)
8-
9-
107
# import mrestimator as mre
118
import mrestimator as mre
129
from tests.test_coefficients import (
1310
calc_corr_arr_stationary,
1411
check_similarity,
1512
)
1613

17-
# Currently not working...
14+
print(__name__)
15+
1816

1917
######################
2018

0 commit comments

Comments
 (0)