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

Commit6c4dd6c

Browse files
committed
run linter
1 parenta71ae13 commit6c4dd6c

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

‎uncoder-core/app/translator/core/render.py‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"""
1919
fromabcimportABC,abstractmethod
2020
fromcollections.abcimportCallable
21-
fromtypingimportOptional,Union
21+
fromtypingimportClassVar,Optional,Union
2222

2323
fromapp.translator.constimportDEFAULT_VALUE_TYPE
2424
fromapp.translator.core.context_varsimportreturn_only_first_query_ctx_var
@@ -165,7 +165,14 @@ class QueryRender(ABC):
165165
is_single_line_comment:bool=False
166166
unsupported_functions_text="Unsupported functions were excluded from the result query:"
167167

168-
platform_functions:PlatformFunctions=PlatformFunctions()
168+
platform_functions:PlatformFunctions=None
169+
170+
def__init__(self):
171+
self.init_platform_functions()
172+
173+
definit_platform_functions(self)->None:
174+
self.platform_functions=PlatformFunctions()
175+
self.platform_functions.platform_query_render=self
169176

170177
defrender_not_supported_functions(self,not_supported_functions:list)->str:
171178
line_template=f"{self.comment_symbol} "ifself.comment_symbolandself.is_single_line_commentelse""
@@ -193,9 +200,10 @@ class PlatformQueryRender(QueryRender):
193200
field_value_map=BaseQueryFieldValue(or_token=or_token)
194201

195202
query_pattern="{table} {query} {functions}"
196-
raw_log_field_pattern_map:dict=None
203+
raw_log_field_pattern_map:ClassVar[dict[str,str]]=None
197204

198205
def__init__(self):
206+
super().__init__()
199207
self.operator_map= {
200208
LogicalOperatorType.AND:f"{self.and_token} ",
201209
LogicalOperatorType.OR:f"{self.or_token} ",

‎uncoder-core/app/translator/platforms/palo_alto/renders/cortex_xsiam.py‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
limitations under the License.
1717
-----------------------------------------------------------------
1818
"""
19-
fromtypingimportOptional,Union
19+
fromtypingimportClassVar,Optional,Union
2020

2121
fromapp.translator.constimportDEFAULT_VALUE_TYPE
2222
fromapp.translator.core.custom_types.valuesimportValueType
@@ -136,12 +136,12 @@ class CortexXQLQueryRender(PlatformQueryRender):
136136
details:PlatformDetails=cortex_xql_query_details
137137
mappings:CortexXQLMappings=cortex_xql_mappings
138138
is_strict_mapping=True
139-
raw_log_field_pattern_map= {
140-
'regex':'| alter {field} = regextract(to_json_string(action_evtlog_data_fields)->{field}{{}}, "\\"(.*)\\"")',
141-
'object':'| alter {field_name} = json_extract_scalar({field_object} , "$.{field_path}")',
142-
'list':'| alter {field_name} = arraystring(json_extract_array({field_object} , "$.{field_path}")," ")'
139+
raw_log_field_pattern_map:ClassVar[dict[str,str]]= {
140+
"regex":'| alter {field} = regextract(to_json_string(action_evtlog_data_fields)->{field}{{}}, "\\"(.*)\\"")',
141+
"object":'| alter {field_name} = json_extract_scalar({field_object} , "$.{field_path}")',
142+
"list":'| alter {field_name} = arraystring(json_extract_array({field_object} , "$.{field_path}")," ")',
143143
}
144-
platform_functions:CortexXQLFunctions=cortex_xql_functions
144+
platform_functions:CortexXQLFunctions=None
145145

146146
or_token="or"
147147
and_token="and"
@@ -152,9 +152,9 @@ class CortexXQLQueryRender(PlatformQueryRender):
152152
comment_symbol="//"
153153
is_single_line_comment=False
154154

155-
def__init__(self):
156-
super().__init__()
157-
self.platform_functions.manager.post_init_configure(self)
155+
definit_platform_functions(self)->None:
156+
self.platform_functions=cortex_xql_functions
157+
self.platform_functions.platform_query_render=self
158158

159159
defprocess_raw_log_field(self,field:str,field_type:str)->Optional[str]:
160160
raw_log_field_pattern=self.raw_log_field_pattern_map.get(field_type)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp