| |
- builtins.object
-
- Config
class Config(builtins.object) |
|
Config(enable_stderr=False, enable_tag_detail=False, enable_only_json=False, infinity=None, nan=None, max_array_size=1000, max_depth=200, max_loop_times=1000)
Config class
Attributes:
_enable_stderr (bool): When True is given, error message is
outputted into stderr.
Otherwise, it is not outputted.
_enable_tag_detail (bool): When True is given, error message's
tag contains either of "Lexer",
"Parser", or "Evaluator".
_enable_only_json (bool): When true is given, the given data is
parsed as JSON.
In other words, script is disabled.
_infinity (str on NoneType): When string is given, Infinity is
allowed. Then the given string is
used to input/output Infinity
from/to JSON. (Note that it is not
surrounded with quotation mark.)
When None is given and Infinity is
happen, error is occurred.
_nan (str on NoneType): When string is given, NaN (Not a
Number) is allowed. Then the given
string is used to input/output NaN
from/to JSON. (Note that it is not
surrounded with quotation mark.)
When None is given and NaN is happen,
error is occurred.
_max_array_size (int): Maximum array/block size
_max_depth (int): Maximum recursive called times of evaluate
method
_max_loop_times (int): Maximum loop times of "for", "while",
and so on
SPEC_VERSION (str): Version of VivJson's specification
as <Major> "." <Minor> "." <Patch>
(For example, "1.0.0")
INTERPRETER_VERSION (str): Version of this interpreter as
<Major> "." <Minor> "." <Patch>
(For example, "1.0.0")
This <Major> "." <Minor> is equal to
<SPEC_VERSION>'s one.
ENABLE_STDERR_DEFAULT (bool): The default of enabling error
message's stderr output
ENABLE_TAG_DETAIL_DEFAULT (bool): The default of enabling
detail of error message's tag
ENABLE_ONLY_JSON_DEFAULT (bool): The default of enabling only
JSON
INFINITY_DEFAULT (str on NoneType): The default of Infinity
NAN_DEFAULT (str on NoneType): The default of NaN (Not a
Number)
MAX_ARRAY_SIZE_DEFAULT (int): The default of maximum array size
MAX_DEPTH_DEFAULT (int): The default of maximum recursive
called times of evaluate method
MAX_LOOP_TIMES_DEFAULT (int): The default of maximum loop times
of "for", "while", and so on |
|
Methods defined here:
- __init__(self, enable_stderr=False, enable_tag_detail=False, enable_only_json=False, infinity=None, nan=None, max_array_size=1000, max_depth=200, max_loop_times=1000)
- Initialize class.
Args:
enable_stderr (bool, optional): When True is given, error
message is outputted into stderr.
Otherwise, it is not outputted.
The default is False.
enable_tag_detail (bool): When True is given, error
message's tag contains either of
"Lexer", "Parser", or "Evaluator".
enable_only_json (bool): When true is given, the given data
is parsed as JSON.
In other words, script is
disabled.
infinity (str on NoneType, optional): When string is given,
Infinity is allowed in JSON. Then
the given string is used to
input/output Infinity from/to JSON.
(Note that it is not surrounded
with quotation mark.)
When None is given and Infinity is
happen, error may be occurred.
The default is None.
nan (str on NoneType, optional): When string is given,
NaN (Not a Number) is allowed in
JSON. Then the given string is used
to input/output NaN from/to JSON.
(Note that it is not surrounded
with quotation mark.)
When None is given and NaN is
happen, error may be occurred.
The default is False.
max_array_size (int, optional): Maximum array/block size
max_depth (int, optional): Maximum recursive called times
of evaluate method
max_loop_times (int, optional): Maximum loop times of
"for", "while", and so on
- clone(self)
- Copy itself.
Returns:
Config: Copied Config object
- enable_only_json(self, enable=True)
- Enable that parsing data as only JSON.
Args:
enable (bool, optional): When true is given, the given data
is parsed as JSON.
In other words, script is
disabled.
- enable_stderr(self, enable=True)
- Enable that error message outputs into stderr.
Args:
enable (bool, optional): When True is given, error message
is outputted into stderr.
Otherwise, it is not outputted.
The argument's default is True.
- enable_tag_detail(self, enable=True)
- Enable that detail of error message's tag.
Args:
enable (bool, optional): When True is given, error
message's tag contains either of
"Lexer", "Parser", or "Evaluator".
The argument's default is True.
- get_enable_only_json(self) -> bool
- Get whether parsing data as only JSON is enable or not.
- get_enable_stderr(self) -> bool
- Get whether outputting error message into stderr is enable.
- get_enable_tag_detail(self) -> bool
- Get whether detail of error message's tag is enable or not.
- get_infinity(self) -> Optional[str]
- Get infinity's string.
- get_max_array_size(self) -> int
- Get maximum array/block size.
- get_max_depth(self) -> int
- Get maximum recursive called times of evaluate method.
- get_max_loop_times(self) -> int
- Get maximum loop times of "for", "while", and so on.
- get_nan(self) -> Optional[str]
- Get NaN(Not a Number)'s string.
- set_infinity(self, infinity: Optional[str])
- Set infinity's string.
When string is given, Infinity is allowed. Then the given
string is used to input/output Infinity from/to JSON. (Note
that it is not surrounded with quotation mark.)
When None is given and Infinity is happen, error may be
occurred.
Args:
infinity (str or NoneType): Infinity's string or None.
- set_max_array_size(self, size: int)
- Set maximum array/block size.
- set_max_depth(self, depth: int)
- Set maximum recursive called times of evaluate method.
- set_max_loop_times(self, times: int)
- Set maximum loop times of "for", "while", and so on.
- set_nan(self, nan: Optional[str])
- Set NaN(Not a Number)'s string.
When string is given, NaN (Not a Number) is allowed. Then the
given string is used to input/output NaN from/to JSON. (Note
that it is not surrounded with quotation mark.)
When None is given and NaN is happen, error may be occurred.
Args:
nan (str or NoneType): NaN(Not a Number)'s string
Static methods defined here:
- get_enable_only_json_alt(config) -> bool
- Get whether parsing data as only JSON is enable or not.
Args:
config (Config or NoneType): Instance of configuration.
When it is None, default
value is returned.
Returns:
bool: parsing data as only JSON is enable or not
- get_enable_stderr_alt(config) -> bool
- Get whether outputting error message into stderr is enable.
Args:
config (Config or NoneType): Instance of configuration.
When it is None, default
value is returned.
Returns:
bool: Outputting error message into stderr is enable or not
- get_enable_tag_detail_alt(config) -> bool
- Get whether detail of error message's tag is enable or not.
Args:
config (Config or NoneType): Instance of configuration.
When it is None, default
value is returned.
Returns:
bool: Detail of error message's tag is enable or not
- get_infinity_alt(config) -> Optional[str]
- Get infinity's string.
Args:
config (Config or NoneType): Instance of configuration.
When it is None, default
value is returned.
Returns:
str on NoneType: Infinity's string.
When this is None, Infinity is not
allowed.
- get_max_array_size_alt(config) -> int
- Get maximum array/block size.
Args:
config (Config or NoneType): Instance of configuration.
When it is None, default
value is returned.
Returns:
int: Maximum array/block size
- get_max_depth_alt(config) -> int
- Get maximum recursive called times of evaluate method.
Args:
config (Config or NoneType): Instance of configuration.
When it is None, default
value is returned.
Returns:
int: Maximum recursive called times of evaluate method
- get_max_loop_times_alt(config) -> int
- Get maximum loop times of "for", "while", and so on.
Args:
config (Config or NoneType): Instance of configuration.
When it is None, default
value is returned.
Returns:
int: Maximum loop times of "for", "while", and so on.
- get_nan_alt(config) -> Optional[str]
- Get NaN(Not a Number)'s string.
Args:
config (Config or NoneType): Instance of configuration.
When it is None, default
value is returned.
Returns:
str on NoneType: NaN (Not a Number)'s string.
When this is None, NaN is not allowed.
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes defined here:
- ENABLE_ONLY_JSON_DEFAULT = False
- ENABLE_STDERR_DEFAULT = False
- ENABLE_TAG_DETAIL_DEFAULT = False
- INFINITY_DEFAULT = None
- INTERPRETER_VERSION = '1.0.1'
- MAX_ARRAY_SIZE_DEFAULT = 1000
- MAX_DEPTH_DEFAULT = 200
- MAX_LOOP_TIMES_DEFAULT = 1000
- NAN_DEFAULT = None
- SPEC_VERSION = '1.0.0'
| |