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

spl str value manager#188

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
alexvolha merged 2 commits intomainfromgis-7010
Sep 13, 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
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,9 +6,7 @@


class SplEscapeManager(EscapeManager):
escape_map: ClassVar[dict[str, list[EscapeDetails]]] = {
ValueType.value: [EscapeDetails(pattern='("|(?<!\\\\)\\\\(?![*?\\\\]))')]
}
escape_map: ClassVar[dict[str, list[EscapeDetails]]] = {ValueType.value: [EscapeDetails(pattern=r"([<>=\"'\|\\])")]}


spl_escape_manager = SplEscapeManager()
10 changes: 5 additions & 5 deletionsuncoder-core/app/translator/platforms/base/spl/tokenizer.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -29,7 +29,7 @@
from app.translator.platforms.base.spl.const import NO_QUOTES_VALUES_PATTERN as NO_Q_V_PATTERN
from app.translator.platforms.base.spl.const import NUM_VALUE_PATTERN as N_V_PATTERN
from app.translator.platforms.base.spl.const import SINGLE_QUOTES_VALUE_PATTERN as S_Q_V_PATTERN
from app.translator.platforms.base.spl.escape_manager importspl_escape_manager
from app.translator.platforms.base.spl.str_value_manager importspl_str_value_manager
from app.translator.tools.utils import get_match_group


Expand DownExpand Up@@ -57,7 +57,7 @@ class SplTokenizer(QueryTokenizer, ANDLogicOperatorMixin):

wildcard_symbol = "*"

escape_manager =spl_escape_manager
str_value_manager =spl_str_value_manager

def get_operator_and_value(
self, match: re.Match, mapped_operator: str = OperatorType.EQ, operator: Optional[str] = None
Expand All@@ -66,13 +66,13 @@ def get_operator_and_value(
return mapped_operator, num_value

if (no_q_value := get_match_group(match, group_name=ValueType.no_quotes_value)) is not None:
return mapped_operator, no_q_value
return mapped_operator,self.str_value_manager.from_str_to_container(no_q_value)

if (d_q_value := get_match_group(match, group_name=ValueType.double_quotes_value)) is not None:
return mapped_operator, self.escape_manager.remove_escape(d_q_value)
return mapped_operator, self.str_value_manager.from_str_to_container(d_q_value)

if (s_q_value := get_match_group(match, group_name=ValueType.single_quotes_value)) is not None:
return mapped_operator, self.escape_manager.remove_escape(s_q_value)
return mapped_operator, self.str_value_manager.from_str_to_container(s_q_value)

return super().get_operator_and_value(match, mapped_operator, operator)

Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -57,7 +57,7 @@ def get_operator_and_value(
return mapped_operator, num_value

if (d_q_value := get_match_group(match, group_name=ValueType.double_quotes_value)) is not None:
return mapped_operator, d_q_value
return mapped_operator,self.escape_manager.remove_escape(d_q_value)

if (re_value := get_match_group(match, group_name=ValueType.regex_value)) is not None:
return OperatorType.REGEX, re_value
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp