@@ -39,7 +39,7 @@ class EntityFieldBase(EntityFieldValueParser, ABC):
3939 patterns in text. You can provide a custom Identifier class
4040 to further increase the granularity of the value you're looking for.
4141 """
42- pre_processor = None
42+ post_processor = None
4343 """
4444 Pre-processor is a callable which is called before the
4545 value is converted to the type_cls of the EntityField.
@@ -50,7 +50,7 @@ class EntityFieldBase(EntityFieldValueParser, ABC):
5050 def __init__ (self ,
5151 identifier : Type [Identifier ] | None = None ,
5252 default : Any = None ,
53- pre_processor : callable = None ,
53+ post_processor : callable = None ,
5454 ** kwargs ):
5555 """
5656 :param as_list: If set to True combined with providing 'valid_strings',
@@ -67,7 +67,7 @@ def __init__(self,
6767 You can read more about Identifier classes in the Pyttman
6868 documentation.
6969 """
70- self .pre_processor = pre_processor
70+ self .post_processor = post_processor
7171 if self .type_cls is None or inspect .isclass (self .type_cls ) is False :
7272 raise InvalidPyttmanObjectException ("All EntityField classes "
7373 "must define a 'type_cls', "
@@ -113,11 +113,11 @@ def convert_value(self, value: Any) -> Any:
113113 to_type = self .type_cls ) from e
114114
115115 try :
116- if self .pre_processor is not None and callable (self .pre_processor ):
117- converted_value = self .pre_processor (converted_value )
116+ if self .post_processor is not None and callable (self .post_processor ):
117+ converted_value = self .post_processor (converted_value )
118118 except Exception as e :
119- value_err = ValueError ("The pre_processor callable '"
120- f"'{ self .pre_processor } ' failed: { e } " )
119+ value_err = ValueError ("The post_processor callable '"
120+ f"'{ self .post_processor } ' failed: { e } " )
121121 raise TypeConversionFailed (from_type = type (value ),
122122 to_type = self .type_cls ) from value_err
123123 return converted_value
0 commit comments