Skip to content

Commit 6c4dd6c

Browse files
committed
run linter
1 parent a71ae13 commit 6c4dd6c

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
from abc import ABC, abstractmethod
2020
from collections.abc import Callable
21-
from typing import Optional, Union
21+
from typing import ClassVar, Optional, Union
2222

2323
from app.translator.const import DEFAULT_VALUE_TYPE
2424
from app.translator.core.context_vars import return_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+
def init_platform_functions(self) -> None:
174+
self.platform_functions = PlatformFunctions()
175+
self.platform_functions.platform_query_render = self
169176

170177
def render_not_supported_functions(self, not_supported_functions: list) -> str:
171178
line_template = f"{self.comment_symbol} " if self.comment_symbol and self.is_single_line_comment else ""
@@ -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-
from typing import Optional, Union
19+
from typing import ClassVar, Optional, Union
2020

2121
from app.translator.const import DEFAULT_VALUE_TYPE
2222
from app.translator.core.custom_types.values import ValueType
@@ -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+
def init_platform_functions(self) -> None:
156+
self.platform_functions = cortex_xql_functions
157+
self.platform_functions.platform_query_render = self
158158

159159
def process_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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy