6.13. Dictionary¶
6.13.1. Dict¶
-
class
easydata.parsers.dict.
Dict
(query: Optional[easydata.queries.base.QuerySearchBase] = None, key_parser: Optional[easydata.parsers.base.Base] = None, val_parser: Optional[easydata.parsers.base.Base] = None, key_query: Optional[easydata.queries.base.QuerySearchBase] = None, val_query: Optional[easydata.queries.base.QuerySearchBase] = None, dict_val_from_key: bool = False, ignore_non_values: bool = False, ignore_non_keys: bool = True, key_normalize: bool = True, key_title: bool = False, key_uppercase: bool = False, key_lowercase: bool = False, key_replace_keys: Optional[list] = None, key_remove_keys: Optional[list] = None, key_split_text_key: Optional[Union[str, tuple]] = None, key_split_text_keys: Optional[List[Union[str, tuple]]] = None, key_take: Optional[int] = None, key_skip: Optional[int] = None, key_fix_spaces: bool = True, key_allow: Optional[Union[List[str], str]] = None, key_callow: Optional[Union[List[str], str]] = None, key_deny: Optional[Union[List[str], str]] = None, key_cdeny: Optional[Union[List[str], str]] = None, key_default: Optional[str] = None, **kwargs)[source]¶
examples coming soon …
Parameters¶
-
query
¶
-
key_parser
¶
-
val_parser
¶
-
key_query
¶
-
val_query
¶
-
dict_val_from_key
¶
-
ignore_non_values
¶
Default: False
Ignore all keys in a dict
that has None
type.
-
ignore_non_keys
¶
Default: True
Ignore all values in a dict
that has None
type.
-
key_normalize
¶
Default: True
When set to True
, it will fix bad encoding in dict keys.
-
key_title
¶
Default: False
When set to True
, it will convert in a dict key all first chars in a word to uppercase.
-
key_uppercase
¶
Default: False
When set to True
, it will convert all chars in a dict keys to uppercase.
-
key_lowercase
¶
Default: False
When set to True
, it will convert all chars in a dict keys to lowercase.
-
key_replace_keys
¶
Default: None
We can replace chars/words in a dict keys through key_replace_keys
parameter.
key_replace_keys
can accept regex pattern as a lookup key and is not
case sensitive.
-
key_remove_keys
¶
Default: None
We can remove chars/words in a dict keys through key_remove_keys
parameter.
key_remove_keys
can accept regex pattern as a lookup key and is not
case sensitive.
-
key_split_text_key
¶
Default: None
Text in a dict key can be split with key_split_text_key
. By default split index
is 0
.
-
key_split_text_keys
¶
Default: None
key_split_text_keys
work in a same way as key_split_text_key
but instead
of single split key it accepts list of keys.
-
key_take
¶
Default: None
With key_take
parameter we can limit maximum number of chars in a dict keys.
-
key_skip
¶
Default: None
With key_skip
parameter we can skip defined number of chars from the start in a
dict keys.
-
key_fix_spaces
¶
Default: True
With key_fix_spaces parameter set to True, all multiple spaces between chars will be removed and left with only single one between chars.
-
key_allow
¶
-
key_callow
¶
-
key_deny
¶
-
key_cdeny
¶
-
key_default
¶
6.13.2. TextDict¶
-
class
easydata.parsers.dict.
TextDict
(*args, val_normalize: bool = True, val_title: bool = False, val_uppercase: bool = False, val_lowercase: bool = False, val_replace_keys: Optional[list] = None, val_remove_keys: Optional[list] = None, val_split_text_key: Optional[Union[str, tuple]] = None, val_split_text_keys: Optional[List[Union[str, tuple]]] = None, val_take: Optional[int] = None, val_skip: Optional[int] = None, val_fix_spaces: bool = True, val_allow: Optional[Union[List[str], str]] = None, val_callow: Optional[Union[List[str], str]] = None, val_deny: Optional[Union[List[str], str]] = None, val_cdeny: Optional[Union[List[str], str]] = None, **kwargs)[source]¶ Bases:
easydata.parsers.dict.Dict
examples coming soon …
Parameters¶
-
val_normalize
¶
Default: True
When set to True
, it will fix bad encoding in dict values.
-
val_title
¶
Default: False
When set to True
, it will convert in a dict value all first chars in a word to uppercase.
-
val_uppercase
¶
Default: False
When set to True
, it will convert all chars in a dict values to uppercase.
-
val_lowercase
¶
When set to True
, it will convert all chars in a dict values to lowercase.
-
val_replace_keys
¶
-
val_remove_keys
¶
-
val_split_text_key
¶
-
val_split_text_keys
¶
-
val_take
¶
-
val_skip
¶
-
val_fix_spaces
¶
-
val_allow
¶
-
val_callow
¶
-
val_deny
¶
-
val_cdeny
¶
6.13.3. HasDict¶
-
class
easydata.parsers.dict.
HasDict
(*args, val_contains: Optional[Union[list, str]] = None, val_ccontains: Optional[Union[list, str]] = None, val_contains_query: Optional[easydata.queries.base.QuerySearchBase] = None, val_empty_as_false: bool = True, **kwargs)[source]¶
examples coming soon …
Parameters¶
-
val_contains
¶
-
val_ccontains
¶
-
val_contains_query
¶
-
val_contains_query_source
¶
-
val_empty_as_false
¶
6.13.4. PriceFloatDict¶
-
class
easydata.parsers.dict.
PriceFloatDict
(*args, val_decimals: Optional[int] = None, val_min_value: Optional[Union[float, int]] = None, val_max_value: Optional[Union[float, int]] = None, **kwargs)[source]¶
examples coming soon …
Parameters¶
-
val_decimals
¶
Default: 2
We can manipulate how many decimals
price in a parsed dict values will be have.
By default this limit is 2
, but we can change this value with a val_decimals
parameter.
-
val_min_value
¶
Default: None
-
val_max_value
¶
Default: None
6.13.5. PriceTextDict¶
-
class
easydata.parsers.dict.
PriceTextDict
(*args, val_decimals: Optional[int] = None, val_min_value: Optional[Union[float, int]] = None, val_max_value: Optional[Union[float, int]] = None, **kwargs)[source]¶
Works exactly the same as PriceFloatDict
, but value type is str
instead of float
.