Python: module manage_defaults_databases

manage_defaults_databases (version 2.0.0) | index manage_defaults_databases.py

`This tool runs CLI scripts and displays output in a Web Interface.
This file implement some functions to manage WebScript default databases.`

Classes
`` |  | builtins.Exception(builtins.BaseException) GroupError UserError builtins.tuple(builtins.object) Group User
class Group(builtins.tuple)
`` | `Group(ID, name) Group(ID, name)`
| Method resolution order: Group builtins.tuple builtins.object Methods defined here: __getnewargs__(self) `Return self as a plain tuple. Used by copy and pickle.` __repr__(self) `Return a nicely formatted representation string` _asdict(self) `Return a new dict which maps field names to their values.` _replace(self, /, **kwds) `Return a new Group object replacing specified fields with new values` Class methods defined here: _make(iterable) from builtins.type `Make a new Group object from a sequence or iterable` Static methods defined here: __new__(_cls, ID, name) `Create new instance of Group(ID, name)` Data descriptors defined here: ID `Alias for field number 0` name `Alias for field number 1` Data and other attributes defined here: __match_args__ = ('ID', 'name') _field_defaults = {} _fields = ('ID', 'name') Methods inherited from builtins.tuple: __add__(self, value, /) `Return self+value.` __contains__(self, key, /) `Return key in self.` __eq__(self, value, /) `Return self==value.` __ge__(self, value, /) `Return self>=value.` __getattribute__(self, name, /) `Return getattr(self, name).` __getitem__(self, key, /) `Return self[key].` __gt__(self, value, /) `Return self>value.` __hash__(self, /) `Return hash(self).` __iter__(self, /) `Implement iter(self).` __le__(self, value, /) `Return self<=value.` __len__(self, /) `Return len(self).` __lt__(self, value, /) `Return self<value.` __mul__(self, value, /) `Return self*value.` __ne__(self, value, /) `Return self!=value.` __rmul__(self, value, /) `Return value*self.` count(self, value, /) `Return number of occurrences of value.` index(self, value, start=0, stop=9223372036854775807, /) `Return first index of value. Raises ValueError if the value is not present.` Class methods inherited from builtins.tuple: __class_getitem__(...) from builtins.type `See PEP 585`
class GroupError(builtins.Exception)
`` | `This class can raise a GroupError.`
| Method resolution order: GroupError 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 User(builtins.tuple)
`` | `User(ID, name, password, salt, enumerations, IPs, groups, apikey, categories, scripts) User(ID, name, password, salt, enumerations, IPs, groups, apikey, categories, scripts)`
| Method resolution order: User builtins.tuple builtins.object Methods defined here: __getnewargs__(self) `Return self as a plain tuple. Used by copy and pickle.` __repr__(self) `Return a nicely formatted representation string` _asdict(self) `Return a new dict which maps field names to their values.` _replace(self, /, **kwds) `Return a new User object replacing specified fields with new values` Class methods defined here: _make(iterable) from builtins.type `Make a new User object from a sequence or iterable` Static methods defined here: __new__(_cls, ID, name, password, salt, enumerations, IPs, groups, apikey, categories, scripts) `Create new instance of User(ID, name, password, salt, enumerations, IPs, groups, apikey, categories, scripts)` Data descriptors defined here: ID `Alias for field number 0` name `Alias for field number 1` password `Alias for field number 2` salt `Alias for field number 3` enumerations `Alias for field number 4` IPs `Alias for field number 5` groups `Alias for field number 6` apikey `Alias for field number 7` categories `Alias for field number 8` scripts `Alias for field number 9` Data and other attributes defined here: __match_args__ = ('ID', 'name', 'password', 'salt', 'enumerations', 'IPs', 'groups', 'apikey', 'categories', 'scripts') _field_defaults = {} _fields = ('ID', 'name', 'password', 'salt', 'enumerations', 'IPs', 'groups', 'apikey', 'categories', 'scripts') Methods inherited from builtins.tuple: __add__(self, value, /) `Return self+value.` __contains__(self, key, /) `Return key in self.` __eq__(self, value, /) `Return self==value.` __ge__(self, value, /) `Return self>=value.` __getattribute__(self, name, /) `Return getattr(self, name).` __getitem__(self, key, /) `Return self[key].` __gt__(self, value, /) `Return self>value.` __hash__(self, /) `Return hash(self).` __iter__(self, /) `Implement iter(self).` __le__(self, value, /) `Return self<=value.` __len__(self, /) `Return len(self).` __lt__(self, value, /) `Return self<value.` __mul__(self, value, /) `Return self*value.` __ne__(self, value, /) `Return self!=value.` __rmul__(self, value, /) `Return value*self.` count(self, value, /) `Return number of occurrences of value.` index(self, value, start=0, stop=9223372036854775807, /) `Return first index of value. Raises ValueError if the value is not present.` Class methods inherited from builtins.tuple: __class_getitem__(...) from builtins.type `See PEP 585`
class UserError(builtins.Exception)
`` | `This class can raise a UserError.`
| Method resolution order: UserError 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

Functions
`` |  | add_group(name: str, id_: int) -> manage_defaults_databases.Group `This function add group in database or raise a GroupError.` add_user(name: str, password: str, groups: List[int], ips: List[str] = ['*'], categories: List[str] = ['*'], scripts: List[str] = ['*']) -> manage_defaults_databases.User `This function add user in database or raise a UserError.` change_user_password(id_: str, new_password: str, old_password: str = None) -> manage_defaults_databases.User `This function change a user password.` create_default_databases() -> None `This function create defaults users and groups.` delete_group(id_: int) -> manage_defaults_databases.Group `This function delete a group by id and return the deleted group.` delete_user(id_: int) -> manage_defaults_databases.User `This function delete a user by id and return the deleted user.` get_apikey(id_: str, password: str) -> str `This function returns the API key after verification of authentication.` get_dict_groups(by_name: bool = False) -> Dict[str, str] `This function returns the dict of groups (ID: Name or Name: ID).` get_groups() -> collections.abc.Iterator[manage_defaults_databases.Group] `This function get groups from CSV database.` get_users() -> collections.abc.Iterator[manage_defaults_databases.User] `This function get users from CSV database.`

Data
`` |  | __all__ = ['User', 'Group', 'add_user', 'add_group', 'get_users', 'UserError', 'GroupError', 'get_groups', 'get_apikey', 'delete_user', 'delete_group', 'get_dict_groups', 'change_user_password', 'create_default_databases'] __author_email__ = 'mauricelambert434@gmail.com' __copyright__ = '\nWebScripts Copyright (C) 2021, 2022, 2023 Mau...ome to redistribute it\nunder certain conditions.\n' __description__ = '\nThis tool runs CLI scripts and displays output ...ctions to manage WebScript default user database\n' __license__ = 'GPL-3.0 License' __maintainer__ = 'Maurice Lambert' __maintainer_email__ = 'mauricelambert434@gmail.com' __url__ = 'https://github.com/mauricelambert/WebScripts' __warningregistry__ = {'version': 0}

Author
`` |  | Maurice Lambert