8.2. Item Processors¶
8.2.1. ItemKeysMergeIntoListProcessor¶
-
class
easydata.processors.item.
ItemKeysMergeIntoListProcessor
(new_item_key: str, item_keys: List[str], preserve_original=False, ignore_none=True)[source]¶ Bases:
easydata.processors.item.ItemBaseProcessor
ItemKeysMergeIntoDictProcessor
creates a list of values under a new key on
a basis of specified keys in item dictionary.
Parameters¶
-
new_item_key
¶
-
item_keys
¶
-
preserve_original
¶
-
ignore_none
¶
8.2.2. ItemKeysMergeProcessor¶
-
class
easydata.processors.item.
ItemKeysMergeProcessor
(new_item_key: str, item_keys: List[str], preserve_original=False, separator: str = ' ')[source]¶ Bases:
easydata.processors.item.ItemKeysMergeIntoListProcessor
Parameters¶
-
new_item_key
¶
-
preserve_original
¶
-
separator
¶
8.2.3. ItemKeysMergeIntoDictProcessor¶
-
class
easydata.processors.item.
ItemKeysMergeIntoDictProcessor
(new_item_key: str, item_keys: List[str], preserve_original=False, ignore_none=True)[source]¶ Bases:
easydata.processors.item.ItemKeysMergeIntoListProcessor
ItemKeysMergeIntoDictProcessor
creates a dictionary under a new key on
a basis of specified keys in item dictionary.
Parameters¶
-
new_item_key
¶
-
item_keys
¶
-
preserve_original
¶
-
ignore_none
¶
8.2.4. ItemValueToStrProcessor¶
-
class
easydata.processors.item.
ItemValueToStrProcessor
(item_keys: List[str], none_as_empty_string: bool = True)[source]¶ Bases:
easydata.processors.item.ItemBaseProcessor
ItemValueToStrProcessor
converts values from various types to str.
Parameters¶
-
item_keys
¶
-
none_as_empty_string
¶
8.2.5. ItemRemoveKeysProcessor¶
-
class
easydata.processors.item.
ItemRemoveKeysProcessor
(item_keys: List[str])[source]¶ Bases:
easydata.processors.item.ItemBaseProcessor
ItemRemoveKeysProcessor
removes keys from item dictionary.
Parameters¶
-
item_keys
¶
8.2.6. ItemDiscountProcessor¶
-
class
easydata.processors.item.
ItemDiscountProcessor
(item_price_key: Optional[str] = None, item_sale_price_key: Optional[str] = None, item_discount_key: Optional[str] = None, decimals: Optional[int] = None, no_decimals: Optional[bool] = None, remove_item_sale_price_key: Optional[bool] = None)[source]¶ Bases:
easydata.processors.item.ItemBaseProcessor
ItemDiscountProcessor
looks for parsed price
and sale_price
in item
dictionary and calculates discount percentage between those two values. Finally
it creates a new discount key in item dictionary and attaches discount value to it.
If our price and sale price values live under different keys under item dictionary
than default ones price
and sale_price
, then we can through parameters,
change those default values in order to suit our needs.
All parameters that ItemDiscountProcessor
accepts are listed bellow:
Parameters¶
-
item_price_key
¶
Note
Default value of item_price_key parameter can be defined through a config variable ED_ITEM_DISCOUNT_ITEM_PRICE_KEY in a config file or a model.
-
item_sale_price_key
¶
Note
Default value of item_sale_price_key parameter can be defined through a config variable ED_ITEM_DISCOUNT_ITEM_SALE_PRICE_KEY in a config file or a model.
-
item_discount_key
¶
Note
Default value of item_discount_key parameter can be defined through a config variable ED_ITEM_DISCOUNT_ITEM_DISCOUNT_KEY in a config file or a model.
-
decimals
¶
Note
Default value of decimals parameter can be defined through a config variable ED_ITEM_DISCOUNT_DECIMALS in a config file or a model.
-
no_decimals
¶
Note
Default value of no_decimals parameter can be defined through a config variable ED_ITEM_DISCOUNT_NO_DECIMALS in a config file or a model.
-
remove_item_sale_price_key
¶
Note
Default value of remove_item_sale_price_key parameter can be defined through a config variable ED_ITEM_DISCOUNT_REMOVE_ITEM_SALE_PRICE_KEY in a config file or a model.