Skip to content

Commit 7a3a435

Browse files
committed
tmp
1 parent 00a60a9 commit 7a3a435

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

logprep/util/helper.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -244,14 +244,14 @@ def _get_item(container: FieldValue, key: str) -> FieldValue:
244244
245245
Parameters
246246
----------
247-
container : Union[dict, list, str, None]
247+
container : FieldValue
248248
Container object where data is read from
249249
key : str
250250
Dictionary key, index or slice spec refering to the container
251251
252252
Returns
253253
-------
254-
Union[dict, list, str, None]
254+
FieldValue
255255
The container value which is referenced by the key
256256
257257
Raises
@@ -284,13 +284,10 @@ def get_dotted_field_value(event: dict[str, FieldValue], dotted_field: str) -> F
284284
285285
Parameters
286286
----------
287-
event: dict
287+
event: dict[str, FieldValue]
288288
The event from which the dotted field value should be extracted
289289
dotted_field: str
290290
The dotted field name which identifies the requested value
291-
silent_fail: bool, optional
292-
Controls output behavior for missing fields. When set to true (which is the default),
293-
None will be returned, otherwise an error will be raised.
294291
295292
Returns
296293
-------
@@ -314,14 +311,14 @@ def get_dotted_field_value(event: dict[str, FieldValue], dotted_field: str) -> F
314311

315312
def get_dotted_field_value_with_explicit_missing(
316313
event: dict[str, FieldValue], dotted_field: str
317-
) -> Union[FieldValue, Missing]:
314+
) -> FieldValue | Missing:
318315
"""
319316
Returns the value of a requested dotted_field by iterating over the event dictionary until the
320317
field was found. In case the field could not be found None is returned.
321318
322319
Parameters
323320
----------
324-
event: dict
321+
event: dict[str, FieldValue]
325322
The event from which the dotted field value should be extracted
326323
dotted_field: str
327324
The dotted field name which identifies the requested value
@@ -349,7 +346,7 @@ def get_dotted_field_value_with_explicit_missing(
349346
def get_dotted_field_values(
350347
event: dict,
351348
dotted_fields: Iterable[str],
352-
on_missing: Callable[[str], Union[FieldValue, Skip]] = lambda _: None,
349+
on_missing: Callable[[str], FieldValue | Skip] = lambda _: None,
353350
) -> dict[str, FieldValue]:
354351
"""
355352
Extract the subset of fields from the dict by using the list of (potentially dotted)
@@ -366,7 +363,7 @@ def get_dotted_field_values(
366363
The (potentially nested) dict where the values are sourced from
367364
dotted_fields : Iterable[str]
368365
The (potentially dotted) list of field names to extract
369-
on_missing : _type_, optional
366+
on_missing : Callable[[str], FieldValue | Skip], optional
370367
The callback to control the behavior for missing fields, by default
371368
`lambda _: None` which returns missing fields with `None` value
372369

0 commit comments

Comments
 (0)