14
14
import random
15
15
import sys
16
16
import traceback
17
- from typing import Callable , Iterable , List , Optional , Tuple , Union
17
+ import typing as t
18
18
import warnings
19
19
20
20
from faker .config import AVAILABLE_LOCALES
@@ -67,17 +67,17 @@ class Status(IntEnum):
67
67
OK = 4
68
68
69
69
70
- Requirements = Iterable [Union [type , object ]]
70
+ Requirements = t . Iterable [t . Union [type , object ]]
71
71
72
72
73
73
@dataclass
74
74
class Check :
75
75
"""Store the specification of a single check."""
76
76
77
77
name : str
78
- fn : Callable
79
- client_required : Optional [str ] = None
80
- other_requirements : Optional [Requirements ] = None
78
+ fn : t . Callable
79
+ client_required : t . Optional [str ] = None
80
+ other_requirements : t . Optional [Requirements ] = None
81
81
82
82
83
83
class InstallationCheckRegistry :
@@ -106,9 +106,9 @@ def __init__(self):
106
106
)
107
107
108
108
def add_check (self , name : str ,
109
- fn : Callable ,
110
- client_required : Optional [str ] = None ,
111
- other_requirements : Optional [Requirements ] = None
109
+ fn : t . Callable ,
110
+ client_required : t . Optional [str ] = None ,
111
+ other_requirements : t . Optional [Requirements ] = None
112
112
):
113
113
"""
114
114
Add a check for this installation.
@@ -129,7 +129,7 @@ def add_check(self, name: str,
129
129
"""
130
130
if (
131
131
other_requirements and
132
- not isinstance (other_requirements , Iterable )
132
+ not isinstance (other_requirements , t . Iterable )
133
133
):
134
134
other_requirements = [other_requirements ]
135
135
self ._checks .append (
@@ -167,8 +167,15 @@ def client(self) -> AbstractHowsoClient:
167
167
return self ._client
168
168
169
169
@property
170
- def client_classes (self ) -> List [str ]:
171
- """Return list of super class names for the current cached client."""
170
+ def client_classes (self ) -> list [str ]:
171
+ """
172
+ Return list of super class names for the current cached client.
173
+
174
+ Returns
175
+ -------
176
+ list of class names
177
+ """
178
+
172
179
if self ._client is None :
173
180
return []
174
181
if self ._client_classes == []:
@@ -460,8 +467,8 @@ def get_nonce(length=8) -> str:
460
467
461
468
def generate_dataframe (* , client : AbstractHowsoClient ,
462
469
num_samples : int = 150 ,
463
- timeout : Optional [int ] = None
464
- ) -> Tuple [pd .DataFrame , Union [ float , int ] ]:
470
+ timeout : t . Optional [int ] = None
471
+ ) -> tuple [pd .DataFrame , float | int ]:
465
472
"""
466
473
Use HowsoClient to create a dataframe of random data.
467
474
@@ -582,7 +589,7 @@ def check_not_emulated(*, registry: InstallationCheckRegistry):
582
589
583
590
584
591
def check_generate_dataframe (* , registry : InstallationCheckRegistry ,
585
- threshold : Optional [float ] = None ):
592
+ threshold : t . Optional [float ] = None ):
586
593
"""
587
594
Rate the speed in which a dataframe was able to be generated.
588
595
@@ -696,7 +703,7 @@ def check_locales_available(*, registry: InstallationCheckRegistry):
696
703
697
704
698
705
def check_save (* , registry : InstallationCheckRegistry ,
699
- source_df : Optional [pd .DataFrame ] = None ):
706
+ source_df : t . Optional [pd .DataFrame ] = None ):
700
707
"""
701
708
Ensure that a model can can be saved.
702
709
@@ -745,7 +752,7 @@ def check_save(*, registry: InstallationCheckRegistry,
745
752
746
753
747
754
def check_synthesizer_create_delete (* , registry : InstallationCheckRegistry ,
748
- source_df : Optional [pd .DataFrame ] = None ):
755
+ source_df : t . Optional [pd .DataFrame ] = None ):
749
756
"""
750
757
Ensure that a model can can be created and deleted.
751
758
@@ -799,7 +806,7 @@ def check_synthesizer_create_delete(*, registry: InstallationCheckRegistry,
799
806
800
807
801
808
def check_latency (* , registry : InstallationCheckRegistry ,
802
- source_df : Optional [pd .DataFrame ] = None ,
809
+ source_df : t . Optional [pd .DataFrame ] = None ,
803
810
notice_threshold : int = 10 , warning_threshold : int = 20 ,
804
811
timeout : int = 10 ):
805
812
"""
@@ -922,7 +929,7 @@ def check_performance(*, registry: InstallationCheckRegistry,
922
929
def check_engine_operation (
923
930
* ,
924
931
registry : InstallationCheckRegistry ,
925
- source_df : Optional [pd .DataFrame ] = None
932
+ source_df : t . Optional [pd .DataFrame ] = None
926
933
):
927
934
"""
928
935
Ensure that Howso Engine operates as it should.
@@ -991,7 +998,7 @@ def check_engine_operation(
991
998
992
999
def check_validator_operation (
993
1000
* , registry : InstallationCheckRegistry ,
994
- source_df : Optional [pd .DataFrame ] = None ,
1001
+ source_df : t . Optional [pd .DataFrame ] = None ,
995
1002
):
996
1003
"""
997
1004
Ensure that Validator-Enterprise operates as it should.
0 commit comments