From 4f12e50fcecb2c2cc37a315ddd06b3eb41bbb5b2 Mon Sep 17 00:00:00 2001 From: Patrick Renner Date: Thu, 9 Jan 2025 10:11:00 -0600 Subject: [PATCH] lint --- .../threatexchange/exchanges/impl/ncmec_api.py | 17 +++++++++++++---- .../exchanges/tests/test_state_compatibility.py | 6 +++--- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/python-threatexchange/threatexchange/exchanges/impl/ncmec_api.py b/python-threatexchange/threatexchange/exchanges/impl/ncmec_api.py index 1cf35eb5d..eedd737f5 100644 --- a/python-threatexchange/threatexchange/exchanges/impl/ncmec_api.py +++ b/python-threatexchange/threatexchange/exchanges/impl/ncmec_api.py @@ -282,7 +282,9 @@ def log(event: str) -> None: updates: t.List[api.NCMECEntryUpdate] = [] for i, entry in enumerate( client.get_entries_iter( - start_timestamp=current_start, end_timestamp=current_end, next_=current_next_fetch, + start_timestamp=current_start, + end_timestamp=current_end, + next_=current_next_fetch, ) ): if i == 0: # First batch, check for overfetch @@ -315,8 +317,11 @@ def log(event: str) -> None: log(f"large fetch ({i}), up to {len(updates)}. storing checkpoint") yield state.FetchDelta( {f"{entry.member_id}-{entry.id}": entry for entry in updates}, - NCMECCheckpoint(get_entries_max_ts=current_start, next_fetch=entry.next, last_fetch_time=int(time.time())), - + NCMECCheckpoint( + get_entries_max_ts=current_start, + next_fetch=entry.next, + last_fetch_time=int(time.time()), + ), ) current_next_fetch = entry.next updates = [] @@ -342,7 +347,11 @@ def log(event: str) -> None: low_fetch_counter = 0 yield state.FetchDelta( {f"{entry.member_id}-{entry.id}": entry for entry in updates}, - NCMECCheckpoint(get_entries_max_ts=current_end, next_fetch="", last_fetch_time=int(time.time())), + NCMECCheckpoint( + get_entries_max_ts=current_end, + next_fetch="", + last_fetch_time=int(time.time()), + ), ) current_start = current_end current_next_fetch = "" diff --git a/python-threatexchange/threatexchange/exchanges/tests/test_state_compatibility.py b/python-threatexchange/threatexchange/exchanges/tests/test_state_compatibility.py index 11f7ccc7f..994d10a51 100644 --- a/python-threatexchange/threatexchange/exchanges/tests/test_state_compatibility.py +++ b/python-threatexchange/threatexchange/exchanges/tests/test_state_compatibility.py @@ -11,7 +11,7 @@ In the test cases, the class descriptions will be used for context, so include: - 1. The last version it was available + 1. The last version it was available 2. The change i.e. @@ -24,7 +24,7 @@ class SignalOpinionOwnerRemoved: ''' owner: int category: SignalOpinionCategory - tags: t.Set[str] + tags: t.Set[str] """ import copy @@ -148,7 +148,7 @@ def get_NCMECCheckpoint() -> t.Tuple[NCMECCheckpoint, t.Sequence[object]]: max_ts = 1197433091 # 1.0.x - current = NCMECCheckpoint(get_entries_max_ts=max_ts) + current = NCMECCheckpoint(get_entries_max_ts=max_ts, next="", last_fetch_time=0) # 0.99.x @dataclass