dsa-helpers 0.4.dev1__tar.gz → 0.4.dev3__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.
Files changed (30) hide show
  1. {dsa_helpers-0.4.dev1/dsa_helpers.egg-info → dsa_helpers-0.4.dev3}/PKG-INFO +1 -1
  2. {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev3}/dsa_helpers/mongo_utils.py +10 -14
  3. {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev3/dsa_helpers.egg-info}/PKG-INFO +1 -1
  4. {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev3}/pyproject.toml +1 -1
  5. {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev3}/.gitignore +0 -0
  6. {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev3}/LICENSE +0 -0
  7. {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev3}/README.md +0 -0
  8. {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev3}/app.py +0 -0
  9. {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev3}/dsa_helpers/__init__.py +0 -0
  10. {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev3}/dsa_helpers/dash/__init__.py +0 -0
  11. {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev3}/dsa_helpers/dash/header.py +0 -0
  12. {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev3}/dsa_helpers/dash/header_callbacks.py +0 -0
  13. {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev3}/dsa_helpers/girder_utils.py +0 -0
  14. {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev3}/dsa_helpers/image_utils.py +0 -0
  15. {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev3}/dsa_helpers/imread.py +0 -0
  16. {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev3}/dsa_helpers/imwrite.py +0 -0
  17. {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev3}/dsa_helpers/login.py +0 -0
  18. {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev3}/dsa_helpers/ml/__init__.py +0 -0
  19. {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev3}/dsa_helpers/ml/object_detection/__init__.py +0 -0
  20. {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev3}/dsa_helpers/ml/object_detection/get_pearce_roi_images.py +0 -0
  21. {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev3}/dsa_helpers/ml/object_detection/tile_image.py +0 -0
  22. {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev3}/dsa_helpers/ml/object_detection/utils.py +0 -0
  23. {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev3}/dsa_helpers.egg-info/SOURCES.txt +0 -0
  24. {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev3}/dsa_helpers.egg-info/dependency_links.txt +0 -0
  25. {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev3}/dsa_helpers.egg-info/requires.txt +0 -0
  26. {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev3}/dsa_helpers.egg-info/top_level.txt +0 -0
  27. {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev3}/readthedocs.yaml +0 -0
  28. {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev3}/requirements.txt +0 -0
  29. {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev3}/setup.cfg +0 -0
  30. {dsa_helpers-0.4.dev1 → dsa_helpers-0.4.dev3}/tests/test.ipynb +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dsa_helpers
3
- Version: 0.4.dev1
3
+ Version: 0.4.dev3
4
4
  Summary: Utility functions for working with the DSA girder client.
5
5
  Author-email: "Juan C. Vizcarra" <jvizcar@emory.edu>
6
6
  Maintainer-email: "Juan C. Vizcarra" <jvizcar@emory.edu>
@@ -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
- ) -> pymongo.MongoClient:
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
- pymongo.MongoClient: The mongo client.
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: pymongo.collection.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 (pymongo.collection.Collection): The mongo collection to add to.
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
 
@@ -89,10 +89,8 @@ def add_many_to_collection(
89
89
 
90
90
  operations = []
91
91
 
92
- for item in items:
93
- operations.append(
94
- pymongo.UpdateOne({"_id": item[key]}, {"$set": item}, upsert=True)
95
- )
92
+ for _id, item in items.items():
93
+ operations.append(pymongo.UpdateOne({"_id": _id}, {"$set": item}, upsert=True))
96
94
 
97
95
  for chunk in chunks(operations):
98
96
  _ = mongo_collection.bulk_write(chunk)
@@ -100,13 +98,11 @@ def add_many_to_collection(
100
98
  return items
101
99
 
102
100
 
103
- def get_img_from_db(
104
- mongo_db: pymongo.database.Database, img_id: str
105
- ) -> Union[np.ndarray, None]:
101
+ def get_img_from_db(mongo_db, img_id: str) -> Union[np.ndarray, None]:
106
102
  """Get an image from the database by its location id.
107
103
 
108
104
  Args:
109
- mongo_db (pymongo.database.Database): The mongo database.
105
+ mongo_db: The mongo database.
110
106
  img_loc (str): The image id in mongo.
111
107
 
112
108
  Returns:
@@ -131,13 +127,13 @@ def get_img_from_db(
131
127
 
132
128
 
133
129
  def add_img_to_db(
134
- mongo_db: pymongo.database.Database,
130
+ mongo_db,
135
131
  img: Image.Image | np.ndarray,
136
132
  ) -> str:
137
133
  """Add an image to the database.
138
134
 
139
135
  Args:
140
- mongo_db (pymongo.database.Database): The mongo database.
136
+ mongo_db: The mongo database.
141
137
  img (np.ndarray or PIL.Image.Image): The image.
142
138
 
143
139
  Returns:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dsa_helpers
3
- Version: 0.4.dev1
3
+ Version: 0.4.dev3
4
4
  Summary: Utility functions for working with the DSA girder client.
5
5
  Author-email: "Juan C. Vizcarra" <jvizcar@emory.edu>
6
6
  Maintainer-email: "Juan C. Vizcarra" <jvizcar@emory.edu>
@@ -31,7 +31,7 @@ classifiers = [
31
31
  "License :: OSI Approved :: MIT License",
32
32
  ]
33
33
  keywords = ["dsa", "girder", "girder_client"]
34
- version = "v0.4dev1"
34
+ version = "v0.4dev3"
35
35
 
36
36
  [project.urls]
37
37
  Repository = "https://github.com/Gutman-Lab/dsa-python-utils"
File without changes
File without changes
File without changes
File without changes