dsa-helpers 0.4.dev1__tar.gz → 0.4.dev2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {dsa_helpers-0.4.dev1/dsa_helpers.egg-info → dsa_helpers-0.4.dev2}/PKG-INFO +1 -1
- {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev2}/dsa_helpers/mongo_utils.py +8 -10
- {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev2/dsa_helpers.egg-info}/PKG-INFO +1 -1
- {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev2}/pyproject.toml +1 -1
- {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev2}/.gitignore +0 -0
- {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev2}/LICENSE +0 -0
- {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev2}/README.md +0 -0
- {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev2}/app.py +0 -0
- {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev2}/dsa_helpers/__init__.py +0 -0
- {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev2}/dsa_helpers/dash/__init__.py +0 -0
- {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev2}/dsa_helpers/dash/header.py +0 -0
- {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev2}/dsa_helpers/dash/header_callbacks.py +0 -0
- {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev2}/dsa_helpers/girder_utils.py +0 -0
- {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev2}/dsa_helpers/image_utils.py +0 -0
- {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev2}/dsa_helpers/imread.py +0 -0
- {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev2}/dsa_helpers/imwrite.py +0 -0
- {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev2}/dsa_helpers/login.py +0 -0
- {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev2}/dsa_helpers/ml/__init__.py +0 -0
- {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev2}/dsa_helpers/ml/object_detection/__init__.py +0 -0
- {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev2}/dsa_helpers/ml/object_detection/get_pearce_roi_images.py +0 -0
- {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev2}/dsa_helpers/ml/object_detection/tile_image.py +0 -0
- {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev2}/dsa_helpers/ml/object_detection/utils.py +0 -0
- {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev2}/dsa_helpers.egg-info/SOURCES.txt +0 -0
- {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev2}/dsa_helpers.egg-info/dependency_links.txt +0 -0
- {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev2}/dsa_helpers.egg-info/requires.txt +0 -0
- {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev2}/dsa_helpers.egg-info/top_level.txt +0 -0
- {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev2}/readthedocs.yaml +0 -0
- {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev2}/requirements.txt +0 -0
- {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev2}/setup.cfg +0 -0
- {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev2}/tests/test.ipynb +0 -0
|
@@ -13,7 +13,7 @@ def get_mongo_client(
|
|
|
13
13
|
username: str | None = None,
|
|
14
14
|
password: str | None = None,
|
|
15
15
|
port: int | None = None,
|
|
16
|
-
)
|
|
16
|
+
):
|
|
17
17
|
"""Get a mongo client by providing the key parts of the URL. By default
|
|
18
18
|
when the parameters are not passed, it sets them to default values first
|
|
19
19
|
by looking at key environment variables. If the environment variables are
|
|
@@ -36,7 +36,7 @@ def get_mongo_client(
|
|
|
36
36
|
missing it will default to 27017.
|
|
37
37
|
|
|
38
38
|
Returns:
|
|
39
|
-
|
|
39
|
+
The mongo client.
|
|
40
40
|
|
|
41
41
|
"""
|
|
42
42
|
if username is None:
|
|
@@ -67,7 +67,7 @@ def chunks(lst: list, n=500):
|
|
|
67
67
|
|
|
68
68
|
|
|
69
69
|
def add_many_to_collection(
|
|
70
|
-
mongo_collection
|
|
70
|
+
mongo_collection,
|
|
71
71
|
items: dict | list,
|
|
72
72
|
key: str = "_id",
|
|
73
73
|
) -> dict[str | dict]:
|
|
@@ -75,7 +75,7 @@ def add_many_to_collection(
|
|
|
75
75
|
user key.
|
|
76
76
|
|
|
77
77
|
Args:
|
|
78
|
-
mongo_collection
|
|
78
|
+
mongo_collection: The mongo collection to add to.
|
|
79
79
|
items (dict | list): The items to add to the collection.
|
|
80
80
|
key (str): The key to use to identify the items.
|
|
81
81
|
|
|
@@ -100,13 +100,11 @@ def add_many_to_collection(
|
|
|
100
100
|
return items
|
|
101
101
|
|
|
102
102
|
|
|
103
|
-
def get_img_from_db(
|
|
104
|
-
mongo_db: pymongo.database.Database, img_id: str
|
|
105
|
-
) -> Union[np.ndarray, None]:
|
|
103
|
+
def get_img_from_db(mongo_db, img_id: str) -> Union[np.ndarray, None]:
|
|
106
104
|
"""Get an image from the database by its location id.
|
|
107
105
|
|
|
108
106
|
Args:
|
|
109
|
-
mongo_db
|
|
107
|
+
mongo_db: The mongo database.
|
|
110
108
|
img_loc (str): The image id in mongo.
|
|
111
109
|
|
|
112
110
|
Returns:
|
|
@@ -131,13 +129,13 @@ def get_img_from_db(
|
|
|
131
129
|
|
|
132
130
|
|
|
133
131
|
def add_img_to_db(
|
|
134
|
-
mongo_db
|
|
132
|
+
mongo_db,
|
|
135
133
|
img: Image.Image | np.ndarray,
|
|
136
134
|
) -> str:
|
|
137
135
|
"""Add an image to the database.
|
|
138
136
|
|
|
139
137
|
Args:
|
|
140
|
-
mongo_db
|
|
138
|
+
mongo_db: The mongo database.
|
|
141
139
|
img (np.ndarray or PIL.Image.Image): The image.
|
|
142
140
|
|
|
143
141
|
Returns:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|