Skip to content

Commit 8f6af11

Browse files
SpliiTgithub-actions[bot]
authored andcommitted
Apply prepare changes
1 parent 3aeb276 commit 8f6af11

File tree

4 files changed

+31
-11
lines changed

4 files changed

+31
-11
lines changed

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,3 @@ werkzeug==3.1.2
6060
# flask
6161
# flask-cors
6262

63-
opengeodeweb-microservice==1.*,>=1.0.11rc1

src/opengeodeweb_back/routes/blueprint_routes.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737

3838
schemas_dict = get_schemas_dict(os.path.join(os.path.dirname(__file__), "schemas"))
3939

40+
4041
@routes.route(
4142
schemas_dict["allowed_files"]["route"],
4243
methods=schemas_dict["allowed_files"]["methods"],
@@ -49,6 +50,7 @@ def allowed_files() -> flask.Response:
4950
extensions.add(extension)
5051
return flask.make_response({"extensions": list(extensions)}, 200)
5152

53+
5254
@routes.route(
5355
schemas_dict["upload_file"]["route"],
5456
methods=schemas_dict["upload_file"]["methods"],
@@ -63,6 +65,7 @@ def upload_file() -> flask.Response:
6365
file.save(os.path.join(UPLOAD_FOLDER, filename))
6466
return flask.make_response({"message": "File uploaded"}, 201)
6567

68+
6669
@routes.route(
6770
schemas_dict["allowed_objects"]["route"],
6871
methods=schemas_dict["allowed_objects"]["methods"],
@@ -88,6 +91,7 @@ def allowed_objects() -> flask.Response:
8891
}
8992
return flask.make_response({"allowed_objects": allowed_objects}, 200)
9093

94+
9195
@routes.route(
9296
schemas_dict["missing_files"]["route"],
9397
methods=schemas_dict["missing_files"]["methods"],
@@ -126,6 +130,7 @@ def missing_files() -> flask.Response:
126130
200,
127131
)
128132

133+
129134
@routes.route(
130135
schemas_dict["geographic_coordinate_systems"]["route"],
131136
methods=schemas_dict["geographic_coordinate_systems"]["methods"],
@@ -150,6 +155,7 @@ def crs_converter_geographic_coordinate_systems() -> flask.Response:
150155
crs_list.append(crs)
151156
return flask.make_response({"crs_list": crs_list}, 200)
152157

158+
153159
@routes.route(
154160
schemas_dict["inspect_file"]["route"],
155161
methods=schemas_dict["inspect_file"]["methods"],
@@ -167,6 +173,7 @@ def inspect_file() -> flask.Response:
167173
inspection_result = extract_inspector_result(inspection_data)
168174
return flask.make_response({"inspection_result": inspection_result}, 200)
169175

176+
170177
def extract_inspector_result(inspection_data: Any) -> object:
171178
new_object = {}
172179

@@ -194,6 +201,7 @@ def extract_inspector_result(inspection_data: Any) -> object:
194201
new_object["issues"] = issues
195202
return new_object
196203

204+
197205
@routes.route(
198206
schemas_dict["geode_objects_and_output_extensions"]["route"],
199207
methods=schemas_dict["geode_objects_and_output_extensions"]["methods"],
@@ -215,6 +223,7 @@ def geode_objects_and_output_extensions() -> flask.Response:
215223
200,
216224
)
217225

226+
218227
@routes.route(
219228
schemas_dict["save_viewable_file"]["route"],
220229
methods=schemas_dict["save_viewable_file"]["methods"],
@@ -232,6 +241,7 @@ def save_viewable_file() -> flask.Response:
232241
200,
233242
)
234243

244+
235245
@routes.route(
236246
schemas_dict["texture_coordinates"]["route"],
237247
methods=schemas_dict["texture_coordinates"]["methods"],
@@ -247,6 +257,7 @@ def texture_coordinates() -> flask.Response:
247257
texture_coordinates = geode_object.texture_manager().texture_names()
248258
return flask.make_response({"texture_coordinates": texture_coordinates}, 200)
249259

260+
250261
@routes.route(
251262
schemas_dict["vertex_attribute_names"]["route"],
252263
methods=schemas_dict["vertex_attribute_names"]["methods"],
@@ -267,6 +278,7 @@ def vertex_attribute_names() -> flask.Response:
267278
200,
268279
)
269280

281+
270282
@routes.route(
271283
schemas_dict["cell_attribute_names"]["route"],
272284
methods=schemas_dict["cell_attribute_names"]["methods"],
@@ -287,6 +299,7 @@ def cell_attribute_names() -> flask.Response:
287299
200,
288300
)
289301

302+
290303
@routes.route(
291304
schemas_dict["polygon_attribute_names"]["route"],
292305
methods=schemas_dict["polygon_attribute_names"]["methods"],
@@ -307,6 +320,7 @@ def polygon_attribute_names() -> flask.Response:
307320
200,
308321
)
309322

323+
310324
@routes.route(
311325
schemas_dict["polyhedron_attribute_names"]["route"],
312326
methods=schemas_dict["polyhedron_attribute_names"]["methods"],
@@ -329,6 +343,7 @@ def polyhedron_attribute_names() -> flask.Response:
329343
200,
330344
)
331345

346+
332347
@routes.route(
333348
schemas_dict["ping"]["route"],
334349
methods=schemas_dict["ping"]["methods"],
@@ -338,12 +353,14 @@ def ping() -> flask.Response:
338353
flask.current_app.config.update(LAST_PING_TIME=time.time())
339354
return flask.make_response({"message": "Flask server is running"}, 200)
340355

356+
341357
@routes.route(schemas_dict["kill"]["route"], methods=schemas_dict["kill"]["methods"])
342358
def kill() -> flask.Response:
343359
print("Manual server kill, shutting down...", flush=True)
344360
os._exit(0)
345361
return flask.make_response({"message": "Flask server is dead"}, 200)
346362

363+
347364
@routes.route(
348365
schemas_dict["export_project"]["route"],
349366
methods=schemas_dict["export_project"]["methods"],
@@ -365,12 +382,9 @@ def export_project() -> flask.Response:
365382
with get_session() as session:
366383
session.query(Data).filter(
367384
(Data.input_file == None) | (Data.input_file == "")
368-
).update(
369-
{Data.input_file: Data.native_file},
370-
synchronize_session=False
371-
)
385+
).update({Data.input_file: Data.native_file}, synchronize_session=False)
372386
session.commit()
373-
387+
374388
rows = session.query(Data.id, Data.input_file, Data.additional_files).all()
375389

376390
with zipfile.ZipFile(
@@ -400,6 +414,7 @@ def export_project() -> flask.Response:
400414

401415
return utils_functions.send_file(project_folder, [export_vease_path], filename)
402416

417+
403418
@routes.route(
404419
schemas_dict["import_project"]["route"],
405420
methods=schemas_dict["import_project"]["methods"],

tests/test_geode_functions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,6 @@ def test_input_output() -> None:
5959
geode_object,
6060
os.path.join(os.path.abspath(f"./output"), filename),
6161
)
62-
assert type(saved_files) is list
62+
assert type(saved_files) is list
6363
for saved_file in saved_files:
64-
os.remove(saved_file)
64+
os.remove(saved_file)

tests/test_models_routes.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
base_dir = os.path.abspath(os.path.dirname(__file__))
1515
data_dir = os.path.join(base_dir, "data")
1616

17+
1718
def test_model_mesh_components(client: FlaskClient, test_id: str) -> None:
1819
route = "/opengeodeweb_back/models/vtm_component_indices"
1920

@@ -34,6 +35,7 @@ def test_model_mesh_components(client: FlaskClient, test_id: str) -> None:
3435
for uuid in uuid_dict.keys():
3536
assert isinstance(uuid, str)
3637

38+
3739
def test_extract_brep_uuids(client: FlaskClient, test_id: str) -> None:
3840
route = "/opengeodeweb_back/models/mesh_components"
3941
brep_filename = os.path.join(data_dir, "cube.og_brep")
@@ -55,6 +57,7 @@ def test_extract_brep_uuids(client: FlaskClient, test_id: str) -> None:
5557
uuid_dict = response.get_json()["uuid_dict"]
5658
assert isinstance(uuid_dict, dict)
5759

60+
5861
def test_export_project_route(client: FlaskClient, tmp_path: Path) -> None:
5962
route = "/opengeodeweb_back/export_project"
6063
snapshot = {
@@ -77,15 +80,15 @@ def test_export_project_route(client: FlaskClient, tmp_path: Path) -> None:
7780
viewer_object="BRep",
7881
input_file=None,
7982
native_file="test_native.txt",
80-
additional_files=[]
83+
additional_files=[],
8184
)
8285
data2 = Data(
8386
id="test_data_2",
8487
geode_object="Section",
8588
viewer_object="Section",
8689
input_file="test_input.txt",
8790
native_file="test_native2.txt",
88-
additional_files=[]
91+
additional_files=[],
8992
)
9093
session.add(data1)
9194
session.add(data2)
@@ -131,6 +134,7 @@ def test_export_project_route(client: FlaskClient, tmp_path: Path) -> None:
131134
if os.path.exists(export_path):
132135
os.remove(export_path)
133136

137+
134138
def test_import_project_route(client: FlaskClient, tmp_path: Path) -> None:
135139
route = "/opengeodeweb_back/import_project"
136140
snapshot = {
@@ -179,6 +183,7 @@ def test_import_project_route(client: FlaskClient, tmp_path: Path) -> None:
179183

180184
client.application.config["DATA_FOLDER_PATH"] = original_data_folder
181185

186+
182187
def test_save_viewable_workflow_from_file(client: FlaskClient) -> None:
183188
file = os.path.join(data_dir, "cube.og_brep")
184189
upload_resp = client.put(
@@ -205,6 +210,7 @@ def test_save_viewable_workflow_from_file(client: FlaskClient) -> None:
205210
refreshed = Data.get(data_id)
206211
assert refreshed is not None
207212

213+
208214
def test_save_viewable_workflow_from_object(client: FlaskClient) -> None:
209215
route = "/opengeodeweb_back/create/create_aoi"
210216
aoi_data = {
@@ -224,4 +230,4 @@ def test_save_viewable_workflow_from_object(client: FlaskClient) -> None:
224230
data_id = response.get_json()["id"]
225231
assert isinstance(data_id, str) and len(data_id) > 0
226232
assert response.get_json()["geode_object_type"] == "EdgedCurve3D"
227-
assert response.get_json()["viewable_file"].endswith(".vtp")
233+
assert response.get_json()["viewable_file"].endswith(".vtp")

0 commit comments

Comments
 (0)