Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

data_import: Remove int detection from IdMapper.

Anders Kaseorg1fd3f983a58f
diff --git a/tools/test-backend b/tools/test-backend
index 1b3d521a2e1..d2bf9c8867d 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 78a734e6c5f..c009d1563e7 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