forked from shaba/openuds
Type checking updates
This commit is contained in:
parent
fa7ce3de0b
commit
31b513a7ef
@ -50,7 +50,7 @@ class Environment:
|
|||||||
_key: str
|
_key: str
|
||||||
_cache: Cache
|
_cache: Cache
|
||||||
_storage: Storage
|
_storage: Storage
|
||||||
_idGenerators: typing.Optional[typing.Dict[str, UniqueIDGenerator]]
|
_idGenerators: typing.Dict[str, UniqueIDGenerator]
|
||||||
|
|
||||||
def __init__(self, uniqueKey: str, idGenerators: typing.Optional[typing.Dict[str, UniqueIDGenerator]] = None):
|
def __init__(self, uniqueKey: str, idGenerators: typing.Optional[typing.Dict[str, UniqueIDGenerator]] = None):
|
||||||
"""
|
"""
|
||||||
|
@ -113,12 +113,12 @@ class ServiceProvider(Module):
|
|||||||
# : This defines the maximum number of concurrent services that should be in state "in preparation" for this provider
|
# : This defines the maximum number of concurrent services that should be in state "in preparation" for this provider
|
||||||
# : Default is return the GlobalConfig value of GlobalConfig.MAX_PREPARING_SERVICES
|
# : Default is return the GlobalConfig value of GlobalConfig.MAX_PREPARING_SERVICES
|
||||||
# : Note: this variable can be either a fixed value (integer, string) or a Gui text field (with a .value property)
|
# : Note: this variable can be either a fixed value (integer, string) or a Gui text field (with a .value property)
|
||||||
maxPreparingServices: typing.Any = None
|
maxPreparingServices: typing.Optional[typing.Union[int, gui.InputField]] = None
|
||||||
|
|
||||||
# : This defines the maximum number of concurrent services that should be in state "removing" for this provider
|
# : This defines the maximum number of concurrent services that should be in state "removing" for this provider
|
||||||
# : Default is return the GlobalConfig value of GlobalConfig.MAX_REMOVING_SERVICES
|
# : Default is return the GlobalConfig value of GlobalConfig.MAX_REMOVING_SERVICES
|
||||||
# : Note: this variable can be either a fixed value (integer, string) or a Gui text field (with a .value property)
|
# : Note: this variable can be either a fixed value (integer, string) or a Gui text field (with a .value property)
|
||||||
maxRemovingServices: typing.Any = None
|
maxRemovingServices: typing.Optional[typing.Union[int, gui.InputField]] = None
|
||||||
|
|
||||||
# : This defines if the limits (max.. vars) should be taken into accout or simply ignored
|
# : This defines if the limits (max.. vars) should be taken into accout or simply ignored
|
||||||
# : Default is return the GlobalConfig value of GlobalConfig.IGNORE_LIMITS
|
# : Default is return the GlobalConfig value of GlobalConfig.IGNORE_LIMITS
|
||||||
@ -179,7 +179,10 @@ class ServiceProvider(Module):
|
|||||||
if val is None:
|
if val is None:
|
||||||
val = self.maxPreparingServices = GlobalConfig.MAX_PREPARING_SERVICES.getInt(force=True) # Recover global an cache till restart
|
val = self.maxPreparingServices = GlobalConfig.MAX_PREPARING_SERVICES.getInt(force=True) # Recover global an cache till restart
|
||||||
|
|
||||||
retVal = int(getattr(val, 'value', val))
|
if isinstance(val, gui.InputField):
|
||||||
|
retVal = val.value
|
||||||
|
else:
|
||||||
|
retVal = val
|
||||||
return retVal if retVal > 0 else 1
|
return retVal if retVal > 0 else 1
|
||||||
|
|
||||||
def getMaxRemovingServices(self) -> int:
|
def getMaxRemovingServices(self) -> int:
|
||||||
@ -187,7 +190,10 @@ class ServiceProvider(Module):
|
|||||||
if val is None:
|
if val is None:
|
||||||
val = self.maxRemovingServices = GlobalConfig.MAX_REMOVING_SERVICES.getInt(force=True) # Recover global an cache till restart
|
val = self.maxRemovingServices = GlobalConfig.MAX_REMOVING_SERVICES.getInt(force=True) # Recover global an cache till restart
|
||||||
|
|
||||||
retVal = int(getattr(val, 'value', val))
|
if isinstance(val, gui.InputField):
|
||||||
|
retVal = val.value
|
||||||
|
else:
|
||||||
|
retVal = val
|
||||||
return retVal if retVal > 0 else 1
|
return retVal if retVal > 0 else 1
|
||||||
|
|
||||||
def getIgnoreLimits(self) -> bool:
|
def getIgnoreLimits(self) -> bool:
|
||||||
|
@ -229,7 +229,8 @@ class UserDeployment(Environmentable, Serializable): # pylint: disable=too-many
|
|||||||
"""
|
"""
|
||||||
Logs a message with requested level associated with this user deployment
|
Logs a message with requested level associated with this user deployment
|
||||||
"""
|
"""
|
||||||
log.doLog(self._dbService, level, message, log.SERVICE)
|
if self._dbService:
|
||||||
|
log.doLog(self._dbService, level, message, log.SERVICE)
|
||||||
|
|
||||||
def macGenerator(self) -> 'UniqueMacGenerator':
|
def macGenerator(self) -> 'UniqueMacGenerator':
|
||||||
"""
|
"""
|
||||||
@ -574,7 +575,7 @@ class UserDeployment(Environmentable, Serializable): # pylint: disable=too-many
|
|||||||
"""
|
"""
|
||||||
Helper to query if a class is custom (implements getJavascript method)
|
Helper to query if a class is custom (implements getJavascript method)
|
||||||
"""
|
"""
|
||||||
return cls.cancel != UserDeployment.cancel
|
return cls.cancel != UserDeployment.cancel # type: ignore
|
||||||
|
|
||||||
def reset(self) -> None:
|
def reset(self) -> None:
|
||||||
"""
|
"""
|
||||||
|
@ -428,8 +428,8 @@ class gui:
|
|||||||
|
|
||||||
def __init__(self, **options):
|
def __init__(self, **options):
|
||||||
super().__init__(**options)
|
super().__init__(**options)
|
||||||
self._data['minValue'] = int(options.get('minValue', '987654321'))
|
self._data['minValue'] = int(options.get('minValue', options.get('minvalue', '987654321')))
|
||||||
self._data['maxValue'] = int(options.get('maxValue', '987654321'))
|
self._data['maxValue'] = int(options.get('maxValue', options.get('maxvalue', '987654321')))
|
||||||
|
|
||||||
self._type(gui.InputField.NUMERIC_TYPE)
|
self._type(gui.InputField.NUMERIC_TYPE)
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ class UniqueIDGenerator:
|
|||||||
_owner: str
|
_owner: str
|
||||||
_baseName: str
|
_baseName: str
|
||||||
|
|
||||||
def __init__(self, typeName: str, owner: typing.Any, baseName: typing.Optional[str] = None):
|
def __init__(self, typeName: str, owner: str, baseName: typing.Optional[str] = None):
|
||||||
self._owner = owner + typeName
|
self._owner = owner + typeName
|
||||||
self._baseName = 'uds' if baseName is None else baseName
|
self._baseName = 'uds' if baseName is None else baseName
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user