Skip to content

Commit 32769c1

Browse files
committed
Merge branch 'mr/cardao/remove-bson' into 'master'
Remove bson dependency and usage Closes #53 See merge request it/e3-core!144
2 parents d1bdfdf + a4d8960 commit 32769c1

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ classifiers = [
2424
# dependencies are not installed by default. This is on purpose to avoid
2525
# importing test/coverage packages in a release install.
2626
dependencies = [
27-
"bson",
2827
"colorama",
2928
"pyyaml",
3029
"python-dateutil",

src/e3/anod/store/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
from __future__ import annotations
22

3-
from bson.objectid import ObjectId
43
from enum import StrEnum
54
import os
65
import json
76
import sqlite3
87
from packaging.version import Version
98
from typing import TYPE_CHECKING
109

10+
from e3.event import unique_id
1111
from e3.fs import cp
1212
from e3.log import getLogger
1313
from e3.anod.store.interface import (
@@ -901,7 +901,7 @@ def insert_to_component_files(
901901
"readme_id",
902902
],
903903
[
904-
str(ObjectId()),
904+
unique_id(),
905905
component_info["name"],
906906
component_info["platform"],
907907
component_info["version"],
@@ -962,7 +962,7 @@ def create_build_id(self, setup: str, date: str, version: str) -> BuildInfoDict:
962962
req_tuple = self._insert(
963963
_Store.TableName.buildinfos,
964964
["id", "build_date", "setup", "build_version"], # type: ignore[arg-type]
965-
[str(ObjectId()), date, setup, version],
965+
[unique_id(), date, setup, version],
966966
)
967967
self.connection.commit()
968968
return self._tuple_to_buildinfo(req_tuple) # type: ignore[arg-type]
@@ -976,7 +976,7 @@ def copy_build_id(self, bid: str, dest_setup: str) -> BuildInfoDict:
976976
") "
977977
" SELECT ?, build_date, ?, build_version"
978978
f" FROM {_Store.TableName.buildinfos} WHERE id=?",
979-
[str(ObjectId()), dest_setup, bid],
979+
[unique_id(), dest_setup, bid],
980980
)
981981
self.connection.commit()
982982
return self._tuple_to_buildinfo(req_tuple) # type: ignore[arg-type]
@@ -1079,7 +1079,7 @@ def _submit_file(self, file_info: FileDict) -> FileDict:
10791079
"metadata",
10801080
],
10811081
[
1082-
str(ObjectId()),
1082+
unique_id(),
10831083
file_info["name"],
10841084
file_info["alias"],
10851085
file_info["filename"],

0 commit comments

Comments
 (0)