Skip to content

Commit 7a71385

Browse files
committed
Apply ruff formatting
1 parent a98b39d commit 7a71385

3 files changed

Lines changed: 7 additions & 9 deletions

File tree

ioc_finder/ioc_grammars.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -288,10 +288,7 @@ def hasBothOrNeitherAngleBrackets(string):
288288
+ Combine(
289289
# we use `Or([Literal("ua-")...` instead of something like `CaselessLiteral("ua-")` b/c...
290290
# we only want to parse "ua" when it is all upper or lowercased (not "uA" or other, similar variations)
291-
one_of("ua- UA-")
292-
+ Word(nums, min=6)("account_number")
293-
+ "-"
294-
+ Word(nums)("property_number")
291+
one_of("ua- UA-") + Word(nums, min=6)("account_number") + "-" + Word(nums)("property_number")
295292
).set_parse_action(pyparsing_common.upcase_tokens)
296293
+ alphanum_word_end
297294
)

tests/find_iocs_cases/feature__included_ioc_types.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,10 @@
5050

5151
# this is a hack to be fixed in https://github.com/fhightower/ioc-finder/issues/224
5252
# imphashes and authentihashes require the hash to be prefixed with `imphash` and `authentihash` respectively, but when parsed, only the hash itself will be present
53-
all_ioc_text = all_ioc_text.replace(IOC_EXAMPLES["imphashes"][0], f'imphash {IOC_EXAMPLES["imphashes"][0]}') # type: ignore
53+
all_ioc_text = all_ioc_text.replace(IOC_EXAMPLES["imphashes"][0], f"imphash {IOC_EXAMPLES['imphashes'][0]}") # type: ignore
5454
all_ioc_text = all_ioc_text.replace(
55-
IOC_EXAMPLES["authentihashes"][0], f'authentihash {IOC_EXAMPLES["authentihashes"][0]}' # type: ignore
55+
IOC_EXAMPLES["authentihashes"][0],
56+
f"authentihash {IOC_EXAMPLES['authentihashes'][0]}", # type: ignore
5657
)
5758
all_ioc_text = all_ioc_text.replace(IOC_EXAMPLES["user_agents"][0], IOC_EXAMPLES["user_agents"][0].rstrip(" TLP")) # type: ignore
5859
# add the attack data

tests/test_find_iocs.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ def test_find_iocs(text: str, results: Dict, args: Dict) -> None:
2323

2424

2525
def _compare_lists(key_name: str, ioc_list: IndicatorList, result_list: IndicatorList) -> None:
26-
assert sorted(ioc_list) == sorted(
27-
result_list
28-
), f"Unexpected result for key '[{key_name}]' -> Expected: '{result_list}' Received: '{ioc_list}'"
26+
assert sorted(ioc_list) == sorted(result_list), (
27+
f"Unexpected result for key '[{key_name}]' -> Expected: '{result_list}' Received: '{ioc_list}'"
28+
)
2929

3030

3131
def _compare_dicts(key_name: str, ioc_dict: IndicatorDict, result_dict: IndicatorDict) -> None:

0 commit comments

Comments
 (0)