Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4154275

Browse files
authored
Merge pull request#120 from UncoderIO/gis-7858
Int value with Contains operator
2 parentse713136 +0a7cb06 commit4154275

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

‎uncoder-core/app/translator/core/custom_types/tokens.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,9 @@ class OperatorType(CustomEnum):
3030
classGroupType(CustomEnum):
3131
L_PAREN="("
3232
R_PAREN=")"
33+
34+
35+
STR_SEARCH_OPERATORS= (
36+
OperatorType.CONTAINS,OperatorType.NOT_CONTAINS,OperatorType.ENDSWITH,OperatorType.NOT_ENDSWITH,
37+
OperatorType.STARTSWITH,OperatorType.NOT_STARTSWITH,OperatorType.REGEX,OperatorType.NOT_REGEX
38+
)

‎uncoder-core/app/translator/core/models/field.py‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
fromtypingimportOptional,Union
22

3-
fromapp.translator.core.custom_types.tokensimportOperatorType
3+
fromapp.translator.core.custom_types.tokensimportOperatorType,STR_SEARCH_OPERATORS
44
fromapp.translator.core.mappingimportDEFAULT_MAPPING_NAME,SourceMapping
55
fromapp.translator.core.models.identifierimportIdentifier
66
fromapp.translator.core.str_value_managerimportStrValue
@@ -14,6 +14,9 @@ def __init__(self, source_name: str):
1414
defget_generic_field_name(self,source_id:str)->Optional[str]:
1515
returnself.__generic_names_map.get(source_id)
1616

17+
defadd_generic_names_map(self,generic_names_map:dict)->None:
18+
self.__generic_names_map=generic_names_map
19+
1720
defset_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
ifvalueandisinstance(value, (list,tuple)):
4750
forvinvalue:
4851
self.__add_value(v)
49-
elifvalueandisinstance(value,str)andvalue.isnumeric():
52+
elifvalueandisinstance(value,str)andvalue.isnumeric()andself.operator.token_typenotinSTR_SEARCH_OPERATORS:
5053
self.values.append(int(value))
5154
elifvalueisnotNoneandisinstance(value, (int,str)):
5255
self.values.append(value)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp