OpenGeodeWeb-Back 5.10.0rc5__py3-none-any.whl → 5.10.0rc6__py3-none-any.whl
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.
- opengeodeweb_back/geode_functions.py +2 -2
- opengeodeweb_back/geode_objects.py +6 -6
- opengeodeweb_back/utils_functions.py +38 -31
- {opengeodeweb_back-5.10.0rc5.dist-info → opengeodeweb_back-5.10.0rc6.dist-info}/METADATA +1 -1
- {opengeodeweb_back-5.10.0rc5.dist-info → opengeodeweb_back-5.10.0rc6.dist-info}/RECORD +8 -8
- {opengeodeweb_back-5.10.0rc5.dist-info → opengeodeweb_back-5.10.0rc6.dist-info}/WHEEL +0 -0
- {opengeodeweb_back-5.10.0rc5.dist-info → opengeodeweb_back-5.10.0rc6.dist-info}/licenses/LICENSE +0 -0
- {opengeodeweb_back-5.10.0rc5.dist-info → opengeodeweb_back-5.10.0rc6.dist-info}/top_level.txt +0 -0
@@ -1,12 +1,12 @@
|
|
1
1
|
# Standard library imports
|
2
2
|
|
3
3
|
# Third party imports
|
4
|
-
import opengeode as og
|
5
|
-
import opengeode_io as og_io
|
6
|
-
import opengeode_inspector as og_inspector
|
7
|
-
import opengeode_geosciences as og_gs
|
8
|
-
import opengeode_geosciencesio as og_gs_io
|
9
|
-
import geode_viewables as g_v
|
4
|
+
import opengeode as og # type: ignore
|
5
|
+
import opengeode_io as og_io # type: ignore
|
6
|
+
import opengeode_inspector as og_inspector # type: ignore
|
7
|
+
import opengeode_geosciences as og_gs # type: ignore
|
8
|
+
import opengeode_geosciencesio as og_gs_io # type: ignore
|
9
|
+
import geode_viewables as g_v # type: ignore
|
10
10
|
|
11
11
|
# Local application imports
|
12
12
|
|
@@ -4,52 +4,55 @@ import threading
|
|
4
4
|
import time
|
5
5
|
import uuid
|
6
6
|
import zipfile
|
7
|
+
from collections.abc import Callable
|
8
|
+
from typing import Any
|
7
9
|
|
8
10
|
# Third party imports
|
9
11
|
import flask
|
10
|
-
import fastjsonschema
|
12
|
+
import fastjsonschema # type: ignore
|
11
13
|
import importlib.metadata as metadata
|
12
14
|
import shutil
|
15
|
+
from werkzeug.exceptions import HTTPException
|
13
16
|
import werkzeug
|
14
17
|
|
15
18
|
# Local application imports
|
16
19
|
from . import geode_functions
|
17
20
|
|
18
21
|
|
19
|
-
def increment_request_counter(current_app):
|
22
|
+
def increment_request_counter(current_app: flask.Flask) -> None:
|
20
23
|
if "REQUEST_COUNTER" in current_app.config:
|
21
|
-
REQUEST_COUNTER = int(current_app.config.get("REQUEST_COUNTER"))
|
24
|
+
REQUEST_COUNTER = int(current_app.config.get("REQUEST_COUNTER", 0))
|
22
25
|
REQUEST_COUNTER += 1
|
23
26
|
current_app.config.update(REQUEST_COUNTER=REQUEST_COUNTER)
|
24
27
|
|
25
28
|
|
26
|
-
def decrement_request_counter(current_app):
|
29
|
+
def decrement_request_counter(current_app: flask.Flask) -> None:
|
27
30
|
if "REQUEST_COUNTER" in current_app.config:
|
28
|
-
REQUEST_COUNTER = int(current_app.config.get("REQUEST_COUNTER"))
|
31
|
+
REQUEST_COUNTER = int(current_app.config.get("REQUEST_COUNTER", 0))
|
29
32
|
REQUEST_COUNTER -= 1
|
30
33
|
current_app.config.update(REQUEST_COUNTER=REQUEST_COUNTER)
|
31
34
|
|
32
35
|
|
33
|
-
def update_last_request_time(current_app):
|
36
|
+
def update_last_request_time(current_app: flask.Flask) -> None:
|
34
37
|
if "LAST_REQUEST_TIME" in current_app.config:
|
35
38
|
LAST_REQUEST_TIME = time.time()
|
36
39
|
current_app.config.update(LAST_REQUEST_TIME=LAST_REQUEST_TIME)
|
37
40
|
|
38
41
|
|
39
|
-
def before_request(current_app):
|
42
|
+
def before_request(current_app: flask.Flask) -> None:
|
40
43
|
increment_request_counter(current_app)
|
41
44
|
|
42
45
|
|
43
|
-
def teardown_request(current_app):
|
46
|
+
def teardown_request(current_app: flask.Flask) -> None:
|
44
47
|
decrement_request_counter(current_app)
|
45
48
|
update_last_request_time(current_app)
|
46
49
|
|
47
50
|
|
48
|
-
def kill_task(current_app):
|
49
|
-
REQUEST_COUNTER = int(current_app.config.get("REQUEST_COUNTER"))
|
50
|
-
LAST_PING_TIME = float(current_app.config.get("LAST_PING_TIME"))
|
51
|
-
LAST_REQUEST_TIME = float(current_app.config.get("LAST_REQUEST_TIME"))
|
52
|
-
MINUTES_BEFORE_TIMEOUT = float(current_app.config.get("MINUTES_BEFORE_TIMEOUT"))
|
51
|
+
def kill_task(current_app: flask.Flask) -> None:
|
52
|
+
REQUEST_COUNTER = int(current_app.config.get("REQUEST_COUNTER", 0))
|
53
|
+
LAST_PING_TIME = float(current_app.config.get("LAST_PING_TIME", 0))
|
54
|
+
LAST_REQUEST_TIME = float(current_app.config.get("LAST_REQUEST_TIME", 0))
|
55
|
+
MINUTES_BEFORE_TIMEOUT = float(current_app.config.get("MINUTES_BEFORE_TIMEOUT", 0))
|
53
56
|
current_time = time.time()
|
54
57
|
minutes_since_last_request = (current_time - LAST_REQUEST_TIME) / 60
|
55
58
|
minutes_since_last_ping = (current_time - LAST_PING_TIME) / 60
|
@@ -64,12 +67,12 @@ def kill_task(current_app):
|
|
64
67
|
kill_server()
|
65
68
|
|
66
69
|
|
67
|
-
def kill_server():
|
70
|
+
def kill_server() -> None:
|
68
71
|
print("Server timed out due to inactivity, shutting down...", flush=True)
|
69
72
|
os._exit(0)
|
70
73
|
|
71
74
|
|
72
|
-
def versions(list_packages: list):
|
75
|
+
def versions(list_packages: list[str]) -> list[dict[str, str]]:
|
73
76
|
list_with_versions = []
|
74
77
|
for package in list_packages:
|
75
78
|
list_with_versions.append(
|
@@ -78,7 +81,7 @@ def versions(list_packages: list):
|
|
78
81
|
return list_with_versions
|
79
82
|
|
80
83
|
|
81
|
-
def validate_request(request, schema):
|
84
|
+
def validate_request(request: flask.Request, schema: dict[str, str]) -> None:
|
82
85
|
json_data = request.get_json(force=True, silent=True)
|
83
86
|
|
84
87
|
if json_data is None:
|
@@ -92,22 +95,26 @@ def validate_request(request, schema):
|
|
92
95
|
flask.abort(400, error_msg)
|
93
96
|
|
94
97
|
|
95
|
-
def set_interval(
|
96
|
-
|
97
|
-
|
98
|
-
|
98
|
+
def set_interval(
|
99
|
+
function: Callable[[Any], None], seconds: float, args: Any
|
100
|
+
) -> threading.Timer:
|
101
|
+
def function_wrapper() -> None:
|
102
|
+
set_interval(function, seconds, args)
|
103
|
+
function(args)
|
99
104
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
return
|
105
|
+
timer = threading.Timer(seconds, function_wrapper)
|
106
|
+
timer.daemon = True
|
107
|
+
timer.start()
|
108
|
+
return timer
|
104
109
|
|
105
110
|
|
106
|
-
def extension_from_filename(filename):
|
111
|
+
def extension_from_filename(filename: str) -> str:
|
107
112
|
return os.path.splitext(filename)[1][1:]
|
108
113
|
|
109
114
|
|
110
|
-
def send_file(
|
115
|
+
def send_file(
|
116
|
+
upload_folder: str, saved_files: str, new_file_name: str
|
117
|
+
) -> flask.Response:
|
111
118
|
if len(saved_files) == 1:
|
112
119
|
mimetype = "application/octet-binary"
|
113
120
|
else:
|
@@ -132,13 +139,13 @@ def send_file(upload_folder, saved_files, new_file_name):
|
|
132
139
|
return response
|
133
140
|
|
134
141
|
|
135
|
-
def handle_exception(
|
136
|
-
response =
|
142
|
+
def handle_exception(exception: HTTPException) -> flask.Response:
|
143
|
+
response = exception.get_response()
|
137
144
|
response.data = flask.json.dumps(
|
138
145
|
{
|
139
|
-
"code":
|
140
|
-
"name":
|
141
|
-
"description":
|
146
|
+
"code": exception.code,
|
147
|
+
"name": exception.name,
|
148
|
+
"description": exception.description,
|
142
149
|
}
|
143
150
|
)
|
144
151
|
response.content_type = "application/json"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: OpenGeodeWeb-Back
|
3
|
-
Version: 5.10.
|
3
|
+
Version: 5.10.0rc6
|
4
4
|
Summary: OpenGeodeWeb-Back is an open source framework that proposes handy python functions and wrappers for the OpenGeode ecosystem
|
5
5
|
Author-email: Geode-solutions <team-web@geode-solutions.com>
|
6
6
|
Project-URL: Homepage, https://github.com/Geode-solutions/OpenGeodeWeb-Back
|
@@ -1,9 +1,9 @@
|
|
1
1
|
opengeodeweb_back/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
2
|
opengeodeweb_back/app_config.py,sha256=gJfYxDJOa_PYLqjqgdXacp3W3F109uujE9LGPvzHOkc,728
|
3
|
-
opengeodeweb_back/geode_functions.py,sha256=
|
4
|
-
opengeodeweb_back/geode_objects.py,sha256=
|
3
|
+
opengeodeweb_back/geode_functions.py,sha256=1Y7o3NjGJxoW1O2s4KEIZ1C5tN5x-EqPNGVnIPzi-Ak,10208
|
4
|
+
opengeodeweb_back/geode_objects.py,sha256=uXCKX8AOdXkItqmYItLnFfHcIBiMFaeN_WmGs4j64Ro,27782
|
5
5
|
opengeodeweb_back/test_utils.py,sha256=18AbRW9-tfKkPcmRGilTTHXI7S3armYyV7Vdy5UvUKM,794
|
6
|
-
opengeodeweb_back/utils_functions.py,sha256=
|
6
|
+
opengeodeweb_back/utils_functions.py,sha256=LGff8qlAnpJ2AI2XRF7YFTWNFwnrrl_ddKuMi7buwx4,7676
|
7
7
|
opengeodeweb_back/routes/blueprint_routes.py,sha256=3fxMR9fs0BqnOiYhKFacGdxWm7JFLz5i5PvUqYgB5z4,11308
|
8
8
|
opengeodeweb_back/routes/models/blueprint_models.py,sha256=PAyHSKjsvVm5gGfjUyWAnODmE0BJMsIWc1AWl0F3bO0,1955
|
9
9
|
opengeodeweb_back/routes/models/schemas/mesh_components.json,sha256=3OQvI4pUCe77WGC46tEr37rEWigQ6n2nsfGUTZRY074,419
|
@@ -22,8 +22,8 @@ opengeodeweb_back/routes/schemas/save_viewable_file.json,sha256=pvvEdaC7bNASPMrl
|
|
22
22
|
opengeodeweb_back/routes/schemas/texture_coordinates.json,sha256=oW84Vh34KfleK935fmMXnqJXy-vaLDd7g87O_PtSzfY,429
|
23
23
|
opengeodeweb_back/routes/schemas/upload_file.json,sha256=LJ3U3L5ApKuQDVFIpVT_y2alq4HW_suTvZ3HUucNbhg,219
|
24
24
|
opengeodeweb_back/routes/schemas/vertex_attribute_names.json,sha256=bmXG0pzVHMUTZY_0iu6ruX7eMUVk8wr2H1o4eEtBlg0,432
|
25
|
-
opengeodeweb_back-5.10.
|
26
|
-
opengeodeweb_back-5.10.
|
27
|
-
opengeodeweb_back-5.10.
|
28
|
-
opengeodeweb_back-5.10.
|
29
|
-
opengeodeweb_back-5.10.
|
25
|
+
opengeodeweb_back-5.10.0rc6.dist-info/licenses/LICENSE,sha256=LoTB-aqQvzTGxoTRXNnhNV0LKiqdk2bQv6MB34l8zkI,1079
|
26
|
+
opengeodeweb_back-5.10.0rc6.dist-info/METADATA,sha256=A9HvSi33ZOiIF50sSHtqlI1Ml0yno415I1wIpVFm-xE,2676
|
27
|
+
opengeodeweb_back-5.10.0rc6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
28
|
+
opengeodeweb_back-5.10.0rc6.dist-info/top_level.txt,sha256=tN1FZeLIVBrdja2-pbmhg5-tK-JILmmT9OeIBnhlUrQ,18
|
29
|
+
opengeodeweb_back-5.10.0rc6.dist-info/RECORD,,
|
File without changes
|
{opengeodeweb_back-5.10.0rc5.dist-info → opengeodeweb_back-5.10.0rc6.dist-info}/licenses/LICENSE
RENAMED
File without changes
|
{opengeodeweb_back-5.10.0rc5.dist-info → opengeodeweb_back-5.10.0rc6.dist-info}/top_level.txt
RENAMED
File without changes
|