AssignBuilder Class
- class kwhelp.AssignBuilder[source]
Helper class for building list to use with “KwargsHelper.Assing() method
- append(key: str, field: Optional[str] = None, require: bool = False, default: Optional[object] = None, types: Optional[List[type]] = None, rules_all: Optional[List[Callable[[kwhelp.rules.IRule], bool]]] = None, rules_any: Optional[List[Callable[[kwhelp.rules.IRule], bool]]] = None)[source]
Appends dictionary item of parameters to list
- Parameters
key (str) – the key of the key, value pair.
field (Optional[str], optional) – the name of the field.. Defaults to
None
.require (bool, optional) – Determins if
key
is required. Defaults toFalse
.default (Optional[object], optional) – default value to assign if key value is missing. Defaults to
None
.types (Optional[List[type]], optional) – list of one or more types that the value of the key value pair must match. Defaults to
None
.rules (Optional[List[Callable[[IRule], bool]]], optional) – Rules to apply. Defaults to
None
.
- Raises
TypeError – if
key
is not instance of``str``.ValueError – if
key
is empty or whitespace str.ValueError – if
key
has already exist.
- append_helper(helper: kwhelp.HelperArgs)[source]
Appends dictionary item of parameters to list
- Parameters
helper (HelperArgs) – parameters to append
- Raises
TypeError – if
helper
is not instance ofHelperArgs
ValueError – if
helper.key
is empty string.ValueError – if
helper.key
already exist.
- extend(other: kwhelp.AssignBuilder) None [source]
Extents this instance by merging values from other instance of
AssignBuilder
.- Parameters
other (AssignBuilder) – instance to merge
- Raises
NotImplementedError – if
other
is not instance ofAssignBuilder
.
- remove(item: kwhelp.HelperArgs) None [source]
Removes an instance of
HelperArgs
from this instance- Parameters
item (HelperArgs) – Object to remove
- Raises
TypeError – if
item
is not instance ofHelperArgs
- Returns
None
- Return type
[obj]