Skip to content

Commit 275e74e

Browse files
committed
stor_opts
1 parent 7e8bebd commit 275e74e

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "dean_utils"
7-
version="0.0.59"
7+
version="0.0.60"
88
authors=[
99
{ name="Dean MacGregor", email="powertrading121@gmail.com"}
1010
]

src/dean_utils/__init__.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
__all__ = [
24
"async_abfs",
35
"az_send",
@@ -14,6 +16,7 @@
1416
"update_queue",
1517
]
1618
import contextlib
19+
import os
1720

1821
from dean_utils.polars_extras import (
1922
pl_scan_hive,
@@ -65,3 +68,22 @@ def wrapper(*args, **kwargs):
6568
)
6669

6770
return wrapper
71+
72+
73+
def stor_opts(os_env: str = "Synblob") -> dict[str, str]:
74+
conn_str = os.environ.get(os_env)
75+
assert conn_str is not None
76+
return {
77+
k: y[1]
78+
for x in conn_str.split(";")
79+
if (k := _name_key((y := x.split("="))[0])) is not None
80+
}
81+
82+
83+
def _name_key(x: str) -> str | None:
84+
if x == "AccountName":
85+
return "account_name"
86+
elif x == "AccountKey":
87+
return "account_key"
88+
else:
89+
return None

0 commit comments

Comments
 (0)