From b7c3df468647404d2c28f05400a4336a91c1e675 Mon Sep 17 00:00:00 2001 From: JulienChampagnol Date: Mon, 6 May 2024 15:10:20 +0200 Subject: [PATCH 1/4] update opengeode dependencies --- requirements.txt | 65 +++++++++++++++++++----------------------------- 1 file changed, 25 insertions(+), 40 deletions(-) diff --git a/requirements.txt b/requirements.txt index 43f4678..2adc74f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,10 +1,10 @@ # -# This file is autogenerated by pip-compile with Python 3.9 +# This file is autogenerated by pip-compile with Python 3.11 # by the following command: # -# pip-compile --pre requirements.in +# pip-compile requirements.in # -asgiref==3.7.2 +asgiref==3.8.1 # via # flask # opengeodeweb-back @@ -13,7 +13,7 @@ attrs==23.2.0 # jsonschema # opengeodeweb-back # referencing -blinker==1.7.0 +blinker==1.8.1 # via # flask # opengeodeweb-back @@ -21,11 +21,7 @@ click==8.1.7 # via # flask # opengeodeweb-back -colorama==0.4.6 - # via - # click - # opengeodeweb-back -flask[async]==3.0.1 +flask[async]==3.0.3 # via # -r requirements.in # flask-cors @@ -34,13 +30,13 @@ flask-cors==4.0.0 # via # -r requirements.in # opengeodeweb-back -geode-background==7.7.1 +geode-background==7.9.8 # via # geode-explicit # geode-implicit # geode-simplex # opengeodeweb-back -geode-common==30.1.2 +geode-common==31.0.8 # via # geode-background # geode-explicit @@ -49,31 +45,27 @@ geode-common==30.1.2 # geode-simplex # geode-viewables # opengeodeweb-back -geode-conversion==5.2.1 +geode-conversion==5.2.8 # via # geode-explicit # geode-implicit # opengeodeweb-back -geode-explicit==4.4.3 +geode-explicit==4.7.5 # via # geode-implicit # opengeodeweb-back -geode-implicit==2.6.1 +geode-implicit==2.8.6 # via opengeodeweb-back -geode-numerics==4.3.0 +geode-numerics==4.3.3 # via # geode-implicit # geode-simplex # opengeodeweb-back -geode-simplex==6.5.1 +geode-simplex==6.7.4 # via opengeodeweb-back -geode-viewables==2.2.0 +geode-viewables==2.2.2 # via opengeodeweb-back -importlib-metadata==7.0.1 - # via - # flask - # opengeodeweb-back -itsdangerous==2.1.2 +itsdangerous==2.2.0 # via # flask # opengeodeweb-back @@ -87,12 +79,12 @@ jsonschema-specifications==2023.12.1 # via # jsonschema # opengeodeweb-back -markupsafe==2.1.4 +markupsafe==2.1.5 # via # jinja2 # opengeodeweb-back # werkzeug -opengeode-core==14.13.2 +opengeode-core==14.19.2 # via # geode-background # geode-common @@ -107,51 +99,44 @@ opengeode-core==14.13.2 # opengeode-inspector # opengeode-io # opengeodeweb-back -opengeode-geosciences==7.4.0 +opengeode-geosciences==7.6.4 # via # geode-implicit # geode-viewables # opengeode-geosciencesio # opengeodeweb-back -opengeode-geosciencesio==4.6.0 +opengeode-geosciencesio==4.7.6 # via # geode-implicit # opengeodeweb-back -opengeode-inspector==4.0.6 +opengeode-inspector==5.1.3 # via # geode-explicit # geode-implicit + # geode-simplex # opengeodeweb-back -opengeode-io==6.4.0 +opengeode-io==6.5.1 # via # geode-implicit # geode-viewables # opengeode-geosciencesio # opengeodeweb-back -opengeodeweb-back==4.0.0 +opengeodeweb-back==4.1.1 # via -r requirements.in python-dotenv==1.0.1 # via -r requirements.in -referencing==0.33.0 +referencing==0.35.0 # via # jsonschema # jsonschema-specifications # opengeodeweb-back -rpds-py==0.17.1 +rpds-py==0.18.0 # via # jsonschema # opengeodeweb-back # referencing -typing-extensions==4.9.0 - # via - # asgiref - # opengeodeweb-back -werkzeug==3.0.1 +werkzeug==3.0.2 # via # -r requirements.in # flask # opengeodeweb-back -zipp==3.17.0 - # via - # importlib-metadata - # opengeodeweb-back From 86283c411beec3590a9718ec125f7b6e19be395c Mon Sep 17 00:00:00 2001 From: JulienChampagnol Date: Mon, 6 May 2024 15:12:27 +0200 Subject: [PATCH 2/4] feat(inspector): remove unused routes and schemas --- .../tools/blueprint_validity_checker.py | 76 +------------------ .../tools/validity_checker_inspect_file.json | 25 ------ .../tools/validity_checker_test_names.json | 17 ----- 3 files changed, 3 insertions(+), 115 deletions(-) delete mode 100644 blueprints/tools/validity_checker_inspect_file.json delete mode 100644 blueprints/tools/validity_checker_test_names.json diff --git a/blueprints/tools/blueprint_validity_checker.py b/blueprints/tools/blueprint_validity_checker.py index b2a45e6..bf6ed75 100644 --- a/blueprints/tools/blueprint_validity_checker.py +++ b/blueprints/tools/blueprint_validity_checker.py @@ -1,11 +1,10 @@ # Standard library imports -import os +# # Third party imports import flask import flask_cors -import werkzeug -from opengeodeweb_back import geode_functions, inspector_functions +from opengeodeweb_back import geode_functions import json validity_checker_routes = flask.Blueprint("validity_checker_routes", __name__) @@ -31,73 +30,4 @@ def validity_checker_versions(): ] return flask.make_response( {"versions": geode_functions.versions(list_packages)}, 200 - ) - - -with open("blueprints/tools/validity_checker_test_names.json", "r") as file: - validity_checker_test_names_json = json.load(file) - - -@validity_checker_routes.route( - validity_checker_test_names_json["route"], - methods=validity_checker_test_names_json["methods"], -) -def validity_checker_test_names(): - geode_functions.validate_request(flask.request, validity_checker_test_names_json) - model_checks = inspector_functions.json_return( - inspector_functions.inspectors()[flask.request.json["input_geode_object"]][ - "tests_names" - ] - ) - - return flask.make_response({"model_checks": model_checks}, 200) - - -with open("blueprints/tools/validity_checker_inspect_file.json", "r") as file: - validity_checker_inspect_file_json = json.load(file) - - -@validity_checker_routes.route( - validity_checker_inspect_file_json["route"], - methods=validity_checker_inspect_file_json["methods"], -) -def validity_checker_inspect_file(): - geode_functions.validate_request(flask.request, validity_checker_inspect_file_json) - UPLOAD_FOLDER = flask.current_app.config["UPLOAD_FOLDER"] - - secure_filename = werkzeug.utils.secure_filename(flask.request.json["filename"]) - file_path = os.path.abspath(os.path.join(UPLOAD_FOLDER, secure_filename)) - data = geode_functions.load(flask.request.json["input_geode_object"], file_path) - inspector = geode_functions.inspector( - flask.request.json["input_geode_object"], data - ) - test_result = getattr(inspector, flask.request.json["test"])() - - if type(test_result) == int: - expected_result = 0 - elif type(test_result) == list: - expected_result = [] - elif type(test_result) == dict: - expected_result = {} - - if test_result != expected_result or type(test_result) != type(expected_result): - if type(test_result) is list: - if type(test_result[0]) is tuple: - temp_test_result = [] - for tuple_item in test_result: - temp_list = [] - for index in range(len(tuple_item)): - temp_list.append(tuple_item[index].string()) - temp_test_result.append(temp_list) - test_result = temp_test_result - result = test_result == expected_result and type(test_result) == type( - expected_result - ) - - if result is False: - test_name = flask.request.json["test"] - print(f"Wrong test result: {test_name}", flush=True) - - return flask.make_response( - {"result": result, "list_invalidities": str(test_result)}, 200 - ) + ) \ No newline at end of file diff --git a/blueprints/tools/validity_checker_inspect_file.json b/blueprints/tools/validity_checker_inspect_file.json deleted file mode 100644 index ecba7a3..0000000 --- a/blueprints/tools/validity_checker_inspect_file.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "$id": "/tools/validity_checker/inspect_file", - "route": "/inspect_file", - "methods": [ - "POST" - ], - "type": "object", - "properties": { - "input_geode_object": { - "type": "string" - }, - "filename": { - "type": "string" - }, - "test": { - "type": "string" - } - }, - "required": [ - "input_geode_object", - "filename", - "test" - ], - "additionalProperties": false -} \ No newline at end of file diff --git a/blueprints/tools/validity_checker_test_names.json b/blueprints/tools/validity_checker_test_names.json deleted file mode 100644 index 764fdfc..0000000 --- a/blueprints/tools/validity_checker_test_names.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "$id": "/tools/validity_checker/tests_names", - "route": "/tests_names", - "methods": [ - "POST" - ], - "type": "object", - "properties": { - "input_geode_object": { - "type": "string" - } - }, - "required": [ - "input_geode_object" - ], - "additionalProperties": false -} \ No newline at end of file From 5188834db9857179b1ddb94c76e0c540165b2a51 Mon Sep 17 00:00:00 2001 From: JulienChampagnol Date: Mon, 6 May 2024 15:28:39 +0200 Subject: [PATCH 3/4] remove unused imports --- tests/test_validity_checker.py | 81 ---------------------------------- 1 file changed, 81 deletions(-) diff --git a/tests/test_validity_checker.py b/tests/test_validity_checker.py index dcb68c4..7f1a120 100644 --- a/tests/test_validity_checker.py +++ b/tests/test_validity_checker.py @@ -1,6 +1,3 @@ -import os -import base64 -from werkzeug.datastructures import FileStorage base_route = "/tools/validity_checker" @@ -12,81 +9,3 @@ def test_versions(client): assert type(versions) is list for version in versions: assert type(version) is dict - - -def test_test_names(client): - ObjectArray = [ - "BRep", - "CrossSection", - "EdgedCurve2D", - "EdgedCurve3D", - "Graph", - "HybridSolid3D", - "PointSet2D", - "PointSet3D", - "PolygonalSurface2D", - "PolygonalSurface3D", - "PolyhedralSolid3D", - "RegularGrid2D", - "RegularGrid3D", - "Section", - "StructuralModel", - "TetrahedralSolid3D", - "TriangulatedSurface2D", - "TriangulatedSurface3D", - "VertexSet", - ] - - for geode_object in ObjectArray: - # Normal test with all objects - response = client.post( - f"{base_route}/tests_names", - json={"input_geode_object": geode_object}, - ) - assert response.status_code == 200 - model_checks = response.json["model_checks"] - - assert type(model_checks) is list - for model_check in model_checks: - assert type(model_check) is dict - is_leaf = model_check["is_leaf"] - route = model_check["route"] - children = model_check["children"] - assert type(is_leaf) is bool - assert type(route) is str - assert type(children) is list - for check in children: - assert type(check) is dict - if check["is_leaf"] == True: - print("is_leaf") - response_test = client.post( - f"{base_route}/inspect_file", - json={ - "object": "BRep", - "filename": "corbi.og_brep", - "test": check["route"], - }, - ) - - assert response_test.status_code == 200 - else: - print("not is_leaf") - - -def test_inspect_file(client): - # Test with file - - filename = "corbi.og_brep" - - response = client.put( - "opengeodeweb_back/upload_file", - data={"file": FileStorage(open(f"./tests/{filename}", "rb"))}, - ) - assert response.status_code == 201 - - response = client.post( - f"{base_route}/inspect_file", - json={ - "filename": filename, - }, - ) From 9d31744505184b25450b0ea787c334ed8f268bb0 Mon Sep 17 00:00:00 2001 From: JulienChampagnol Date: Mon, 6 May 2024 14:04:57 +0000 Subject: [PATCH 4/4] Apply prepare changes --- blueprints/tools/blueprint_validity_checker.py | 4 ++-- tests/test_validity_checker.py | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/blueprints/tools/blueprint_validity_checker.py b/blueprints/tools/blueprint_validity_checker.py index bf6ed75..bfc021a 100644 --- a/blueprints/tools/blueprint_validity_checker.py +++ b/blueprints/tools/blueprint_validity_checker.py @@ -1,5 +1,5 @@ # Standard library imports -# +# # Third party imports import flask @@ -30,4 +30,4 @@ def validity_checker_versions(): ] return flask.make_response( {"versions": geode_functions.versions(list_packages)}, 200 - ) \ No newline at end of file + ) diff --git a/tests/test_validity_checker.py b/tests/test_validity_checker.py index 7f1a120..08c1e18 100644 --- a/tests/test_validity_checker.py +++ b/tests/test_validity_checker.py @@ -1,4 +1,3 @@ - base_route = "/tools/validity_checker"