Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
prenner committed Jan 9, 2025
1 parent fed5dec commit 4f12e50
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
17 changes: 13 additions & 4 deletions python-threatexchange/threatexchange/exchanges/impl/ncmec_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 = []
Expand All @@ -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 = ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -24,7 +24,7 @@ class SignalOpinionOwnerRemoved:
'''
owner: int
category: SignalOpinionCategory
tags: t.Set[str]
tags: t.Set[str]
"""

import copy
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 4f12e50

Please sign in to comment.