From 1fd3f983a58f960c7282a2ae60836841f79bdb8d Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Wed, 17 Jul 2024 13:43:39 -0700 Subject: [PATCH] data_import: Remove int detection from IdMapper. This seems to have been used only for HipChat. Signed-off-by: Anders Kaseorg --- tools/test-backend | 1 - zerver/data_import/sequencer.py | 19 ++----------------- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/tools/test-backend b/tools/test-backend index 1b3d521a2e..d2bf9c8867 100755 --- a/tools/test-backend +++ b/tools/test-backend @@ -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 diff --git a/zerver/data_import/sequencer.py b/zerver/data_import/sequencer.py index 78a734e6c5..c009d1563e 100644 --- a/zerver/data_import/sequencer.py +++ b/zerver/data_import/sequencer.py @@ -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.cnt += 1 + our_id = self.cnt self.map[their_id] = our_id return our_id