kardioutils 1.0.20__tar.gz → 1.0.22__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.
- {kardioutils-1.0.20/kardioutils.egg-info → kardioutils-1.0.22}/PKG-INFO +1 -1
- kardioutils-1.0.22/dl2050utils/__version__.py +1 -0
- {kardioutils-1.0.20 → kardioutils-1.0.22}/dl2050utils/fdb.py +9 -6
- {kardioutils-1.0.20 → kardioutils-1.0.22}/dl2050utils/rest.py +6 -9
- {kardioutils-1.0.20 → kardioutils-1.0.22/kardioutils.egg-info}/PKG-INFO +1 -1
- kardioutils-1.0.20/dl2050utils/__version__.py +0 -1
- {kardioutils-1.0.20 → kardioutils-1.0.22}/LICENSE.txt +0 -0
- {kardioutils-1.0.20 → kardioutils-1.0.22}/README.md +0 -0
- {kardioutils-1.0.20 → kardioutils-1.0.22}/dl2050utils/__config__.py +0 -0
- {kardioutils-1.0.20 → kardioutils-1.0.22}/dl2050utils/__init__.py +0 -0
- {kardioutils-1.0.20 → kardioutils-1.0.22}/dl2050utils/api.py +0 -0
- {kardioutils-1.0.20 → kardioutils-1.0.22}/dl2050utils/auth.py +0 -0
- {kardioutils-1.0.20 → kardioutils-1.0.22}/dl2050utils/com.py +0 -0
- {kardioutils-1.0.20 → kardioutils-1.0.22}/dl2050utils/common.py +0 -0
- {kardioutils-1.0.20 → kardioutils-1.0.22}/dl2050utils/core.py +0 -0
- {kardioutils-1.0.20 → kardioutils-1.0.22}/dl2050utils/db copy.py +0 -0
- {kardioutils-1.0.20 → kardioutils-1.0.22}/dl2050utils/db.py +0 -0
- {kardioutils-1.0.20 → kardioutils-1.0.22}/dl2050utils/dbdf.py +0 -0
- {kardioutils-1.0.20 → kardioutils-1.0.22}/dl2050utils/dbutils.py +0 -0
- {kardioutils-1.0.20 → kardioutils-1.0.22}/dl2050utils/df.py +0 -0
- {kardioutils-1.0.20 → kardioutils-1.0.22}/dl2050utils/df_utils.py +0 -0
- {kardioutils-1.0.20 → kardioutils-1.0.22}/dl2050utils/env.py +0 -0
- {kardioutils-1.0.20 → kardioutils-1.0.22}/dl2050utils/etl.py +0 -0
- {kardioutils-1.0.20 → kardioutils-1.0.22}/dl2050utils/fs.py +0 -0
- {kardioutils-1.0.20 → kardioutils-1.0.22}/dl2050utils/graphql.py +0 -0
- {kardioutils-1.0.20 → kardioutils-1.0.22}/dl2050utils/gs.py +0 -0
- {kardioutils-1.0.20 → kardioutils-1.0.22}/dl2050utils/ju.py +0 -0
- {kardioutils-1.0.20 → kardioutils-1.0.22}/dl2050utils/log.py +0 -0
- {kardioutils-1.0.20 → kardioutils-1.0.22}/dl2050utils/mq.py +0 -0
- {kardioutils-1.0.20 → kardioutils-1.0.22}/dl2050utils/restapp.py +0 -0
- {kardioutils-1.0.20 → kardioutils-1.0.22}/dl2050utils/restutils.py +0 -0
- {kardioutils-1.0.20 → kardioutils-1.0.22}/dl2050utils/sqlite.py +0 -0
- {kardioutils-1.0.20 → kardioutils-1.0.22}/dl2050utils/ulists.py +0 -0
- {kardioutils-1.0.20 → kardioutils-1.0.22}/dl2050utils/wsgi.py +0 -0
- {kardioutils-1.0.20 → kardioutils-1.0.22}/kardioutils.egg-info/SOURCES.txt +0 -0
- {kardioutils-1.0.20 → kardioutils-1.0.22}/kardioutils.egg-info/dependency_links.txt +0 -0
- {kardioutils-1.0.20 → kardioutils-1.0.22}/kardioutils.egg-info/top_level.txt +0 -0
- {kardioutils-1.0.20 → kardioutils-1.0.22}/setup.cfg +0 -0
- {kardioutils-1.0.20 → kardioutils-1.0.22}/setup.py +0 -0
- {kardioutils-1.0.20 → kardioutils-1.0.22}/test/test_core.py +0 -0
- {kardioutils-1.0.20 → kardioutils-1.0.22}/test/test_db.py +0 -0
- {kardioutils-1.0.20 → kardioutils-1.0.22}/test/test_env.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
version = "1.0.22"
|
|
@@ -59,7 +59,7 @@ class FileDB():
|
|
|
59
59
|
"""
|
|
60
60
|
return f'{pre}{key}{ext}'
|
|
61
61
|
|
|
62
|
-
def save(self, key, data, pre='', ext='', save_f=pickle_save, allow_pickle=False):
|
|
62
|
+
def save(self, key, data, pre='', ext='', save_f=pickle_save, allow_pickle=False, show=False):
|
|
63
63
|
"""
|
|
64
64
|
Saves data to a file in the directory corresponding to the key.
|
|
65
65
|
Args:
|
|
@@ -81,10 +81,11 @@ class FileDB():
|
|
|
81
81
|
save_f(p, data)
|
|
82
82
|
return 0
|
|
83
83
|
except Exception as exc:
|
|
84
|
-
|
|
84
|
+
if show:
|
|
85
|
+
print(f'FileDB save Exception: {exc}')
|
|
85
86
|
return 1
|
|
86
87
|
|
|
87
|
-
def load(self, key, pre='', ext='', load_f=pickle_load, allow_pickle=False):
|
|
88
|
+
def load(self, key, pre='', ext='', load_f=pickle_load, allow_pickle=False,show=False):
|
|
88
89
|
"""
|
|
89
90
|
Loads data from a file based on the key, prefix, and extension.
|
|
90
91
|
Args:
|
|
@@ -102,10 +103,11 @@ class FileDB():
|
|
|
102
103
|
if ext=='.npy': return np.load(p, allow_pickle=allow_pickle)
|
|
103
104
|
return load_f(p)
|
|
104
105
|
except Exception as exc:
|
|
105
|
-
|
|
106
|
+
if show:
|
|
107
|
+
print(f'FileDB load Exception: {exc}')
|
|
106
108
|
return None
|
|
107
109
|
|
|
108
|
-
def delete(self, key, pre='', ext=''):
|
|
110
|
+
def delete(self, key, pre='', ext='',show=False):
|
|
109
111
|
"""
|
|
110
112
|
Deletes file based on the key, prefix, and extension.
|
|
111
113
|
Args:
|
|
@@ -121,5 +123,6 @@ class FileDB():
|
|
|
121
123
|
p.unlink()
|
|
122
124
|
return 0
|
|
123
125
|
except Exception as exc:
|
|
124
|
-
|
|
126
|
+
if show:
|
|
127
|
+
print(f'FileDB delete Exception: {exc}')
|
|
125
128
|
return 1
|
|
@@ -131,6 +131,7 @@ class ASGI_Server:
|
|
|
131
131
|
Middleware(RestEndMiddleware, LOG=self.LOG, auth=auth),
|
|
132
132
|
]
|
|
133
133
|
self.routes = auth.get_routes() + app.get_routes()
|
|
134
|
+
|
|
134
135
|
|
|
135
136
|
async def http_exception(self, request, exc):
|
|
136
137
|
"""Handles HTTP exceptions, returning a formatted error response.
|
|
@@ -175,14 +176,8 @@ class ASGI_Server:
|
|
|
175
176
|
async def shutdown(self):
|
|
176
177
|
"""Logs and performs necessary shutdown tasks for the server."""
|
|
177
178
|
self.LOG(2, 0, label="REST", label2="SHUTDOWN")
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
"""Runs the ASGI server on the specified port.
|
|
181
|
-
|
|
182
|
-
Args:
|
|
183
|
-
port (int, optional): Port to run the server. Defaults to self.port.
|
|
184
|
-
"""
|
|
185
|
-
rest = Starlette(
|
|
179
|
+
def create_app(self):
|
|
180
|
+
return Starlette(
|
|
186
181
|
debug=DEBUG,
|
|
187
182
|
exception_handlers=self.exception_handlers,
|
|
188
183
|
middleware=self.middleware,
|
|
@@ -190,8 +185,10 @@ class ASGI_Server:
|
|
|
190
185
|
on_shutdown=[self.shutdown],
|
|
191
186
|
routes=self.routes,
|
|
192
187
|
)
|
|
188
|
+
|
|
189
|
+
def run(self, port=None):
|
|
193
190
|
port = port or self.port
|
|
194
|
-
uvicorn.run(
|
|
191
|
+
uvicorn.run(self.create_app(), port=port, host="0.0.0.0", log_level="critical")
|
|
195
192
|
|
|
196
193
|
class RestStartMiddleware(BaseHTTPMiddleware):
|
|
197
194
|
"""Middleware to initialize request state.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
version = "1.0.20"
|
|
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
|
|
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
|