11from typing import Optional , Union
22
3- from app .translator .core .custom_types .tokens import OperatorType
3+ from app .translator .core .custom_types .tokens import OperatorType , STR_SEARCH_OPERATORS
44from app .translator .core .mapping import DEFAULT_MAPPING_NAME , SourceMapping
55from app .translator .core .models .identifier import Identifier
66from app .translator .core .str_value_manager import StrValue
@@ -14,6 +14,9 @@ def __init__(self, source_name: str):
1414 def get_generic_field_name (self , source_id : str ) -> Optional [str ]:
1515 return self .__generic_names_map .get (source_id )
1616
17+ def add_generic_names_map (self , generic_names_map : dict ) -> None :
18+ self .__generic_names_map = generic_names_map
19+
1720 def set_generic_names_map (self , source_mappings : list [SourceMapping ], default_mapping : SourceMapping ) -> None :
1821 generic_names_map = {
1922 source_mapping .source_id : source_mapping .fields_mapping .get_generic_field_name (self .source_name )
@@ -46,7 +49,7 @@ def __add_value(self, value: Optional[Union[int, str, StrValue, list, tuple]]) -
4649 if value and isinstance (value , (list , tuple )):
4750 for v in value :
4851 self .__add_value (v )
49- elif value and isinstance (value , str ) and value .isnumeric ():
52+ elif value and isinstance (value , str ) and value .isnumeric () and self . operator . token_type not in STR_SEARCH_OPERATORS :
5053 self .values .append (int (value ))
5154 elif value is not None and isinstance (value , (int , str )):
5255 self .values .append (value )
0 commit comments