Skip to content

Commit bfdfc33

Browse files
committed
fix mypy and ruff
1 parent f6ea3e0 commit bfdfc33

File tree

2 files changed

+229
-8
lines changed

2 files changed

+229
-8
lines changed

pysatl_criterion/statistics/__init__.py

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,48 @@
3333
WeExponentialityGofStatistic,
3434
WongWongExponentialityGofStatistic,
3535
)
36+
from pysatl_criterion.statistics.log_normal import (
37+
AbstractLogNormalGofStatistic,
38+
AndersonDarlingLogNormalGofStatistic,
39+
BonettSeierLogNormalGofStatistic,
40+
BontempsMeddahi1LogNormalGofStatistic,
41+
BontempsMeddahi2LogNormalGofStatistic,
42+
CabanaCabana1LogNormalGofStatistic,
43+
CabanaCabana2LogNormalGofStatistic,
44+
ChenShapiroLogNormalGofStatistic,
45+
CoinLogNormalGofStatistic,
46+
CramerVonMiseLogNormalGofStatistic,
47+
DagostinoLogNormalGofStatistic,
48+
DAPLogNormalGofStatistic,
49+
DesgagneLafayeLogNormalGofStatistic,
50+
DoornikHansenLogNormalGofStatistic,
51+
EppsPulleyLogNormalGofStatistic,
52+
FilliLogNormalGofStatistic,
53+
GlenLeemisBarrLogNormalGofStatistic,
54+
GMGLogNormalGofStatistic,
55+
Hosking1LogNormalGofStatistic,
56+
Hosking2LogNormalGofStatistic,
57+
Hosking3LogNormalGofStatistic,
58+
Hosking4LogNormalGofStatistic,
59+
JBLogNormalGofStatistic,
60+
KolmogorovSmirnovLogNormalGofStatistic,
61+
KurtosisLogNormalGofStatistic,
62+
LillieforsLogNormalGofStatistic,
63+
LooneyGulledgeLogNormalGofStatistic,
64+
MartinezIglewiczLogNormalGofStatistic,
65+
QuesenberryMillerLogNormalGofStatistic,
66+
RobustJarqueBeraLogNormalGofStatistic,
67+
RyanJoinerLogNormalGofStatistic,
68+
SFLogNormalGofStatistic,
69+
ShapiroWilkLogNormalGofStatistic,
70+
SkewLogNormalGofStatistic,
71+
SpiegelhalterLogNormalGofStatistic,
72+
SWRGLogNormalGofStatistic,
73+
ZhangQLogNormalGofStatistic,
74+
ZhangQStarLogNormalGofStatistic,
75+
ZhangWuALogNormalGofStatistic,
76+
ZhangWuCLogNormalGofStatistic,
77+
)
3678
from pysatl_criterion.statistics.models import AbstractStatistic
3779
from pysatl_criterion.statistics.normal import (
3880
AbstractNormalityGofStatistic,
@@ -76,7 +118,6 @@
76118
ZhangWuANormalityGofStatistic,
77119
ZhangWuCNormalityGofStatistic,
78120
)
79-
from pysatl_criterion.statistics.log_normal import *
80121
from pysatl_criterion.statistics.weibull import (
81122
AbstractWeibullGofStatistic,
82123
AndersonDarlingWeibullGofStatistic,
@@ -100,6 +141,7 @@
100141
WPPWeibullGofStatistic,
101142
)
102143

144+
103145
__all__ = [
104146
"AbstractStatistic",
105147
"ADStatistic",

pysatl_criterion/statistics/log_normal.py

Lines changed: 186 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from pysatl_criterion.statistics import normal
99
from pysatl_criterion.statistics.common import CrammerVonMisesStatistic, KSStatistic
1010
from pysatl_criterion.statistics.goodness_of_fit import AbstractGoodnessOfFitStatistic
11-
from pysatl_criterion.statistics.normal import AbstractNormalityGofStatistic
1211

1312

1413
class AbstractLogNormalGofStatistic(AbstractGoodnessOfFitStatistic):
@@ -115,6 +114,150 @@ def execute_statistic(self, rvs, **kwargs):
115114
# =================================================================================================
116115

117116

117+
class AndersonDarlingLogNormalGofStatistic:
118+
pass
119+
120+
121+
class BonettSeierLogNormalGofStatistic:
122+
pass
123+
124+
125+
class BontempsMeddahi1LogNormalGofStatistic:
126+
pass
127+
128+
129+
class BontempsMeddahi2LogNormalGofStatistic:
130+
pass
131+
132+
133+
class CabanaCabana1LogNormalGofStatistic:
134+
pass
135+
136+
137+
class CabanaCabana2LogNormalGofStatistic:
138+
pass
139+
140+
141+
class ChenShapiroLogNormalGofStatistic:
142+
pass
143+
144+
145+
class CoinLogNormalGofStatistic:
146+
pass
147+
148+
149+
class DagostinoLogNormalGofStatistic:
150+
pass
151+
152+
153+
class DAPLogNormalGofStatistic:
154+
pass
155+
156+
157+
class DesgagneLafayeLogNormalGofStatistic:
158+
pass
159+
160+
161+
class DoornikHansenLogNormalGofStatistic:
162+
pass
163+
164+
165+
class EppsPulleyLogNormalGofStatistic:
166+
pass
167+
168+
169+
class FilliLogNormalGofStatistic:
170+
pass
171+
172+
173+
class GlenLeemisBarrLogNormalGofStatistic:
174+
pass
175+
176+
177+
class GMGLogNormalGofStatistic:
178+
pass
179+
180+
181+
class Hosking1LogNormalGofStatistic:
182+
pass
183+
184+
185+
class Hosking2LogNormalGofStatistic:
186+
pass
187+
188+
189+
class Hosking3LogNormalGofStatistic:
190+
pass
191+
192+
193+
class Hosking4LogNormalGofStatistic:
194+
pass
195+
196+
197+
class JBLogNormalGofStatistic:
198+
pass
199+
200+
201+
class KurtosisLogNormalGofStatistic:
202+
pass
203+
204+
205+
class LillieforsLogNormalGofStatistic:
206+
pass
207+
208+
209+
class LooneyGulledgeLogNormalGofStatistic:
210+
pass
211+
212+
213+
class MartinezIglewiczLogNormalGofStatistic:
214+
pass
215+
216+
217+
class RobustJarqueBeraLogNormalGofStatistic:
218+
pass
219+
220+
221+
class RyanJoinerLogNormalGofStatistic:
222+
pass
223+
224+
225+
class SFLogNormalGofStatistic:
226+
pass
227+
228+
229+
class ShapiroWilkLogNormalGofStatistic:
230+
pass
231+
232+
233+
class SkewLogNormalGofStatistic:
234+
pass
235+
236+
237+
class SpiegelhalterLogNormalGofStatistic:
238+
pass
239+
240+
241+
class SWRGLogNormalGofStatistic:
242+
pass
243+
244+
245+
class ZhangQLogNormalGofStatistic:
246+
pass
247+
248+
249+
class ZhangQStarLogNormalGofStatistic:
250+
pass
251+
252+
253+
class ZhangWuALogNormalGofStatistic:
254+
pass
255+
256+
257+
class ZhangWuCLogNormalGofStatistic:
258+
pass
259+
260+
118261
def _create_lognormal_class(normal_cls):
119262
new_class_name = normal_cls.__name__.replace("Normality", "LogNormal")
120263
class_code = normal_cls.code().replace("NORMALITY", "LOGNORMAL")
@@ -142,8 +285,47 @@ def code():
142285
return LogNormalClass
143286

144287

145-
# List of Normal statistics that we have explicitly implemented for LogNormal above.
146-
# We should NOT generate dynamic wrappers for these.
288+
_REQUESTED_CLASS_NAMES = [
289+
"AndersonDarlingNormalityGofStatistic",
290+
"BonettSeierNormalityGofStatistic",
291+
"BontempsMeddahi1NormalityGofStatistic",
292+
"BontempsMeddahi2NormalityGofStatistic",
293+
"CabanaCabana1NormalityGofStatistic",
294+
"CabanaCabana2NormalityGofStatistic",
295+
"ChenShapiroNormalityGofStatistic",
296+
"CoinNormalityGofStatistic",
297+
"CramerVonMiseNormalityGofStatistic",
298+
"DagostinoNormalityGofStatistic",
299+
"DAPNormalityGofStatistic",
300+
"DesgagneLafayeNormalityGofStatistic",
301+
"DoornikHansenNormalityGofStatistic",
302+
"EppsPulleyNormalityGofStatistic",
303+
"FilliNormalityGofStatistic",
304+
"GlenLeemisBarrNormalityGofStatistic",
305+
"GMGNormalityGofStatistic",
306+
"Hosking1NormalityGofStatistic",
307+
"Hosking2NormalityGofStatistic",
308+
"Hosking3NormalityGofStatistic",
309+
"Hosking4NormalityGofStatistic",
310+
"JBNormalityGofStatistic",
311+
"KolmogorovSmirnovNormalityGofStatistic",
312+
"KurtosisNormalityGofStatistic",
313+
"LillieforsNormalityGofStatistic",
314+
"LooneyGulledgeNormalityGofStatistic",
315+
"MartinezIglewiczNormalityGofStatistic",
316+
"RobustJarqueBeraNormalityGofStatistic",
317+
"RyanJoinerNormalityGofStatistic",
318+
"SFNormalityGofStatistic",
319+
"SkewNormalityGofStatistic",
320+
"SpiegelhalterNormalityGofStatistic",
321+
"ShapiroWilkNormalityGofStatistic",
322+
"SWRGNormalityGofStatistic",
323+
"ZhangQNormalityGofStatistic",
324+
"ZhangQStarNormalityGofStatistic",
325+
"ZhangWuANormalityGofStatistic",
326+
"ZhangWuCNormalityGofStatistic",
327+
]
328+
147329
_EXPLICITLY_IMPLEMENTED_NORMAL_STATS = [
148330
"KolmogorovSmirnovNormalityGofStatistic",
149331
"CramerVonMiseNormalityGofStatistic",
@@ -162,11 +344,8 @@ def code():
162344
for name, obj in inspect.getmembers(normal):
163345
if (
164346
inspect.isclass(obj)
165-
and issubclass(obj, AbstractNormalityGofStatistic)
166-
and obj is not AbstractNormalityGofStatistic
347+
and name in _REQUESTED_CLASS_NAMES
167348
and name not in _EXPLICITLY_IMPLEMENTED_NORMAL_STATS
168-
and not name.startswith("Abstract")
169-
and not name.startswith("Graph")
170349
):
171350
ln_class = _create_lognormal_class(obj)
172351
setattr(current_module, ln_class.__name__, ln_class)

0 commit comments

Comments
 (0)