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

Int value with Contains operator#120

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
saltar-ua merged 1 commit intomainfromgis-7858
May 24, 2024
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletionsuncoder-core/app/translator/core/custom_types/tokens.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -30,3 +30,9 @@ class OperatorType(CustomEnum):
class GroupType(CustomEnum):
L_PAREN = "("
R_PAREN = ")"


STR_SEARCH_OPERATORS = (
OperatorType.CONTAINS, OperatorType.NOT_CONTAINS, OperatorType.ENDSWITH, OperatorType.NOT_ENDSWITH,
OperatorType.STARTSWITH, OperatorType.NOT_STARTSWITH, OperatorType.REGEX, OperatorType.NOT_REGEX
)
7 changes: 5 additions & 2 deletionsuncoder-core/app/translator/core/models/field.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
from typing import Optional, Union

from app.translator.core.custom_types.tokens import OperatorType
from app.translator.core.custom_types.tokens import OperatorType, STR_SEARCH_OPERATORS
from app.translator.core.mapping import DEFAULT_MAPPING_NAME, SourceMapping
from app.translator.core.models.identifier import Identifier
from app.translator.core.str_value_manager import StrValue
Expand All@@ -14,6 +14,9 @@ def __init__(self, source_name: str):
def get_generic_field_name(self, source_id: str) -> Optional[str]:
return self.__generic_names_map.get(source_id)

def add_generic_names_map(self, generic_names_map: dict) -> None:
self.__generic_names_map = generic_names_map

def set_generic_names_map(self, source_mappings: list[SourceMapping], default_mapping: SourceMapping) -> None:
generic_names_map = {
source_mapping.source_id: source_mapping.fields_mapping.get_generic_field_name(self.source_name)
Expand DownExpand Up@@ -46,7 +49,7 @@ def __add_value(self, value: Optional[Union[int, str, StrValue, list, tuple]]) -
if value and isinstance(value, (list, tuple)):
for v in value:
self.__add_value(v)
elif value and isinstance(value, str) and value.isnumeric():
elif value and isinstance(value, str) and value.isnumeric() and self.operator.token_type not in STR_SEARCH_OPERATORS:
self.values.append(int(value))
elif value is not None and isinstance(value, (int, str)):
self.values.append(value)
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp