| |
- builtins.Exception(builtins.BaseException)
-
- NotEnoughArguments
- builtins.ValueError(builtins.Exception)
-
- InvalidArgument
- builtins.float(builtins.object)
-
- BaseContinuousScale(builtins.float, CustomType)
- builtins.int(builtins.object)
-
- BaseDiscreteScale(builtins.int, CustomType)
-
- FixedEnumType
- builtins.object
-
- AdminCommand
- AdminCommandExecutor
-
- AdminCommandEWrapper
- AdminCommandExtension
- CustomType
-
- BaseContinuousScale(builtins.float, CustomType)
- BaseDiscreteScale(builtins.int, CustomType)
-
- FixedEnumType
- DateTimeType
- DateType
- DurationType
- TimeType
- FakeAsyncRawInput
class AdminCommand(builtins.object) |
|
AdminCommand(afunc, name: str, args: Sequence[Tuple[Union[str, int, float, bool, NoneType, admin_console.CustomType], str]], optargs: Sequence[Tuple[Union[str, int, float, bool, NoneType, admin_console.CustomType], str]], description: str = '', atabcomplete: Optional[Callable[[str], Coroutine[Any, Any, Any]]] = None)
Represents a console command.
To add a command of an extension, use AdminCommandExtension.add_command(
afunc, name, args, optargs, description) instead
Emits AdminCommandExecutor.cmdexec_event, AdminCommandExecutor.cmdtab_event |
|
Methods defined here:
- __init__(self, afunc, name: str, args: Sequence[Tuple[Union[str, int, float, bool, NoneType, admin_console.CustomType], str]], optargs: Sequence[Tuple[Union[str, int, float, bool, NoneType, admin_console.CustomType], str]], description: str = '', atabcomplete: Optional[Callable[[str], Coroutine[Any, Any, Any]]] = None)
- Parameters
----------
afunc : coroutine function
await afunc(AdminCommandExecutor, *args)
Coroutine function that represents the command functor and receives parsed arguments
name : str
Name of the command
args : list
[(type : type, name : str), ...]
List of the mandatory arguments of the command
Possible types are: str, int, float, bool, None
-------------------
str: a word or a "string"
int: valid number, 123
float: a number with floating point, 123.456
bool: switch argument, can be yes / no, true / false, y / n
None: raw string, such an argument could be only the last argument of the command
Cannot be used with at least 1 argument from optargs
-------------------
optargs : list
[(type : class, name : str), ...]
List of the optional arguments of the command
Types are described in args
description : str
Description of what this command does. Shows in help
atabcomplete : coroutine function
await atabcomplete(AdminCommandExecutor, *args)
Coroutine function that is called when a tab with the last incomplete or empty argument is specified
Must return None or a collection of suggested arguments
- async execute(self, executor, args: Sequence[object])
- Shouldn't be overriden, use afunc to assign a functor to the command
- async tab_complete(self, executor, args: Sequence[object], argl: str = '') -> Optional[MutableSequence[str]]
- Shouldn't be overriden, use atabcomplete to assign a tab complete handler
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class AdminCommandEWrapper(AdminCommandExecutor) |
|
AdminCommandEWrapper(*args, ace: admin_console.AdminCommandExecutor, **kwargs)
AdminCommandExecutor wrapper. It overlays all the functions from the AdminCommandExecutor, but anything could be replaced to change command behavior, like redirecting its output or providing a different way of IO.
It operates with an existing AdminCommandExecutor, if a special keyword argument is specified.
Usually it is passed into the command callback instead of the AdminCommandExecutor, like when a command output needs to be handled differently.
Useful for a remote console server, or GUI, where command output is sent to a remote client or is shown in a GUI.
A proper way to use it is to change its members, for example assigning a different AsyncRawInput or logger implementation.
WARNING: this is NOT a sandbox solution for the extensions! This class is used to execute commands in a different way |
|
- Method resolution order:
- AdminCommandEWrapper
- AdminCommandExecutor
- builtins.object
Methods defined here:
- __getattribute__(self, name: str, /)
- Return getattr(self, name).
- __init__(self, *args, ace: admin_console.AdminCommandExecutor, **kwargs)
- Parameters
----------
stuff : dict
Arbitrary data storage
use_config : bool
Whether or not a config.json file should be created or loaded in a working directory. Defaults to True
logger : logging.Logger
logging.Logger instance to handle all the log messages
extension_path : str
Relative or absolute path to the extensions directory. Defaults to "extensions/"
- __setattr__(self, name: str, value, /)
- Implement setattr(self, name, value).
- override(self, name: str, value)
- Change the member of the class, but apply it only for the wrapper, not the real command executor
For example, replace ainput with something else if the command needs to query input and show messages
in a different way, rather than doing this in the main console
Methods inherited from AdminCommandExecutor:
- add_command(self, afunc: Callable[[Any], Coroutine[Any, Any, Any]], name: str, args: Sequence[Tuple[Type, str]] = (), optargs: Sequence[Tuple[Type, str]] = (), description: str = '', atabcomplete: Optional[Callable[[Any], Coroutine[Any, Any, Any]]] = None) -> bool
- Constructs an AdminCommand instance with all the arguments passed.
Adds the command to the first layer of the chainmap
Emits cmdadd_event asynchronously.
Note
----
This function will be transformed into an async function in the future versions
Parameters
----------
see AdminCommand
Returns
-------
bool
Success
- async cmd_interruptor(self)
- Listens for Ctrl + C event during command execution.
Cancels the command execution task if Ctrl + C pressed.
- async dispatch(self, cmdline: str) -> bool
- Executes a command. Shouldn't be used explicitly with input(). Use prompt_loop() instead.
Parameters
----------
cmdline : str
A whole line representing a command
Returns
-------
bool
Success
- error(self, msg: str, log=True)
- Shows a red error message in the console and logs.
ERROR: msg
Parameters
----------
msg : str
Message
- async full_cleanup(self)
- Perform cleanup steps in AdminCommandExecutor.full_cleanup_steps
- info(self, msg: str)
- Shows a regular info message in the console and logs.
Parameters
----------
msg : str
Message
- interrupt_command(self)
- Cancels the command execution task.
Ctrl + C is replaced during any command being executed.
- load_config(self, path: str = 'config.json') -> bool
- Loads a configuration from a JSON file
Parameters
----------
path : str
Absolute or relative path to the config file. Defaults to "config.json"
Returns
-------
bool
Success
- async load_extension(self, name: str) -> bool
- Loads a Python script as an extension from its extension path and call await extension_init(AdminCommandExtension)
Emits extload_event.
Parameters
----------
name : str
The extensionless name of a file containing a Python script
Returns
-------
bool
Success
Note
----
Due to the Python's importlib limitation, extensions cannot "import" other extensions properly
and that way can't be implemented in any non-destructible way. Temporary modifying sys.modules
may cause interference between multiple ACE instances (possible name collisions in
sys.modules) and race conditions in multithreaded application.
The only way one extension can make use of another is through AdminCommandExecutor.extensions['name'].*
Extension objects must not be stored anywhere except by the AdminCommandExecutor owning it.
Otherwise the garbage collection won't work and the extension wouldn't unload properly.
Also, the Python module cannot be unloaded from the memory, in that particular case, the modules
are cached, and if the same extension loads again, its module is taken from the known_modules and
reloaded.
- async load_extensions(self)
- Loads extensions from an extension directory specified in AdminCommandExecutor.extpath
- log(self, msg: str, level=10)
- Shows a log message in the console and logs
Parameters
----------
msg : str
Message
level : int
Level of the log message between 0 and 50
- parse_args(self, argl: str, argtypes: Sequence[Tuple[Union[str, int, float, bool, NoneType, admin_console.CustomType], str]] = None, opt_argtypes: Sequence[Tuple[Union[str, int, float, bool, NoneType, admin_console.CustomType], str]] = None, *, raise_exc=True, saved_matches: Optional[MutableSequence[re.Match]] = None, until: Optional[int] = None) -> (<class 'list'>, <class 'str'>)
- Smart split the argument line and convert all the arguments to its types
Raises InvalidArgument(argname) if one of the arguments couldn't be converted
Raises NotEnoughArguments(len(args)) if there isn't enough arguments provided
Parameters
----------
argl : str
Argument line with raw space-separated arguments
argtypes : list
Any collection containing a tuples (type, name) representing an argument name and type
The arguments that are listed in there are mandatory.
opt_argtypes : list
Same as argtypes, but those arguments are parsed after mandatory and are optional.
Doesn't cause NotEnoughArguments to be raise if there is not enough optional arguments
Keyword-only parameters:
raise_exc : bool
Whether or not exceptions are raised. If False, data is returned as it is
saved_matches : list
If specified, the parser will append the re.Match objects for each argument
to this list except the last NoneType argument (if present in args),
which does not have any boundaries
until : int
If specified, will stop parsing arguments when passed more than n symbols.
Useful when passing sliced string isn't good due to storing argument boundaries
in saved_matches.
Returns
-------
list, str
A list of converted arguments and the remnant
If remnant isn't an empty string, then there is probably too many arguments provided
- print(self, *value, sep=' ', end='\n')
- Prints a message in the console, preserving the prompt and user input, if any
Partially copies the Python print() command
- async prompt_loop(self)
- Asynchronously prompt for commands and dispatch them
Blocks asynchronously until the prompt is closed.
Prefer launching in asyncio.Task wrapper.
- remove_command(self, name: str)
- Permanently removes the command from the chainmap.
Emits cmdrm_event asynchronously.
Note
----
This function will be transformed into an async function in the future versions
Parameters
----------
name : str
name of the command
Returns
-------
bool
Success
- save_config(self, path: str = 'config.json') -> bool
- Saves a configuration into a JSON file
Parameters
----------
path : str
Absolute or relative path to the config file. Defaults to "config.json"
Returns
-------
bool
Success
- spawn_interruptor(self)
- Spawn a listener for command cancellation keystroke.
Useful when a command executes for an indefinite time and
lets the user to bring back the prompt in emergency cases
New in version 1.4.2
- async unload_extension(self, name: str, keep_dict=False) -> bool
- Unload an extension and call await extension_cleanup(AdminCommandExtension)
Emits extunload_event.
Parameters
----------
name : str
The name of an extension
keep_dict : bool
DEPRECATED: ignored in version 1.1.0
Whether or not this extension should be kept in the list. Defaults to False
Returns
-------
bool
Success
Note
----
Due to a Python limitation, it is impossible to unload a module from memory, but
its possible to reload them with importlib.reload()
- usage(self, cmdname: str, lang=True) -> str
- Get a formatted usage string for the command
Raises KeyError if the command doesn't exist.
Parameters
----------
cmdname : str
Name of the command
lang : bool
Whether or not returned string should be formatted through lang['usage']
Returns
-------
str
Formatted string representing a usage of the command
Data descriptors inherited from AdminCommandExecutor:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class AdminCommandExecutor(builtins.object) |
|
AdminCommandExecutor(stuff: Optional[Mapping] = None, use_config=True, logger: logging.Logger = None, extension_path='extensions/', backend: Optional[admin_console.ainput.AsyncRawInput] = None)
This is the main class of the library. It handles command execution and extension load/unload
Firstly, an extensions should be loaded before prompting for commands.
ace = AdminCommandExecutor()
await ace.load_extensions()
Launching a prompt. Waits until exit command is invoked.
await ace.prompt_loop()
Perform a cleanup
await ace.full_cleanup()
Members
-------
AdminCommandExecutor.stuff : dict
Arbitrary data storage. Can be used to share data between extensions
AdminCommandExecutor.commands : collections.ChainMap
dictionary of a commands and its overrides (extension commands)
{"name": AdminCommand}, {"extensioncmd": AdminCommand}, ....
AdminCommandExecutor.lang : dict
dictionary of formattable strings
{
'nocmd': '{0}: unknown command',
'usage': 'Usage: {0}',
'invalidarg': '{0} is invalid, check your command arguments.',
'toomanyargs': 'warning: this command receives {0} arguments, you provided {1} or more',
'notenoughargs': 'not enough arguments: the command receives {0} arguments, you provided {1}.'
}
AdminCommandExecutor.types : dict
dictionary of typenames
{
str: 'word',
int: 'n',
float: 'n.n',
bool: 'yes / no',
None: 'text...'
}
AdminCommandExecutor.extpath : str
self.prompt_dispatching : bool = True
Set this variable to False to stop prompt_loop() after a command dispatch
self.promptheader : str
Command prompt header. Defaults to 'nothing'
self.promptarrow : str
Command prompt arrow. Defaults to '>'
Command prompt header and arrow are combined into a prompt
self.history : list
Last executed commands, can be cycled with an arrow keys.
self.ainput : AsyncRawInput(history=self.history)
AsyncRawInput class for reading user input in raw tty mode
self.ainput.ctrl_c = self.full_cleanup
Async function for handling Ctrl + C
self.disabledCmd : AdminCommand
AdminCommand that alerts the user that this command is disabled by the system
Used by AdminCommandExtension.remove_command(name)
self.prompt_format = {'bold': True, 'fgcolor': colors.GREEN}
Formatting of the prompt header and arrow.
self.input_format = {'fgcolor': 10}
Formatting of the user input in terminal
self.tab_complete_lastinp = ''
Contains last input on last tabcomplete call
self.tab_complete_seq = tuple()
Contains last argument suggestions on tab complete call
self.tab_complete_id = 0
Contains currently cycled element ID in self.tab_complete_seq
Events
self.events : collections.defaultdict(AIOHandlerChain)
Main pool of events. Can be used to store custom events.
self.tab_event : AIOHandlerChain
Arguments: (executor: Union[AdminCommandExecutor, AdminCommandEWrapper], suggestions: MutableSequence[str])
Emits when user hits the TAB key without full command. Cancellable
Event handlers must modify the suggestions list if needed. Otherwise, if event emission fails,
this list is cleared and no results are shown
self.cmdexec_event : AIOHandlerChain
Arguments: (cmd: AdminCommand, executor: Union[AdminCommandExecutor, AdminCommandEWrapper], args: Sequence[Any])
Emits when a command is executed through specific executor and with parsed arguments. Cancellable.
self.cmdtab_event : AIOHandlerChain
Arguments: (cmd: AdminCommand, executor: Union[AdminCommandExecutor, AdminCommandEWrapper], args: Sequence[Any], *, argl: str = "")
Keyword arguments are received from handlers: {'override': Sequence[str]}
Emits when TAB key is pressed with this command. Arguments are parsed until the text cursor.
Cancellable. Set 'override' in keyword argument dictionary to explicitly set the list of suggested strings.
self.cmdadd_event : AIOHandlerChain
Arguments: (name: str, args: Sequence[(Type, name)], optargs: Sequence[(Type, name)], description: str)
Emits when an extension adds the command or self.add_command is called. Emits asynchronously since AdminCommandExtension.add_command is not async. Not cancellable.
self.cmdrm_event : AIOHandlerChain
Arguments: (name: str)
Emits when an extension removes the command or self.remove_command is called. Emits asynchronously since AdminCommandExtension.remove_command is not async. Not cancellable.
self.extload_event : AIOHandlerChain
Arguments: (name: str)
Emits when an extension is loading. Cancellable.
self.extunload_event : AIOHandlerChain
Arguments: (name: str)
Emits when an extension is unloading. Cancellable.
Others:
self.print = self.ainput.writeln
self.logger = logger |
|
Methods defined here:
- __init__(self, stuff: Optional[Mapping] = None, use_config=True, logger: logging.Logger = None, extension_path='extensions/', backend: Optional[admin_console.ainput.AsyncRawInput] = None)
- Parameters
----------
stuff : dict
Arbitrary data storage
use_config : bool
Whether or not a config.json file should be created or loaded in a working directory. Defaults to True
logger : logging.Logger
logging.Logger instance to handle all the log messages
extension_path : str
Relative or absolute path to the extensions directory. Defaults to "extensions/"
- add_command(self, afunc: Callable[[Any], Coroutine[Any, Any, Any]], name: str, args: Sequence[Tuple[Type, str]] = (), optargs: Sequence[Tuple[Type, str]] = (), description: str = '', atabcomplete: Optional[Callable[[Any], Coroutine[Any, Any, Any]]] = None) -> bool
- Constructs an AdminCommand instance with all the arguments passed.
Adds the command to the first layer of the chainmap
Emits cmdadd_event asynchronously.
Note
----
This function will be transformed into an async function in the future versions
Parameters
----------
see AdminCommand
Returns
-------
bool
Success
- async cmd_interruptor(self)
- Listens for Ctrl + C event during command execution.
Cancels the command execution task if Ctrl + C pressed.
- async dispatch(self, cmdline: str) -> bool
- Executes a command. Shouldn't be used explicitly with input(). Use prompt_loop() instead.
Parameters
----------
cmdline : str
A whole line representing a command
Returns
-------
bool
Success
- error(self, msg: str, log=True)
- Shows a red error message in the console and logs.
ERROR: msg
Parameters
----------
msg : str
Message
- async full_cleanup(self)
- Perform cleanup steps in AdminCommandExecutor.full_cleanup_steps
- info(self, msg: str)
- Shows a regular info message in the console and logs.
Parameters
----------
msg : str
Message
- interrupt_command(self)
- Cancels the command execution task.
Ctrl + C is replaced during any command being executed.
- load_config(self, path: str = 'config.json') -> bool
- Loads a configuration from a JSON file
Parameters
----------
path : str
Absolute or relative path to the config file. Defaults to "config.json"
Returns
-------
bool
Success
- async load_extension(self, name: str) -> bool
- Loads a Python script as an extension from its extension path and call await extension_init(AdminCommandExtension)
Emits extload_event.
Parameters
----------
name : str
The extensionless name of a file containing a Python script
Returns
-------
bool
Success
Note
----
Due to the Python's importlib limitation, extensions cannot "import" other extensions properly
and that way can't be implemented in any non-destructible way. Temporary modifying sys.modules
may cause interference between multiple ACE instances (possible name collisions in
sys.modules) and race conditions in multithreaded application.
The only way one extension can make use of another is through AdminCommandExecutor.extensions['name'].*
Extension objects must not be stored anywhere except by the AdminCommandExecutor owning it.
Otherwise the garbage collection won't work and the extension wouldn't unload properly.
Also, the Python module cannot be unloaded from the memory, in that particular case, the modules
are cached, and if the same extension loads again, its module is taken from the known_modules and
reloaded.
- async load_extensions(self)
- Loads extensions from an extension directory specified in AdminCommandExecutor.extpath
- log(self, msg: str, level=10)
- Shows a log message in the console and logs
Parameters
----------
msg : str
Message
level : int
Level of the log message between 0 and 50
- parse_args(self, argl: str, argtypes: Sequence[Tuple[Union[str, int, float, bool, NoneType, admin_console.CustomType], str]] = None, opt_argtypes: Sequence[Tuple[Union[str, int, float, bool, NoneType, admin_console.CustomType], str]] = None, *, raise_exc=True, saved_matches: Optional[MutableSequence[re.Match]] = None, until: Optional[int] = None) -> (<class 'list'>, <class 'str'>)
- Smart split the argument line and convert all the arguments to its types
Raises InvalidArgument(argname) if one of the arguments couldn't be converted
Raises NotEnoughArguments(len(args)) if there isn't enough arguments provided
Parameters
----------
argl : str
Argument line with raw space-separated arguments
argtypes : list
Any collection containing a tuples (type, name) representing an argument name and type
The arguments that are listed in there are mandatory.
opt_argtypes : list
Same as argtypes, but those arguments are parsed after mandatory and are optional.
Doesn't cause NotEnoughArguments to be raise if there is not enough optional arguments
Keyword-only parameters:
raise_exc : bool
Whether or not exceptions are raised. If False, data is returned as it is
saved_matches : list
If specified, the parser will append the re.Match objects for each argument
to this list except the last NoneType argument (if present in args),
which does not have any boundaries
until : int
If specified, will stop parsing arguments when passed more than n symbols.
Useful when passing sliced string isn't good due to storing argument boundaries
in saved_matches.
Returns
-------
list, str
A list of converted arguments and the remnant
If remnant isn't an empty string, then there is probably too many arguments provided
- print(self, *value, sep=' ', end='\n')
- Prints a message in the console, preserving the prompt and user input, if any
Partially copies the Python print() command
- async prompt_loop(self)
- Asynchronously prompt for commands and dispatch them
Blocks asynchronously until the prompt is closed.
Prefer launching in asyncio.Task wrapper.
- remove_command(self, name: str)
- Permanently removes the command from the chainmap.
Emits cmdrm_event asynchronously.
Note
----
This function will be transformed into an async function in the future versions
Parameters
----------
name : str
name of the command
Returns
-------
bool
Success
- save_config(self, path: str = 'config.json') -> bool
- Saves a configuration into a JSON file
Parameters
----------
path : str
Absolute or relative path to the config file. Defaults to "config.json"
Returns
-------
bool
Success
- spawn_interruptor(self)
- Spawn a listener for command cancellation keystroke.
Useful when a command executes for an indefinite time and
lets the user to bring back the prompt in emergency cases
New in version 1.4.2
- async unload_extension(self, name: str, keep_dict=False) -> bool
- Unload an extension and call await extension_cleanup(AdminCommandExtension)
Emits extunload_event.
Parameters
----------
name : str
The name of an extension
keep_dict : bool
DEPRECATED: ignored in version 1.1.0
Whether or not this extension should be kept in the list. Defaults to False
Returns
-------
bool
Success
Note
----
Due to a Python limitation, it is impossible to unload a module from memory, but
its possible to reload them with importlib.reload()
- usage(self, cmdname: str, lang=True) -> str
- Get a formatted usage string for the command
Raises KeyError if the command doesn't exist.
Parameters
----------
cmdname : str
Name of the command
lang : bool
Whether or not returned string should be formatted through lang['usage']
Returns
-------
str
Formatted string representing a usage of the command
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class AdminCommandExtension(builtins.object) |
|
AdminCommandExtension(ACE, name: str, module: module, logger: logging.Logger = <Logger main (WARNING)>)
Extension data class. Constructed by AdminCommandExecutor.
In extension scripts the instance is passed into:
async def extension_init(AdminCommandExtension)
called when an extension is loaded
async def extension_cleanup(AdminCommandExtension)
called when an extension is unloaded |
|
Methods defined here:
- __init__(self, ACE, name: str, module: module, logger: logging.Logger = <Logger main (WARNING)>)
- Parameters
----------
ACE : AdminCommandExecutor
instance of the AdminCommandExecutor class holding this extension.
name : str
name of the extension or extensionless filename of the extension
module : types.ModuleType
Python importlib module of the extension
logger : logging.Logger
logging.Logger instance attached to an extension
- add_command(self, afunc: Callable[[Any], Coroutine[Any, Any, Any]], name: str, args: Sequence[Tuple[Union[str, int, float, bool, NoneType, admin_console.CustomType], str]] = (), optargs: Sequence[Tuple[Union[str, int, float, bool, NoneType, admin_console.CustomType], str]] = (), description: str = '', atabcomplete: Optional[Callable[[str], Coroutine[Any, Any, Any]]] = None, replace=False) -> bool
- Registers a command and adds it to the AdminCommandExecutor.
Constructs an AdminCommand instance with all the arguments passed.
Doesn't require sync_local_commands() to be run
Note
----
This function will be transformed into an async function in the future versions
Parameters
----------
see AdminCommand
replace : bool
Whether or not the command should be replaced if already exists. Defaults to False
Returns
-------
bool
Success
- clear_commands(self) -> bool
- Clear all the commands registered by this extension
Returns
-------
bool
Success
- logmsg(self, msg: str, level: int = 20)
- Write a message into the log
- msg(self, msg: str)
- Show message in the console with the extension prefix
- remove_command(self, name: str, remove_native=False) -> bool
- Unregisters a command from the AdminCommandExtension and/or from an AdminCommandExecutor
If remove_native is True, it doesn't check whether or not this command is owned by this extension
Parameters
----------
remove_native : bool
If False, delete only if this command is owned by self
Assign a command to AdminCommandExecutor.disabledCmd in case of it already existing
Returns
-------
bool
Success
- sync_local_commands(self, overwrite=False) -> bool
- DEPRECATED: since version 1.1.0 admin_console uses collections.ChainMap for command overrides
Adds all the extension commands into AdminCommandExecutor commands list
Parameters
----------
overwrite : bool
If True, already existing commands will be replaced
If False, fails in case when any of the extension commands are overlapping with already existing.
Returns
-------
bool
Success
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class BaseContinuousScale(builtins.float, CustomType) |
|
BaseContinuousScale(value, /, *args, **kwargs)
Base class for defining types that are based on float, but has boundaries
Unlike BaseDiscreteScale, this type doesn't have _step attribute as it is continuous. |
|
- Method resolution order:
- BaseContinuousScale
- builtins.float
- CustomType
- builtins.object
Methods defined here:
- __init__(self, value, /, *args, **kwargs)
- Initialize self. See help(type(self)) for accurate signature.
- getValue(self) -> float
- Obtain a value from this type wrapper
Class methods defined here:
- getMax() -> float from builtins.type
- Returns the highest point of a scale
- getMin() -> float from builtins.type
- Returns the lowest point of a scale
- getTypeName(ace) -> str from builtins.type
- Obtain a name for this type that is used in command usage
Name is obtained from AdminCommandExecutor.lang first, then from
self._typename if not found in former
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Methods inherited from builtins.float:
- __abs__(self, /)
- abs(self)
- __add__(self, value, /)
- Return self+value.
- __bool__(self, /)
- True if self else False
- __ceil__(self, /)
- Return the ceiling as an Integral.
- __divmod__(self, value, /)
- Return divmod(self, value).
- __eq__(self, value, /)
- Return self==value.
- __float__(self, /)
- float(self)
- __floor__(self, /)
- Return the floor as an Integral.
- __floordiv__(self, value, /)
- Return self//value.
- __format__(self, format_spec, /)
- Formats the float according to format_spec.
- __ge__(self, value, /)
- Return self>=value.
- __getattribute__(self, name, /)
- Return getattr(self, name).
- __getnewargs__(self, /)
- __gt__(self, value, /)
- Return self>value.
- __hash__(self, /)
- Return hash(self).
- __int__(self, /)
- int(self)
- __le__(self, value, /)
- Return self<=value.
- __lt__(self, value, /)
- Return self<value.
- __mod__(self, value, /)
- Return self%value.
- __mul__(self, value, /)
- Return self*value.
- __ne__(self, value, /)
- Return self!=value.
- __neg__(self, /)
- -self
- __pos__(self, /)
- +self
- __pow__(self, value, mod=None, /)
- Return pow(self, value, mod).
- __radd__(self, value, /)
- Return value+self.
- __rdivmod__(self, value, /)
- Return divmod(value, self).
- __repr__(self, /)
- Return repr(self).
- __rfloordiv__(self, value, /)
- Return value//self.
- __rmod__(self, value, /)
- Return value%self.
- __rmul__(self, value, /)
- Return value*self.
- __round__(self, ndigits=None, /)
- Return the Integral closest to x, rounding half toward even.
When an argument is passed, work like built-in round(x, ndigits).
- __rpow__(self, value, mod=None, /)
- Return pow(value, self, mod).
- __rsub__(self, value, /)
- Return value-self.
- __rtruediv__(self, value, /)
- Return value/self.
- __sub__(self, value, /)
- Return self-value.
- __truediv__(self, value, /)
- Return self/value.
- __trunc__(self, /)
- Return the Integral closest to x between 0 and x.
- as_integer_ratio(self, /)
- Return integer ratio.
Return a pair of integers, whose ratio is exactly equal to the original float
and with a positive denominator.
Raise OverflowError on infinities and a ValueError on NaNs.
>>> (10.0).as_integer_ratio()
(10, 1)
>>> (0.0).as_integer_ratio()
(0, 1)
>>> (-.25).as_integer_ratio()
(-1, 4)
- conjugate(self, /)
- Return self, the complex conjugate of any float.
- hex(self, /)
- Return a hexadecimal representation of a floating-point number.
>>> (-0.1).hex()
'-0x1.999999999999ap-4'
>>> 3.14159.hex()
'0x1.921f9f01b866ep+1'
- is_integer(self, /)
- Return True if the float is an integer.
Class methods inherited from builtins.float:
- __getformat__(typestr, /) from builtins.type
- You probably don't want to use this function.
typestr
Must be 'double' or 'float'.
It exists mainly to be used in Python's test suite.
This function returns whichever of 'unknown', 'IEEE, big-endian' or 'IEEE,
little-endian' best describes the format of floating point numbers used by the
C type named by typestr.
- __setformat__(typestr, fmt, /) from builtins.type
- You probably don't want to use this function.
typestr
Must be 'double' or 'float'.
fmt
Must be one of 'unknown', 'IEEE, big-endian' or 'IEEE, little-endian',
and in addition can only be one of the latter two if it appears to
match the underlying C reality.
It exists mainly to be used in Python's test suite.
Override the automatic determination of C-level floating point type.
This affects how floats are converted to and from binary strings.
- fromhex(string, /) from builtins.type
- Create a floating-point number from a hexadecimal string.
>>> float.fromhex('0x1.ffffp10')
2047.984375
>>> float.fromhex('-0x1p-1074')
-5e-324
Static methods inherited from builtins.float:
- __new__(*args, **kwargs) from builtins.type
- Create and return a new object. See help(type) for accurate signature.
Data descriptors inherited from builtins.float:
- imag
- the imaginary part of a complex number
- real
- the real part of a complex number
Methods inherited from CustomType:
- __str__(self)
- Return str(self).
- getRawValue(self) -> str
- Obtain source value that this object is initialized from
- serialize(self) -> Union[str, int, float, bool, NoneType]
- Obtain primitive value representing this object
Can be async
Class methods inherited from CustomType:
- deserialize(data) from builtins.type
- Construct an object from this raw data
- tabComplete(value: Optional[str] = None) -> MutableSequence[str] from builtins.type
- Returns a list containing all available items from a starting value
Can be async
|
class BaseDiscreteScale(builtins.int, CustomType) |
|
BaseDiscreteScale(value, /, *args, **kwargs)
Base class for defining discrete scale types. An inheritor must either implement getMin, getMax, getStep methods or
set self._min, self._max and self._step variables accordingly.
Default value for _step is 1 |
|
- Method resolution order:
- BaseDiscreteScale
- builtins.int
- CustomType
- builtins.object
Methods defined here:
- __init__(self, value, /, *args, **kwargs)
- Initialize self. See help(type(self)) for accurate signature.
- getValue(self) -> int
- Obtain a value from this type wrapper
Class methods defined here:
- getMax() -> int from builtins.type
- Returns the highest point of a scale
- getMin() -> int from builtins.type
- Returns the lowest point of a scale
- getStep() -> int from builtins.type
- Returns the distance between each elements
- getTypeName(cmd) -> str from builtins.type
- Obtain a name for this type that is used in command usage
Name is obtained from AdminCommandExecutor.lang first, then from
self._typename if not found in former
- tabComplete(value: Optional[str] = None) from builtins.type
- Returns a list containing all available items from a starting value
Can be async
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
Methods inherited from builtins.int:
- __abs__(self, /)
- abs(self)
- __add__(self, value, /)
- Return self+value.
- __and__(self, value, /)
- Return self&value.
- __bool__(self, /)
- True if self else False
- __ceil__(...)
- Ceiling of an Integral returns itself.
- __divmod__(self, value, /)
- Return divmod(self, value).
- __eq__(self, value, /)
- Return self==value.
- __float__(self, /)
- float(self)
- __floor__(...)
- Flooring an Integral returns itself.
- __floordiv__(self, value, /)
- Return self//value.
- __format__(self, format_spec, /)
- Default object formatter.
- __ge__(self, value, /)
- Return self>=value.
- __getattribute__(self, name, /)
- Return getattr(self, name).
- __getnewargs__(self, /)
- __gt__(self, value, /)
- Return self>value.
- __hash__(self, /)
- Return hash(self).
- __index__(self, /)
- Return self converted to an integer, if self is suitable for use as an index into a list.
- __int__(self, /)
- int(self)
- __invert__(self, /)
- ~self
- __le__(self, value, /)
- Return self<=value.
- __lshift__(self, value, /)
- Return self<<value.
- __lt__(self, value, /)
- Return self<value.
- __mod__(self, value, /)
- Return self%value.
- __mul__(self, value, /)
- Return self*value.
- __ne__(self, value, /)
- Return self!=value.
- __neg__(self, /)
- -self
- __or__(self, value, /)
- Return self|value.
- __pos__(self, /)
- +self
- __pow__(self, value, mod=None, /)
- Return pow(self, value, mod).
- __radd__(self, value, /)
- Return value+self.
- __rand__(self, value, /)
- Return value&self.
- __rdivmod__(self, value, /)
- Return divmod(value, self).
- __repr__(self, /)
- Return repr(self).
- __rfloordiv__(self, value, /)
- Return value//self.
- __rlshift__(self, value, /)
- Return value<<self.
- __rmod__(self, value, /)
- Return value%self.
- __rmul__(self, value, /)
- Return value*self.
- __ror__(self, value, /)
- Return value|self.
- __round__(...)
- Rounding an Integral returns itself.
Rounding with an ndigits argument also returns an integer.
- __rpow__(self, value, mod=None, /)
- Return pow(value, self, mod).
- __rrshift__(self, value, /)
- Return value>>self.
- __rshift__(self, value, /)
- Return self>>value.
- __rsub__(self, value, /)
- Return value-self.
- __rtruediv__(self, value, /)
- Return value/self.
- __rxor__(self, value, /)
- Return value^self.
- __sizeof__(self, /)
- Returns size in memory, in bytes.
- __sub__(self, value, /)
- Return self-value.
- __truediv__(self, value, /)
- Return self/value.
- __trunc__(...)
- Truncating an Integral returns itself.
- __xor__(self, value, /)
- Return self^value.
- as_integer_ratio(self, /)
- Return integer ratio.
Return a pair of integers, whose ratio is exactly equal to the original int
and with a positive denominator.
>>> (10).as_integer_ratio()
(10, 1)
>>> (-10).as_integer_ratio()
(-10, 1)
>>> (0).as_integer_ratio()
(0, 1)
- bit_count(self, /)
- Number of ones in the binary representation of the absolute value of self.
Also known as the population count.
>>> bin(13)
'0b1101'
>>> (13).bit_count()
3
- bit_length(self, /)
- Number of bits necessary to represent self in binary.
>>> bin(37)
'0b100101'
>>> (37).bit_length()
6
- conjugate(...)
- Returns self, the complex conjugate of any int.
- to_bytes(self, /, length, byteorder, *, signed=False)
- Return an array of bytes representing an integer.
length
Length of bytes object to use. An OverflowError is raised if the
integer is not representable with the given number of bytes.
byteorder
The byte order used to represent the integer. If byteorder is 'big',
the most significant byte is at the beginning of the byte array. If
byteorder is 'little', the most significant byte is at the end of the
byte array. To request the native byte order of the host system, use
`sys.byteorder' as the byte order value.
signed
Determines whether two's complement is used to represent the integer.
If signed is False and a negative integer is given, an OverflowError
is raised.
Class methods inherited from builtins.int:
- from_bytes(bytes, byteorder, *, signed=False) from builtins.type
- Return the integer represented by the given array of bytes.
bytes
Holds the array of bytes to convert. The argument must either
support the buffer protocol or be an iterable object producing bytes.
Bytes and bytearray are examples of built-in objects that support the
buffer protocol.
byteorder
The byte order used to represent the integer. If byteorder is 'big',
the most significant byte is at the beginning of the byte array. If
byteorder is 'little', the most significant byte is at the end of the
byte array. To request the native byte order of the host system, use
`sys.byteorder' as the byte order value.
signed
Indicates whether two's complement is used to represent the integer.
Static methods inherited from builtins.int:
- __new__(*args, **kwargs) from builtins.type
- Create and return a new object. See help(type) for accurate signature.
Data descriptors inherited from builtins.int:
- denominator
- the denominator of a rational number in lowest terms
- imag
- the imaginary part of a complex number
- numerator
- the numerator of a rational number in lowest terms
- real
- the real part of a complex number
Methods inherited from CustomType:
- __str__(self)
- Return str(self).
- getRawValue(self) -> str
- Obtain source value that this object is initialized from
- serialize(self) -> Union[str, int, float, bool, NoneType]
- Obtain primitive value representing this object
Can be async
Class methods inherited from CustomType:
- deserialize(data) from builtins.type
- Construct an object from this raw data
Data descriptors inherited from CustomType:
- __weakref__
- list of weak references to the object (if defined)
|
class CustomType(builtins.object) |
|
Base class inherited by all custom types for commands. Has only one predefined method that all derivative types must have: getValue() |
|
Methods defined here:
- __str__(self)
- Return str(self).
- getRawValue(self) -> str
- Obtain source value that this object is initialized from
- getValue(self)
- Obtain a value from this type wrapper
- serialize(self) -> Union[str, int, float, bool, NoneType]
- Obtain primitive value representing this object
Can be async
Class methods defined here:
- deserialize(data) from builtins.type
- Construct an object from this raw data
- getTypeName(ace) -> str from builtins.type
- Obtain a name for this type that is used in command usage
Name is obtained from AdminCommandExecutor.lang first, then from
self._typename if not found in former
- tabComplete(value: Optional[str] = None) -> MutableSequence[str] from builtins.type
- Returns a list containing all available items from a starting value
Can be async
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class DateTimeType(CustomType) |
|
DateTimeType(value: Optional[str] = None, *, raise_exc=True, from_datetime: Optional[datetime.datetime] = None)
|
|
- Method resolution order:
- DateTimeType
- CustomType
- builtins.object
Methods defined here:
- __init__(self, value: Optional[str] = None, *, raise_exc=True, from_datetime: Optional[datetime.datetime] = None)
- Initialize self. See help(type(self)) for accurate signature.
- serialize(self)
- Obtain primitive value representing this object
Can be async
Class methods defined here:
- deserialize(timestamp: int) from builtins.type
- Construct an object from this raw data
- parse(value: str, *, raise_exc=True) from builtins.type
- tabComplete(value: str) from builtins.type
- Returns a list containing all available items from a starting value
Can be async
Data and other attributes defined here:
- datetime_expr = re.compile('(?:(?P<year>\\d{4})(?P<date_delimite...limiter>[:.\\-_ ])(?P<minute>\\d{1,2})(?:(?P=tim)
- datetime_reverse_expr = '%Y/%m/%d_%H:%M:%S'
Methods inherited from CustomType:
- __str__(self)
- Return str(self).
- getRawValue(self) -> str
- Obtain source value that this object is initialized from
- getValue(self)
- Obtain a value from this type wrapper
Class methods inherited from CustomType:
- getTypeName(ace) -> str from builtins.type
- Obtain a name for this type that is used in command usage
Name is obtained from AdminCommandExecutor.lang first, then from
self._typename if not found in former
Data descriptors inherited from CustomType:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class DateType(CustomType) |
|
DateType(value: Optional[str] = None, *, raise_exc=True, from_date: Optional[datetime.date] = None)
|
|
- Method resolution order:
- DateType
- CustomType
- builtins.object
Methods defined here:
- __init__(self, value: Optional[str] = None, *, raise_exc=True, from_date: Optional[datetime.date] = None)
- Initialize self. See help(type(self)) for accurate signature.
Class methods defined here:
- parse(value: str, *, raise_exc=True) from builtins.type
- tabComplete(value: str) from builtins.type
- Returns a list containing all available items from a starting value
Can be async
Data and other attributes defined here:
- date_expr = re.compile('(?P<year>\\d{4})(?P<date_delimiter>[...h>\\d{1,2})(?P=date_delimiter)(?P<day>\\d{1,2})')
- date_reverse_expr = '%Y/%m/%d'
Methods inherited from CustomType:
- __str__(self)
- Return str(self).
- getRawValue(self) -> str
- Obtain source value that this object is initialized from
- getValue(self)
- Obtain a value from this type wrapper
- serialize(self) -> Union[str, int, float, bool, NoneType]
- Obtain primitive value representing this object
Can be async
Class methods inherited from CustomType:
- deserialize(data) from builtins.type
- Construct an object from this raw data
- getTypeName(ace) -> str from builtins.type
- Obtain a name for this type that is used in command usage
Name is obtained from AdminCommandExecutor.lang first, then from
self._typename if not found in former
Data descriptors inherited from CustomType:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class DurationType(CustomType) |
|
DurationType(value: Optional[str] = None, *, raise_exc=True, from_timedelta: datetime.timedelta = None)
|
|
- Method resolution order:
- DurationType
- CustomType
- builtins.object
Methods defined here:
- __init__(self, value: Optional[str] = None, *, raise_exc=True, from_timedelta: datetime.timedelta = None)
- Initialize self. See help(type(self)) for accurate signature.
- serialize(self)
- Obtain primitive value representing this object
Can be async
Class methods defined here:
- deserialize(usec: int) from builtins.type
- Construct an object from this raw data
- parse(value: str, *, raise_exc=True) from builtins.type
Data and other attributes defined here:
- duration_expr = re.compile('(?:(?P<yrs>\\d+) *y(?:(?:ea)?r)?s?)?...| *and)? *(?:(?P<ds>\\d+) *d(?:ay)?s?)?(?:[.,]| )
Methods inherited from CustomType:
- __str__(self)
- Return str(self).
- getRawValue(self) -> str
- Obtain source value that this object is initialized from
- getValue(self)
- Obtain a value from this type wrapper
Class methods inherited from CustomType:
- getTypeName(ace) -> str from builtins.type
- Obtain a name for this type that is used in command usage
Name is obtained from AdminCommandExecutor.lang first, then from
self._typename if not found in former
- tabComplete(value: Optional[str] = None) -> MutableSequence[str] from builtins.type
- Returns a list containing all available items from a starting value
Can be async
Data descriptors inherited from CustomType:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class FakeAsyncRawInput(builtins.object) |
|
FakeAsyncRawInput(ace: admin_console.AdminCommandExecutor, *args, **kwargs)
A helper class for emulating real user input. Used to pipe the IO through custom ways.
Doesn't handle any ANSI escape codes at all. Just lets the data go through
Works best with AdminCommandEWrapper.
See ainput.AsyncRawInput for more info |
|
Methods defined here:
- __del__(self)
- __init__(self, ace: admin_console.AdminCommandExecutor, *args, **kwargs)
- Initialize self. See help(type(self)) for accurate signature.
- add_keystroke(self, keystroke: str, awaitable)
- Add a key press event
- end(self)
- Do something after IO
- prepare(self)
- Do something before handling IO
- prompt_keystroke(self, prompt='', echo=True)
- Ask a user to press a key
- prompt_line(self, prompt='', echo=True, history_disabled=False, prompt_formats: Optional[MutableMapping] = None, input_formats: Optional[MutableMapping] = None)
- Ask a user for input
- redraw_lastinp(self, at: int)
- remove_keystroke(self, keystroke: str)
- Remove key press event
- set_interrupt_handler(self, awaitable)
- Ctrl + C event in the real terminal. Useless here
- write(self, msg: str, **formats)
- Send raw data without end of line
- writeln(self, msg: str, **formats)
- Send a formatted message line with EOL
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class FixedEnumType(BaseDiscreteScale) |
|
FixedEnumType(value: Optional[str] = None, *args, from_instance: Optional[enum.IntEnum] = None, start_at: int = 0, **kwargs)
Base class for defining a discrete scale of constant certain objects (e.g. words, literal phrases)
This class must be subclassed with cls._enum of type IntEnum, An enum must be ordered and start from 0.
If an enum starts from a number other than 0, specify keyword start_at with
super().__init__(self, value: str, *args, start_at=N) |
|
- Method resolution order:
- FixedEnumType
- BaseDiscreteScale
- builtins.int
- CustomType
- builtins.object
Methods defined here:
- __init__(self, value: Optional[str] = None, *args, from_instance: Optional[enum.IntEnum] = None, start_at: int = 0, **kwargs)
- Initialize self. See help(type(self)) for accurate signature.
- getEnum(self)
- Returns an underlying Enum instance
- getRawValue(self)
- Obtain source value that this object is initialized from
Class methods defined here:
- tabComplete(value: str) from builtins.type
- Returns a list containing all available items from a starting value
Can be async
Methods inherited from BaseDiscreteScale:
- getValue(self) -> int
- Obtain a value from this type wrapper
Class methods inherited from BaseDiscreteScale:
- getMax() -> int from builtins.type
- Returns the highest point of a scale
- getMin() -> int from builtins.type
- Returns the lowest point of a scale
- getStep() -> int from builtins.type
- Returns the distance between each elements
- getTypeName(cmd) -> str from builtins.type
- Obtain a name for this type that is used in command usage
Name is obtained from AdminCommandExecutor.lang first, then from
self._typename if not found in former
Data descriptors inherited from BaseDiscreteScale:
- __dict__
- dictionary for instance variables (if defined)
Methods inherited from builtins.int:
- __abs__(self, /)
- abs(self)
- __add__(self, value, /)
- Return self+value.
- __and__(self, value, /)
- Return self&value.
- __bool__(self, /)
- True if self else False
- __ceil__(...)
- Ceiling of an Integral returns itself.
- __divmod__(self, value, /)
- Return divmod(self, value).
- __eq__(self, value, /)
- Return self==value.
- __float__(self, /)
- float(self)
- __floor__(...)
- Flooring an Integral returns itself.
- __floordiv__(self, value, /)
- Return self//value.
- __format__(self, format_spec, /)
- Default object formatter.
- __ge__(self, value, /)
- Return self>=value.
- __getattribute__(self, name, /)
- Return getattr(self, name).
- __getnewargs__(self, /)
- __gt__(self, value, /)
- Return self>value.
- __hash__(self, /)
- Return hash(self).
- __index__(self, /)
- Return self converted to an integer, if self is suitable for use as an index into a list.
- __int__(self, /)
- int(self)
- __invert__(self, /)
- ~self
- __le__(self, value, /)
- Return self<=value.
- __lshift__(self, value, /)
- Return self<<value.
- __lt__(self, value, /)
- Return self<value.
- __mod__(self, value, /)
- Return self%value.
- __mul__(self, value, /)
- Return self*value.
- __ne__(self, value, /)
- Return self!=value.
- __neg__(self, /)
- -self
- __or__(self, value, /)
- Return self|value.
- __pos__(self, /)
- +self
- __pow__(self, value, mod=None, /)
- Return pow(self, value, mod).
- __radd__(self, value, /)
- Return value+self.
- __rand__(self, value, /)
- Return value&self.
- __rdivmod__(self, value, /)
- Return divmod(value, self).
- __repr__(self, /)
- Return repr(self).
- __rfloordiv__(self, value, /)
- Return value//self.
- __rlshift__(self, value, /)
- Return value<<self.
- __rmod__(self, value, /)
- Return value%self.
- __rmul__(self, value, /)
- Return value*self.
- __ror__(self, value, /)
- Return value|self.
- __round__(...)
- Rounding an Integral returns itself.
Rounding with an ndigits argument also returns an integer.
- __rpow__(self, value, mod=None, /)
- Return pow(value, self, mod).
- __rrshift__(self, value, /)
- Return value>>self.
- __rshift__(self, value, /)
- Return self>>value.
- __rsub__(self, value, /)
- Return value-self.
- __rtruediv__(self, value, /)
- Return value/self.
- __rxor__(self, value, /)
- Return value^self.
- __sizeof__(self, /)
- Returns size in memory, in bytes.
- __sub__(self, value, /)
- Return self-value.
- __truediv__(self, value, /)
- Return self/value.
- __trunc__(...)
- Truncating an Integral returns itself.
- __xor__(self, value, /)
- Return self^value.
- as_integer_ratio(self, /)
- Return integer ratio.
Return a pair of integers, whose ratio is exactly equal to the original int
and with a positive denominator.
>>> (10).as_integer_ratio()
(10, 1)
>>> (-10).as_integer_ratio()
(-10, 1)
>>> (0).as_integer_ratio()
(0, 1)
- bit_count(self, /)
- Number of ones in the binary representation of the absolute value of self.
Also known as the population count.
>>> bin(13)
'0b1101'
>>> (13).bit_count()
3
- bit_length(self, /)
- Number of bits necessary to represent self in binary.
>>> bin(37)
'0b100101'
>>> (37).bit_length()
6
- conjugate(...)
- Returns self, the complex conjugate of any int.
- to_bytes(self, /, length, byteorder, *, signed=False)
- Return an array of bytes representing an integer.
length
Length of bytes object to use. An OverflowError is raised if the
integer is not representable with the given number of bytes.
byteorder
The byte order used to represent the integer. If byteorder is 'big',
the most significant byte is at the beginning of the byte array. If
byteorder is 'little', the most significant byte is at the end of the
byte array. To request the native byte order of the host system, use
`sys.byteorder' as the byte order value.
signed
Determines whether two's complement is used to represent the integer.
If signed is False and a negative integer is given, an OverflowError
is raised.
Class methods inherited from builtins.int:
- from_bytes(bytes, byteorder, *, signed=False) from builtins.type
- Return the integer represented by the given array of bytes.
bytes
Holds the array of bytes to convert. The argument must either
support the buffer protocol or be an iterable object producing bytes.
Bytes and bytearray are examples of built-in objects that support the
buffer protocol.
byteorder
The byte order used to represent the integer. If byteorder is 'big',
the most significant byte is at the beginning of the byte array. If
byteorder is 'little', the most significant byte is at the end of the
byte array. To request the native byte order of the host system, use
`sys.byteorder' as the byte order value.
signed
Indicates whether two's complement is used to represent the integer.
Static methods inherited from builtins.int:
- __new__(*args, **kwargs) from builtins.type
- Create and return a new object. See help(type) for accurate signature.
Data descriptors inherited from builtins.int:
- denominator
- the denominator of a rational number in lowest terms
- imag
- the imaginary part of a complex number
- numerator
- the numerator of a rational number in lowest terms
- real
- the real part of a complex number
Methods inherited from CustomType:
- __str__(self)
- Return str(self).
- serialize(self) -> Union[str, int, float, bool, NoneType]
- Obtain primitive value representing this object
Can be async
Class methods inherited from CustomType:
- deserialize(data) from builtins.type
- Construct an object from this raw data
Data descriptors inherited from CustomType:
- __weakref__
- list of weak references to the object (if defined)
|
class InvalidArgument(builtins.ValueError) |
|
Raised by AdminCommandExecutor.parse_args() when one of the arguments cannot be parsed |
|
- Method resolution order:
- InvalidArgument
- builtins.ValueError
- builtins.Exception
- builtins.BaseException
- builtins.object
Data descriptors defined here:
- __weakref__
- list of weak references to the object (if defined)
Methods inherited from builtins.ValueError:
- __init__(self, /, *args, **kwargs)
- Initialize self. See help(type(self)) for accurate signature.
Static methods inherited from builtins.ValueError:
- __new__(*args, **kwargs) from builtins.type
- Create and return a new object. See help(type) for accurate signature.
Methods inherited from builtins.BaseException:
- __delattr__(self, name, /)
- Implement delattr(self, name).
- __getattribute__(self, name, /)
- Return getattr(self, name).
- __reduce__(...)
- Helper for pickle.
- __repr__(self, /)
- Return repr(self).
- __setattr__(self, name, value, /)
- Implement setattr(self, name, value).
- __setstate__(...)
- __str__(self, /)
- Return str(self).
- with_traceback(...)
- Exception.with_traceback(tb) --
set self.__traceback__ to tb and return self.
Data descriptors inherited from builtins.BaseException:
- __cause__
- exception cause
- __context__
- exception context
- __dict__
- __suppress_context__
- __traceback__
- args
|
class NotEnoughArguments(builtins.Exception) |
|
Raised by AdminCommandExecutor.dispatch() when command string doesn't have enough arguments |
|
- Method resolution order:
- NotEnoughArguments
- builtins.Exception
- builtins.BaseException
- builtins.object
Data descriptors defined here:
- __weakref__
- list of weak references to the object (if defined)
Methods inherited from builtins.Exception:
- __init__(self, /, *args, **kwargs)
- Initialize self. See help(type(self)) for accurate signature.
Static methods inherited from builtins.Exception:
- __new__(*args, **kwargs) from builtins.type
- Create and return a new object. See help(type) for accurate signature.
Methods inherited from builtins.BaseException:
- __delattr__(self, name, /)
- Implement delattr(self, name).
- __getattribute__(self, name, /)
- Return getattr(self, name).
- __reduce__(...)
- Helper for pickle.
- __repr__(self, /)
- Return repr(self).
- __setattr__(self, name, value, /)
- Implement setattr(self, name, value).
- __setstate__(...)
- __str__(self, /)
- Return str(self).
- with_traceback(...)
- Exception.with_traceback(tb) --
set self.__traceback__ to tb and return self.
Data descriptors inherited from builtins.BaseException:
- __cause__
- exception cause
- __context__
- exception context
- __dict__
- __suppress_context__
- __traceback__
- args
|
class TimeType(CustomType) |
|
TimeType(value: Optional[str] = None, *, raise_exc=True, from_time: Optional[datetime.time] = None)
|
|
- Method resolution order:
- TimeType
- CustomType
- builtins.object
Methods defined here:
- __init__(self, value: Optional[str] = None, *, raise_exc=True, from_time: Optional[datetime.time] = None)
- Initialize self. See help(type(self)) for accurate signature.
- serialize(self)
- Obtain primitive value representing this object
Can be async
- tabComplete(cls, value: str)
- Returns a list containing all available items from a starting value
Can be async
Class methods defined here:
- deserialize(data: int) from builtins.type
- Construct an object from this raw data
- parse(value: str, *, raise_exc=True) from builtins.type
Data and other attributes defined here:
- time_expr = re.compile('(?P<hour>\\d{1,2})(?P<time_delimiter...2})(?:(?P=time_delimiter)(?P<second>\\d{1,2}))?')
- time_reverse_expr = '%H:%M:%S'
Methods inherited from CustomType:
- __str__(self)
- Return str(self).
- getRawValue(self) -> str
- Obtain source value that this object is initialized from
- getValue(self)
- Obtain a value from this type wrapper
Class methods inherited from CustomType:
- getTypeName(ace) -> str from builtins.type
- Obtain a name for this type that is used in command usage
Name is obtained from AdminCommandExecutor.lang first, then from
self._typename if not found in former
Data descriptors inherited from CustomType:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
| |