argsloader.base.result¶
ParseResultChildProxy¶
-
class
argsloader.base.result.
ParseResultChildProxy
(children)[source]¶ - Overview:
Proxy class of children, only used for accessing.
-
__contains__
(item) → bool¶ Check if this children collection contain the given
item
.- Parameters
item – Item to be checked.
- Returns
Item is contained or not.
-
__getitem__
(item) → Union[argsloader.base.result.ParseResultChildProxy, object]¶ Get item from children.
- Parameters
item – Name of item, can be a string or an integer.
- Returns
Item got, can be a
argsloader.base.result.ParseResultChildProxy
or an object.
-
__init__
(children)[source]¶ Constructor of class
argsloader.base.result.ParseResultChildProxy
.- Parameters
children – Child structure.
-
items
() → Iterator[Tuple[Union[int, str], Union[argsloader.base.result.ParseResultChildProxy, object]]]¶ Get collection of pairs.
- Returns
Collection of pairs
-
keys
()¶ Get collection of keys, can be a collection of string or integer.
- Returns
Collection of keys.
ResultStatus¶
-
enum
argsloader.base.result.
ResultStatus
(value)[source]¶ An enumeration.
- Member Type
int
Valid values are as follows:
-
SKIPPED
= <ResultStatus.SKIPPED: 0>¶ Unit processing is skipped.
-
SUCCESS
= <ResultStatus.SUCCESS: 1>¶ Unit processing is not skipped and succeed.
-
ERROR
= <ResultStatus.ERROR: 2>¶ Unit processing is not skipped and error occurred.
The
Enum
and its members also have the following methods:-
property
valid
¶ Validity, which means it is processed and succeed.
-
property
processed
¶ Processed or not, which means this process is not skipped.
-
classmethod
loads
(data) → Optional[argsloader.base.result.ResultStatus]¶ - Overview:
Load enum data from raw data.
- Arguments:
data (
Any
): Data which going to be parsed.
- Returns:
enum_data (:obj:): Parsed enum data
ErrMode¶
-
enum
argsloader.base.result.
ErrMode
(value)[source]¶ An enumeration.
- Member Type
int
Valid values are as follows:
-
FIRST
= <ErrMode.FIRST: 1>¶ Raise first error.
-
TRY_ALL
= <ErrMode.TRY_ALL: 2>¶ Try raise all errors, if only one error is found, raise it.
-
ALL
= <ErrMode.ALL: 3>¶ Raise all errors, with
argsloader.base.exception.MultipleParseError
.
The
Enum
and its members also have the following methods:-
classmethod
loads
(data) → Optional[argsloader.base.result.ErrMode]¶ - Overview:
Load enum data from raw data.
- Arguments:
data (
Any
): Data which going to be parsed.
- Returns:
enum_data (:obj:): Parsed enum data
ParseResult¶
-
class
argsloader.base.result.
ParseResult
(input_: Optional[argsloader.base.value.PValue], unit, status, result: Optional[argsloader.base.value.PValue], error: Optional[argsloader.base.exception.ParseError], children=None)[source]¶ - Overview:
Result of one parsing process.
-
__contains__
(item) → bool¶ Check if this children collection contain the given
item
.- Parameters
item – Item to be checked.
- Returns
Item is contained or not.
-
__getitem__
(item) → Union[argsloader.base.result.ParseResultChildProxy, object]¶ Get item from children.
- Parameters
item – Name of item, can be a string or an integer.
- Returns
Item got, can be a
argsloader.base.result.ParseResultChildProxy
or an object.
-
__init__
(input_: Optional[argsloader.base.value.PValue], unit, status, result: Optional[argsloader.base.value.PValue], error: Optional[argsloader.base.exception.ParseError], children=None)[source]¶ Constructor of class
argsloader.base.result.ParseResult
.- Parameters
input_ – Input value object.
unit – Unit to do parsing process.
status – Status of result.
result – Result object of parsing process, should be
None
whenstatus
is not valid.error – Error object of parsing process, should be
None
when no error, skipped or the error is caused by child leveled unit.children – Children information, should be structure like
dict
,list
ortuple
.
-
act
(err_mode)[source]¶ Act this result:
If success, return value as result.
If error, raise the error as the
err_mode
saied.If skipped, raise
argsloader.base.result.SkippedParseError
.
- Parameters
err_mode – Error mode.
-
property
error
¶ Error object of parsing process, should be
None
when no error, skipped or the error is caused by child leveled unit.
-
property
input
¶ Input value object.
-
items
() → Iterator[Tuple[Union[int, str], Union[argsloader.base.result.ParseResultChildProxy, object]]]¶ Get collection of pairs.
- Returns
Collection of pairs
-
keys
()¶ Get collection of keys, can be a collection of string or integer.
- Returns
Collection of keys.
-
property
result
¶ Result object of parsing process, should be
None
whenstatus
is not valid.
-
property
status
¶ Status of result.
-
property
unit
¶ Unit to do parsing process.