Skip to content

Commit 0e87ae8

Browse files
feat: Update docstring and signature
1 parent 41603a0 commit 0e87ae8

File tree

1 file changed

+41
-3
lines changed

1 file changed

+41
-3
lines changed

src/thread/utils/config.py

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,17 @@ def _compare(
8585

8686
@staticmethod
8787
def is_valid_level(level: Any) -> bool:
88+
"""
89+
Determines whether the given level is a valid verbosity level.
90+
91+
Parameters
92+
----------
93+
:param level: The level to check.
94+
95+
Returns
96+
-------
97+
:returns: True if the level is a valid verbosity level, False otherwise.
98+
"""
8899
if isinstance(level, int):
89100
return level in VerbosityMapping.values()
90101
if isinstance(level, str):
@@ -109,9 +120,36 @@ def __init__(self):
109120
raise NotImplementedError('This class is not instantiable')
110121

111122
@staticmethod
112-
def set_graceful_exit(enabled: bool = True):
123+
def set_graceful_exit(enabled: bool = True) -> None:
124+
"""
125+
Enables/Disables graceful exiting.
126+
127+
Parameters
128+
----------
129+
:param enabled: True to enable graceful exit, False otherwise.
130+
131+
Returns
132+
-------
133+
:returns: None
134+
"""
113135
Settings.GRACEFUL_EXIT_ENABLED = enabled
114136

115137
@staticmethod
116-
def set_verbosity(verbosity: bool = True):
117-
Settings.VERBOSITY = verbosity
138+
def set_verbosity(verbosity: VerbosityLevel = 'normal') -> None:
139+
"""
140+
Sets the verbosity level.
141+
142+
Parameters
143+
----------
144+
:param verbosity: The level of verbosity. Can be a number or an enum.
145+
146+
Returns
147+
-------
148+
:returns: None
149+
150+
Raises
151+
------
152+
ValueError: If the level is not a valid number or enum.
153+
ValueError: If the level is not of a valid type.
154+
"""
155+
Settings.VERBOSITY = Verbosity(verbosity)

0 commit comments

Comments
 (0)