Skip to content

Commit 1ccfa9b

Browse files
MaxNumeriquegithub-actions[bot]
authored andcommitted
Apply prepare changes
1 parent 4c19434 commit 1ccfa9b

File tree

5 files changed

+30
-27
lines changed

5 files changed

+30
-27
lines changed

src/opengeodeweb_back/app_config.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,5 @@ class DevConfig(Config):
3232
SECONDS_BETWEEN_SHUTDOWNS = "10"
3333
DATA_FOLDER_PATH = "./data/"
3434

35-
TEST_ID = "1"
35+
36+
TEST_ID = "1"

src/opengeodeweb_back/geode_functions.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ def is_loadable(geode_object: str, file_absolute_path: str):
3939
def load(geode_object: str, file_absolute_path: str):
4040
return geode_object_value(geode_object)["load"](file_absolute_path)
4141

42+
4243
def load_from_request(geode_object: str, data_folder_path: str, request_json: dict):
4344
file_absolute_path = os.path.join(
4445
data_folder_path,
@@ -47,17 +48,18 @@ def load_from_request(geode_object: str, data_folder_path: str, request_json: di
4748
)
4849
return load(geode_object, file_absolute_path)
4950

51+
5052
def build_data_path(data_folder_path, request_json, filename):
5153
return os.path.join(
5254
data_folder_path,
5355
request_json["id"],
5456
werkzeug.utils.secure_filename(filename),
5557
)
5658

59+
5760
def build_upload_file_path(upload_folder, filename):
5861
secure_filename = werkzeug.utils.secure_filename(filename)
59-
return os.path.abspath(os.path.join(upload_folder, secure_filename)
60-
)
62+
return os.path.abspath(os.path.join(upload_folder, secure_filename))
6163

6264

6365
def is_saveable(geode_object: str, data, filename: str):

src/opengeodeweb_back/routes/blueprint_routes.py

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ def allowed_objects():
100100
UPLOAD_FOLDER = flask.current_app.config["UPLOAD_FOLDER"]
101101
utils_functions.validate_request(flask.request, allowed_objects_json)
102102
file_absolute_path = geode_functions.build_upload_file_path(
103-
UPLOAD_FOLDER, flask.request.json["filename"])
103+
UPLOAD_FOLDER, flask.request.json["filename"]
104+
)
104105
allowed_objects = geode_functions.list_geode_objects(
105106
file_absolute_path, flask.request.json["supported_feature"]
106107
)
@@ -125,7 +126,8 @@ def missing_files():
125126
missing_files = geode_functions.missing_files(
126127
flask.request.json["input_geode_object"],
127128
geode_functions.build_upload_file_path(
128-
UPLOAD_FOLDER, flask.request.json["filename"]),
129+
UPLOAD_FOLDER, flask.request.json["filename"]
130+
),
129131
)
130132
has_missing_files = missing_files.has_missing_files()
131133

@@ -218,7 +220,8 @@ def geode_objects_and_output_extensions():
218220
data = geode_functions.load(
219221
flask.request.json["input_geode_object"],
220222
geode_functions.build_upload_file_path(
221-
UPLOAD_FOLDER, flask.request.json["filename"]),
223+
UPLOAD_FOLDER, flask.request.json["filename"]
224+
),
222225
)
223226
geode_objects_and_output_extensions = (
224227
geode_functions.geode_objects_output_extensions(
@@ -291,10 +294,10 @@ def create_point():
291294
def texture_coordinates():
292295
utils_functions.validate_request(flask.request, texture_coordinates_json)
293296
data = geode_functions.load_from_request(
294-
flask.request.json["input_geode_object"],
295-
DATA_FOLDER_PATH,
296-
flask.request.json,
297-
)
297+
flask.request.json["input_geode_object"],
298+
DATA_FOLDER_PATH,
299+
flask.request.json,
300+
)
298301

299302
texture_coordinates = data.texture_manager().texture_names()
300303

@@ -315,9 +318,9 @@ def texture_coordinates():
315318
def vertex_attribute_names():
316319
utils_functions.validate_request(flask.request, vertex_attribute_names_json)
317320
data = geode_functions.load_from_request(
318-
flask.request.json["input_geode_object"],
319-
DATA_FOLDER_PATH,
320-
flask.request.json,
321+
flask.request.json["input_geode_object"],
322+
DATA_FOLDER_PATH,
323+
flask.request.json,
321324
)
322325

323326
vertex_attribute_names = data.vertex_attribute_manager().attribute_names()
@@ -344,9 +347,9 @@ def vertex_attribute_names():
344347
def polygon_attribute_names():
345348
utils_functions.validate_request(flask.request, polygon_attribute_names_json)
346349
data = geode_functions.load_from_request(
347-
flask.request.json["input_geode_object"],
348-
DATA_FOLDER_PATH,
349-
flask.request.json,
350+
flask.request.json["input_geode_object"],
351+
DATA_FOLDER_PATH,
352+
flask.request.json,
350353
)
351354

352355
polygon_attribute_names = data.polygon_attribute_manager().attribute_names()
@@ -373,9 +376,9 @@ def polygon_attribute_names():
373376
def polyhedron_attribute_names():
374377
utils_functions.validate_request(flask.request, vertex_attribute_names_json)
375378
data = geode_functions.load_from_request(
376-
flask.request.json["input_geode_object"],
377-
DATA_FOLDER_PATH,
378-
flask.request.json,
379+
flask.request.json["input_geode_object"],
380+
DATA_FOLDER_PATH,
381+
flask.request.json,
379382
)
380383

381384
polyhedron_attribute_names = data.polyhedron_attribute_manager().attribute_names()

src/opengeodeweb_back/routes/models/blueprint_models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ def uuid_to_flat_index():
3535
current_index += 1
3636
return flask.make_response({"uuid_to_flat_index": uuid_to_flat_index}, 200)
3737

38+
3839
def extract_model_uuids(model):
3940
mesh_components = model.mesh_components()
4041
uuid_dict = {}

tests/test_models_routes.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import os
22
import shutil
3+
4+
35
def test_model_mesh_components(client, test_id):
46
route = "/models/vtm_component_indices"
57

6-
data_path = geode_functions.data_file_path(
7-
{"id": test_id},
8-
"viewable.vtm"
9-
)
8+
data_path = geode_functions.data_file_path({"id": test_id}, "viewable.vtm")
109
os.makedirs(os.path.dirname(data_path), exist_ok=True)
1110
shutil.copy("./tests/data/cube.vtm", data_path)
1211

@@ -28,10 +27,7 @@ def test_extract_brep_uuids(client, test_id):
2827
brep_filename = "cube.og_brep"
2928
json_data = {"id": test_id, "geode_object": "BRep", "filename": brep_filename}
3029

31-
data_path = geode_functions.data_file_path(
32-
json_data,
33-
brep_filename
34-
)
30+
data_path = geode_functions.data_file_path(json_data, brep_filename)
3531
os.makedirs(os.path.dirname(data_path), exist_ok=True)
3632
shutil.copy(f"./tests/data/{brep_filename}", data_path)
3733

0 commit comments

Comments
 (0)