data_import: Remove int detection from IdMapper.

This seems to have been used only for HipChat.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2024-07-17 13:43:39 -07:00 committed by Tim Abbott
parent daadf28260
commit 1fd3f983a5
2 changed files with 2 additions and 18 deletions

View File

@ -118,7 +118,6 @@ not_yet_fully_covered = [
"zerver/tornado/sharding.py",
"zerver/tornado/views.py",
# Data import files; relatively low priority
"zerver/data_import/sequencer.py",
"zerver/data_import/slack.py",
"zerver/data_import/import_util.py",
# Webhook integrations with incomplete coverage

View File

@ -54,15 +54,6 @@ import of the file.
NEXT_ID = sequencer()
def is_int(key: Any) -> bool:
try:
n = int(key)
except ValueError:
return False
return n <= 999999999
class IdMapper:
def __init__(self) -> None:
self.map: dict[Any, int] = {}
@ -75,13 +66,7 @@ class IdMapper:
if their_id in self.map:
return self.map[their_id]
if is_int(their_id):
our_id = int(their_id)
if self.cnt > 0:
raise Exception("mixed key styles")
else:
self.cnt += 1
our_id = self.cnt
self.map[their_id] = our_id
return our_id