zombie-squirrel 0.1.1__tar.gz → 0.1.3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: zombie-squirrel
3
- Version: 0.1.1
3
+ Version: 0.1.3
4
4
  Summary: Generated from aind-library-template
5
5
  Author: Allen Institute for Neural Dynamics
6
6
  License: MIT
@@ -0,0 +1,4 @@
1
+ """Init package"""
2
+ __version__ = "0.1.3"
3
+
4
+ from zombie_squirrel.squirrels import unique_project_names
@@ -4,10 +4,7 @@ import pandas as pd
4
4
  import os
5
5
 
6
6
  from aind_data_access_api.rds_tables import Client, RDSCredentials
7
-
8
-
9
- def prefix_table_name(table_name: str) -> str:
10
- return "zs_" + table_name
7
+ from zombie_squirrel.utils import prefix_table_name
11
8
 
12
9
 
13
10
  class Acorn(ABC):
@@ -5,6 +5,7 @@ from zombie_squirrel.acorns import RedshiftAcorn, MemoryAcorn
5
5
  from aind_data_access_api.document_db import MetadataDbClient
6
6
  import os
7
7
  import logging
8
+ from zombie_squirrel.utils import prefix_table_name, rds_get_handle_empty
8
9
 
9
10
  # --- Backend setup ---------------------------------------------------
10
11
 
@@ -42,11 +43,7 @@ NAMES = {
42
43
 
43
44
  @register_squirrel(NAMES["upn"])
44
45
  def unique_project_names(force_update: bool = False) -> list[str]:
45
- try:
46
- df = ACORN.scurry(NAMES["upn"])
47
- except Exception as e:
48
- logging.warning(f"Error fetching from cache: {e}")
49
- df = pd.DataFrame()
46
+ df = rds_get_handle_empty(ACORN, NAMES["upn"])
50
47
 
51
48
  if df.empty or force_update:
52
49
  # If cache is missing, fetch data
@@ -69,7 +66,7 @@ def unique_project_names(force_update: bool = False) -> list[str]:
69
66
 
70
67
  @register_squirrel(NAMES["usi"])
71
68
  def unique_subject_ids(force_update: bool = False) -> list[str]:
72
- df = ACORN.scurry(NAMES["usi"])
69
+ df = rds_get_handle_empty(ACORN, NAMES["usi"])
73
70
 
74
71
  if df.empty or force_update:
75
72
  # If cache is missing, fetch data
@@ -0,0 +1,20 @@
1
+ """Utility functions"""
2
+ import pandas as pd
3
+ import logging
4
+
5
+ from zombie_squirrel.acorns import Acorn
6
+
7
+
8
+ def prefix_table_name(table_name: str) -> str:
9
+ return "zs_" + table_name
10
+
11
+
12
+ def rds_get_handle_empty(acorn: Acorn, table_name: str) -> pd.DataFrame:
13
+ """Utility function for testing purposes."""
14
+ try:
15
+ df = acorn.scurry(table_name)
16
+ except Exception as e:
17
+ logging.warning(f"Error fetching from cache: {e}")
18
+ df = pd.DataFrame()
19
+
20
+ return df
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: zombie-squirrel
3
- Version: 0.1.1
3
+ Version: 0.1.3
4
4
  Summary: Generated from aind-library-template
5
5
  Author: Allen Institute for Neural Dynamics
6
6
  License: MIT
@@ -6,6 +6,7 @@ src/zombie_squirrel/__init__.py
6
6
  src/zombie_squirrel/acorns.py
7
7
  src/zombie_squirrel/squirrels.py
8
8
  src/zombie_squirrel/sync.py
9
+ src/zombie_squirrel/utils.py
9
10
  src/zombie_squirrel.egg-info/PKG-INFO
10
11
  src/zombie_squirrel.egg-info/SOURCES.txt
11
12
  src/zombie_squirrel.egg-info/dependency_links.txt
@@ -1,4 +0,0 @@
1
- """Init package"""
2
- __version__ = "0.1.1"
3
-
4
- from zombie_squirrel.squirrels import unique_project_names
File without changes