From 1ab162457252110c998a77ff4d511e6a37e4a5bf Mon Sep 17 00:00:00 2001 From: MaxNumerique Date: Mon, 5 Jan 2026 13:46:50 +0100 Subject: [PATCH 01/12] type geode_objects --- mypy.ini | 32 ++++++++++++- .../geode_objects/geode_brep.py | 24 ++++++---- .../geode_objects/geode_cross_section.py | 31 ++++++++----- .../geode_objects/geode_edged_curve2d.py | 27 ++++++----- .../geode_objects/geode_edged_curve3d.py | 27 ++++++----- .../geode_objects/geode_graph.py | 13 +++--- .../geode_objects/geode_hybrid_solid3d.py | 27 ++++++----- .../geode_implicit_cross_section.py | 43 +++++++++++++----- .../geode_implicit_structural_model.py | 45 ++++++++++++++----- .../geode_light_regular_grid2d.py | 31 ++++++++----- .../geode_light_regular_grid3d.py | 31 ++++++++----- .../geode_objects/geode_model.py | 1 - .../geode_objects/geode_point_set2d.py | 27 ++++++----- .../geode_objects/geode_point_set3d.py | 27 ++++++----- .../geode_polygonal_surface2d.py | 31 ++++++++----- .../geode_polygonal_surface3d.py | 31 ++++++++----- .../geode_objects/geode_polyhedral_solid3d.py | 31 ++++++++----- .../geode_objects/geode_raster_image2d.py | 27 ++++++----- .../geode_objects/geode_raster_image3d.py | 27 ++++++----- .../geode_objects/geode_regular_grid2d.py | 27 ++++++----- .../geode_objects/geode_regular_grid3d.py | 27 ++++++----- .../geode_objects/geode_section.py | 27 ++++++----- .../geode_objects/geode_structural_model.py | 39 +++++++++++----- .../geode_tetrahedral_solid3d.py | 31 ++++++++----- .../geode_triangulated_surface2d.py | 33 +++++++++----- .../geode_triangulated_surface3d.py | 33 +++++++++----- .../geode_objects/geode_vertex_set.py | 13 +++--- src/opengeodeweb_back/py.typed | 1 - 28 files changed, 513 insertions(+), 251 deletions(-) diff --git a/mypy.ini b/mypy.ini index 089c0496..e8f498dc 100644 --- a/mypy.ini +++ b/mypy.ini @@ -1,4 +1,34 @@ [mypy] strict = True files = src/ -disallow_untyped_decorators = False \ No newline at end of file +disallow_untyped_decorators = False + +[mypy-opengeode.*] +ignore_missing_imports = True + +[mypy-opengeode_geosciences.*] +ignore_missing_imports = True + +[mypy-opengeode_inspector.*] +ignore_missing_imports = True + +[mypy-opengeode_io.*] +ignore_missing_imports = True + +[mypy-opengeode_geosciencesio.*] +ignore_missing_imports = True + +[mypy-geode_viewables.*] +ignore_missing_imports = True + +[mypy-werkzeug.*] +ignore_missing_imports = True + +[mypy-flask.*] +ignore_missing_imports = True + +[mypy-opengeodeweb_microservice.*] +ignore_missing_imports = True + +[mypy-dataclasses_json.*] +ignore_missing_imports = True \ No newline at end of file diff --git a/src/opengeodeweb_back/geode_objects/geode_brep.py b/src/opengeodeweb_back/geode_objects/geode_brep.py index 6637fb9a..a546e373 100644 --- a/src/opengeodeweb_back/geode_objects/geode_brep.py +++ b/src/opengeodeweb_back/geode_objects/geode_brep.py @@ -1,5 +1,6 @@ # Standard library imports from __future__ import annotations +from typing import cast, Any # Third party imports import opengeode as og @@ -24,7 +25,7 @@ def geode_object_type(cls) -> GeodeModelType: return "BRep" def native_extension(self) -> str: - return self.brep.native_extension() + return cast(str, self.brep.native_extension()) @classmethod def is_3D(cls) -> bool: @@ -51,30 +52,35 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return og.BRepInputFactory.list_creators() + return cast(list[str], og.BRepInputFactory.list_creators()) @classmethod def output_extensions(cls) -> list[str]: - return og.BRepOutputFactory.list_creators() + return cast(list[str], og.BRepOutputFactory.list_creators()) @classmethod def object_priority(cls, filename: str) -> int: - return og.brep_object_priority(filename) + return cast(int, og.brep_object_priority(filename)) def is_saveable(self, filename: str) -> bool: - return og.is_brep_saveable(self.brep, filename) + return cast(bool, og.is_brep_saveable(self.brep, filename)) def save(self, filename: str) -> list[str]: - return og.save_brep(self.brep, filename) + return cast(list[str], og.save_brep(self.brep, filename)) def save_viewable(self, filename_without_extension: str) -> str: - return viewables.save_viewable_brep(self.brep, filename_without_extension) + return cast( + str, viewables.save_viewable_brep(self.brep, filename_without_extension) + ) def save_light_viewable(self, filename_without_extension: str) -> str: - return viewables.save_light_viewable_brep(self.brep, filename_without_extension) + return cast( + str, + viewables.save_light_viewable_brep(self.brep, filename_without_extension), + ) def mesh_components(self) -> ComponentRegistry: - return self.brep.mesh_components() + return cast(dict[Any, list[Any]], self.brep.mesh_components()) def inspect(self) -> og_inspector.BRepInspectionResult: return og_inspector.inspect_brep(self.brep) diff --git a/src/opengeodeweb_back/geode_objects/geode_cross_section.py b/src/opengeodeweb_back/geode_objects/geode_cross_section.py index bfeda2c6..2e589a07 100644 --- a/src/opengeodeweb_back/geode_objects/geode_cross_section.py +++ b/src/opengeodeweb_back/geode_objects/geode_cross_section.py @@ -1,5 +1,6 @@ # Standard library imports from __future__ import annotations +from typing import cast # Third party imports import opengeode as og @@ -29,7 +30,7 @@ def geode_object_type(cls) -> GeodeModelType: return "CrossSection" def native_extension(self) -> str: - return self.cross_section.native_extension() + return cast(str, self.cross_section.native_extension()) def builder(self) -> og_geosciences.CrossSectionBuilder: return og_geosciences.CrossSectionBuilder(self.cross_section) @@ -48,28 +49,38 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return og_geosciences.CrossSectionInputFactory.list_creators() + return cast(list[str], og_geosciences.CrossSectionInputFactory.list_creators()) @classmethod def output_extensions(cls) -> list[str]: - return og_geosciences.CrossSectionOutputFactory.list_creators() + return cast(list[str], og_geosciences.CrossSectionOutputFactory.list_creators()) @classmethod def object_priority(cls, filename: str) -> int: - return og_geosciences.cross_section_object_priority(filename) + return cast(int, og_geosciences.cross_section_object_priority(filename)) def is_saveable(self, filename: str) -> bool: - return og_geosciences.is_cross_section_saveable(self.cross_section, filename) + return cast( + bool, og_geosciences.is_cross_section_saveable(self.cross_section, filename) + ) def save(self, filename: str) -> list[str]: - return og_geosciences.save_cross_section(self.cross_section, filename) + return cast( + list[str], og_geosciences.save_cross_section(self.cross_section, filename) + ) def save_viewable(self, filename_without_extension: str) -> str: - return viewables.save_viewable_cross_section( - self.cross_section, filename_without_extension + return cast( + str, + viewables.save_viewable_cross_section( + self.cross_section, filename_without_extension + ), ) def save_light_viewable(self, filename_without_extension: str) -> str: - return viewables.save_light_viewable_cross_section( - self.cross_section, filename_without_extension + return cast( + str, + viewables.save_light_viewable_cross_section( + self.cross_section, filename_without_extension + ), ) diff --git a/src/opengeodeweb_back/geode_objects/geode_edged_curve2d.py b/src/opengeodeweb_back/geode_objects/geode_edged_curve2d.py index a0124882..ead463f0 100644 --- a/src/opengeodeweb_back/geode_objects/geode_edged_curve2d.py +++ b/src/opengeodeweb_back/geode_objects/geode_edged_curve2d.py @@ -1,5 +1,6 @@ # Standard library imports from __future__ import annotations +from typing import cast # Third party imports import opengeode as og @@ -26,7 +27,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "EdgedCurve2D" def native_extension(self) -> str: - return self.edged_curve.native_extension() + return cast(str, self.edged_curve.native_extension()) @classmethod def is_3D(cls) -> bool: @@ -53,30 +54,36 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return og.EdgedCurveInputFactory2D.list_creators() + return cast(list[str], og.EdgedCurveInputFactory2D.list_creators()) @classmethod def output_extensions(cls) -> list[str]: - return og.EdgedCurveOutputFactory2D.list_creators() + return cast(list[str], og.EdgedCurveOutputFactory2D.list_creators()) @classmethod def object_priority(cls, filename: str) -> int: - return og.edged_curve_object_priority2D(filename) + return cast(int, og.edged_curve_object_priority2D(filename)) def is_saveable(self, filename: str) -> bool: - return og.is_edged_curve_saveable2D(self.edged_curve, filename) + return cast(bool, og.is_edged_curve_saveable2D(self.edged_curve, filename)) def save(self, filename: str) -> list[str]: - return og.save_edged_curve2D(self.edged_curve, filename) + return cast(list[str], og.save_edged_curve2D(self.edged_curve, filename)) def save_viewable(self, filename_without_extension: str) -> str: - return viewables.save_viewable_edged_curve2D( - self.edged_curve, filename_without_extension + return cast( + str, + viewables.save_viewable_edged_curve2D( + self.edged_curve, filename_without_extension + ), ) def save_light_viewable(self, filename_without_extension: str) -> str: - return viewables.save_light_viewable_edged_curve2D( - self.edged_curve, filename_without_extension + return cast( + str, + viewables.save_light_viewable_edged_curve2D( + self.edged_curve, filename_without_extension + ), ) def inspect(self) -> og_inspector.EdgedCurveInspectionResult: diff --git a/src/opengeodeweb_back/geode_objects/geode_edged_curve3d.py b/src/opengeodeweb_back/geode_objects/geode_edged_curve3d.py index 632da9a7..7833755e 100644 --- a/src/opengeodeweb_back/geode_objects/geode_edged_curve3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_edged_curve3d.py @@ -1,5 +1,6 @@ # Standard library imports from __future__ import annotations +from typing import cast # Third party imports import opengeode as og @@ -26,7 +27,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "EdgedCurve3D" def native_extension(self) -> str: - return self.edged_curve.native_extension() + return cast(str, self.edged_curve.native_extension()) @classmethod def is_3D(cls) -> bool: @@ -53,30 +54,36 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return og.EdgedCurveInputFactory3D.list_creators() + return cast(list[str], og.EdgedCurveInputFactory3D.list_creators()) @classmethod def output_extensions(cls) -> list[str]: - return og.EdgedCurveOutputFactory3D.list_creators() + return cast(list[str], og.EdgedCurveOutputFactory3D.list_creators()) @classmethod def object_priority(cls, filename: str) -> int: - return og.edged_curve_object_priority3D(filename) + return cast(int, og.edged_curve_object_priority3D(filename)) def is_saveable(self, filename: str) -> bool: - return og.is_edged_curve_saveable3D(self.edged_curve, filename) + return cast(bool, og.is_edged_curve_saveable3D(self.edged_curve, filename)) def save(self, filename: str) -> list[str]: - return og.save_edged_curve3D(self.edged_curve, filename) + return cast(list[str], og.save_edged_curve3D(self.edged_curve, filename)) def save_viewable(self, filename_without_extension: str) -> str: - return viewables.save_viewable_edged_curve3D( - self.edged_curve, filename_without_extension + return cast( + str, + viewables.save_viewable_edged_curve3D( + self.edged_curve, filename_without_extension + ), ) def save_light_viewable(self, filename_without_extension: str) -> str: - return viewables.save_light_viewable_edged_curve3D( - self.edged_curve, filename_without_extension + return cast( + str, + viewables.save_light_viewable_edged_curve3D( + self.edged_curve, filename_without_extension + ), ) def inspect(self) -> og_inspector.EdgedCurveInspectionResult: diff --git a/src/opengeodeweb_back/geode_objects/geode_graph.py b/src/opengeodeweb_back/geode_objects/geode_graph.py index cd12775c..191fb969 100644 --- a/src/opengeodeweb_back/geode_objects/geode_graph.py +++ b/src/opengeodeweb_back/geode_objects/geode_graph.py @@ -1,5 +1,6 @@ # Standard library imports from __future__ import annotations +from typing import cast # Third party imports import opengeode as og @@ -23,7 +24,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "Graph" def native_extension(self) -> str: - return self.graph.native_extension() + return cast(str, self.graph.native_extension()) @classmethod def is_3D(cls) -> bool: @@ -50,21 +51,21 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return og.GraphInputFactory.list_creators() + return cast(list[str], og.GraphInputFactory.list_creators()) @classmethod def output_extensions(cls) -> list[str]: - return og.GraphOutputFactory.list_creators() + return cast(list[str], og.GraphOutputFactory.list_creators()) @classmethod def object_priority(cls, filename: str) -> int: - return og.graph_object_priority(filename) + return cast(int, og.graph_object_priority(filename)) def is_saveable(self, filename: str) -> bool: - return og.is_graph_saveable(self.graph, filename) + return cast(bool, og.is_graph_saveable(self.graph, filename)) def save(self, filename: str) -> list[str]: - return og.save_graph(self.graph, filename) + return cast(list[str], og.save_graph(self.graph, filename)) def save_viewable(self, filename_without_extension: str) -> str: return "" diff --git a/src/opengeodeweb_back/geode_objects/geode_hybrid_solid3d.py b/src/opengeodeweb_back/geode_objects/geode_hybrid_solid3d.py index 8a22d9be..bd863888 100644 --- a/src/opengeodeweb_back/geode_objects/geode_hybrid_solid3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_hybrid_solid3d.py @@ -1,5 +1,6 @@ # Standard library imports from __future__ import annotations +from typing import cast # Third party imports import opengeode as og @@ -25,7 +26,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "HybridSolid3D" def native_extension(self) -> str: - return self.hybrid_solid.native_extension() + return cast(str, self.hybrid_solid.native_extension()) def builder(self) -> og.HybridSolidBuilder3D: return og.HybridSolidBuilder3D.create(self.hybrid_solid) @@ -44,28 +45,34 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return og.HybridSolidInputFactory3D.list_creators() + return cast(list[str], og.HybridSolidInputFactory3D.list_creators()) @classmethod def output_extensions(cls) -> list[str]: - return og.HybridSolidOutputFactory3D.list_creators() + return cast(list[str], og.HybridSolidOutputFactory3D.list_creators()) @classmethod def object_priority(cls, filename: str) -> int: - return og.hybrid_solid_object_priority3D(filename) + return cast(int, og.hybrid_solid_object_priority3D(filename)) def is_saveable(self, filename: str) -> bool: - return og.is_hybrid_solid_saveable3D(self.hybrid_solid, filename) + return cast(bool, og.is_hybrid_solid_saveable3D(self.hybrid_solid, filename)) def save(self, filename: str) -> list[str]: - return og.save_hybrid_solid3D(self.hybrid_solid, filename) + return cast(list[str], og.save_hybrid_solid3D(self.hybrid_solid, filename)) def save_viewable(self, filename_without_extension: str) -> str: - return viewables.save_viewable_hybrid_solid3D( - self.hybrid_solid, filename_without_extension + return cast( + str, + viewables.save_viewable_hybrid_solid3D( + self.hybrid_solid, filename_without_extension + ), ) def save_light_viewable(self, filename_without_extension: str) -> str: - return viewables.save_light_viewable_hybrid_solid3D( - self.hybrid_solid, filename_without_extension + return cast( + str, + viewables.save_light_viewable_hybrid_solid3D( + self.hybrid_solid, filename_without_extension + ), ) diff --git a/src/opengeodeweb_back/geode_objects/geode_implicit_cross_section.py b/src/opengeodeweb_back/geode_objects/geode_implicit_cross_section.py index 8f9a4e41..4f38754c 100644 --- a/src/opengeodeweb_back/geode_objects/geode_implicit_cross_section.py +++ b/src/opengeodeweb_back/geode_objects/geode_implicit_cross_section.py @@ -1,5 +1,6 @@ # Standard library imports from __future__ import annotations +from typing import cast # Third party imports import opengeode as og @@ -29,7 +30,7 @@ def geode_object_type(cls) -> GeodeModelType: return "ImplicitCrossSection" def native_extension(self) -> str: - return self.implicit_cross_section.native_extension() + return cast(str, self.implicit_cross_section.native_extension()) def builder(self) -> og_geosciences.ImplicitCrossSectionBuilder: return og_geosciences.ImplicitCrossSectionBuilder(self.implicit_cross_section) @@ -50,32 +51,50 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return og_geosciences.ImplicitCrossSectionInputFactory.list_creators() + return cast( + list[str], og_geosciences.ImplicitCrossSectionInputFactory.list_creators() + ) @classmethod def output_extensions(cls) -> list[str]: - return og_geosciences.ImplicitCrossSectionOutputFactory.list_creators() + return cast( + list[str], og_geosciences.ImplicitCrossSectionOutputFactory.list_creators() + ) @classmethod def object_priority(cls, filename: str) -> int: - return og_geosciences.implicit_cross_section_object_priority(filename) + return cast( + int, og_geosciences.implicit_cross_section_object_priority(filename) + ) def is_saveable(self, filename: str) -> bool: - return og_geosciences.is_implicit_cross_section_saveable( - self.implicit_cross_section, filename + return cast( + bool, + og_geosciences.is_implicit_cross_section_saveable( + self.implicit_cross_section, filename + ), ) def save(self, filename: str) -> list[str]: - return og_geosciences.save_implicit_cross_section( - self.implicit_cross_section, filename + return cast( + list[str], + og_geosciences.save_implicit_cross_section( + self.implicit_cross_section, filename + ), ) def save_viewable(self, filename_without_extension: str) -> str: - return viewables.save_viewable_implicit_cross_section( - self.implicit_cross_section, filename_without_extension + return cast( + str, + viewables.save_viewable_implicit_cross_section( + self.implicit_cross_section, filename_without_extension + ), ) def save_light_viewable(self, filename_without_extension: str) -> str: - return viewables.save_light_viewable_implicit_cross_section( - self.implicit_cross_section, filename_without_extension + return cast( + str, + viewables.save_light_viewable_implicit_cross_section( + self.implicit_cross_section, filename_without_extension + ), ) diff --git a/src/opengeodeweb_back/geode_objects/geode_implicit_structural_model.py b/src/opengeodeweb_back/geode_objects/geode_implicit_structural_model.py index 0df5a5b6..f776a32c 100644 --- a/src/opengeodeweb_back/geode_objects/geode_implicit_structural_model.py +++ b/src/opengeodeweb_back/geode_objects/geode_implicit_structural_model.py @@ -1,5 +1,6 @@ # Standard library imports from __future__ import annotations +from typing import cast # Third party imports import opengeode as og @@ -31,7 +32,7 @@ def geode_object_type(cls) -> GeodeModelType: return "ImplicitStructuralModel" def native_extension(self) -> str: - return self.implicit_structural_model.native_extension() + return cast(str, self.implicit_structural_model.native_extension()) def builder(self) -> og_geosciences.ImplicitStructuralModelBuilder: return og_geosciences.ImplicitStructuralModelBuilder( @@ -54,32 +55,52 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return og_geosciences.ImplicitStructuralModelInputFactory.list_creators() + return cast( + list[str], + og_geosciences.ImplicitStructuralModelInputFactory.list_creators(), + ) @classmethod def output_extensions(cls) -> list[str]: - return og_geosciences.ImplicitStructuralModelOutputFactory.list_creators() + return cast( + list[str], + og_geosciences.ImplicitStructuralModelOutputFactory.list_creators(), + ) @classmethod def object_priority(cls, filename: str) -> int: - return og_geosciences.implicit_structural_model_object_priority(filename) + return cast( + int, og_geosciences.implicit_structural_model_object_priority(filename) + ) def is_saveable(self, filename: str) -> bool: - return og_geosciences.is_implicit_structural_model_saveable( - self.implicit_structural_model, filename + return cast( + bool, + og_geosciences.is_implicit_structural_model_saveable( + self.implicit_structural_model, filename + ), ) def save(self, filename: str) -> list[str]: - return og_geosciences.save_implicit_structural_model( - self.implicit_structural_model, filename + return cast( + list[str], + og_geosciences.save_implicit_structural_model( + self.implicit_structural_model, filename + ), ) def save_viewable(self, filename_without_extension: str) -> str: - return viewables.save_viewable_implicit_structural_model( - self.implicit_structural_model, filename_without_extension + return cast( + str, + viewables.save_viewable_implicit_structural_model( + self.implicit_structural_model, filename_without_extension + ), ) def save_light_viewable(self, filename_without_extension: str) -> str: - return viewables.save_light_viewable_implicit_structural_model( - self.implicit_structural_model, filename_without_extension + return cast( + str, + viewables.save_light_viewable_implicit_structural_model( + self.implicit_structural_model, filename_without_extension + ), ) diff --git a/src/opengeodeweb_back/geode_objects/geode_light_regular_grid2d.py b/src/opengeodeweb_back/geode_objects/geode_light_regular_grid2d.py index 5a345707..caf0b8ab 100644 --- a/src/opengeodeweb_back/geode_objects/geode_light_regular_grid2d.py +++ b/src/opengeodeweb_back/geode_objects/geode_light_regular_grid2d.py @@ -1,5 +1,6 @@ # Standard library imports from __future__ import annotations +from typing import cast # Third party imports import opengeode as og @@ -23,7 +24,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "LightRegularGrid2D" def native_extension(self) -> str: - return self.light_regular_grid.native_extension() + return cast(str, self.light_regular_grid.native_extension()) @classmethod def load(cls, filename: str) -> GeodeLightRegularGrid2D: @@ -39,30 +40,40 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return og.LightRegularGridInputFactory2D.list_creators() + return cast(list[str], og.LightRegularGridInputFactory2D.list_creators()) @classmethod def output_extensions(cls) -> list[str]: - return og.LightRegularGridOutputFactory2D.list_creators() + return cast(list[str], og.LightRegularGridOutputFactory2D.list_creators()) @classmethod def object_priority(cls, filename: str) -> int: - return og.light_regular_grid_object_priority2D(filename) + return cast(int, og.light_regular_grid_object_priority2D(filename)) def is_saveable(self, filename: str) -> bool: - return og.is_light_regular_grid_saveable2D(self.light_regular_grid, filename) + return cast( + bool, og.is_light_regular_grid_saveable2D(self.light_regular_grid, filename) + ) def save(self, filename: str) -> list[str]: - return og.save_light_regular_grid2D(self.light_regular_grid, filename) + return cast( + list[str], og.save_light_regular_grid2D(self.light_regular_grid, filename) + ) def save_viewable(self, filename_without_extension: str) -> str: - return viewables.save_viewable_light_regular_grid2D( - self.light_regular_grid, filename_without_extension + return cast( + str, + viewables.save_viewable_light_regular_grid2D( + self.light_regular_grid, filename_without_extension + ), ) def save_light_viewable(self, filename_without_extension: str) -> str: - return viewables.save_light_viewable_light_regular_grid2D( - self.light_regular_grid, filename_without_extension + return cast( + str, + viewables.save_light_viewable_light_regular_grid2D( + self.light_regular_grid, filename_without_extension + ), ) def vertex_attribute_manager(self) -> og.AttributeManager: diff --git a/src/opengeodeweb_back/geode_objects/geode_light_regular_grid3d.py b/src/opengeodeweb_back/geode_objects/geode_light_regular_grid3d.py index e342907b..d291d161 100644 --- a/src/opengeodeweb_back/geode_objects/geode_light_regular_grid3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_light_regular_grid3d.py @@ -1,5 +1,6 @@ # Standard library imports from __future__ import annotations +from typing import cast # Third party imports import opengeode as og @@ -23,7 +24,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "LightRegularGrid3D" def native_extension(self) -> str: - return self.light_regular_grid.native_extension() + return cast(str, self.light_regular_grid.native_extension()) @classmethod def load(cls, filename: str) -> GeodeLightRegularGrid3D: @@ -39,30 +40,40 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return og.LightRegularGridInputFactory3D.list_creators() + return cast(list[str], og.LightRegularGridInputFactory3D.list_creators()) @classmethod def output_extensions(cls) -> list[str]: - return og.LightRegularGridOutputFactory3D.list_creators() + return cast(list[str], og.LightRegularGridOutputFactory3D.list_creators()) @classmethod def object_priority(cls, filename: str) -> int: - return og.light_regular_grid_object_priority3D(filename) + return cast(int, og.light_regular_grid_object_priority3D(filename)) def is_saveable(self, filename: str) -> bool: - return og.is_light_regular_grid_saveable3D(self.light_regular_grid, filename) + return cast( + bool, og.is_light_regular_grid_saveable3D(self.light_regular_grid, filename) + ) def save(self, filename: str) -> list[str]: - return og.save_light_regular_grid3D(self.light_regular_grid, filename) + return cast( + list[str], og.save_light_regular_grid3D(self.light_regular_grid, filename) + ) def save_viewable(self, filename_without_extension: str) -> str: - return viewables.save_viewable_light_regular_grid3D( - self.light_regular_grid, filename_without_extension + return cast( + str, + viewables.save_viewable_light_regular_grid3D( + self.light_regular_grid, filename_without_extension + ), ) def save_light_viewable(self, filename_without_extension: str) -> str: - return viewables.save_light_viewable_light_regular_grid3D( - self.light_regular_grid, filename_without_extension + return cast( + str, + viewables.save_light_viewable_light_regular_grid3D( + self.light_regular_grid, filename_without_extension + ), ) def vertex_attribute_manager(self) -> og.AttributeManager: diff --git a/src/opengeodeweb_back/geode_objects/geode_model.py b/src/opengeodeweb_back/geode_objects/geode_model.py index 8715c8f3..f7352d02 100644 --- a/src/opengeodeweb_back/geode_objects/geode_model.py +++ b/src/opengeodeweb_back/geode_objects/geode_model.py @@ -1,7 +1,6 @@ # Standard library imports from __future__ import annotations from abc import ABC, abstractmethod -from typing import Literal, Any, get_args, cast # Third party imports import opengeode as og diff --git a/src/opengeodeweb_back/geode_objects/geode_point_set2d.py b/src/opengeodeweb_back/geode_objects/geode_point_set2d.py index 2a35b97a..4ffa6753 100644 --- a/src/opengeodeweb_back/geode_objects/geode_point_set2d.py +++ b/src/opengeodeweb_back/geode_objects/geode_point_set2d.py @@ -1,5 +1,6 @@ # Standard library imports from __future__ import annotations +from typing import cast # Third party imports import opengeode as og @@ -24,7 +25,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "PointSet2D" def native_extension(self) -> str: - return self.point_set.native_extension() + return cast(str, self.point_set.native_extension()) @classmethod def is_3D(cls) -> bool: @@ -51,30 +52,36 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return og.PointSetInputFactory2D.list_creators() + return cast(list[str], og.PointSetInputFactory2D.list_creators()) @classmethod def output_extensions(cls) -> list[str]: - return og.PointSetOutputFactory2D.list_creators() + return cast(list[str], og.PointSetOutputFactory2D.list_creators()) @classmethod def object_priority(cls, filename: str) -> int: - return og.point_set_object_priority2D(filename) + return cast(int, og.point_set_object_priority2D(filename)) def is_saveable(self, filename: str) -> bool: - return og.is_point_set_saveable2D(self.point_set, filename) + return cast(bool, og.is_point_set_saveable2D(self.point_set, filename)) def save(self, filename: str) -> list[str]: - return og.save_point_set2D(self.point_set, filename) + return cast(list[str], og.save_point_set2D(self.point_set, filename)) def save_viewable(self, filename_without_extension: str) -> str: - return viewables.save_viewable_point_set2D( - self.point_set, filename_without_extension + return cast( + str, + viewables.save_viewable_point_set2D( + self.point_set, filename_without_extension + ), ) def save_light_viewable(self, filename_without_extension: str) -> str: - return viewables.save_light_viewable_point_set2D( - self.point_set, filename_without_extension + return cast( + str, + viewables.save_light_viewable_point_set2D( + self.point_set, filename_without_extension + ), ) def inspect(self) -> og_inspector.PointSetInspectionResult: diff --git a/src/opengeodeweb_back/geode_objects/geode_point_set3d.py b/src/opengeodeweb_back/geode_objects/geode_point_set3d.py index 1c490b59..4f400557 100644 --- a/src/opengeodeweb_back/geode_objects/geode_point_set3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_point_set3d.py @@ -1,5 +1,6 @@ # Standard library imports from __future__ import annotations +from typing import cast # Third party imports import opengeode as og @@ -24,7 +25,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "PointSet3D" def native_extension(self) -> str: - return self.point_set.native_extension() + return cast(str, self.point_set.native_extension()) @classmethod def is_3D(cls) -> bool: @@ -51,30 +52,36 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return og.PointSetInputFactory3D.list_creators() + return cast(list[str], og.PointSetInputFactory3D.list_creators()) @classmethod def output_extensions(cls) -> list[str]: - return og.PointSetOutputFactory3D.list_creators() + return cast(list[str], og.PointSetOutputFactory3D.list_creators()) @classmethod def object_priority(cls, filename: str) -> int: - return og.point_set_object_priority3D(filename) + return cast(int, og.point_set_object_priority3D(filename)) def is_saveable(self, filename: str) -> bool: - return og.is_point_set_saveable3D(self.point_set, filename) + return cast(bool, og.is_point_set_saveable3D(self.point_set, filename)) def save(self, filename: str) -> list[str]: - return og.save_point_set3D(self.point_set, filename) + return cast(list[str], og.save_point_set3D(self.point_set, filename)) def save_viewable(self, filename_without_extension: str) -> str: - return viewables.save_viewable_point_set3D( - self.point_set, filename_without_extension + return cast( + str, + viewables.save_viewable_point_set3D( + self.point_set, filename_without_extension + ), ) def save_light_viewable(self, filename_without_extension: str) -> str: - return viewables.save_light_viewable_point_set3D( - self.point_set, filename_without_extension + return cast( + str, + viewables.save_light_viewable_point_set3D( + self.point_set, filename_without_extension + ), ) def inspect(self) -> og_inspector.PointSetInspectionResult: diff --git a/src/opengeodeweb_back/geode_objects/geode_polygonal_surface2d.py b/src/opengeodeweb_back/geode_objects/geode_polygonal_surface2d.py index 6ff30f5a..0fad998f 100644 --- a/src/opengeodeweb_back/geode_objects/geode_polygonal_surface2d.py +++ b/src/opengeodeweb_back/geode_objects/geode_polygonal_surface2d.py @@ -1,5 +1,6 @@ # Standard library imports from __future__ import annotations +from typing import cast # Third party imports import opengeode as og @@ -27,7 +28,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "PolygonalSurface2D" def native_extension(self) -> str: - return self.polygonal_surface.native_extension() + return cast(str, self.polygonal_surface.native_extension()) def builder(self) -> og.PolygonalSurfaceBuilder2D: return og.PolygonalSurfaceBuilder2D.create(self.polygonal_surface) @@ -46,28 +47,38 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return og.PolygonalSurfaceInputFactory2D.list_creators() + return cast(list[str], og.PolygonalSurfaceInputFactory2D.list_creators()) @classmethod def output_extensions(cls) -> list[str]: - return og.PolygonalSurfaceOutputFactory2D.list_creators() + return cast(list[str], og.PolygonalSurfaceOutputFactory2D.list_creators()) @classmethod def object_priority(cls, filename: str) -> int: - return og.polygonal_surface_object_priority2D(filename) + return cast(int, og.polygonal_surface_object_priority2D(filename)) def is_saveable(self, filename: str) -> bool: - return og.is_polygonal_surface_saveable2D(self.polygonal_surface, filename) + return cast( + bool, og.is_polygonal_surface_saveable2D(self.polygonal_surface, filename) + ) def save(self, filename: str) -> list[str]: - return og.save_polygonal_surface2D(self.polygonal_surface, filename) + return cast( + list[str], og.save_polygonal_surface2D(self.polygonal_surface, filename) + ) def save_viewable(self, filename_without_extension: str) -> str: - return viewables.save_viewable_polygonal_surface2D( - self.polygonal_surface, filename_without_extension + return cast( + str, + viewables.save_viewable_polygonal_surface2D( + self.polygonal_surface, filename_without_extension + ), ) def save_light_viewable(self, filename_without_extension: str) -> str: - return viewables.save_light_viewable_polygonal_surface2D( - self.polygonal_surface, filename_without_extension + return cast( + str, + viewables.save_light_viewable_polygonal_surface2D( + self.polygonal_surface, filename_without_extension + ), ) diff --git a/src/opengeodeweb_back/geode_objects/geode_polygonal_surface3d.py b/src/opengeodeweb_back/geode_objects/geode_polygonal_surface3d.py index 48438d53..e973ca8a 100644 --- a/src/opengeodeweb_back/geode_objects/geode_polygonal_surface3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_polygonal_surface3d.py @@ -1,5 +1,6 @@ # Standard library imports from __future__ import annotations +from typing import cast # Third party imports import opengeode as og @@ -27,7 +28,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "PolygonalSurface3D" def native_extension(self) -> str: - return self.polygonal_surface.native_extension() + return cast(str, self.polygonal_surface.native_extension()) def builder(self) -> og.PolygonalSurfaceBuilder3D: return og.PolygonalSurfaceBuilder3D.create(self.polygonal_surface) @@ -46,28 +47,38 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return og.PolygonalSurfaceInputFactory3D.list_creators() + return cast(list[str], og.PolygonalSurfaceInputFactory3D.list_creators()) @classmethod def output_extensions(cls) -> list[str]: - return og.PolygonalSurfaceOutputFactory3D.list_creators() + return cast(list[str], og.PolygonalSurfaceOutputFactory3D.list_creators()) @classmethod def object_priority(cls, filename: str) -> int: - return og.polygonal_surface_object_priority3D(filename) + return cast(int, og.polygonal_surface_object_priority3D(filename)) def is_saveable(self, filename: str) -> bool: - return og.is_polygonal_surface_saveable3D(self.polygonal_surface, filename) + return cast( + bool, og.is_polygonal_surface_saveable3D(self.polygonal_surface, filename) + ) def save(self, filename: str) -> list[str]: - return og.save_polygonal_surface3D(self.polygonal_surface, filename) + return cast( + list[str], og.save_polygonal_surface3D(self.polygonal_surface, filename) + ) def save_viewable(self, filename_without_extension: str) -> str: - return viewables.save_viewable_polygonal_surface3D( - self.polygonal_surface, filename_without_extension + return cast( + str, + viewables.save_viewable_polygonal_surface3D( + self.polygonal_surface, filename_without_extension + ), ) def save_light_viewable(self, filename_without_extension: str) -> str: - return viewables.save_light_viewable_polygonal_surface3D( - self.polygonal_surface, filename_without_extension + return cast( + str, + viewables.save_light_viewable_polygonal_surface3D( + self.polygonal_surface, filename_without_extension + ), ) diff --git a/src/opengeodeweb_back/geode_objects/geode_polyhedral_solid3d.py b/src/opengeodeweb_back/geode_objects/geode_polyhedral_solid3d.py index 140dd324..662f6cb0 100644 --- a/src/opengeodeweb_back/geode_objects/geode_polyhedral_solid3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_polyhedral_solid3d.py @@ -1,5 +1,6 @@ # Standard library imports from __future__ import annotations +from typing import cast # Third party imports import opengeode as og @@ -27,7 +28,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "PolyhedralSolid3D" def native_extension(self) -> str: - return self.polyhedral_solid.native_extension() + return cast(str, self.polyhedral_solid.native_extension()) def builder(self) -> og.PolyhedralSolidBuilder3D: return og.PolyhedralSolidBuilder3D.create(self.polyhedral_solid) @@ -46,28 +47,38 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return og.PolyhedralSolidInputFactory3D.list_creators() + return cast(list[str], og.PolyhedralSolidInputFactory3D.list_creators()) @classmethod def output_extensions(cls) -> list[str]: - return og.PolyhedralSolidOutputFactory3D.list_creators() + return cast(list[str], og.PolyhedralSolidOutputFactory3D.list_creators()) @classmethod def object_priority(cls, filename: str) -> int: - return og.polyhedral_solid_object_priority3D(filename) + return cast(int, og.polyhedral_solid_object_priority3D(filename)) def is_saveable(self, filename: str) -> bool: - return og.is_polyhedral_solid_saveable3D(self.polyhedral_solid, filename) + return cast( + bool, og.is_polyhedral_solid_saveable3D(self.polyhedral_solid, filename) + ) def save(self, filename: str) -> list[str]: - return og.save_polyhedral_solid3D(self.polyhedral_solid, filename) + return cast( + list[str], og.save_polyhedral_solid3D(self.polyhedral_solid, filename) + ) def save_viewable(self, filename_without_extension: str) -> str: - return viewables.save_viewable_polyhedral_solid3D( - self.polyhedral_solid, filename_without_extension + return cast( + str, + viewables.save_viewable_polyhedral_solid3D( + self.polyhedral_solid, filename_without_extension + ), ) def save_light_viewable(self, filename_without_extension: str) -> str: - return viewables.save_light_viewable_polyhedral_solid3D( - self.polyhedral_solid, filename_without_extension + return cast( + str, + viewables.save_light_viewable_polyhedral_solid3D( + self.polyhedral_solid, filename_without_extension + ), ) diff --git a/src/opengeodeweb_back/geode_objects/geode_raster_image2d.py b/src/opengeodeweb_back/geode_objects/geode_raster_image2d.py index 1cd24e52..c16e5c50 100644 --- a/src/opengeodeweb_back/geode_objects/geode_raster_image2d.py +++ b/src/opengeodeweb_back/geode_objects/geode_raster_image2d.py @@ -1,5 +1,6 @@ # Standard library imports from __future__ import annotations +from typing import cast # Third party imports import opengeode as og @@ -23,7 +24,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "RasterImage2D" def native_extension(self) -> str: - return self.raster_image.native_extension() + return cast(str, self.raster_image.native_extension()) @classmethod def is_3D(cls) -> bool: @@ -50,30 +51,36 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return og.RasterImageInputFactory2D.list_creators() + return cast(list[str], og.RasterImageInputFactory2D.list_creators()) @classmethod def output_extensions(cls) -> list[str]: - return og.RasterImageOutputFactory2D.list_creators() + return cast(list[str], og.RasterImageOutputFactory2D.list_creators()) @classmethod def object_priority(cls, filename: str) -> int: - return og.raster_image_object_priority2D(filename) + return cast(int, og.raster_image_object_priority2D(filename)) def is_saveable(self, filename: str) -> bool: - return og.is_raster_image_saveable2D(self.raster_image, filename) + return cast(bool, og.is_raster_image_saveable2D(self.raster_image, filename)) def save(self, filename: str) -> list[str]: - return og.save_raster_image2D(self.raster_image, filename) + return cast(list[str], og.save_raster_image2D(self.raster_image, filename)) def save_viewable(self, filename_without_extension: str) -> str: - return viewables.save_viewable_raster_image2D( - self.raster_image, filename_without_extension + return cast( + str, + viewables.save_viewable_raster_image2D( + self.raster_image, filename_without_extension + ), ) def save_light_viewable(self, filename_without_extension: str) -> str: - return viewables.save_light_viewable_raster_image2D( - self.raster_image, filename_without_extension + return cast( + str, + viewables.save_light_viewable_raster_image2D( + self.raster_image, filename_without_extension + ), ) def inspect(self) -> None: diff --git a/src/opengeodeweb_back/geode_objects/geode_raster_image3d.py b/src/opengeodeweb_back/geode_objects/geode_raster_image3d.py index 6aef8db7..a1615b42 100644 --- a/src/opengeodeweb_back/geode_objects/geode_raster_image3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_raster_image3d.py @@ -1,5 +1,6 @@ # Standard library imports from __future__ import annotations +from typing import cast # Third party imports import opengeode as og @@ -23,7 +24,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "RasterImage3D" def native_extension(self) -> str: - return self.raster_image.native_extension() + return cast(str, self.raster_image.native_extension()) @classmethod def is_3D(cls) -> bool: @@ -50,30 +51,36 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return og.RasterImageInputFactory3D.list_creators() + return cast(list[str], og.RasterImageInputFactory3D.list_creators()) @classmethod def output_extensions(cls) -> list[str]: - return og.RasterImageOutputFactory3D.list_creators() + return cast(list[str], og.RasterImageOutputFactory3D.list_creators()) @classmethod def object_priority(cls, filename: str) -> int: - return og.raster_image_object_priority3D(filename) + return cast(int, og.raster_image_object_priority3D(filename)) def is_saveable(self, filename: str) -> bool: - return og.is_raster_image_saveable3D(self.raster_image, filename) + return cast(bool, og.is_raster_image_saveable3D(self.raster_image, filename)) def save(self, filename: str) -> list[str]: - return og.save_raster_image3D(self.raster_image, filename) + return cast(list[str], og.save_raster_image3D(self.raster_image, filename)) def save_viewable(self, filename_without_extension: str) -> str: - return viewables.save_viewable_raster_image3D( - self.raster_image, filename_without_extension + return cast( + str, + viewables.save_viewable_raster_image3D( + self.raster_image, filename_without_extension + ), ) def save_light_viewable(self, filename_without_extension: str) -> str: - return viewables.save_light_viewable_raster_image3D( - self.raster_image, filename_without_extension + return cast( + str, + viewables.save_light_viewable_raster_image3D( + self.raster_image, filename_without_extension + ), ) def inspect(self) -> None: diff --git a/src/opengeodeweb_back/geode_objects/geode_regular_grid2d.py b/src/opengeodeweb_back/geode_objects/geode_regular_grid2d.py index 7fa45e07..f40faa19 100644 --- a/src/opengeodeweb_back/geode_objects/geode_regular_grid2d.py +++ b/src/opengeodeweb_back/geode_objects/geode_regular_grid2d.py @@ -1,5 +1,6 @@ # Standard library imports from __future__ import annotations +from typing import cast, Any # Third party imports import opengeode as og @@ -29,7 +30,7 @@ def inspect(self) -> og_inspector.SurfaceInspectionResult: return super().inspect() def native_extension(self) -> str: - return self.regular_grid.native_extension() + return cast(str, self.regular_grid.native_extension()) def builder(self) -> og.RegularGridBuilder2D: return og.RegularGridBuilder2D.create(self.regular_grid) @@ -48,30 +49,36 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return og.RegularGridInputFactory2D.list_creators() + return cast(list[str], og.RegularGridInputFactory2D.list_creators()) @classmethod def output_extensions(cls) -> list[str]: - return og.RegularGridOutputFactory2D.list_creators() + return cast(list[str], og.RegularGridOutputFactory2D.list_creators()) @classmethod def object_priority(cls, filename: str) -> int: - return og.regular_grid_object_priority2D(filename) + return cast(int, og.regular_grid_object_priority2D(filename)) def is_saveable(self, filename: str) -> bool: - return og.is_regular_grid_saveable2D(self.regular_grid, filename) + return cast(bool, og.is_regular_grid_saveable2D(self.regular_grid, filename)) def save(self, filename: str) -> list[str]: - return og.save_regular_grid2D(self.regular_grid, filename) + return cast(list[str], og.save_regular_grid2D(self.regular_grid, filename)) def save_viewable(self, filename_without_extension: str) -> str: - return viewables.save_viewable_regular_grid2D( - self.regular_grid, filename_without_extension + return cast( + str, + viewables.save_viewable_regular_grid2D( + self.regular_grid, filename_without_extension + ), ) def save_light_viewable(self, filename_without_extension: str) -> str: - return viewables.save_light_viewable_regular_grid2D( - self.regular_grid, filename_without_extension + return cast( + str, + viewables.save_light_viewable_regular_grid2D( + self.regular_grid, filename_without_extension + ), ) def cell_attribute_manager(self) -> og.AttributeManager: diff --git a/src/opengeodeweb_back/geode_objects/geode_regular_grid3d.py b/src/opengeodeweb_back/geode_objects/geode_regular_grid3d.py index 8f158ca4..c595d6bb 100644 --- a/src/opengeodeweb_back/geode_objects/geode_regular_grid3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_regular_grid3d.py @@ -1,5 +1,6 @@ # Standard library imports from __future__ import annotations +from typing import cast # Third party imports import opengeode as og @@ -26,7 +27,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "RegularGrid3D" def native_extension(self) -> str: - return self.regular_grid.native_extension() + return cast(str, self.regular_grid.native_extension()) def builder(self) -> og.RegularGridBuilder3D: return og.RegularGridBuilder3D.create(self.regular_grid) @@ -45,30 +46,36 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return og.RegularGridInputFactory3D.list_creators() + return cast(list[str], og.RegularGridInputFactory3D.list_creators()) @classmethod def output_extensions(cls) -> list[str]: - return og.RegularGridOutputFactory3D.list_creators() + return cast(list[str], og.RegularGridOutputFactory3D.list_creators()) @classmethod def object_priority(cls, filename: str) -> int: - return og.regular_grid_object_priority3D(filename) + return cast(int, og.regular_grid_object_priority3D(filename)) def is_saveable(self, filename: str) -> bool: - return og.is_regular_grid_saveable3D(self.regular_grid, filename) + return cast(bool, og.is_regular_grid_saveable3D(self.regular_grid, filename)) def save(self, filename: str) -> list[str]: - return og.save_regular_grid3D(self.regular_grid, filename) + return cast(list[str], og.save_regular_grid3D(self.regular_grid, filename)) def save_viewable(self, filename_without_extension: str) -> str: - return viewables.save_viewable_regular_grid3D( - self.regular_grid, filename_without_extension + return cast( + str, + viewables.save_viewable_regular_grid3D( + self.regular_grid, filename_without_extension + ), ) def save_light_viewable(self, filename_without_extension: str) -> str: - return viewables.save_light_viewable_regular_grid3D( - self.regular_grid, filename_without_extension + return cast( + str, + viewables.save_light_viewable_regular_grid3D( + self.regular_grid, filename_without_extension + ), ) def cell_attribute_manager(self) -> og.AttributeManager: diff --git a/src/opengeodeweb_back/geode_objects/geode_section.py b/src/opengeodeweb_back/geode_objects/geode_section.py index a848673b..855de7cc 100644 --- a/src/opengeodeweb_back/geode_objects/geode_section.py +++ b/src/opengeodeweb_back/geode_objects/geode_section.py @@ -1,5 +1,6 @@ # Standard library imports from __future__ import annotations +from typing import cast, Any # Third party imports import opengeode as og @@ -24,7 +25,7 @@ def geode_object_type(cls) -> GeodeModelType: return "Section" def native_extension(self) -> str: - return self.section.native_extension() + return cast(str, self.section.native_extension()) @classmethod def is_3D(cls) -> bool: @@ -51,32 +52,38 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return og.SectionInputFactory.list_creators() + return cast(list[str], og.SectionInputFactory.list_creators()) @classmethod def output_extensions(cls) -> list[str]: - return og.SectionOutputFactory.list_creators() + return cast(list[str], og.SectionOutputFactory.list_creators()) @classmethod def object_priority(cls, filename: str) -> int: - return og.section_object_priority(filename) + return cast(int, og.section_object_priority(filename)) def is_saveable(self, filename: str) -> bool: - return og.is_section_saveable(self.section, filename) + return cast(bool, og.is_section_saveable(self.section, filename)) def save(self, filename: str) -> list[str]: - return og.save_section(self.section, filename) + return cast(list[str], og.save_section(self.section, filename)) def save_viewable(self, filename_without_extension: str) -> str: - return viewables.save_viewable_section(self.section, filename_without_extension) + return cast( + str, + viewables.save_viewable_section(self.section, filename_without_extension), + ) def save_light_viewable(self, filename_without_extension: str) -> str: - return viewables.save_light_viewable_section( - self.section, filename_without_extension + return cast( + str, + viewables.save_light_viewable_section( + self.section, filename_without_extension + ), ) def mesh_components(self) -> ComponentRegistry: - return self.section.mesh_components() + return cast(dict[Any, list[Any]], self.section.mesh_components()) def inspect(self) -> og_inspector.SectionInspectionResult: return og_inspector.inspect_section(self.section) diff --git a/src/opengeodeweb_back/geode_objects/geode_structural_model.py b/src/opengeodeweb_back/geode_objects/geode_structural_model.py index 74b28fc8..9f30c3d7 100644 --- a/src/opengeodeweb_back/geode_objects/geode_structural_model.py +++ b/src/opengeodeweb_back/geode_objects/geode_structural_model.py @@ -1,5 +1,6 @@ # Standard library imports from __future__ import annotations +from typing import cast # Third party imports import opengeode as og @@ -30,7 +31,7 @@ def geode_object_type(cls) -> GeodeModelType: return "StructuralModel" def native_extension(self) -> str: - return self.structural_model.native_extension() + return cast(str, self.structural_model.native_extension()) def builder(self) -> og_geosciences.StructuralModelBuilder: return og_geosciences.StructuralModelBuilder(self.structural_model) @@ -49,30 +50,46 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return og_geosciences.StructuralModelInputFactory.list_creators() + return cast( + list[str], og_geosciences.StructuralModelInputFactory.list_creators() + ) @classmethod def output_extensions(cls) -> list[str]: - return og_geosciences.StructuralModelOutputFactory.list_creators() + return cast( + list[str], og_geosciences.StructuralModelOutputFactory.list_creators() + ) @classmethod def object_priority(cls, filename: str) -> int: - return og_geosciences.structural_model_object_priority(filename) + return cast(int, og_geosciences.structural_model_object_priority(filename)) def is_saveable(self, filename: str) -> bool: - return og_geosciences.is_structural_model_saveable( - self.structural_model, filename + return cast( + bool, + og_geosciences.is_structural_model_saveable( + self.structural_model, filename + ), ) def save(self, filename: str) -> list[str]: - return og_geosciences.save_structural_model(self.structural_model, filename) + return cast( + list[str], + og_geosciences.save_structural_model(self.structural_model, filename), + ) def save_viewable(self, filename_without_extension: str) -> str: - return viewables.save_viewable_structural_model( - self.structural_model, filename_without_extension + return cast( + str, + viewables.save_viewable_structural_model( + self.structural_model, filename_without_extension + ), ) def save_light_viewable(self, filename_without_extension: str) -> str: - return viewables.save_light_viewable_structural_model( - self.structural_model, filename_without_extension + return cast( + str, + viewables.save_light_viewable_structural_model( + self.structural_model, filename_without_extension + ), ) diff --git a/src/opengeodeweb_back/geode_objects/geode_tetrahedral_solid3d.py b/src/opengeodeweb_back/geode_objects/geode_tetrahedral_solid3d.py index d1b95f02..029391ce 100644 --- a/src/opengeodeweb_back/geode_objects/geode_tetrahedral_solid3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_tetrahedral_solid3d.py @@ -1,5 +1,6 @@ # Standard library imports from __future__ import annotations +from typing import cast # Third party imports import opengeode as og @@ -27,7 +28,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "TetrahedralSolid3D" def native_extension(self) -> str: - return self.tetrahedral_solid.native_extension() + return cast(str, self.tetrahedral_solid.native_extension()) def builder(self) -> og.TetrahedralSolidBuilder3D: return og.TetrahedralSolidBuilder3D.create(self.tetrahedral_solid) @@ -46,28 +47,38 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return og.TetrahedralSolidInputFactory3D.list_creators() + return cast(list[str], og.TetrahedralSolidInputFactory3D.list_creators()) @classmethod def output_extensions(cls) -> list[str]: - return og.TetrahedralSolidOutputFactory3D.list_creators() + return cast(list[str], og.TetrahedralSolidOutputFactory3D.list_creators()) @classmethod def object_priority(cls, filename: str) -> int: - return og.tetrahedral_solid_object_priority3D(filename) + return cast(int, og.tetrahedral_solid_object_priority3D(filename)) def is_saveable(self, filename: str) -> bool: - return og.is_tetrahedral_solid_saveable3D(self.tetrahedral_solid, filename) + return cast( + bool, og.is_tetrahedral_solid_saveable3D(self.tetrahedral_solid, filename) + ) def save(self, filename: str) -> list[str]: - return og.save_tetrahedral_solid3D(self.tetrahedral_solid, filename) + return cast( + list[str], og.save_tetrahedral_solid3D(self.tetrahedral_solid, filename) + ) def save_viewable(self, filename_without_extension: str) -> str: - return viewables.save_viewable_tetrahedral_solid3D( - self.tetrahedral_solid, filename_without_extension + return cast( + str, + viewables.save_viewable_tetrahedral_solid3D( + self.tetrahedral_solid, filename_without_extension + ), ) def save_light_viewable(self, filename_without_extension: str) -> str: - return viewables.save_light_viewable_tetrahedral_solid3D( - self.tetrahedral_solid, filename_without_extension + return cast( + str, + viewables.save_light_viewable_tetrahedral_solid3D( + self.tetrahedral_solid, filename_without_extension + ), ) diff --git a/src/opengeodeweb_back/geode_objects/geode_triangulated_surface2d.py b/src/opengeodeweb_back/geode_objects/geode_triangulated_surface2d.py index 8363cd38..bb2e9f1d 100644 --- a/src/opengeodeweb_back/geode_objects/geode_triangulated_surface2d.py +++ b/src/opengeodeweb_back/geode_objects/geode_triangulated_surface2d.py @@ -1,5 +1,6 @@ # Standard library imports from __future__ import annotations +from typing import cast # Third party imports import opengeode as og @@ -29,7 +30,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "TriangulatedSurface2D" def native_extension(self) -> str: - return self.triangulated_surface.native_extension() + return cast(str, self.triangulated_surface.native_extension()) def builder(self) -> og.TriangulatedSurfaceBuilder2D: return og.TriangulatedSurfaceBuilder2D.create(self.triangulated_surface) @@ -48,30 +49,40 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return og.TriangulatedSurfaceInputFactory2D.list_creators() + return cast(list[str], og.TriangulatedSurfaceInputFactory2D.list_creators()) @classmethod def output_extensions(cls) -> list[str]: - return og.TriangulatedSurfaceOutputFactory2D.list_creators() + return cast(list[str], og.TriangulatedSurfaceOutputFactory2D.list_creators()) @classmethod def object_priority(cls, filename: str) -> int: - return og.triangulated_surface_object_priority2D(filename) + return cast(int, og.triangulated_surface_object_priority2D(filename)) def is_saveable(self, filename: str) -> bool: - return og.is_triangulated_surface_saveable2D( - self.triangulated_surface, filename + return cast( + bool, + og.is_triangulated_surface_saveable2D(self.triangulated_surface, filename), ) def save(self, filename: str) -> list[str]: - return og.save_triangulated_surface2D(self.triangulated_surface, filename) + return cast( + list[str], + og.save_triangulated_surface2D(self.triangulated_surface, filename), + ) def save_viewable(self, filename_without_extension: str) -> str: - return viewables.save_viewable_triangulated_surface2D( - self.triangulated_surface, filename_without_extension + return cast( + str, + viewables.save_viewable_triangulated_surface2D( + self.triangulated_surface, filename_without_extension + ), ) def save_light_viewable(self, filename_without_extension: str) -> str: - return viewables.save_light_viewable_triangulated_surface2D( - self.triangulated_surface, filename_without_extension + return cast( + str, + viewables.save_light_viewable_triangulated_surface2D( + self.triangulated_surface, filename_without_extension + ), ) diff --git a/src/opengeodeweb_back/geode_objects/geode_triangulated_surface3d.py b/src/opengeodeweb_back/geode_objects/geode_triangulated_surface3d.py index b34d6487..91e61abe 100644 --- a/src/opengeodeweb_back/geode_objects/geode_triangulated_surface3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_triangulated_surface3d.py @@ -1,5 +1,6 @@ # Standard library imports from __future__ import annotations +from typing import cast # Third party imports import opengeode as og @@ -29,7 +30,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "TriangulatedSurface3D" def native_extension(self) -> str: - return self.triangulated_surface.native_extension() + return cast(str, self.triangulated_surface.native_extension()) def builder(self) -> og.TriangulatedSurfaceBuilder3D: return og.TriangulatedSurfaceBuilder3D.create(self.triangulated_surface) @@ -48,30 +49,40 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return og.TriangulatedSurfaceInputFactory3D.list_creators() + return cast(list[str], og.TriangulatedSurfaceInputFactory3D.list_creators()) @classmethod def output_extensions(cls) -> list[str]: - return og.TriangulatedSurfaceOutputFactory3D.list_creators() + return cast(list[str], og.TriangulatedSurfaceOutputFactory3D.list_creators()) @classmethod def object_priority(cls, filename: str) -> int: - return og.triangulated_surface_object_priority3D(filename) + return cast(int, og.triangulated_surface_object_priority3D(filename)) def is_saveable(self, filename: str) -> bool: - return og.is_triangulated_surface_saveable3D( - self.triangulated_surface, filename + return cast( + bool, + og.is_triangulated_surface_saveable3D(self.triangulated_surface, filename), ) def save(self, filename: str) -> list[str]: - return og.save_triangulated_surface3D(self.triangulated_surface, filename) + return cast( + list[str], + og.save_triangulated_surface3D(self.triangulated_surface, filename), + ) def save_viewable(self, filename_without_extension: str) -> str: - return viewables.save_viewable_triangulated_surface3D( - self.triangulated_surface, filename_without_extension + return cast( + str, + viewables.save_viewable_triangulated_surface3D( + self.triangulated_surface, filename_without_extension + ), ) def save_light_viewable(self, filename_without_extension: str) -> str: - return viewables.save_light_viewable_triangulated_surface3D( - self.triangulated_surface, filename_without_extension + return cast( + str, + viewables.save_light_viewable_triangulated_surface3D( + self.triangulated_surface, filename_without_extension + ), ) diff --git a/src/opengeodeweb_back/geode_objects/geode_vertex_set.py b/src/opengeodeweb_back/geode_objects/geode_vertex_set.py index 0cf9028f..253f7070 100644 --- a/src/opengeodeweb_back/geode_objects/geode_vertex_set.py +++ b/src/opengeodeweb_back/geode_objects/geode_vertex_set.py @@ -1,5 +1,6 @@ # Standard library imports from __future__ import annotations +from typing import cast # Third party imports import opengeode as og @@ -25,7 +26,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "VertexSet" def native_extension(self) -> str: - return self.vertex_set.native_extension() + return cast(str, self.vertex_set.native_extension()) @classmethod def is_3D(cls) -> bool: @@ -52,21 +53,21 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return og.VertexSetInputFactory.list_creators() + return cast(list[str], og.VertexSetInputFactory.list_creators()) @classmethod def output_extensions(cls) -> list[str]: - return og.VertexSetOutputFactory.list_creators() + return cast(list[str], og.VertexSetOutputFactory.list_creators()) @classmethod def object_priority(cls, filename: str) -> int: - return og.vertex_set_object_priority(filename) + return cast(int, og.vertex_set_object_priority(filename)) def is_saveable(self, filename: str) -> bool: - return og.is_vertex_set_saveable(self.vertex_set, filename) + return cast(bool, og.is_vertex_set_saveable(self.vertex_set, filename)) def save(self, filename: str) -> list[str]: - return og.save_vertex_set(self.vertex_set, filename) + return cast(list[str], og.save_vertex_set(self.vertex_set, filename)) def save_viewable(self, filename_without_extension: str) -> str: return "" diff --git a/src/opengeodeweb_back/py.typed b/src/opengeodeweb_back/py.typed index b648ac92..e69de29b 100644 --- a/src/opengeodeweb_back/py.typed +++ b/src/opengeodeweb_back/py.typed @@ -1 +0,0 @@ -partial From 4dc2059588bfa41a9632787d4e15bfff340a73bb Mon Sep 17 00:00:00 2001 From: MaxNumerique Date: Mon, 5 Jan 2026 14:58:51 +0100 Subject: [PATCH 02/12] mypy.ini ignores missing imports --- mypy.ini | 26 +------------------ src/opengeodeweb_back/geode_functions.py | 3 ++- .../geode_objects/geode_graph.py | 2 -- .../geode_objects/geode_grid2d.py | 2 -- .../geode_objects/geode_grid3d.py | 2 -- .../geode_objects/geode_hybrid_solid3d.py | 1 - .../geode_implicit_structural_model.py | 1 - .../geode_light_regular_grid2d.py | 1 - .../geode_light_regular_grid3d.py | 1 - .../geode_objects/geode_mesh.py | 2 +- .../geode_objects/geode_model.py | 4 +-- .../geode_objects/geode_object.py | 2 +- .../geode_polygonal_surface2d.py | 1 - .../geode_polygonal_surface3d.py | 1 - .../geode_objects/geode_polyhedral_solid3d.py | 1 - .../geode_objects/geode_raster_image2d.py | 1 - .../geode_objects/geode_raster_image3d.py | 1 - .../geode_objects/geode_regular_grid2d.py | 2 +- .../geode_objects/geode_section.py | 2 +- .../geode_objects/geode_solid_mesh3d.py | 2 -- .../geode_objects/geode_structural_model.py | 1 - .../geode_objects/geode_surface_mesh2d.py | 2 -- .../geode_objects/geode_surface_mesh3d.py | 2 -- .../geode_tetrahedral_solid3d.py | 1 - .../geode_triangulated_surface2d.py | 1 - .../geode_triangulated_surface3d.py | 1 - .../geode_objects/geode_vertex_set.py | 4 +-- .../routes/blueprint_routes.py | 5 ++++ .../routes/create/blueprint_create.py | 2 +- .../routes/models/blueprint_models.py | 2 ++ src/opengeodeweb_back/utils_functions.py | 3 ++- 31 files changed, 20 insertions(+), 62 deletions(-) diff --git a/mypy.ini b/mypy.ini index e8f498dc..656ac495 100644 --- a/mypy.ini +++ b/mypy.ini @@ -3,32 +3,8 @@ strict = True files = src/ disallow_untyped_decorators = False -[mypy-opengeode.*] -ignore_missing_imports = True - -[mypy-opengeode_geosciences.*] -ignore_missing_imports = True - -[mypy-opengeode_inspector.*] -ignore_missing_imports = True - -[mypy-opengeode_io.*] -ignore_missing_imports = True - -[mypy-opengeode_geosciencesio.*] -ignore_missing_imports = True - -[mypy-geode_viewables.*] -ignore_missing_imports = True - -[mypy-werkzeug.*] -ignore_missing_imports = True - -[mypy-flask.*] +[mypy-opengeode.*,geode.*,opengeode.*,opengeode_io.*,opengeode_geosciences.*,opengeode_inspector.*,opengeode_geosciencesio.*,geode_viewables.*,werkzeug.*,flask.*,dataclasses_json.*] ignore_missing_imports = True [mypy-opengeodeweb_microservice.*] -ignore_missing_imports = True - -[mypy-dataclasses_json.*] ignore_missing_imports = True \ No newline at end of file diff --git a/src/opengeodeweb_back/geode_functions.py b/src/opengeodeweb_back/geode_functions.py index afcd2e1c..978861f2 100644 --- a/src/opengeodeweb_back/geode_functions.py +++ b/src/opengeodeweb_back/geode_functions.py @@ -4,6 +4,7 @@ # Third party imports import werkzeug import flask +from typing import cast # Local application imports from .geode_objects import geode_objects @@ -48,7 +49,7 @@ def get_data_info(data_id: str) -> Data: def upload_file_path(filename: str) -> str: upload_folder = flask.current_app.config["UPLOAD_FOLDER"] secure_filename = werkzeug.utils.secure_filename(filename) - return os.path.abspath(os.path.join(upload_folder, secure_filename)) + return cast(str, os.path.abspath(os.path.join(upload_folder, secure_filename))) def geode_object_output_extensions( diff --git a/src/opengeodeweb_back/geode_objects/geode_graph.py b/src/opengeodeweb_back/geode_objects/geode_graph.py index 191fb969..2b3bf912 100644 --- a/src/opengeodeweb_back/geode_objects/geode_graph.py +++ b/src/opengeodeweb_back/geode_objects/geode_graph.py @@ -4,8 +4,6 @@ # Third party imports import opengeode as og -import opengeode_inspector as og_inspector -import geode_viewables as viewables # Local application imports from .types import GeodeMeshType diff --git a/src/opengeodeweb_back/geode_objects/geode_grid2d.py b/src/opengeodeweb_back/geode_objects/geode_grid2d.py index 75cb1a0d..f7d592ea 100644 --- a/src/opengeodeweb_back/geode_objects/geode_grid2d.py +++ b/src/opengeodeweb_back/geode_objects/geode_grid2d.py @@ -4,10 +4,8 @@ # Third party imports import opengeode as og -import geode_viewables as viewables # Local application imports -from .types import GeodeMeshType from .geode_mesh import GeodeMesh diff --git a/src/opengeodeweb_back/geode_objects/geode_grid3d.py b/src/opengeodeweb_back/geode_objects/geode_grid3d.py index bf4a441a..91458c96 100644 --- a/src/opengeodeweb_back/geode_objects/geode_grid3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_grid3d.py @@ -4,10 +4,8 @@ # Third party imports import opengeode as og -import geode_viewables as viewables # Local application imports -from .types import GeodeMeshType from .geode_mesh import GeodeMesh diff --git a/src/opengeodeweb_back/geode_objects/geode_hybrid_solid3d.py b/src/opengeodeweb_back/geode_objects/geode_hybrid_solid3d.py index bd863888..d9c6693d 100644 --- a/src/opengeodeweb_back/geode_objects/geode_hybrid_solid3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_hybrid_solid3d.py @@ -4,7 +4,6 @@ # Third party imports import opengeode as og -import opengeode_inspector as og_inspector import geode_viewables as viewables # Local application imports diff --git a/src/opengeodeweb_back/geode_objects/geode_implicit_structural_model.py b/src/opengeodeweb_back/geode_objects/geode_implicit_structural_model.py index f776a32c..7c2660d0 100644 --- a/src/opengeodeweb_back/geode_objects/geode_implicit_structural_model.py +++ b/src/opengeodeweb_back/geode_objects/geode_implicit_structural_model.py @@ -5,7 +5,6 @@ # Third party imports import opengeode as og import opengeode_geosciences as og_geosciences -import opengeode_inspector as og_inspector import geode_viewables as viewables # Local application imports diff --git a/src/opengeodeweb_back/geode_objects/geode_light_regular_grid2d.py b/src/opengeodeweb_back/geode_objects/geode_light_regular_grid2d.py index caf0b8ab..7fa16af5 100644 --- a/src/opengeodeweb_back/geode_objects/geode_light_regular_grid2d.py +++ b/src/opengeodeweb_back/geode_objects/geode_light_regular_grid2d.py @@ -4,7 +4,6 @@ # Third party imports import opengeode as og -import opengeode_inspector as og_inspector import geode_viewables as viewables # Local application imports diff --git a/src/opengeodeweb_back/geode_objects/geode_light_regular_grid3d.py b/src/opengeodeweb_back/geode_objects/geode_light_regular_grid3d.py index d291d161..6d75baa0 100644 --- a/src/opengeodeweb_back/geode_objects/geode_light_regular_grid3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_light_regular_grid3d.py @@ -4,7 +4,6 @@ # Third party imports import opengeode as og -import opengeode_inspector as og_inspector import geode_viewables as viewables # Local application imports diff --git a/src/opengeodeweb_back/geode_objects/geode_mesh.py b/src/opengeodeweb_back/geode_objects/geode_mesh.py index 6680eca4..68b7512f 100644 --- a/src/opengeodeweb_back/geode_objects/geode_mesh.py +++ b/src/opengeodeweb_back/geode_objects/geode_mesh.py @@ -6,7 +6,7 @@ import opengeode as og # Local application imports -from .types import GeodeObjectType, ViewerType +from .types import ViewerType from .geode_object import GeodeObject diff --git a/src/opengeodeweb_back/geode_objects/geode_model.py b/src/opengeodeweb_back/geode_objects/geode_model.py index f7352d02..394f0d80 100644 --- a/src/opengeodeweb_back/geode_objects/geode_model.py +++ b/src/opengeodeweb_back/geode_objects/geode_model.py @@ -1,12 +1,12 @@ # Standard library imports from __future__ import annotations -from abc import ABC, abstractmethod +from abc import abstractmethod # Third party imports import opengeode as og # Local application imports -from .types import GeodeObjectType, GeodeModelType, ViewerType +from .types import ViewerType from .geode_object import GeodeObject ComponentRegistry = dict[og.ComponentType, list[og.uuid]] diff --git a/src/opengeodeweb_back/geode_objects/geode_object.py b/src/opengeodeweb_back/geode_objects/geode_object.py index 8c44ef45..580a846c 100644 --- a/src/opengeodeweb_back/geode_objects/geode_object.py +++ b/src/opengeodeweb_back/geode_objects/geode_object.py @@ -1,7 +1,7 @@ # Standard library imports from __future__ import annotations from abc import ABC, abstractmethod -from typing import Literal, Any, get_args, cast +from typing import Any # Third party imports import opengeode as og diff --git a/src/opengeodeweb_back/geode_objects/geode_polygonal_surface2d.py b/src/opengeodeweb_back/geode_objects/geode_polygonal_surface2d.py index 0fad998f..00e0bdb0 100644 --- a/src/opengeodeweb_back/geode_objects/geode_polygonal_surface2d.py +++ b/src/opengeodeweb_back/geode_objects/geode_polygonal_surface2d.py @@ -4,7 +4,6 @@ # Third party imports import opengeode as og -import opengeode_inspector as og_inspector import geode_viewables as viewables # Local application imports diff --git a/src/opengeodeweb_back/geode_objects/geode_polygonal_surface3d.py b/src/opengeodeweb_back/geode_objects/geode_polygonal_surface3d.py index e973ca8a..9fb5774f 100644 --- a/src/opengeodeweb_back/geode_objects/geode_polygonal_surface3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_polygonal_surface3d.py @@ -4,7 +4,6 @@ # Third party imports import opengeode as og -import opengeode_inspector as og_inspector import geode_viewables as viewables # Local application imports diff --git a/src/opengeodeweb_back/geode_objects/geode_polyhedral_solid3d.py b/src/opengeodeweb_back/geode_objects/geode_polyhedral_solid3d.py index 662f6cb0..4009a23d 100644 --- a/src/opengeodeweb_back/geode_objects/geode_polyhedral_solid3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_polyhedral_solid3d.py @@ -4,7 +4,6 @@ # Third party imports import opengeode as og -import opengeode_inspector as og_inspector import geode_viewables as viewables # Local application imports diff --git a/src/opengeodeweb_back/geode_objects/geode_raster_image2d.py b/src/opengeodeweb_back/geode_objects/geode_raster_image2d.py index c16e5c50..8842ad3c 100644 --- a/src/opengeodeweb_back/geode_objects/geode_raster_image2d.py +++ b/src/opengeodeweb_back/geode_objects/geode_raster_image2d.py @@ -4,7 +4,6 @@ # Third party imports import opengeode as og -import opengeode_inspector as og_inspector import geode_viewables as viewables # Local application imports diff --git a/src/opengeodeweb_back/geode_objects/geode_raster_image3d.py b/src/opengeodeweb_back/geode_objects/geode_raster_image3d.py index a1615b42..24a0c823 100644 --- a/src/opengeodeweb_back/geode_objects/geode_raster_image3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_raster_image3d.py @@ -4,7 +4,6 @@ # Third party imports import opengeode as og -import opengeode_inspector as og_inspector import geode_viewables as viewables # Local application imports diff --git a/src/opengeodeweb_back/geode_objects/geode_regular_grid2d.py b/src/opengeodeweb_back/geode_objects/geode_regular_grid2d.py index f40faa19..edbf5766 100644 --- a/src/opengeodeweb_back/geode_objects/geode_regular_grid2d.py +++ b/src/opengeodeweb_back/geode_objects/geode_regular_grid2d.py @@ -1,6 +1,6 @@ # Standard library imports from __future__ import annotations -from typing import cast, Any +from typing import cast # Third party imports import opengeode as og diff --git a/src/opengeodeweb_back/geode_objects/geode_section.py b/src/opengeodeweb_back/geode_objects/geode_section.py index 855de7cc..c115b3cc 100644 --- a/src/opengeodeweb_back/geode_objects/geode_section.py +++ b/src/opengeodeweb_back/geode_objects/geode_section.py @@ -9,7 +9,7 @@ import geode_viewables as viewables # Local application imports -from .types import GeodeModelType, ViewerType +from .types import GeodeModelType from .geode_model import GeodeModel, ComponentRegistry diff --git a/src/opengeodeweb_back/geode_objects/geode_solid_mesh3d.py b/src/opengeodeweb_back/geode_objects/geode_solid_mesh3d.py index 7842bcc8..d7112035 100644 --- a/src/opengeodeweb_back/geode_objects/geode_solid_mesh3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_solid_mesh3d.py @@ -5,10 +5,8 @@ import opengeode as og import opengeode_geosciences as og_geosciences import opengeode_inspector as og_inspector -import geode_viewables as viewables # Local application imports -from .types import GeodeMeshType from .geode_vertex_set import GeodeVertexSet diff --git a/src/opengeodeweb_back/geode_objects/geode_structural_model.py b/src/opengeodeweb_back/geode_objects/geode_structural_model.py index 9f30c3d7..ca00e446 100644 --- a/src/opengeodeweb_back/geode_objects/geode_structural_model.py +++ b/src/opengeodeweb_back/geode_objects/geode_structural_model.py @@ -5,7 +5,6 @@ # Third party imports import opengeode as og import opengeode_geosciences as og_geosciences -import opengeode_inspector as og_inspector import geode_viewables as viewables # Local application imports diff --git a/src/opengeodeweb_back/geode_objects/geode_surface_mesh2d.py b/src/opengeodeweb_back/geode_objects/geode_surface_mesh2d.py index dd49135e..199846f9 100644 --- a/src/opengeodeweb_back/geode_objects/geode_surface_mesh2d.py +++ b/src/opengeodeweb_back/geode_objects/geode_surface_mesh2d.py @@ -5,10 +5,8 @@ import opengeode as og import opengeode_geosciences as og_geosciences import opengeode_inspector as og_inspector -import geode_viewables as viewables # Local application imports -from .types import GeodeMeshType from .geode_vertex_set import GeodeVertexSet diff --git a/src/opengeodeweb_back/geode_objects/geode_surface_mesh3d.py b/src/opengeodeweb_back/geode_objects/geode_surface_mesh3d.py index d064f885..8468c7b0 100644 --- a/src/opengeodeweb_back/geode_objects/geode_surface_mesh3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_surface_mesh3d.py @@ -5,10 +5,8 @@ import opengeode as og import opengeode_geosciences as og_geosciences import opengeode_inspector as og_inspector -import geode_viewables as viewables # Local application imports -from .types import GeodeMeshType from .geode_vertex_set import GeodeVertexSet diff --git a/src/opengeodeweb_back/geode_objects/geode_tetrahedral_solid3d.py b/src/opengeodeweb_back/geode_objects/geode_tetrahedral_solid3d.py index 029391ce..e918f215 100644 --- a/src/opengeodeweb_back/geode_objects/geode_tetrahedral_solid3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_tetrahedral_solid3d.py @@ -4,7 +4,6 @@ # Third party imports import opengeode as og -import opengeode_inspector as og_inspector import geode_viewables as viewables # Local application imports diff --git a/src/opengeodeweb_back/geode_objects/geode_triangulated_surface2d.py b/src/opengeodeweb_back/geode_objects/geode_triangulated_surface2d.py index bb2e9f1d..60eb096a 100644 --- a/src/opengeodeweb_back/geode_objects/geode_triangulated_surface2d.py +++ b/src/opengeodeweb_back/geode_objects/geode_triangulated_surface2d.py @@ -4,7 +4,6 @@ # Third party imports import opengeode as og -import opengeode_inspector as og_inspector import geode_viewables as viewables # Local application imports diff --git a/src/opengeodeweb_back/geode_objects/geode_triangulated_surface3d.py b/src/opengeodeweb_back/geode_objects/geode_triangulated_surface3d.py index 91e61abe..8c74118b 100644 --- a/src/opengeodeweb_back/geode_objects/geode_triangulated_surface3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_triangulated_surface3d.py @@ -4,7 +4,6 @@ # Third party imports import opengeode as og -import opengeode_inspector as og_inspector import geode_viewables as viewables # Local application imports diff --git a/src/opengeodeweb_back/geode_objects/geode_vertex_set.py b/src/opengeodeweb_back/geode_objects/geode_vertex_set.py index 253f7070..39e3a9f2 100644 --- a/src/opengeodeweb_back/geode_objects/geode_vertex_set.py +++ b/src/opengeodeweb_back/geode_objects/geode_vertex_set.py @@ -4,11 +4,9 @@ # Third party imports import opengeode as og -import opengeode_inspector as og_inspector -import geode_viewables as viewables # Local application imports -from .types import GeodeMeshType, ViewerType +from .types import GeodeMeshType from .geode_mesh import GeodeMesh diff --git a/src/opengeodeweb_back/routes/blueprint_routes.py b/src/opengeodeweb_back/routes/blueprint_routes.py index 4f2108d1..6d6c06d9 100644 --- a/src/opengeodeweb_back/routes/blueprint_routes.py +++ b/src/opengeodeweb_back/routes/blueprint_routes.py @@ -257,6 +257,7 @@ def texture_coordinates() -> flask.Response: geode_object = geode_functions.load_geode_object(params.id) if not isinstance(geode_object, GeodeSurfaceMesh2D | GeodeSurfaceMesh3D): flask.abort(400, f"{params.id} is not a GeodeSurfaceMesh") + assert isinstance(geode_object, GeodeSurfaceMesh2D | GeodeSurfaceMesh3D) texture_coordinates = geode_object.texture_manager().texture_names() return flask.make_response({"texture_coordinates": texture_coordinates}, 200) @@ -273,6 +274,7 @@ def vertex_attribute_names() -> flask.Response: geode_object = geode_functions.load_geode_object(params.id) if not isinstance(geode_object, GeodeMesh): flask.abort(400, f"{params.id} is not a GeodeMesh") + assert isinstance(geode_object, GeodeMesh) vertex_attribute_names = geode_object.vertex_attribute_manager().attribute_names() return flask.make_response( { @@ -294,6 +296,7 @@ def cell_attribute_names() -> flask.Response: geode_object = geode_functions.load_geode_object(params.id) if not isinstance(geode_object, GeodeGrid2D | GeodeGrid3D): flask.abort(400, f"{params.id} is not a GeodeGrid") + assert isinstance(geode_object, GeodeGrid2D | GeodeGrid3D) cell_attribute_names = geode_object.cell_attribute_manager().attribute_names() return flask.make_response( { @@ -315,6 +318,7 @@ def polygon_attribute_names() -> flask.Response: geode_object = geode_functions.load_geode_object(params.id) if not isinstance(geode_object, GeodeSurfaceMesh2D | GeodeSurfaceMesh3D): flask.abort(400, f"{params.id} is not a GeodeSurfaceMesh") + assert isinstance(geode_object, GeodeSurfaceMesh2D | GeodeSurfaceMesh3D) polygon_attribute_names = geode_object.polygon_attribute_manager().attribute_names() return flask.make_response( { @@ -336,6 +340,7 @@ def polyhedron_attribute_names() -> flask.Response: geode_object = geode_functions.load_geode_object(params.id) if not isinstance(geode_object, GeodeSolidMesh3D): flask.abort(400, f"{params.id} is not a GeodeSolidMesh") + assert isinstance(geode_object, GeodeSolidMesh3D) polyhedron_attribute_names = ( geode_object.polyhedron_attribute_manager().attribute_names() ) diff --git a/src/opengeodeweb_back/routes/create/blueprint_create.py b/src/opengeodeweb_back/routes/create/blueprint_create.py index b788f261..74cebb0a 100644 --- a/src/opengeodeweb_back/routes/create/blueprint_create.py +++ b/src/opengeodeweb_back/routes/create/blueprint_create.py @@ -90,7 +90,7 @@ def create_voi() -> flask.Response: if not isinstance(aoi_object, GeodeEdgedCurve3D): flask.abort(400, f"AOI with id {params.aoi_id} is not a GeodeEdgedCurve3D") - aoi_curve = aoi_object.edged_curve + aoi_curve = aoi_object.edged_curve # type: ignore[attr-defined] nb_points = aoi_curve.nb_vertices() edged_curve = GeodeEdgedCurve3D() diff --git a/src/opengeodeweb_back/routes/models/blueprint_models.py b/src/opengeodeweb_back/routes/models/blueprint_models.py index ab052745..6bd17930 100644 --- a/src/opengeodeweb_back/routes/models/blueprint_models.py +++ b/src/opengeodeweb_back/routes/models/blueprint_models.py @@ -27,6 +27,7 @@ def uuid_to_flat_index() -> flask.Response: flask.abort(500, "Failed to read viewable file") uuid_to_flat_index = {} current_index = 0 + assert root is not None for elem in root.iter(): if "uuid" in elem.attrib and elem.tag == "DataSet": uuid_to_flat_index[elem.attrib["uuid"]] = current_index @@ -46,6 +47,7 @@ def extract_uuids_endpoint() -> flask.Response: model = geode_functions.load_geode_object(params.id) if not isinstance(model, GeodeModel): flask.abort(400, f"{params.id} is not a GeodeModel") + assert isinstance(model, GeodeModel) mesh_components = model.mesh_components() uuid_dict = {} for mesh_component, ids in mesh_components.items(): diff --git a/src/opengeodeweb_back/utils_functions.py b/src/opengeodeweb_back/utils_functions.py index 1264690d..04c25d4c 100644 --- a/src/opengeodeweb_back/utils_functions.py +++ b/src/opengeodeweb_back/utils_functions.py @@ -15,6 +15,7 @@ import shutil from werkzeug.exceptions import HTTPException import werkzeug +from typing import cast from opengeodeweb_microservice.schemas import SchemaDict from opengeodeweb_microservice.database.data import Data from opengeodeweb_microservice.database.connection import get_session @@ -115,7 +116,7 @@ def validate_request(request: flask.Request, schema: SchemaDict) -> dict[str, An error_msg = str(e) print("Validation failed:", error_msg, flush=True) flask.abort(400, error_msg) - return json_data + return cast(dict[str, Any], json_data) def set_interval( From 73c8b89204f297c355d135c0b53591e745aafbe3 Mon Sep 17 00:00:00 2001 From: MaxNumerique Date: Mon, 5 Jan 2026 15:54:39 +0100 Subject: [PATCH 03/12] better way to have predefined cast in types file --- src/opengeodeweb_back/geode_functions.py | 8 +--- .../geode_objects/geode_brep.py | 27 ++++++------ .../geode_objects/geode_cross_section.py | 29 ++++++------- .../geode_objects/geode_edged_curve2d.py | 21 ++++----- .../geode_objects/geode_edged_curve3d.py | 21 ++++----- .../geode_objects/geode_graph.py | 15 +++---- .../geode_objects/geode_hybrid_solid3d.py | 21 ++++----- .../geode_implicit_cross_section.py | 29 +++++-------- .../geode_implicit_structural_model.py | 27 +++++------- .../geode_light_regular_grid2d.py | 25 +++++------ .../geode_light_regular_grid3d.py | 25 +++++------ .../geode_objects/geode_point_set2d.py | 21 ++++----- .../geode_objects/geode_point_set3d.py | 21 ++++----- .../geode_polygonal_surface2d.py | 25 +++++------ .../geode_polygonal_surface3d.py | 25 +++++------ .../geode_objects/geode_polyhedral_solid3d.py | 25 +++++------ .../geode_objects/geode_raster_image2d.py | 21 ++++----- .../geode_objects/geode_raster_image3d.py | 21 ++++----- .../geode_objects/geode_regular_grid2d.py | 21 ++++----- .../geode_objects/geode_regular_grid3d.py | 21 ++++----- .../geode_objects/geode_section.py | 24 +++++------ .../geode_objects/geode_structural_model.py | 29 +++++-------- .../geode_tetrahedral_solid3d.py | 25 +++++------ .../geode_triangulated_surface2d.py | 23 ++++------ .../geode_triangulated_surface3d.py | 23 ++++------ .../geode_objects/geode_vertex_set.py | 15 +++---- src/opengeodeweb_back/geode_objects/types.py | 43 +++++++++++++++++++ src/opengeodeweb_back/utils_functions.py | 3 +- 28 files changed, 294 insertions(+), 340 deletions(-) diff --git a/src/opengeodeweb_back/geode_functions.py b/src/opengeodeweb_back/geode_functions.py index 978861f2..2cf51199 100644 --- a/src/opengeodeweb_back/geode_functions.py +++ b/src/opengeodeweb_back/geode_functions.py @@ -4,14 +4,10 @@ # Third party imports import werkzeug import flask -from typing import cast # Local application imports from .geode_objects import geode_objects -from .geode_objects.types import ( - GeodeObjectType, - geode_object_type, -) +from .geode_objects.types import GeodeObjectType, geode_object_type, cast_str from .geode_objects.geode_object import GeodeObject from opengeodeweb_microservice.database.data import Data @@ -49,7 +45,7 @@ def get_data_info(data_id: str) -> Data: def upload_file_path(filename: str) -> str: upload_folder = flask.current_app.config["UPLOAD_FOLDER"] secure_filename = werkzeug.utils.secure_filename(filename) - return cast(str, os.path.abspath(os.path.join(upload_folder, secure_filename))) + return cast_str(os.path.abspath(os.path.join(upload_folder, secure_filename))) def geode_object_output_extensions( diff --git a/src/opengeodeweb_back/geode_objects/geode_brep.py b/src/opengeodeweb_back/geode_objects/geode_brep.py index a546e373..403133fa 100644 --- a/src/opengeodeweb_back/geode_objects/geode_brep.py +++ b/src/opengeodeweb_back/geode_objects/geode_brep.py @@ -1,6 +1,6 @@ # Standard library imports from __future__ import annotations -from typing import cast, Any +from typing import cast # Third party imports import opengeode as og @@ -9,7 +9,7 @@ import geode_viewables as viewables # Local application imports -from .types import GeodeModelType +from .types import GeodeModelType, cast_str, cast_list_str, cast_int, cast_bool from .geode_model import GeodeModel, ComponentRegistry @@ -25,7 +25,7 @@ def geode_object_type(cls) -> GeodeModelType: return "BRep" def native_extension(self) -> str: - return cast(str, self.brep.native_extension()) + return cast_str(self.brep.native_extension()) @classmethod def is_3D(cls) -> bool: @@ -52,35 +52,34 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast(list[str], og.BRepInputFactory.list_creators()) + return cast_list_str(og.BRepInputFactory.list_creators()) @classmethod def output_extensions(cls) -> list[str]: - return cast(list[str], og.BRepOutputFactory.list_creators()) + return cast_list_str(og.BRepOutputFactory.list_creators()) @classmethod def object_priority(cls, filename: str) -> int: - return cast(int, og.brep_object_priority(filename)) + return cast_int(og.brep_object_priority(filename)) def is_saveable(self, filename: str) -> bool: - return cast(bool, og.is_brep_saveable(self.brep, filename)) + return cast_bool(og.is_brep_saveable(self.brep, filename)) def save(self, filename: str) -> list[str]: - return cast(list[str], og.save_brep(self.brep, filename)) + return cast_list_str(og.save_brep(self.brep, filename)) def save_viewable(self, filename_without_extension: str) -> str: - return cast( - str, viewables.save_viewable_brep(self.brep, filename_without_extension) + return cast_str( + viewables.save_viewable_brep(self.brep, filename_without_extension) ) def save_light_viewable(self, filename_without_extension: str) -> str: - return cast( - str, - viewables.save_light_viewable_brep(self.brep, filename_without_extension), + return cast_str( + viewables.save_light_viewable_brep(self.brep, filename_without_extension) ) def mesh_components(self) -> ComponentRegistry: - return cast(dict[Any, list[Any]], self.brep.mesh_components()) + return cast(ComponentRegistry, self.brep.mesh_components()) def inspect(self) -> og_inspector.BRepInspectionResult: return og_inspector.inspect_brep(self.brep) diff --git a/src/opengeodeweb_back/geode_objects/geode_cross_section.py b/src/opengeodeweb_back/geode_objects/geode_cross_section.py index 2e589a07..78bb0638 100644 --- a/src/opengeodeweb_back/geode_objects/geode_cross_section.py +++ b/src/opengeodeweb_back/geode_objects/geode_cross_section.py @@ -1,6 +1,5 @@ # Standard library imports from __future__ import annotations -from typing import cast # Third party imports import opengeode as og @@ -8,7 +7,7 @@ import geode_viewables as viewables # Local application imports -from .types import GeodeModelType +from .types import GeodeModelType, cast_str, cast_list_str, cast_int, cast_bool from .geode_section import GeodeSection @@ -30,7 +29,7 @@ def geode_object_type(cls) -> GeodeModelType: return "CrossSection" def native_extension(self) -> str: - return cast(str, self.cross_section.native_extension()) + return cast_str(self.cross_section.native_extension()) def builder(self) -> og_geosciences.CrossSectionBuilder: return og_geosciences.CrossSectionBuilder(self.cross_section) @@ -49,38 +48,36 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast(list[str], og_geosciences.CrossSectionInputFactory.list_creators()) + return cast_list_str(og_geosciences.CrossSectionInputFactory.list_creators()) @classmethod def output_extensions(cls) -> list[str]: - return cast(list[str], og_geosciences.CrossSectionOutputFactory.list_creators()) + return cast_list_str(og_geosciences.CrossSectionOutputFactory.list_creators()) @classmethod def object_priority(cls, filename: str) -> int: - return cast(int, og_geosciences.cross_section_object_priority(filename)) + return cast_int(og_geosciences.cross_section_object_priority(filename)) def is_saveable(self, filename: str) -> bool: - return cast( - bool, og_geosciences.is_cross_section_saveable(self.cross_section, filename) + return cast_bool( + og_geosciences.is_cross_section_saveable(self.cross_section, filename) ) def save(self, filename: str) -> list[str]: - return cast( - list[str], og_geosciences.save_cross_section(self.cross_section, filename) + return cast_list_str( + og_geosciences.save_cross_section(self.cross_section, filename) ) def save_viewable(self, filename_without_extension: str) -> str: - return cast( - str, + return cast_str( viewables.save_viewable_cross_section( self.cross_section, filename_without_extension - ), + ) ) def save_light_viewable(self, filename_without_extension: str) -> str: - return cast( - str, + return cast_str( viewables.save_light_viewable_cross_section( self.cross_section, filename_without_extension - ), + ) ) diff --git a/src/opengeodeweb_back/geode_objects/geode_edged_curve2d.py b/src/opengeodeweb_back/geode_objects/geode_edged_curve2d.py index ead463f0..3aac7678 100644 --- a/src/opengeodeweb_back/geode_objects/geode_edged_curve2d.py +++ b/src/opengeodeweb_back/geode_objects/geode_edged_curve2d.py @@ -1,6 +1,5 @@ # Standard library imports from __future__ import annotations -from typing import cast # Third party imports import opengeode as og @@ -9,7 +8,7 @@ import geode_viewables as viewables # Local application imports -from .types import GeodeMeshType +from .types import GeodeMeshType, cast_str, cast_list_str, cast_int, cast_bool from .geode_graph import GeodeGraph @@ -27,7 +26,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "EdgedCurve2D" def native_extension(self) -> str: - return cast(str, self.edged_curve.native_extension()) + return cast_str(self.edged_curve.native_extension()) @classmethod def is_3D(cls) -> bool: @@ -54,33 +53,31 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast(list[str], og.EdgedCurveInputFactory2D.list_creators()) + return cast_list_str(og.EdgedCurveInputFactory2D.list_creators()) @classmethod def output_extensions(cls) -> list[str]: - return cast(list[str], og.EdgedCurveOutputFactory2D.list_creators()) + return cast_list_str(og.EdgedCurveOutputFactory2D.list_creators()) @classmethod def object_priority(cls, filename: str) -> int: - return cast(int, og.edged_curve_object_priority2D(filename)) + return cast_int(og.edged_curve_object_priority2D(filename)) def is_saveable(self, filename: str) -> bool: - return cast(bool, og.is_edged_curve_saveable2D(self.edged_curve, filename)) + return cast_bool(og.is_edged_curve_saveable2D(self.edged_curve, filename)) def save(self, filename: str) -> list[str]: - return cast(list[str], og.save_edged_curve2D(self.edged_curve, filename)) + return cast_list_str(og.save_edged_curve2D(self.edged_curve, filename)) def save_viewable(self, filename_without_extension: str) -> str: - return cast( - str, + return cast_str( viewables.save_viewable_edged_curve2D( self.edged_curve, filename_without_extension ), ) def save_light_viewable(self, filename_without_extension: str) -> str: - return cast( - str, + return cast_str( viewables.save_light_viewable_edged_curve2D( self.edged_curve, filename_without_extension ), diff --git a/src/opengeodeweb_back/geode_objects/geode_edged_curve3d.py b/src/opengeodeweb_back/geode_objects/geode_edged_curve3d.py index 7833755e..38c74874 100644 --- a/src/opengeodeweb_back/geode_objects/geode_edged_curve3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_edged_curve3d.py @@ -1,6 +1,5 @@ # Standard library imports from __future__ import annotations -from typing import cast # Third party imports import opengeode as og @@ -9,7 +8,7 @@ import geode_viewables as viewables # Local application imports -from .types import GeodeMeshType +from .types import GeodeMeshType, cast_str, cast_list_str, cast_int, cast_bool from .geode_graph import GeodeGraph @@ -27,7 +26,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "EdgedCurve3D" def native_extension(self) -> str: - return cast(str, self.edged_curve.native_extension()) + return cast_str(self.edged_curve.native_extension()) @classmethod def is_3D(cls) -> bool: @@ -54,33 +53,31 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast(list[str], og.EdgedCurveInputFactory3D.list_creators()) + return cast_list_str(og.EdgedCurveInputFactory3D.list_creators()) @classmethod def output_extensions(cls) -> list[str]: - return cast(list[str], og.EdgedCurveOutputFactory3D.list_creators()) + return cast_list_str(og.EdgedCurveOutputFactory3D.list_creators()) @classmethod def object_priority(cls, filename: str) -> int: - return cast(int, og.edged_curve_object_priority3D(filename)) + return cast_int(og.edged_curve_object_priority3D(filename)) def is_saveable(self, filename: str) -> bool: - return cast(bool, og.is_edged_curve_saveable3D(self.edged_curve, filename)) + return cast_bool(og.is_edged_curve_saveable3D(self.edged_curve, filename)) def save(self, filename: str) -> list[str]: - return cast(list[str], og.save_edged_curve3D(self.edged_curve, filename)) + return cast_list_str(og.save_edged_curve3D(self.edged_curve, filename)) def save_viewable(self, filename_without_extension: str) -> str: - return cast( - str, + return cast_str( viewables.save_viewable_edged_curve3D( self.edged_curve, filename_without_extension ), ) def save_light_viewable(self, filename_without_extension: str) -> str: - return cast( - str, + return cast_str( viewables.save_light_viewable_edged_curve3D( self.edged_curve, filename_without_extension ), diff --git a/src/opengeodeweb_back/geode_objects/geode_graph.py b/src/opengeodeweb_back/geode_objects/geode_graph.py index 2b3bf912..39c61e41 100644 --- a/src/opengeodeweb_back/geode_objects/geode_graph.py +++ b/src/opengeodeweb_back/geode_objects/geode_graph.py @@ -1,12 +1,11 @@ # Standard library imports from __future__ import annotations -from typing import cast # Third party imports import opengeode as og # Local application imports -from .types import GeodeMeshType +from .types import GeodeMeshType, cast_str, cast_list_str, cast_int, cast_bool from .geode_vertex_set import GeodeVertexSet @@ -22,7 +21,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "Graph" def native_extension(self) -> str: - return cast(str, self.graph.native_extension()) + return cast_str(self.graph.native_extension()) @classmethod def is_3D(cls) -> bool: @@ -49,21 +48,21 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast(list[str], og.GraphInputFactory.list_creators()) + return cast_list_str(og.GraphInputFactory.list_creators()) @classmethod def output_extensions(cls) -> list[str]: - return cast(list[str], og.GraphOutputFactory.list_creators()) + return cast_list_str(og.GraphOutputFactory.list_creators()) @classmethod def object_priority(cls, filename: str) -> int: - return cast(int, og.graph_object_priority(filename)) + return cast_int(og.graph_object_priority(filename)) def is_saveable(self, filename: str) -> bool: - return cast(bool, og.is_graph_saveable(self.graph, filename)) + return cast_bool(og.is_graph_saveable(self.graph, filename)) def save(self, filename: str) -> list[str]: - return cast(list[str], og.save_graph(self.graph, filename)) + return cast_list_str(og.save_graph(self.graph, filename)) def save_viewable(self, filename_without_extension: str) -> str: return "" diff --git a/src/opengeodeweb_back/geode_objects/geode_hybrid_solid3d.py b/src/opengeodeweb_back/geode_objects/geode_hybrid_solid3d.py index d9c6693d..7f5f0dbc 100644 --- a/src/opengeodeweb_back/geode_objects/geode_hybrid_solid3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_hybrid_solid3d.py @@ -1,13 +1,12 @@ # Standard library imports from __future__ import annotations -from typing import cast # Third party imports import opengeode as og import geode_viewables as viewables # Local application imports -from .types import GeodeMeshType +from .types import GeodeMeshType, cast_str, cast_list_str, cast_int, cast_bool from .geode_solid_mesh3d import GeodeSolidMesh3D @@ -25,7 +24,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "HybridSolid3D" def native_extension(self) -> str: - return cast(str, self.hybrid_solid.native_extension()) + return cast_str(self.hybrid_solid.native_extension()) def builder(self) -> og.HybridSolidBuilder3D: return og.HybridSolidBuilder3D.create(self.hybrid_solid) @@ -44,33 +43,31 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast(list[str], og.HybridSolidInputFactory3D.list_creators()) + return cast_list_str(og.HybridSolidInputFactory3D.list_creators()) @classmethod def output_extensions(cls) -> list[str]: - return cast(list[str], og.HybridSolidOutputFactory3D.list_creators()) + return cast_list_str(og.HybridSolidOutputFactory3D.list_creators()) @classmethod def object_priority(cls, filename: str) -> int: - return cast(int, og.hybrid_solid_object_priority3D(filename)) + return cast_int(og.hybrid_solid_object_priority3D(filename)) def is_saveable(self, filename: str) -> bool: - return cast(bool, og.is_hybrid_solid_saveable3D(self.hybrid_solid, filename)) + return cast_bool(og.is_hybrid_solid_saveable3D(self.hybrid_solid, filename)) def save(self, filename: str) -> list[str]: - return cast(list[str], og.save_hybrid_solid3D(self.hybrid_solid, filename)) + return cast_list_str(og.save_hybrid_solid3D(self.hybrid_solid, filename)) def save_viewable(self, filename_without_extension: str) -> str: - return cast( - str, + return cast_str( viewables.save_viewable_hybrid_solid3D( self.hybrid_solid, filename_without_extension ), ) def save_light_viewable(self, filename_without_extension: str) -> str: - return cast( - str, + return cast_str( viewables.save_light_viewable_hybrid_solid3D( self.hybrid_solid, filename_without_extension ), diff --git a/src/opengeodeweb_back/geode_objects/geode_implicit_cross_section.py b/src/opengeodeweb_back/geode_objects/geode_implicit_cross_section.py index 4f38754c..51db471b 100644 --- a/src/opengeodeweb_back/geode_objects/geode_implicit_cross_section.py +++ b/src/opengeodeweb_back/geode_objects/geode_implicit_cross_section.py @@ -1,6 +1,5 @@ # Standard library imports from __future__ import annotations -from typing import cast # Third party imports import opengeode as og @@ -8,7 +7,7 @@ import geode_viewables as viewables # Local application imports -from .types import GeodeModelType +from .types import GeodeModelType, cast_str, cast_list_str, cast_int, cast_bool from .geode_cross_section import GeodeCrossSection @@ -30,7 +29,7 @@ def geode_object_type(cls) -> GeodeModelType: return "ImplicitCrossSection" def native_extension(self) -> str: - return cast(str, self.implicit_cross_section.native_extension()) + return cast_str(self.implicit_cross_section.native_extension()) def builder(self) -> og_geosciences.ImplicitCrossSectionBuilder: return og_geosciences.ImplicitCrossSectionBuilder(self.implicit_cross_section) @@ -51,49 +50,43 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast( - list[str], og_geosciences.ImplicitCrossSectionInputFactory.list_creators() + return cast_list_str( + og_geosciences.ImplicitCrossSectionInputFactory.list_creators() ) @classmethod def output_extensions(cls) -> list[str]: - return cast( - list[str], og_geosciences.ImplicitCrossSectionOutputFactory.list_creators() + return cast_list_str( + og_geosciences.ImplicitCrossSectionOutputFactory.list_creators() ) @classmethod def object_priority(cls, filename: str) -> int: - return cast( - int, og_geosciences.implicit_cross_section_object_priority(filename) - ) + return cast_int(og_geosciences.implicit_cross_section_object_priority(filename)) def is_saveable(self, filename: str) -> bool: - return cast( - bool, + return cast_bool( og_geosciences.is_implicit_cross_section_saveable( self.implicit_cross_section, filename ), ) def save(self, filename: str) -> list[str]: - return cast( - list[str], + return cast_list_str( og_geosciences.save_implicit_cross_section( self.implicit_cross_section, filename ), ) def save_viewable(self, filename_without_extension: str) -> str: - return cast( - str, + return cast_str( viewables.save_viewable_implicit_cross_section( self.implicit_cross_section, filename_without_extension ), ) def save_light_viewable(self, filename_without_extension: str) -> str: - return cast( - str, + return cast_str( viewables.save_light_viewable_implicit_cross_section( self.implicit_cross_section, filename_without_extension ), diff --git a/src/opengeodeweb_back/geode_objects/geode_implicit_structural_model.py b/src/opengeodeweb_back/geode_objects/geode_implicit_structural_model.py index 7c2660d0..47fa1834 100644 --- a/src/opengeodeweb_back/geode_objects/geode_implicit_structural_model.py +++ b/src/opengeodeweb_back/geode_objects/geode_implicit_structural_model.py @@ -1,6 +1,5 @@ # Standard library imports from __future__ import annotations -from typing import cast # Third party imports import opengeode as og @@ -8,7 +7,7 @@ import geode_viewables as viewables # Local application imports -from .types import GeodeModelType +from .types import GeodeModelType, cast_str, cast_list_str, cast_int, cast_bool from .geode_structural_model import GeodeStructuralModel @@ -31,7 +30,7 @@ def geode_object_type(cls) -> GeodeModelType: return "ImplicitStructuralModel" def native_extension(self) -> str: - return cast(str, self.implicit_structural_model.native_extension()) + return cast_str(self.implicit_structural_model.native_extension()) def builder(self) -> og_geosciences.ImplicitStructuralModelBuilder: return og_geosciences.ImplicitStructuralModelBuilder( @@ -54,51 +53,45 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast( - list[str], + return cast_list_str( og_geosciences.ImplicitStructuralModelInputFactory.list_creators(), ) @classmethod def output_extensions(cls) -> list[str]: - return cast( - list[str], + return cast_list_str( og_geosciences.ImplicitStructuralModelOutputFactory.list_creators(), ) @classmethod def object_priority(cls, filename: str) -> int: - return cast( - int, og_geosciences.implicit_structural_model_object_priority(filename) + return cast_int( + og_geosciences.implicit_structural_model_object_priority(filename) ) def is_saveable(self, filename: str) -> bool: - return cast( - bool, + return cast_bool( og_geosciences.is_implicit_structural_model_saveable( self.implicit_structural_model, filename ), ) def save(self, filename: str) -> list[str]: - return cast( - list[str], + return cast_list_str( og_geosciences.save_implicit_structural_model( self.implicit_structural_model, filename ), ) def save_viewable(self, filename_without_extension: str) -> str: - return cast( - str, + return cast_str( viewables.save_viewable_implicit_structural_model( self.implicit_structural_model, filename_without_extension ), ) def save_light_viewable(self, filename_without_extension: str) -> str: - return cast( - str, + return cast_str( viewables.save_light_viewable_implicit_structural_model( self.implicit_structural_model, filename_without_extension ), diff --git a/src/opengeodeweb_back/geode_objects/geode_light_regular_grid2d.py b/src/opengeodeweb_back/geode_objects/geode_light_regular_grid2d.py index 7fa16af5..8e532ce5 100644 --- a/src/opengeodeweb_back/geode_objects/geode_light_regular_grid2d.py +++ b/src/opengeodeweb_back/geode_objects/geode_light_regular_grid2d.py @@ -1,13 +1,12 @@ # Standard library imports from __future__ import annotations -from typing import cast # Third party imports import opengeode as og import geode_viewables as viewables # Local application imports -from .types import GeodeMeshType +from .types import GeodeMeshType, cast_str, cast_list_str, cast_int, cast_bool from .geode_grid2d import GeodeGrid2D @@ -23,7 +22,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "LightRegularGrid2D" def native_extension(self) -> str: - return cast(str, self.light_regular_grid.native_extension()) + return cast_str(self.light_regular_grid.native_extension()) @classmethod def load(cls, filename: str) -> GeodeLightRegularGrid2D: @@ -39,37 +38,35 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast(list[str], og.LightRegularGridInputFactory2D.list_creators()) + return cast_list_str(og.LightRegularGridInputFactory2D.list_creators()) @classmethod def output_extensions(cls) -> list[str]: - return cast(list[str], og.LightRegularGridOutputFactory2D.list_creators()) + return cast_list_str(og.LightRegularGridOutputFactory2D.list_creators()) @classmethod def object_priority(cls, filename: str) -> int: - return cast(int, og.light_regular_grid_object_priority2D(filename)) + return cast_int(og.light_regular_grid_object_priority2D(filename)) def is_saveable(self, filename: str) -> bool: - return cast( - bool, og.is_light_regular_grid_saveable2D(self.light_regular_grid, filename) + return cast_bool( + og.is_light_regular_grid_saveable2D(self.light_regular_grid, filename) ) def save(self, filename: str) -> list[str]: - return cast( - list[str], og.save_light_regular_grid2D(self.light_regular_grid, filename) + return cast_list_str( + og.save_light_regular_grid2D(self.light_regular_grid, filename) ) def save_viewable(self, filename_without_extension: str) -> str: - return cast( - str, + return cast_str( viewables.save_viewable_light_regular_grid2D( self.light_regular_grid, filename_without_extension ), ) def save_light_viewable(self, filename_without_extension: str) -> str: - return cast( - str, + return cast_str( viewables.save_light_viewable_light_regular_grid2D( self.light_regular_grid, filename_without_extension ), diff --git a/src/opengeodeweb_back/geode_objects/geode_light_regular_grid3d.py b/src/opengeodeweb_back/geode_objects/geode_light_regular_grid3d.py index 6d75baa0..666e369d 100644 --- a/src/opengeodeweb_back/geode_objects/geode_light_regular_grid3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_light_regular_grid3d.py @@ -1,13 +1,12 @@ # Standard library imports from __future__ import annotations -from typing import cast # Third party imports import opengeode as og import geode_viewables as viewables # Local application imports -from .types import GeodeMeshType +from .types import GeodeMeshType, cast_str, cast_list_str, cast_int, cast_bool from .geode_grid3d import GeodeGrid3D @@ -23,7 +22,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "LightRegularGrid3D" def native_extension(self) -> str: - return cast(str, self.light_regular_grid.native_extension()) + return cast_str(self.light_regular_grid.native_extension()) @classmethod def load(cls, filename: str) -> GeodeLightRegularGrid3D: @@ -39,37 +38,35 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast(list[str], og.LightRegularGridInputFactory3D.list_creators()) + return cast_list_str(og.LightRegularGridInputFactory3D.list_creators()) @classmethod def output_extensions(cls) -> list[str]: - return cast(list[str], og.LightRegularGridOutputFactory3D.list_creators()) + return cast_list_str(og.LightRegularGridOutputFactory3D.list_creators()) @classmethod def object_priority(cls, filename: str) -> int: - return cast(int, og.light_regular_grid_object_priority3D(filename)) + return cast_int(og.light_regular_grid_object_priority3D(filename)) def is_saveable(self, filename: str) -> bool: - return cast( - bool, og.is_light_regular_grid_saveable3D(self.light_regular_grid, filename) + return cast_bool( + og.is_light_regular_grid_saveable3D(self.light_regular_grid, filename) ) def save(self, filename: str) -> list[str]: - return cast( - list[str], og.save_light_regular_grid3D(self.light_regular_grid, filename) + return cast_list_str( + og.save_light_regular_grid3D(self.light_regular_grid, filename) ) def save_viewable(self, filename_without_extension: str) -> str: - return cast( - str, + return cast_str( viewables.save_viewable_light_regular_grid3D( self.light_regular_grid, filename_without_extension ), ) def save_light_viewable(self, filename_without_extension: str) -> str: - return cast( - str, + return cast_str( viewables.save_light_viewable_light_regular_grid3D( self.light_regular_grid, filename_without_extension ), diff --git a/src/opengeodeweb_back/geode_objects/geode_point_set2d.py b/src/opengeodeweb_back/geode_objects/geode_point_set2d.py index 4ffa6753..5c5cf699 100644 --- a/src/opengeodeweb_back/geode_objects/geode_point_set2d.py +++ b/src/opengeodeweb_back/geode_objects/geode_point_set2d.py @@ -1,6 +1,5 @@ # Standard library imports from __future__ import annotations -from typing import cast # Third party imports import opengeode as og @@ -9,7 +8,7 @@ import geode_viewables as viewables # Local application imports -from .types import GeodeMeshType +from .types import GeodeMeshType, cast_str, cast_list_str, cast_int, cast_bool from .geode_vertex_set import GeodeVertexSet @@ -25,7 +24,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "PointSet2D" def native_extension(self) -> str: - return cast(str, self.point_set.native_extension()) + return cast_str(self.point_set.native_extension()) @classmethod def is_3D(cls) -> bool: @@ -52,33 +51,31 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast(list[str], og.PointSetInputFactory2D.list_creators()) + return cast_list_str(og.PointSetInputFactory2D.list_creators()) @classmethod def output_extensions(cls) -> list[str]: - return cast(list[str], og.PointSetOutputFactory2D.list_creators()) + return cast_list_str(og.PointSetOutputFactory2D.list_creators()) @classmethod def object_priority(cls, filename: str) -> int: - return cast(int, og.point_set_object_priority2D(filename)) + return cast_int(og.point_set_object_priority2D(filename)) def is_saveable(self, filename: str) -> bool: - return cast(bool, og.is_point_set_saveable2D(self.point_set, filename)) + return cast_bool(og.is_point_set_saveable2D(self.point_set, filename)) def save(self, filename: str) -> list[str]: - return cast(list[str], og.save_point_set2D(self.point_set, filename)) + return cast_list_str(og.save_point_set2D(self.point_set, filename)) def save_viewable(self, filename_without_extension: str) -> str: - return cast( - str, + return cast_str( viewables.save_viewable_point_set2D( self.point_set, filename_without_extension ), ) def save_light_viewable(self, filename_without_extension: str) -> str: - return cast( - str, + return cast_str( viewables.save_light_viewable_point_set2D( self.point_set, filename_without_extension ), diff --git a/src/opengeodeweb_back/geode_objects/geode_point_set3d.py b/src/opengeodeweb_back/geode_objects/geode_point_set3d.py index 4f400557..b25e9f3c 100644 --- a/src/opengeodeweb_back/geode_objects/geode_point_set3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_point_set3d.py @@ -1,6 +1,5 @@ # Standard library imports from __future__ import annotations -from typing import cast # Third party imports import opengeode as og @@ -9,7 +8,7 @@ import geode_viewables as viewables # Local application imports -from .types import GeodeMeshType +from .types import GeodeMeshType, cast_str, cast_list_str, cast_int, cast_bool from .geode_vertex_set import GeodeVertexSet @@ -25,7 +24,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "PointSet3D" def native_extension(self) -> str: - return cast(str, self.point_set.native_extension()) + return cast_str(self.point_set.native_extension()) @classmethod def is_3D(cls) -> bool: @@ -52,33 +51,31 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast(list[str], og.PointSetInputFactory3D.list_creators()) + return cast_list_str(og.PointSetInputFactory3D.list_creators()) @classmethod def output_extensions(cls) -> list[str]: - return cast(list[str], og.PointSetOutputFactory3D.list_creators()) + return cast_list_str(og.PointSetOutputFactory3D.list_creators()) @classmethod def object_priority(cls, filename: str) -> int: - return cast(int, og.point_set_object_priority3D(filename)) + return cast_int(og.point_set_object_priority3D(filename)) def is_saveable(self, filename: str) -> bool: - return cast(bool, og.is_point_set_saveable3D(self.point_set, filename)) + return cast_bool(og.is_point_set_saveable3D(self.point_set, filename)) def save(self, filename: str) -> list[str]: - return cast(list[str], og.save_point_set3D(self.point_set, filename)) + return cast_list_str(og.save_point_set3D(self.point_set, filename)) def save_viewable(self, filename_without_extension: str) -> str: - return cast( - str, + return cast_str( viewables.save_viewable_point_set3D( self.point_set, filename_without_extension ), ) def save_light_viewable(self, filename_without_extension: str) -> str: - return cast( - str, + return cast_str( viewables.save_light_viewable_point_set3D( self.point_set, filename_without_extension ), diff --git a/src/opengeodeweb_back/geode_objects/geode_polygonal_surface2d.py b/src/opengeodeweb_back/geode_objects/geode_polygonal_surface2d.py index 00e0bdb0..f21163cd 100644 --- a/src/opengeodeweb_back/geode_objects/geode_polygonal_surface2d.py +++ b/src/opengeodeweb_back/geode_objects/geode_polygonal_surface2d.py @@ -1,13 +1,12 @@ # Standard library imports from __future__ import annotations -from typing import cast # Third party imports import opengeode as og import geode_viewables as viewables # Local application imports -from .types import GeodeMeshType +from .types import GeodeMeshType, cast_str, cast_list_str, cast_int, cast_bool from .geode_surface_mesh2d import GeodeSurfaceMesh2D @@ -27,7 +26,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "PolygonalSurface2D" def native_extension(self) -> str: - return cast(str, self.polygonal_surface.native_extension()) + return cast_str(self.polygonal_surface.native_extension()) def builder(self) -> og.PolygonalSurfaceBuilder2D: return og.PolygonalSurfaceBuilder2D.create(self.polygonal_surface) @@ -46,37 +45,35 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast(list[str], og.PolygonalSurfaceInputFactory2D.list_creators()) + return cast_list_str(og.PolygonalSurfaceInputFactory2D.list_creators()) @classmethod def output_extensions(cls) -> list[str]: - return cast(list[str], og.PolygonalSurfaceOutputFactory2D.list_creators()) + return cast_list_str(og.PolygonalSurfaceOutputFactory2D.list_creators()) @classmethod def object_priority(cls, filename: str) -> int: - return cast(int, og.polygonal_surface_object_priority2D(filename)) + return cast_int(og.polygonal_surface_object_priority2D(filename)) def is_saveable(self, filename: str) -> bool: - return cast( - bool, og.is_polygonal_surface_saveable2D(self.polygonal_surface, filename) + return cast_bool( + og.is_polygonal_surface_saveable2D(self.polygonal_surface, filename) ) def save(self, filename: str) -> list[str]: - return cast( - list[str], og.save_polygonal_surface2D(self.polygonal_surface, filename) + return cast_list_str( + og.save_polygonal_surface2D(self.polygonal_surface, filename) ) def save_viewable(self, filename_without_extension: str) -> str: - return cast( - str, + return cast_str( viewables.save_viewable_polygonal_surface2D( self.polygonal_surface, filename_without_extension ), ) def save_light_viewable(self, filename_without_extension: str) -> str: - return cast( - str, + return cast_str( viewables.save_light_viewable_polygonal_surface2D( self.polygonal_surface, filename_without_extension ), diff --git a/src/opengeodeweb_back/geode_objects/geode_polygonal_surface3d.py b/src/opengeodeweb_back/geode_objects/geode_polygonal_surface3d.py index 9fb5774f..a0175c0e 100644 --- a/src/opengeodeweb_back/geode_objects/geode_polygonal_surface3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_polygonal_surface3d.py @@ -1,13 +1,12 @@ # Standard library imports from __future__ import annotations -from typing import cast # Third party imports import opengeode as og import geode_viewables as viewables # Local application imports -from .types import GeodeMeshType +from .types import GeodeMeshType, cast_str, cast_list_str, cast_int, cast_bool from .geode_surface_mesh3d import GeodeSurfaceMesh3D @@ -27,7 +26,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "PolygonalSurface3D" def native_extension(self) -> str: - return cast(str, self.polygonal_surface.native_extension()) + return cast_str(self.polygonal_surface.native_extension()) def builder(self) -> og.PolygonalSurfaceBuilder3D: return og.PolygonalSurfaceBuilder3D.create(self.polygonal_surface) @@ -46,37 +45,35 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast(list[str], og.PolygonalSurfaceInputFactory3D.list_creators()) + return cast_list_str(og.PolygonalSurfaceInputFactory3D.list_creators()) @classmethod def output_extensions(cls) -> list[str]: - return cast(list[str], og.PolygonalSurfaceOutputFactory3D.list_creators()) + return cast_list_str(og.PolygonalSurfaceOutputFactory3D.list_creators()) @classmethod def object_priority(cls, filename: str) -> int: - return cast(int, og.polygonal_surface_object_priority3D(filename)) + return cast_int(og.polygonal_surface_object_priority3D(filename)) def is_saveable(self, filename: str) -> bool: - return cast( - bool, og.is_polygonal_surface_saveable3D(self.polygonal_surface, filename) + return cast_bool( + og.is_polygonal_surface_saveable3D(self.polygonal_surface, filename) ) def save(self, filename: str) -> list[str]: - return cast( - list[str], og.save_polygonal_surface3D(self.polygonal_surface, filename) + return cast_list_str( + og.save_polygonal_surface3D(self.polygonal_surface, filename) ) def save_viewable(self, filename_without_extension: str) -> str: - return cast( - str, + return cast_str( viewables.save_viewable_polygonal_surface3D( self.polygonal_surface, filename_without_extension ), ) def save_light_viewable(self, filename_without_extension: str) -> str: - return cast( - str, + return cast_str( viewables.save_light_viewable_polygonal_surface3D( self.polygonal_surface, filename_without_extension ), diff --git a/src/opengeodeweb_back/geode_objects/geode_polyhedral_solid3d.py b/src/opengeodeweb_back/geode_objects/geode_polyhedral_solid3d.py index 4009a23d..83f394d7 100644 --- a/src/opengeodeweb_back/geode_objects/geode_polyhedral_solid3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_polyhedral_solid3d.py @@ -1,13 +1,12 @@ # Standard library imports from __future__ import annotations -from typing import cast # Third party imports import opengeode as og import geode_viewables as viewables # Local application imports -from .types import GeodeMeshType +from .types import GeodeMeshType, cast_str, cast_list_str, cast_int, cast_bool from .geode_solid_mesh3d import GeodeSolidMesh3D @@ -27,7 +26,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "PolyhedralSolid3D" def native_extension(self) -> str: - return cast(str, self.polyhedral_solid.native_extension()) + return cast_str(self.polyhedral_solid.native_extension()) def builder(self) -> og.PolyhedralSolidBuilder3D: return og.PolyhedralSolidBuilder3D.create(self.polyhedral_solid) @@ -46,37 +45,35 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast(list[str], og.PolyhedralSolidInputFactory3D.list_creators()) + return cast_list_str(og.PolyhedralSolidInputFactory3D.list_creators()) @classmethod def output_extensions(cls) -> list[str]: - return cast(list[str], og.PolyhedralSolidOutputFactory3D.list_creators()) + return cast_list_str(og.PolyhedralSolidOutputFactory3D.list_creators()) @classmethod def object_priority(cls, filename: str) -> int: - return cast(int, og.polyhedral_solid_object_priority3D(filename)) + return cast_int(og.polyhedral_solid_object_priority3D(filename)) def is_saveable(self, filename: str) -> bool: - return cast( - bool, og.is_polyhedral_solid_saveable3D(self.polyhedral_solid, filename) + return cast_bool( + og.is_polyhedral_solid_saveable3D(self.polyhedral_solid, filename) ) def save(self, filename: str) -> list[str]: - return cast( - list[str], og.save_polyhedral_solid3D(self.polyhedral_solid, filename) + return cast_list_str( + og.save_polyhedral_solid3D(self.polyhedral_solid, filename) ) def save_viewable(self, filename_without_extension: str) -> str: - return cast( - str, + return cast_str( viewables.save_viewable_polyhedral_solid3D( self.polyhedral_solid, filename_without_extension ), ) def save_light_viewable(self, filename_without_extension: str) -> str: - return cast( - str, + return cast_str( viewables.save_light_viewable_polyhedral_solid3D( self.polyhedral_solid, filename_without_extension ), diff --git a/src/opengeodeweb_back/geode_objects/geode_raster_image2d.py b/src/opengeodeweb_back/geode_objects/geode_raster_image2d.py index 8842ad3c..ff51b18e 100644 --- a/src/opengeodeweb_back/geode_objects/geode_raster_image2d.py +++ b/src/opengeodeweb_back/geode_objects/geode_raster_image2d.py @@ -1,13 +1,12 @@ # Standard library imports from __future__ import annotations -from typing import cast # Third party imports import opengeode as og import geode_viewables as viewables # Local application imports -from .types import GeodeMeshType +from .types import GeodeMeshType, cast_str, cast_list_str, cast_int, cast_bool from .geode_mesh import GeodeMesh @@ -23,7 +22,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "RasterImage2D" def native_extension(self) -> str: - return cast(str, self.raster_image.native_extension()) + return cast_str(self.raster_image.native_extension()) @classmethod def is_3D(cls) -> bool: @@ -50,33 +49,31 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast(list[str], og.RasterImageInputFactory2D.list_creators()) + return cast_list_str(og.RasterImageInputFactory2D.list_creators()) @classmethod def output_extensions(cls) -> list[str]: - return cast(list[str], og.RasterImageOutputFactory2D.list_creators()) + return cast_list_str(og.RasterImageOutputFactory2D.list_creators()) @classmethod def object_priority(cls, filename: str) -> int: - return cast(int, og.raster_image_object_priority2D(filename)) + return cast_int(og.raster_image_object_priority2D(filename)) def is_saveable(self, filename: str) -> bool: - return cast(bool, og.is_raster_image_saveable2D(self.raster_image, filename)) + return cast_bool(og.is_raster_image_saveable2D(self.raster_image, filename)) def save(self, filename: str) -> list[str]: - return cast(list[str], og.save_raster_image2D(self.raster_image, filename)) + return cast_list_str(og.save_raster_image2D(self.raster_image, filename)) def save_viewable(self, filename_without_extension: str) -> str: - return cast( - str, + return cast_str( viewables.save_viewable_raster_image2D( self.raster_image, filename_without_extension ), ) def save_light_viewable(self, filename_without_extension: str) -> str: - return cast( - str, + return cast_str( viewables.save_light_viewable_raster_image2D( self.raster_image, filename_without_extension ), diff --git a/src/opengeodeweb_back/geode_objects/geode_raster_image3d.py b/src/opengeodeweb_back/geode_objects/geode_raster_image3d.py index 24a0c823..633610e2 100644 --- a/src/opengeodeweb_back/geode_objects/geode_raster_image3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_raster_image3d.py @@ -1,13 +1,12 @@ # Standard library imports from __future__ import annotations -from typing import cast # Third party imports import opengeode as og import geode_viewables as viewables # Local application imports -from .types import GeodeMeshType +from .types import GeodeMeshType, cast_str, cast_list_str, cast_int, cast_bool from .geode_mesh import GeodeMesh @@ -23,7 +22,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "RasterImage3D" def native_extension(self) -> str: - return cast(str, self.raster_image.native_extension()) + return cast_str(self.raster_image.native_extension()) @classmethod def is_3D(cls) -> bool: @@ -50,33 +49,31 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast(list[str], og.RasterImageInputFactory3D.list_creators()) + return cast_list_str(og.RasterImageInputFactory3D.list_creators()) @classmethod def output_extensions(cls) -> list[str]: - return cast(list[str], og.RasterImageOutputFactory3D.list_creators()) + return cast_list_str(og.RasterImageOutputFactory3D.list_creators()) @classmethod def object_priority(cls, filename: str) -> int: - return cast(int, og.raster_image_object_priority3D(filename)) + return cast_int(og.raster_image_object_priority3D(filename)) def is_saveable(self, filename: str) -> bool: - return cast(bool, og.is_raster_image_saveable3D(self.raster_image, filename)) + return cast_bool(og.is_raster_image_saveable3D(self.raster_image, filename)) def save(self, filename: str) -> list[str]: - return cast(list[str], og.save_raster_image3D(self.raster_image, filename)) + return cast_list_str(og.save_raster_image3D(self.raster_image, filename)) def save_viewable(self, filename_without_extension: str) -> str: - return cast( - str, + return cast_str( viewables.save_viewable_raster_image3D( self.raster_image, filename_without_extension ), ) def save_light_viewable(self, filename_without_extension: str) -> str: - return cast( - str, + return cast_str( viewables.save_light_viewable_raster_image3D( self.raster_image, filename_without_extension ), diff --git a/src/opengeodeweb_back/geode_objects/geode_regular_grid2d.py b/src/opengeodeweb_back/geode_objects/geode_regular_grid2d.py index edbf5766..856ffd01 100644 --- a/src/opengeodeweb_back/geode_objects/geode_regular_grid2d.py +++ b/src/opengeodeweb_back/geode_objects/geode_regular_grid2d.py @@ -1,6 +1,5 @@ # Standard library imports from __future__ import annotations -from typing import cast # Third party imports import opengeode as og @@ -8,7 +7,7 @@ import geode_viewables as viewables # Local application imports -from .types import GeodeMeshType +from .types import GeodeMeshType, cast_str, cast_list_str, cast_int, cast_bool from .geode_surface_mesh2d import GeodeSurfaceMesh2D from .geode_grid2d import GeodeGrid2D @@ -30,7 +29,7 @@ def inspect(self) -> og_inspector.SurfaceInspectionResult: return super().inspect() def native_extension(self) -> str: - return cast(str, self.regular_grid.native_extension()) + return cast_str(self.regular_grid.native_extension()) def builder(self) -> og.RegularGridBuilder2D: return og.RegularGridBuilder2D.create(self.regular_grid) @@ -49,33 +48,31 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast(list[str], og.RegularGridInputFactory2D.list_creators()) + return cast_list_str(og.RegularGridInputFactory2D.list_creators()) @classmethod def output_extensions(cls) -> list[str]: - return cast(list[str], og.RegularGridOutputFactory2D.list_creators()) + return cast_list_str(og.RegularGridOutputFactory2D.list_creators()) @classmethod def object_priority(cls, filename: str) -> int: - return cast(int, og.regular_grid_object_priority2D(filename)) + return cast_int(og.regular_grid_object_priority2D(filename)) def is_saveable(self, filename: str) -> bool: - return cast(bool, og.is_regular_grid_saveable2D(self.regular_grid, filename)) + return cast_bool(og.is_regular_grid_saveable2D(self.regular_grid, filename)) def save(self, filename: str) -> list[str]: - return cast(list[str], og.save_regular_grid2D(self.regular_grid, filename)) + return cast_list_str(og.save_regular_grid2D(self.regular_grid, filename)) def save_viewable(self, filename_without_extension: str) -> str: - return cast( - str, + return cast_str( viewables.save_viewable_regular_grid2D( self.regular_grid, filename_without_extension ), ) def save_light_viewable(self, filename_without_extension: str) -> str: - return cast( - str, + return cast_str( viewables.save_light_viewable_regular_grid2D( self.regular_grid, filename_without_extension ), diff --git a/src/opengeodeweb_back/geode_objects/geode_regular_grid3d.py b/src/opengeodeweb_back/geode_objects/geode_regular_grid3d.py index c595d6bb..1317edc6 100644 --- a/src/opengeodeweb_back/geode_objects/geode_regular_grid3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_regular_grid3d.py @@ -1,6 +1,5 @@ # Standard library imports from __future__ import annotations -from typing import cast # Third party imports import opengeode as og @@ -8,7 +7,7 @@ import geode_viewables as viewables # Local application imports -from .types import GeodeMeshType +from .types import GeodeMeshType, cast_str, cast_list_str, cast_int, cast_bool from .geode_solid_mesh3d import GeodeSolidMesh3D from .geode_grid3d import GeodeGrid3D @@ -27,7 +26,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "RegularGrid3D" def native_extension(self) -> str: - return cast(str, self.regular_grid.native_extension()) + return cast_str(self.regular_grid.native_extension()) def builder(self) -> og.RegularGridBuilder3D: return og.RegularGridBuilder3D.create(self.regular_grid) @@ -46,33 +45,31 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast(list[str], og.RegularGridInputFactory3D.list_creators()) + return cast_list_str(og.RegularGridInputFactory3D.list_creators()) @classmethod def output_extensions(cls) -> list[str]: - return cast(list[str], og.RegularGridOutputFactory3D.list_creators()) + return cast_list_str(og.RegularGridOutputFactory3D.list_creators()) @classmethod def object_priority(cls, filename: str) -> int: - return cast(int, og.regular_grid_object_priority3D(filename)) + return cast_int(og.regular_grid_object_priority3D(filename)) def is_saveable(self, filename: str) -> bool: - return cast(bool, og.is_regular_grid_saveable3D(self.regular_grid, filename)) + return cast_bool(og.is_regular_grid_saveable3D(self.regular_grid, filename)) def save(self, filename: str) -> list[str]: - return cast(list[str], og.save_regular_grid3D(self.regular_grid, filename)) + return cast_list_str(og.save_regular_grid3D(self.regular_grid, filename)) def save_viewable(self, filename_without_extension: str) -> str: - return cast( - str, + return cast_str( viewables.save_viewable_regular_grid3D( self.regular_grid, filename_without_extension ), ) def save_light_viewable(self, filename_without_extension: str) -> str: - return cast( - str, + return cast_str( viewables.save_light_viewable_regular_grid3D( self.regular_grid, filename_without_extension ), diff --git a/src/opengeodeweb_back/geode_objects/geode_section.py b/src/opengeodeweb_back/geode_objects/geode_section.py index c115b3cc..812ce7f8 100644 --- a/src/opengeodeweb_back/geode_objects/geode_section.py +++ b/src/opengeodeweb_back/geode_objects/geode_section.py @@ -1,6 +1,6 @@ # Standard library imports from __future__ import annotations -from typing import cast, Any +from typing import cast # Third party imports import opengeode as og @@ -9,7 +9,7 @@ import geode_viewables as viewables # Local application imports -from .types import GeodeModelType +from .types import GeodeModelType, cast_str, cast_list_str, cast_int, cast_bool from .geode_model import GeodeModel, ComponentRegistry @@ -25,7 +25,7 @@ def geode_object_type(cls) -> GeodeModelType: return "Section" def native_extension(self) -> str: - return cast(str, self.section.native_extension()) + return cast_str(self.section.native_extension()) @classmethod def is_3D(cls) -> bool: @@ -52,38 +52,36 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast(list[str], og.SectionInputFactory.list_creators()) + return cast_list_str(og.SectionInputFactory.list_creators()) @classmethod def output_extensions(cls) -> list[str]: - return cast(list[str], og.SectionOutputFactory.list_creators()) + return cast_list_str(og.SectionOutputFactory.list_creators()) @classmethod def object_priority(cls, filename: str) -> int: - return cast(int, og.section_object_priority(filename)) + return cast_int(og.section_object_priority(filename)) def is_saveable(self, filename: str) -> bool: - return cast(bool, og.is_section_saveable(self.section, filename)) + return cast_bool(og.is_section_saveable(self.section, filename)) def save(self, filename: str) -> list[str]: - return cast(list[str], og.save_section(self.section, filename)) + return cast_list_str(og.save_section(self.section, filename)) def save_viewable(self, filename_without_extension: str) -> str: - return cast( - str, + return cast_str( viewables.save_viewable_section(self.section, filename_without_extension), ) def save_light_viewable(self, filename_without_extension: str) -> str: - return cast( - str, + return cast_str( viewables.save_light_viewable_section( self.section, filename_without_extension ), ) def mesh_components(self) -> ComponentRegistry: - return cast(dict[Any, list[Any]], self.section.mesh_components()) + return cast(ComponentRegistry, self.section.mesh_components()) def inspect(self) -> og_inspector.SectionInspectionResult: return og_inspector.inspect_section(self.section) diff --git a/src/opengeodeweb_back/geode_objects/geode_structural_model.py b/src/opengeodeweb_back/geode_objects/geode_structural_model.py index ca00e446..ecc2a559 100644 --- a/src/opengeodeweb_back/geode_objects/geode_structural_model.py +++ b/src/opengeodeweb_back/geode_objects/geode_structural_model.py @@ -1,6 +1,5 @@ # Standard library imports from __future__ import annotations -from typing import cast # Third party imports import opengeode as og @@ -8,7 +7,7 @@ import geode_viewables as viewables # Local application imports -from .types import GeodeModelType +from .types import GeodeModelType, cast_str, cast_list_str, cast_int, cast_bool from .geode_brep import GeodeBRep @@ -30,7 +29,7 @@ def geode_object_type(cls) -> GeodeModelType: return "StructuralModel" def native_extension(self) -> str: - return cast(str, self.structural_model.native_extension()) + return cast_str(self.structural_model.native_extension()) def builder(self) -> og_geosciences.StructuralModelBuilder: return og_geosciences.StructuralModelBuilder(self.structural_model) @@ -49,45 +48,39 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast( - list[str], og_geosciences.StructuralModelInputFactory.list_creators() - ) + return cast_list_str(og_geosciences.StructuralModelInputFactory.list_creators()) @classmethod def output_extensions(cls) -> list[str]: - return cast( - list[str], og_geosciences.StructuralModelOutputFactory.list_creators() + return cast_list_str( + og_geosciences.StructuralModelOutputFactory.list_creators() ) @classmethod def object_priority(cls, filename: str) -> int: - return cast(int, og_geosciences.structural_model_object_priority(filename)) + return cast_int(og_geosciences.structural_model_object_priority(filename)) def is_saveable(self, filename: str) -> bool: - return cast( - bool, + return cast_bool( og_geosciences.is_structural_model_saveable( self.structural_model, filename ), ) def save(self, filename: str) -> list[str]: - return cast( - list[str], - og_geosciences.save_structural_model(self.structural_model, filename), + return cast_list_str( + og_geosciences.save_structural_model(self.structural_model, filename) ) def save_viewable(self, filename_without_extension: str) -> str: - return cast( - str, + return cast_str( viewables.save_viewable_structural_model( self.structural_model, filename_without_extension ), ) def save_light_viewable(self, filename_without_extension: str) -> str: - return cast( - str, + return cast_str( viewables.save_light_viewable_structural_model( self.structural_model, filename_without_extension ), diff --git a/src/opengeodeweb_back/geode_objects/geode_tetrahedral_solid3d.py b/src/opengeodeweb_back/geode_objects/geode_tetrahedral_solid3d.py index e918f215..60f35d75 100644 --- a/src/opengeodeweb_back/geode_objects/geode_tetrahedral_solid3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_tetrahedral_solid3d.py @@ -1,13 +1,12 @@ # Standard library imports from __future__ import annotations -from typing import cast # Third party imports import opengeode as og import geode_viewables as viewables # Local application imports -from .types import GeodeMeshType +from .types import GeodeMeshType, cast_str, cast_list_str, cast_int, cast_bool from .geode_solid_mesh3d import GeodeSolidMesh3D @@ -27,7 +26,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "TetrahedralSolid3D" def native_extension(self) -> str: - return cast(str, self.tetrahedral_solid.native_extension()) + return cast_str(self.tetrahedral_solid.native_extension()) def builder(self) -> og.TetrahedralSolidBuilder3D: return og.TetrahedralSolidBuilder3D.create(self.tetrahedral_solid) @@ -46,37 +45,35 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast(list[str], og.TetrahedralSolidInputFactory3D.list_creators()) + return cast_list_str(og.TetrahedralSolidInputFactory3D.list_creators()) @classmethod def output_extensions(cls) -> list[str]: - return cast(list[str], og.TetrahedralSolidOutputFactory3D.list_creators()) + return cast_list_str(og.TetrahedralSolidOutputFactory3D.list_creators()) @classmethod def object_priority(cls, filename: str) -> int: - return cast(int, og.tetrahedral_solid_object_priority3D(filename)) + return cast_int(og.tetrahedral_solid_object_priority3D(filename)) def is_saveable(self, filename: str) -> bool: - return cast( - bool, og.is_tetrahedral_solid_saveable3D(self.tetrahedral_solid, filename) + return cast_bool( + og.is_tetrahedral_solid_saveable3D(self.tetrahedral_solid, filename) ) def save(self, filename: str) -> list[str]: - return cast( - list[str], og.save_tetrahedral_solid3D(self.tetrahedral_solid, filename) + return cast_list_str( + og.save_tetrahedral_solid3D(self.tetrahedral_solid, filename) ) def save_viewable(self, filename_without_extension: str) -> str: - return cast( - str, + return cast_str( viewables.save_viewable_tetrahedral_solid3D( self.tetrahedral_solid, filename_without_extension ), ) def save_light_viewable(self, filename_without_extension: str) -> str: - return cast( - str, + return cast_str( viewables.save_light_viewable_tetrahedral_solid3D( self.tetrahedral_solid, filename_without_extension ), diff --git a/src/opengeodeweb_back/geode_objects/geode_triangulated_surface2d.py b/src/opengeodeweb_back/geode_objects/geode_triangulated_surface2d.py index 60eb096a..98abdb40 100644 --- a/src/opengeodeweb_back/geode_objects/geode_triangulated_surface2d.py +++ b/src/opengeodeweb_back/geode_objects/geode_triangulated_surface2d.py @@ -1,13 +1,12 @@ # Standard library imports from __future__ import annotations -from typing import cast # Third party imports import opengeode as og import geode_viewables as viewables # Local application imports -from .types import GeodeMeshType +from .types import GeodeMeshType, cast_str, cast_list_str, cast_int, cast_bool from .geode_surface_mesh2d import GeodeSurfaceMesh2D @@ -29,7 +28,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "TriangulatedSurface2D" def native_extension(self) -> str: - return cast(str, self.triangulated_surface.native_extension()) + return cast_str(self.triangulated_surface.native_extension()) def builder(self) -> og.TriangulatedSurfaceBuilder2D: return og.TriangulatedSurfaceBuilder2D.create(self.triangulated_surface) @@ -48,39 +47,35 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast(list[str], og.TriangulatedSurfaceInputFactory2D.list_creators()) + return cast_list_str(og.TriangulatedSurfaceInputFactory2D.list_creators()) @classmethod def output_extensions(cls) -> list[str]: - return cast(list[str], og.TriangulatedSurfaceOutputFactory2D.list_creators()) + return cast_list_str(og.TriangulatedSurfaceOutputFactory2D.list_creators()) @classmethod def object_priority(cls, filename: str) -> int: - return cast(int, og.triangulated_surface_object_priority2D(filename)) + return cast_int(og.triangulated_surface_object_priority2D(filename)) def is_saveable(self, filename: str) -> bool: - return cast( - bool, + return cast_bool( og.is_triangulated_surface_saveable2D(self.triangulated_surface, filename), ) def save(self, filename: str) -> list[str]: - return cast( - list[str], + return cast_list_str( og.save_triangulated_surface2D(self.triangulated_surface, filename), ) def save_viewable(self, filename_without_extension: str) -> str: - return cast( - str, + return cast_str( viewables.save_viewable_triangulated_surface2D( self.triangulated_surface, filename_without_extension ), ) def save_light_viewable(self, filename_without_extension: str) -> str: - return cast( - str, + return cast_str( viewables.save_light_viewable_triangulated_surface2D( self.triangulated_surface, filename_without_extension ), diff --git a/src/opengeodeweb_back/geode_objects/geode_triangulated_surface3d.py b/src/opengeodeweb_back/geode_objects/geode_triangulated_surface3d.py index 8c74118b..1b9a76cf 100644 --- a/src/opengeodeweb_back/geode_objects/geode_triangulated_surface3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_triangulated_surface3d.py @@ -1,13 +1,12 @@ # Standard library imports from __future__ import annotations -from typing import cast # Third party imports import opengeode as og import geode_viewables as viewables # Local application imports -from .types import GeodeMeshType +from .types import GeodeMeshType, cast_str, cast_list_str, cast_int, cast_bool from .geode_surface_mesh3d import GeodeSurfaceMesh3D @@ -29,7 +28,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "TriangulatedSurface3D" def native_extension(self) -> str: - return cast(str, self.triangulated_surface.native_extension()) + return cast_str(self.triangulated_surface.native_extension()) def builder(self) -> og.TriangulatedSurfaceBuilder3D: return og.TriangulatedSurfaceBuilder3D.create(self.triangulated_surface) @@ -48,39 +47,35 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast(list[str], og.TriangulatedSurfaceInputFactory3D.list_creators()) + return cast_list_str(og.TriangulatedSurfaceInputFactory3D.list_creators()) @classmethod def output_extensions(cls) -> list[str]: - return cast(list[str], og.TriangulatedSurfaceOutputFactory3D.list_creators()) + return cast_list_str(og.TriangulatedSurfaceOutputFactory3D.list_creators()) @classmethod def object_priority(cls, filename: str) -> int: - return cast(int, og.triangulated_surface_object_priority3D(filename)) + return cast_int(og.triangulated_surface_object_priority3D(filename)) def is_saveable(self, filename: str) -> bool: - return cast( - bool, + return cast_bool( og.is_triangulated_surface_saveable3D(self.triangulated_surface, filename), ) def save(self, filename: str) -> list[str]: - return cast( - list[str], + return cast_list_str( og.save_triangulated_surface3D(self.triangulated_surface, filename), ) def save_viewable(self, filename_without_extension: str) -> str: - return cast( - str, + return cast_str( viewables.save_viewable_triangulated_surface3D( self.triangulated_surface, filename_without_extension ), ) def save_light_viewable(self, filename_without_extension: str) -> str: - return cast( - str, + return cast_str( viewables.save_light_viewable_triangulated_surface3D( self.triangulated_surface, filename_without_extension ), diff --git a/src/opengeodeweb_back/geode_objects/geode_vertex_set.py b/src/opengeodeweb_back/geode_objects/geode_vertex_set.py index 39e3a9f2..fbf0869e 100644 --- a/src/opengeodeweb_back/geode_objects/geode_vertex_set.py +++ b/src/opengeodeweb_back/geode_objects/geode_vertex_set.py @@ -1,12 +1,11 @@ # Standard library imports from __future__ import annotations -from typing import cast # Third party imports import opengeode as og # Local application imports -from .types import GeodeMeshType +from .types import GeodeMeshType, cast_str, cast_list_str, cast_int, cast_bool from .geode_mesh import GeodeMesh @@ -24,7 +23,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "VertexSet" def native_extension(self) -> str: - return cast(str, self.vertex_set.native_extension()) + return cast_str(self.vertex_set.native_extension()) @classmethod def is_3D(cls) -> bool: @@ -51,21 +50,21 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast(list[str], og.VertexSetInputFactory.list_creators()) + return cast_list_str(og.VertexSetInputFactory.list_creators()) @classmethod def output_extensions(cls) -> list[str]: - return cast(list[str], og.VertexSetOutputFactory.list_creators()) + return cast_list_str(og.VertexSetOutputFactory.list_creators()) @classmethod def object_priority(cls, filename: str) -> int: - return cast(int, og.vertex_set_object_priority(filename)) + return cast_int(og.vertex_set_object_priority(filename)) def is_saveable(self, filename: str) -> bool: - return cast(bool, og.is_vertex_set_saveable(self.vertex_set, filename)) + return cast_bool(og.is_vertex_set_saveable(self.vertex_set, filename)) def save(self, filename: str) -> list[str]: - return cast(list[str], og.save_vertex_set(self.vertex_set, filename)) + return cast_list_str(og.save_vertex_set(self.vertex_set, filename)) def save_viewable(self, filename_without_extension: str) -> str: return "" diff --git a/src/opengeodeweb_back/geode_objects/types.py b/src/opengeodeweb_back/geode_objects/types.py index 57fbccf6..e726e7c2 100644 --- a/src/opengeodeweb_back/geode_objects/types.py +++ b/src/opengeodeweb_back/geode_objects/types.py @@ -73,3 +73,46 @@ def geode_object_type(value: str) -> GeodeObjectType: ViewerType = Literal["mesh", "model"] + +# Type casting helpers for OpenGeode C++ bindings +# OpenGeode functions return 'Any' due to missing type stubs, + + +def cast_str(value: object) -> str: + """ + Args: + value: Return value from OpenGeode binding (typed as Any) + Returns: + The value cast to str for type checking purposes + """ + return cast(str, value) + + +def cast_list_str(value: object) -> list[str]: + """ + Args: + value: Return value from OpenGeode binding (typed as Any) + Returns: + The value cast to list[str] for type checking purposes + """ + return cast(list[str], value) + + +def cast_int(value: object) -> int: + """ + Args: + value: Return value from OpenGeode binding (typed as Any) + Returns: + The value cast to int for type checking purposes + """ + return cast(int, value) + + +def cast_bool(value: object) -> bool: + """ + Args: + value: Return value from OpenGeode binding (typed as Any) + Returns: + The value cast to bool for type checking purposes + """ + return cast(bool, value) diff --git a/src/opengeodeweb_back/utils_functions.py b/src/opengeodeweb_back/utils_functions.py index 04c25d4c..2ce1393c 100644 --- a/src/opengeodeweb_back/utils_functions.py +++ b/src/opengeodeweb_back/utils_functions.py @@ -5,7 +5,7 @@ import zipfile from collections.abc import Callable from concurrent.futures import ThreadPoolExecutor -from typing import Any +from typing import Any, cast # Third party imports @@ -15,7 +15,6 @@ import shutil from werkzeug.exceptions import HTTPException import werkzeug -from typing import cast from opengeodeweb_microservice.schemas import SchemaDict from opengeodeweb_microservice.database.data import Data from opengeodeweb_microservice.database.connection import get_session From 9fec37f266ee61a34a346f44212ee4d49002eb59 Mon Sep 17 00:00:00 2001 From: MaxNumerique <144453705+MaxNumerique@users.noreply.github.com> Date: Mon, 5 Jan 2026 15:02:48 +0000 Subject: [PATCH 04/12] Apply prepare changes --- mypy.ini | 8 +------- requirements.txt | 1 - 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/mypy.ini b/mypy.ini index 656ac495..089c0496 100644 --- a/mypy.ini +++ b/mypy.ini @@ -1,10 +1,4 @@ [mypy] strict = True files = src/ -disallow_untyped_decorators = False - -[mypy-opengeode.*,geode.*,opengeode.*,opengeode_io.*,opengeode_geosciences.*,opengeode_inspector.*,opengeode_geosciencesio.*,geode_viewables.*,werkzeug.*,flask.*,dataclasses_json.*] -ignore_missing_imports = True - -[mypy-opengeodeweb_microservice.*] -ignore_missing_imports = True \ No newline at end of file +disallow_untyped_decorators = False \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 2dfb9026..08d64bdf 100644 --- a/requirements.txt +++ b/requirements.txt @@ -60,4 +60,3 @@ werkzeug==3.1.2 # flask # flask-cors -opengeodeweb-microservice==1.*,>=1.0.11 From f310e196694f5e39201250e08a5ae682b85d96e3 Mon Sep 17 00:00:00 2001 From: MaxNumerique Date: Mon, 5 Jan 2026 16:40:15 +0100 Subject: [PATCH 05/12] revert : no more type issue --- src/opengeodeweb_back/geode_functions.py | 4 +- .../geode_objects/geode_brep.py | 25 +++++------ .../geode_objects/geode_cross_section.py | 30 +++++-------- .../geode_objects/geode_edged_curve2d.py | 24 +++++----- .../geode_objects/geode_edged_curve3d.py | 24 +++++----- .../geode_objects/geode_graph.py | 14 +++--- .../geode_objects/geode_hybrid_solid3d.py | 24 +++++----- .../geode_implicit_cross_section.py | 34 ++++++-------- .../geode_implicit_structural_model.py | 44 +++++++------------ .../geode_light_regular_grid2d.py | 26 +++++------ .../geode_light_regular_grid3d.py | 26 +++++------ .../geode_objects/geode_point_set2d.py | 24 +++++----- .../geode_objects/geode_point_set3d.py | 24 +++++----- .../geode_polygonal_surface2d.py | 26 +++++------ .../geode_polygonal_surface3d.py | 26 +++++------ .../geode_objects/geode_polyhedral_solid3d.py | 26 +++++------ .../geode_objects/geode_raster_image2d.py | 24 +++++----- .../geode_objects/geode_raster_image3d.py | 24 +++++----- .../geode_objects/geode_regular_grid2d.py | 24 +++++----- .../geode_objects/geode_regular_grid3d.py | 24 +++++----- .../geode_objects/geode_section.py | 28 ++++++------ .../geode_objects/geode_structural_model.py | 30 +++++-------- .../geode_tetrahedral_solid3d.py | 26 +++++------ .../geode_triangulated_surface2d.py | 26 +++++------ .../geode_triangulated_surface3d.py | 26 +++++------ .../geode_objects/geode_vertex_set.py | 14 +++--- src/opengeodeweb_back/geode_objects/types.py | 43 ------------------ .../routes/blueprint_routes.py | 2 + .../routes/create/blueprint_create.py | 2 +- 29 files changed, 283 insertions(+), 411 deletions(-) diff --git a/src/opengeodeweb_back/geode_functions.py b/src/opengeodeweb_back/geode_functions.py index 2cf51199..fb884f6c 100644 --- a/src/opengeodeweb_back/geode_functions.py +++ b/src/opengeodeweb_back/geode_functions.py @@ -7,7 +7,7 @@ # Local application imports from .geode_objects import geode_objects -from .geode_objects.types import GeodeObjectType, geode_object_type, cast_str +from .geode_objects.types import GeodeObjectType, geode_object_type from .geode_objects.geode_object import GeodeObject from opengeodeweb_microservice.database.data import Data @@ -45,7 +45,7 @@ def get_data_info(data_id: str) -> Data: def upload_file_path(filename: str) -> str: upload_folder = flask.current_app.config["UPLOAD_FOLDER"] secure_filename = werkzeug.utils.secure_filename(filename) - return cast_str(os.path.abspath(os.path.join(upload_folder, secure_filename))) + return os.path.abspath(os.path.join(upload_folder, secure_filename)) def geode_object_output_extensions( diff --git a/src/opengeodeweb_back/geode_objects/geode_brep.py b/src/opengeodeweb_back/geode_objects/geode_brep.py index 403133fa..6637fb9a 100644 --- a/src/opengeodeweb_back/geode_objects/geode_brep.py +++ b/src/opengeodeweb_back/geode_objects/geode_brep.py @@ -1,6 +1,5 @@ # Standard library imports from __future__ import annotations -from typing import cast # Third party imports import opengeode as og @@ -9,7 +8,7 @@ import geode_viewables as viewables # Local application imports -from .types import GeodeModelType, cast_str, cast_list_str, cast_int, cast_bool +from .types import GeodeModelType from .geode_model import GeodeModel, ComponentRegistry @@ -25,7 +24,7 @@ def geode_object_type(cls) -> GeodeModelType: return "BRep" def native_extension(self) -> str: - return cast_str(self.brep.native_extension()) + return self.brep.native_extension() @classmethod def is_3D(cls) -> bool: @@ -52,34 +51,30 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast_list_str(og.BRepInputFactory.list_creators()) + return og.BRepInputFactory.list_creators() @classmethod def output_extensions(cls) -> list[str]: - return cast_list_str(og.BRepOutputFactory.list_creators()) + return og.BRepOutputFactory.list_creators() @classmethod def object_priority(cls, filename: str) -> int: - return cast_int(og.brep_object_priority(filename)) + return og.brep_object_priority(filename) def is_saveable(self, filename: str) -> bool: - return cast_bool(og.is_brep_saveable(self.brep, filename)) + return og.is_brep_saveable(self.brep, filename) def save(self, filename: str) -> list[str]: - return cast_list_str(og.save_brep(self.brep, filename)) + return og.save_brep(self.brep, filename) def save_viewable(self, filename_without_extension: str) -> str: - return cast_str( - viewables.save_viewable_brep(self.brep, filename_without_extension) - ) + return viewables.save_viewable_brep(self.brep, filename_without_extension) def save_light_viewable(self, filename_without_extension: str) -> str: - return cast_str( - viewables.save_light_viewable_brep(self.brep, filename_without_extension) - ) + return viewables.save_light_viewable_brep(self.brep, filename_without_extension) def mesh_components(self) -> ComponentRegistry: - return cast(ComponentRegistry, self.brep.mesh_components()) + return self.brep.mesh_components() def inspect(self) -> og_inspector.BRepInspectionResult: return og_inspector.inspect_brep(self.brep) diff --git a/src/opengeodeweb_back/geode_objects/geode_cross_section.py b/src/opengeodeweb_back/geode_objects/geode_cross_section.py index 78bb0638..bfeda2c6 100644 --- a/src/opengeodeweb_back/geode_objects/geode_cross_section.py +++ b/src/opengeodeweb_back/geode_objects/geode_cross_section.py @@ -7,7 +7,7 @@ import geode_viewables as viewables # Local application imports -from .types import GeodeModelType, cast_str, cast_list_str, cast_int, cast_bool +from .types import GeodeModelType from .geode_section import GeodeSection @@ -29,7 +29,7 @@ def geode_object_type(cls) -> GeodeModelType: return "CrossSection" def native_extension(self) -> str: - return cast_str(self.cross_section.native_extension()) + return self.cross_section.native_extension() def builder(self) -> og_geosciences.CrossSectionBuilder: return og_geosciences.CrossSectionBuilder(self.cross_section) @@ -48,36 +48,28 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast_list_str(og_geosciences.CrossSectionInputFactory.list_creators()) + return og_geosciences.CrossSectionInputFactory.list_creators() @classmethod def output_extensions(cls) -> list[str]: - return cast_list_str(og_geosciences.CrossSectionOutputFactory.list_creators()) + return og_geosciences.CrossSectionOutputFactory.list_creators() @classmethod def object_priority(cls, filename: str) -> int: - return cast_int(og_geosciences.cross_section_object_priority(filename)) + return og_geosciences.cross_section_object_priority(filename) def is_saveable(self, filename: str) -> bool: - return cast_bool( - og_geosciences.is_cross_section_saveable(self.cross_section, filename) - ) + return og_geosciences.is_cross_section_saveable(self.cross_section, filename) def save(self, filename: str) -> list[str]: - return cast_list_str( - og_geosciences.save_cross_section(self.cross_section, filename) - ) + return og_geosciences.save_cross_section(self.cross_section, filename) def save_viewable(self, filename_without_extension: str) -> str: - return cast_str( - viewables.save_viewable_cross_section( - self.cross_section, filename_without_extension - ) + return viewables.save_viewable_cross_section( + self.cross_section, filename_without_extension ) def save_light_viewable(self, filename_without_extension: str) -> str: - return cast_str( - viewables.save_light_viewable_cross_section( - self.cross_section, filename_without_extension - ) + return viewables.save_light_viewable_cross_section( + self.cross_section, filename_without_extension ) diff --git a/src/opengeodeweb_back/geode_objects/geode_edged_curve2d.py b/src/opengeodeweb_back/geode_objects/geode_edged_curve2d.py index 3aac7678..a08552e8 100644 --- a/src/opengeodeweb_back/geode_objects/geode_edged_curve2d.py +++ b/src/opengeodeweb_back/geode_objects/geode_edged_curve2d.py @@ -8,7 +8,7 @@ import geode_viewables as viewables # Local application imports -from .types import GeodeMeshType, cast_str, cast_list_str, cast_int, cast_bool +from .types import GeodeMeshType from .geode_graph import GeodeGraph @@ -26,7 +26,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "EdgedCurve2D" def native_extension(self) -> str: - return cast_str(self.edged_curve.native_extension()) + return self.edged_curve.native_extension() @classmethod def is_3D(cls) -> bool: @@ -53,34 +53,32 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast_list_str(og.EdgedCurveInputFactory2D.list_creators()) + return og.EdgedCurveInputFactory2D.list_creators() @classmethod def output_extensions(cls) -> list[str]: - return cast_list_str(og.EdgedCurveOutputFactory2D.list_creators()) + return og.EdgedCurveOutputFactory2D.list_creators() @classmethod def object_priority(cls, filename: str) -> int: - return cast_int(og.edged_curve_object_priority2D(filename)) + return og.edged_curve_object_priority2D(filename) def is_saveable(self, filename: str) -> bool: - return cast_bool(og.is_edged_curve_saveable2D(self.edged_curve, filename)) + return og.is_edged_curve_saveable2D(self.edged_curve, filename) def save(self, filename: str) -> list[str]: - return cast_list_str(og.save_edged_curve2D(self.edged_curve, filename)) + return og.save_edged_curve2D(self.edged_curve, filename) def save_viewable(self, filename_without_extension: str) -> str: - return cast_str( - viewables.save_viewable_edged_curve2D( + return viewables.save_viewable_edged_curve2D( self.edged_curve, filename_without_extension - ), + , ) def save_light_viewable(self, filename_without_extension: str) -> str: - return cast_str( - viewables.save_light_viewable_edged_curve2D( + return viewables.save_light_viewable_edged_curve2D( self.edged_curve, filename_without_extension - ), + , ) def inspect(self) -> og_inspector.EdgedCurveInspectionResult: diff --git a/src/opengeodeweb_back/geode_objects/geode_edged_curve3d.py b/src/opengeodeweb_back/geode_objects/geode_edged_curve3d.py index 38c74874..44bf356f 100644 --- a/src/opengeodeweb_back/geode_objects/geode_edged_curve3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_edged_curve3d.py @@ -8,7 +8,7 @@ import geode_viewables as viewables # Local application imports -from .types import GeodeMeshType, cast_str, cast_list_str, cast_int, cast_bool +from .types import GeodeMeshType from .geode_graph import GeodeGraph @@ -26,7 +26,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "EdgedCurve3D" def native_extension(self) -> str: - return cast_str(self.edged_curve.native_extension()) + return self.edged_curve.native_extension() @classmethod def is_3D(cls) -> bool: @@ -53,34 +53,32 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast_list_str(og.EdgedCurveInputFactory3D.list_creators()) + return og.EdgedCurveInputFactory3D.list_creators() @classmethod def output_extensions(cls) -> list[str]: - return cast_list_str(og.EdgedCurveOutputFactory3D.list_creators()) + return og.EdgedCurveOutputFactory3D.list_creators() @classmethod def object_priority(cls, filename: str) -> int: - return cast_int(og.edged_curve_object_priority3D(filename)) + return og.edged_curve_object_priority3D(filename) def is_saveable(self, filename: str) -> bool: - return cast_bool(og.is_edged_curve_saveable3D(self.edged_curve, filename)) + return og.is_edged_curve_saveable3D(self.edged_curve, filename) def save(self, filename: str) -> list[str]: - return cast_list_str(og.save_edged_curve3D(self.edged_curve, filename)) + return og.save_edged_curve3D(self.edged_curve, filename) def save_viewable(self, filename_without_extension: str) -> str: - return cast_str( - viewables.save_viewable_edged_curve3D( + return viewables.save_viewable_edged_curve3D( self.edged_curve, filename_without_extension - ), + , ) def save_light_viewable(self, filename_without_extension: str) -> str: - return cast_str( - viewables.save_light_viewable_edged_curve3D( + return viewables.save_light_viewable_edged_curve3D( self.edged_curve, filename_without_extension - ), + , ) def inspect(self) -> og_inspector.EdgedCurveInspectionResult: diff --git a/src/opengeodeweb_back/geode_objects/geode_graph.py b/src/opengeodeweb_back/geode_objects/geode_graph.py index 39c61e41..7c79f1c6 100644 --- a/src/opengeodeweb_back/geode_objects/geode_graph.py +++ b/src/opengeodeweb_back/geode_objects/geode_graph.py @@ -5,7 +5,7 @@ import opengeode as og # Local application imports -from .types import GeodeMeshType, cast_str, cast_list_str, cast_int, cast_bool +from .types import GeodeMeshType from .geode_vertex_set import GeodeVertexSet @@ -21,7 +21,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "Graph" def native_extension(self) -> str: - return cast_str(self.graph.native_extension()) + return self.graph.native_extension() @classmethod def is_3D(cls) -> bool: @@ -48,21 +48,21 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast_list_str(og.GraphInputFactory.list_creators()) + return og.GraphInputFactory.list_creators() @classmethod def output_extensions(cls) -> list[str]: - return cast_list_str(og.GraphOutputFactory.list_creators()) + return og.GraphOutputFactory.list_creators() @classmethod def object_priority(cls, filename: str) -> int: - return cast_int(og.graph_object_priority(filename)) + return og.graph_object_priority(filename) def is_saveable(self, filename: str) -> bool: - return cast_bool(og.is_graph_saveable(self.graph, filename)) + return og.is_graph_saveable(self.graph, filename) def save(self, filename: str) -> list[str]: - return cast_list_str(og.save_graph(self.graph, filename)) + return og.save_graph(self.graph, filename) def save_viewable(self, filename_without_extension: str) -> str: return "" diff --git a/src/opengeodeweb_back/geode_objects/geode_hybrid_solid3d.py b/src/opengeodeweb_back/geode_objects/geode_hybrid_solid3d.py index 7f5f0dbc..50186ec6 100644 --- a/src/opengeodeweb_back/geode_objects/geode_hybrid_solid3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_hybrid_solid3d.py @@ -6,7 +6,7 @@ import geode_viewables as viewables # Local application imports -from .types import GeodeMeshType, cast_str, cast_list_str, cast_int, cast_bool +from .types import GeodeMeshType from .geode_solid_mesh3d import GeodeSolidMesh3D @@ -24,7 +24,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "HybridSolid3D" def native_extension(self) -> str: - return cast_str(self.hybrid_solid.native_extension()) + return self.hybrid_solid.native_extension() def builder(self) -> og.HybridSolidBuilder3D: return og.HybridSolidBuilder3D.create(self.hybrid_solid) @@ -43,32 +43,30 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast_list_str(og.HybridSolidInputFactory3D.list_creators()) + return og.HybridSolidInputFactory3D.list_creators() @classmethod def output_extensions(cls) -> list[str]: - return cast_list_str(og.HybridSolidOutputFactory3D.list_creators()) + return og.HybridSolidOutputFactory3D.list_creators() @classmethod def object_priority(cls, filename: str) -> int: - return cast_int(og.hybrid_solid_object_priority3D(filename)) + return og.hybrid_solid_object_priority3D(filename) def is_saveable(self, filename: str) -> bool: - return cast_bool(og.is_hybrid_solid_saveable3D(self.hybrid_solid, filename)) + return og.is_hybrid_solid_saveable3D(self.hybrid_solid, filename) def save(self, filename: str) -> list[str]: - return cast_list_str(og.save_hybrid_solid3D(self.hybrid_solid, filename)) + return og.save_hybrid_solid3D(self.hybrid_solid, filename) def save_viewable(self, filename_without_extension: str) -> str: - return cast_str( - viewables.save_viewable_hybrid_solid3D( + return viewables.save_viewable_hybrid_solid3D( self.hybrid_solid, filename_without_extension - ), + , ) def save_light_viewable(self, filename_without_extension: str) -> str: - return cast_str( - viewables.save_light_viewable_hybrid_solid3D( + return viewables.save_light_viewable_hybrid_solid3D( self.hybrid_solid, filename_without_extension - ), + , ) diff --git a/src/opengeodeweb_back/geode_objects/geode_implicit_cross_section.py b/src/opengeodeweb_back/geode_objects/geode_implicit_cross_section.py index 51db471b..b7815637 100644 --- a/src/opengeodeweb_back/geode_objects/geode_implicit_cross_section.py +++ b/src/opengeodeweb_back/geode_objects/geode_implicit_cross_section.py @@ -7,7 +7,7 @@ import geode_viewables as viewables # Local application imports -from .types import GeodeModelType, cast_str, cast_list_str, cast_int, cast_bool +from .types import GeodeModelType from .geode_cross_section import GeodeCrossSection @@ -29,7 +29,7 @@ def geode_object_type(cls) -> GeodeModelType: return "ImplicitCrossSection" def native_extension(self) -> str: - return cast_str(self.implicit_cross_section.native_extension()) + return self.implicit_cross_section.native_extension() def builder(self) -> og_geosciences.ImplicitCrossSectionBuilder: return og_geosciences.ImplicitCrossSectionBuilder(self.implicit_cross_section) @@ -50,44 +50,36 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast_list_str( - og_geosciences.ImplicitCrossSectionInputFactory.list_creators() - ) + return og_geosciences.ImplicitCrossSectionInputFactory.list_creators() @classmethod def output_extensions(cls) -> list[str]: - return cast_list_str( - og_geosciences.ImplicitCrossSectionOutputFactory.list_creators() - ) + return og_geosciences.ImplicitCrossSectionOutputFactory.list_creators() @classmethod def object_priority(cls, filename: str) -> int: - return cast_int(og_geosciences.implicit_cross_section_object_priority(filename)) + return og_geosciences.implicit_cross_section_object_priority(filename) def is_saveable(self, filename: str) -> bool: - return cast_bool( - og_geosciences.is_implicit_cross_section_saveable( + return og_geosciences.is_implicit_cross_section_saveable( self.implicit_cross_section, filename - ), + , ) def save(self, filename: str) -> list[str]: - return cast_list_str( - og_geosciences.save_implicit_cross_section( + return og_geosciences.save_implicit_cross_section( self.implicit_cross_section, filename - ), + , ) def save_viewable(self, filename_without_extension: str) -> str: - return cast_str( - viewables.save_viewable_implicit_cross_section( + return viewables.save_viewable_implicit_cross_section( self.implicit_cross_section, filename_without_extension - ), + , ) def save_light_viewable(self, filename_without_extension: str) -> str: - return cast_str( - viewables.save_light_viewable_implicit_cross_section( + return viewables.save_light_viewable_implicit_cross_section( self.implicit_cross_section, filename_without_extension - ), + , ) diff --git a/src/opengeodeweb_back/geode_objects/geode_implicit_structural_model.py b/src/opengeodeweb_back/geode_objects/geode_implicit_structural_model.py index 47fa1834..572b7e78 100644 --- a/src/opengeodeweb_back/geode_objects/geode_implicit_structural_model.py +++ b/src/opengeodeweb_back/geode_objects/geode_implicit_structural_model.py @@ -7,7 +7,7 @@ import geode_viewables as viewables # Local application imports -from .types import GeodeModelType, cast_str, cast_list_str, cast_int, cast_bool +from .types import GeodeModelType from .geode_structural_model import GeodeStructuralModel @@ -30,7 +30,7 @@ def geode_object_type(cls) -> GeodeModelType: return "ImplicitStructuralModel" def native_extension(self) -> str: - return cast_str(self.implicit_structural_model.native_extension()) + return self.implicit_structural_model.native_extension() def builder(self) -> og_geosciences.ImplicitStructuralModelBuilder: return og_geosciences.ImplicitStructuralModelBuilder( @@ -53,46 +53,36 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast_list_str( - og_geosciences.ImplicitStructuralModelInputFactory.list_creators(), - ) + return og_geosciences.ImplicitStructuralModelInputFactory.list_creators() @classmethod def output_extensions(cls) -> list[str]: - return cast_list_str( - og_geosciences.ImplicitStructuralModelOutputFactory.list_creators(), - ) + return og_geosciences.ImplicitStructuralModelOutputFactory.list_creators() @classmethod def object_priority(cls, filename: str) -> int: - return cast_int( - og_geosciences.implicit_structural_model_object_priority(filename) - ) + return og_geosciences.implicit_structural_model_object_priority(filename) def is_saveable(self, filename: str) -> bool: - return cast_bool( - og_geosciences.is_implicit_structural_model_saveable( - self.implicit_structural_model, filename - ), + return og_geosciences.is_implicit_structural_model_saveable( + self.implicit_structural_model, + filename, ) def save(self, filename: str) -> list[str]: - return cast_list_str( - og_geosciences.save_implicit_structural_model( - self.implicit_structural_model, filename - ), + return og_geosciences.save_implicit_structural_model( + self.implicit_structural_model, + filename, ) def save_viewable(self, filename_without_extension: str) -> str: - return cast_str( - viewables.save_viewable_implicit_structural_model( - self.implicit_structural_model, filename_without_extension - ), + return viewables.save_viewable_implicit_structural_model( + self.implicit_structural_model, + filename_without_extension, ) def save_light_viewable(self, filename_without_extension: str) -> str: - return cast_str( - viewables.save_light_viewable_implicit_structural_model( - self.implicit_structural_model, filename_without_extension - ), + return viewables.save_light_viewable_implicit_structural_model( + self.implicit_structural_model, + filename_without_extension, ) diff --git a/src/opengeodeweb_back/geode_objects/geode_light_regular_grid2d.py b/src/opengeodeweb_back/geode_objects/geode_light_regular_grid2d.py index 8e532ce5..290f5093 100644 --- a/src/opengeodeweb_back/geode_objects/geode_light_regular_grid2d.py +++ b/src/opengeodeweb_back/geode_objects/geode_light_regular_grid2d.py @@ -6,7 +6,7 @@ import geode_viewables as viewables # Local application imports -from .types import GeodeMeshType, cast_str, cast_list_str, cast_int, cast_bool +from .types import GeodeMeshType from .geode_grid2d import GeodeGrid2D @@ -22,7 +22,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "LightRegularGrid2D" def native_extension(self) -> str: - return cast_str(self.light_regular_grid.native_extension()) + return self.light_regular_grid.native_extension() @classmethod def load(cls, filename: str) -> GeodeLightRegularGrid2D: @@ -38,38 +38,34 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast_list_str(og.LightRegularGridInputFactory2D.list_creators()) + return og.LightRegularGridInputFactory2D.list_creators() @classmethod def output_extensions(cls) -> list[str]: - return cast_list_str(og.LightRegularGridOutputFactory2D.list_creators()) + return og.LightRegularGridOutputFactory2D.list_creators() @classmethod def object_priority(cls, filename: str) -> int: - return cast_int(og.light_regular_grid_object_priority2D(filename)) + return og.light_regular_grid_object_priority2D(filename) def is_saveable(self, filename: str) -> bool: - return cast_bool( - og.is_light_regular_grid_saveable2D(self.light_regular_grid, filename) + return og.is_light_regular_grid_saveable2D(self.light_regular_grid, filename ) def save(self, filename: str) -> list[str]: - return cast_list_str( - og.save_light_regular_grid2D(self.light_regular_grid, filename) + return og.save_light_regular_grid2D(self.light_regular_grid, filename ) def save_viewable(self, filename_without_extension: str) -> str: - return cast_str( - viewables.save_viewable_light_regular_grid2D( + return viewables.save_viewable_light_regular_grid2D( self.light_regular_grid, filename_without_extension - ), + , ) def save_light_viewable(self, filename_without_extension: str) -> str: - return cast_str( - viewables.save_light_viewable_light_regular_grid2D( + return viewables.save_light_viewable_light_regular_grid2D( self.light_regular_grid, filename_without_extension - ), + , ) def vertex_attribute_manager(self) -> og.AttributeManager: diff --git a/src/opengeodeweb_back/geode_objects/geode_light_regular_grid3d.py b/src/opengeodeweb_back/geode_objects/geode_light_regular_grid3d.py index 666e369d..3825af67 100644 --- a/src/opengeodeweb_back/geode_objects/geode_light_regular_grid3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_light_regular_grid3d.py @@ -6,7 +6,7 @@ import geode_viewables as viewables # Local application imports -from .types import GeodeMeshType, cast_str, cast_list_str, cast_int, cast_bool +from .types import GeodeMeshType from .geode_grid3d import GeodeGrid3D @@ -22,7 +22,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "LightRegularGrid3D" def native_extension(self) -> str: - return cast_str(self.light_regular_grid.native_extension()) + return self.light_regular_grid.native_extension() @classmethod def load(cls, filename: str) -> GeodeLightRegularGrid3D: @@ -38,38 +38,34 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast_list_str(og.LightRegularGridInputFactory3D.list_creators()) + return og.LightRegularGridInputFactory3D.list_creators() @classmethod def output_extensions(cls) -> list[str]: - return cast_list_str(og.LightRegularGridOutputFactory3D.list_creators()) + return og.LightRegularGridOutputFactory3D.list_creators() @classmethod def object_priority(cls, filename: str) -> int: - return cast_int(og.light_regular_grid_object_priority3D(filename)) + return og.light_regular_grid_object_priority3D(filename) def is_saveable(self, filename: str) -> bool: - return cast_bool( - og.is_light_regular_grid_saveable3D(self.light_regular_grid, filename) + return og.is_light_regular_grid_saveable3D(self.light_regular_grid, filename ) def save(self, filename: str) -> list[str]: - return cast_list_str( - og.save_light_regular_grid3D(self.light_regular_grid, filename) + return og.save_light_regular_grid3D(self.light_regular_grid, filename ) def save_viewable(self, filename_without_extension: str) -> str: - return cast_str( - viewables.save_viewable_light_regular_grid3D( + return viewables.save_viewable_light_regular_grid3D( self.light_regular_grid, filename_without_extension - ), + , ) def save_light_viewable(self, filename_without_extension: str) -> str: - return cast_str( - viewables.save_light_viewable_light_regular_grid3D( + return viewables.save_light_viewable_light_regular_grid3D( self.light_regular_grid, filename_without_extension - ), + , ) def vertex_attribute_manager(self) -> og.AttributeManager: diff --git a/src/opengeodeweb_back/geode_objects/geode_point_set2d.py b/src/opengeodeweb_back/geode_objects/geode_point_set2d.py index 5c5cf699..0b6d1263 100644 --- a/src/opengeodeweb_back/geode_objects/geode_point_set2d.py +++ b/src/opengeodeweb_back/geode_objects/geode_point_set2d.py @@ -8,7 +8,7 @@ import geode_viewables as viewables # Local application imports -from .types import GeodeMeshType, cast_str, cast_list_str, cast_int, cast_bool +from .types import GeodeMeshType from .geode_vertex_set import GeodeVertexSet @@ -24,7 +24,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "PointSet2D" def native_extension(self) -> str: - return cast_str(self.point_set.native_extension()) + return self.point_set.native_extension() @classmethod def is_3D(cls) -> bool: @@ -51,34 +51,32 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast_list_str(og.PointSetInputFactory2D.list_creators()) + return og.PointSetInputFactory2D.list_creators() @classmethod def output_extensions(cls) -> list[str]: - return cast_list_str(og.PointSetOutputFactory2D.list_creators()) + return og.PointSetOutputFactory2D.list_creators() @classmethod def object_priority(cls, filename: str) -> int: - return cast_int(og.point_set_object_priority2D(filename)) + return og.point_set_object_priority2D(filename) def is_saveable(self, filename: str) -> bool: - return cast_bool(og.is_point_set_saveable2D(self.point_set, filename)) + return og.is_point_set_saveable2D(self.point_set, filename) def save(self, filename: str) -> list[str]: - return cast_list_str(og.save_point_set2D(self.point_set, filename)) + return og.save_point_set2D(self.point_set, filename) def save_viewable(self, filename_without_extension: str) -> str: - return cast_str( - viewables.save_viewable_point_set2D( + return viewables.save_viewable_point_set2D( self.point_set, filename_without_extension - ), + , ) def save_light_viewable(self, filename_without_extension: str) -> str: - return cast_str( - viewables.save_light_viewable_point_set2D( + return viewables.save_light_viewable_point_set2D( self.point_set, filename_without_extension - ), + , ) def inspect(self) -> og_inspector.PointSetInspectionResult: diff --git a/src/opengeodeweb_back/geode_objects/geode_point_set3d.py b/src/opengeodeweb_back/geode_objects/geode_point_set3d.py index b25e9f3c..0be20e40 100644 --- a/src/opengeodeweb_back/geode_objects/geode_point_set3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_point_set3d.py @@ -8,7 +8,7 @@ import geode_viewables as viewables # Local application imports -from .types import GeodeMeshType, cast_str, cast_list_str, cast_int, cast_bool +from .types import GeodeMeshType from .geode_vertex_set import GeodeVertexSet @@ -24,7 +24,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "PointSet3D" def native_extension(self) -> str: - return cast_str(self.point_set.native_extension()) + return self.point_set.native_extension() @classmethod def is_3D(cls) -> bool: @@ -51,34 +51,32 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast_list_str(og.PointSetInputFactory3D.list_creators()) + return og.PointSetInputFactory3D.list_creators() @classmethod def output_extensions(cls) -> list[str]: - return cast_list_str(og.PointSetOutputFactory3D.list_creators()) + return og.PointSetOutputFactory3D.list_creators() @classmethod def object_priority(cls, filename: str) -> int: - return cast_int(og.point_set_object_priority3D(filename)) + return og.point_set_object_priority3D(filename) def is_saveable(self, filename: str) -> bool: - return cast_bool(og.is_point_set_saveable3D(self.point_set, filename)) + return og.is_point_set_saveable3D(self.point_set, filename) def save(self, filename: str) -> list[str]: - return cast_list_str(og.save_point_set3D(self.point_set, filename)) + return og.save_point_set3D(self.point_set, filename) def save_viewable(self, filename_without_extension: str) -> str: - return cast_str( - viewables.save_viewable_point_set3D( + return viewables.save_viewable_point_set3D( self.point_set, filename_without_extension - ), + , ) def save_light_viewable(self, filename_without_extension: str) -> str: - return cast_str( - viewables.save_light_viewable_point_set3D( + return viewables.save_light_viewable_point_set3D( self.point_set, filename_without_extension - ), + , ) def inspect(self) -> og_inspector.PointSetInspectionResult: diff --git a/src/opengeodeweb_back/geode_objects/geode_polygonal_surface2d.py b/src/opengeodeweb_back/geode_objects/geode_polygonal_surface2d.py index f21163cd..ddf7a38c 100644 --- a/src/opengeodeweb_back/geode_objects/geode_polygonal_surface2d.py +++ b/src/opengeodeweb_back/geode_objects/geode_polygonal_surface2d.py @@ -6,7 +6,7 @@ import geode_viewables as viewables # Local application imports -from .types import GeodeMeshType, cast_str, cast_list_str, cast_int, cast_bool +from .types import GeodeMeshType from .geode_surface_mesh2d import GeodeSurfaceMesh2D @@ -26,7 +26,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "PolygonalSurface2D" def native_extension(self) -> str: - return cast_str(self.polygonal_surface.native_extension()) + return self.polygonal_surface.native_extension() def builder(self) -> og.PolygonalSurfaceBuilder2D: return og.PolygonalSurfaceBuilder2D.create(self.polygonal_surface) @@ -45,36 +45,32 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast_list_str(og.PolygonalSurfaceInputFactory2D.list_creators()) + return og.PolygonalSurfaceInputFactory2D.list_creators() @classmethod def output_extensions(cls) -> list[str]: - return cast_list_str(og.PolygonalSurfaceOutputFactory2D.list_creators()) + return og.PolygonalSurfaceOutputFactory2D.list_creators() @classmethod def object_priority(cls, filename: str) -> int: - return cast_int(og.polygonal_surface_object_priority2D(filename)) + return og.polygonal_surface_object_priority2D(filename) def is_saveable(self, filename: str) -> bool: - return cast_bool( - og.is_polygonal_surface_saveable2D(self.polygonal_surface, filename) + return og.is_polygonal_surface_saveable2D(self.polygonal_surface, filename ) def save(self, filename: str) -> list[str]: - return cast_list_str( - og.save_polygonal_surface2D(self.polygonal_surface, filename) + return og.save_polygonal_surface2D(self.polygonal_surface, filename ) def save_viewable(self, filename_without_extension: str) -> str: - return cast_str( - viewables.save_viewable_polygonal_surface2D( + return viewables.save_viewable_polygonal_surface2D( self.polygonal_surface, filename_without_extension - ), + , ) def save_light_viewable(self, filename_without_extension: str) -> str: - return cast_str( - viewables.save_light_viewable_polygonal_surface2D( + return viewables.save_light_viewable_polygonal_surface2D( self.polygonal_surface, filename_without_extension - ), + , ) diff --git a/src/opengeodeweb_back/geode_objects/geode_polygonal_surface3d.py b/src/opengeodeweb_back/geode_objects/geode_polygonal_surface3d.py index a0175c0e..40f04f2d 100644 --- a/src/opengeodeweb_back/geode_objects/geode_polygonal_surface3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_polygonal_surface3d.py @@ -6,7 +6,7 @@ import geode_viewables as viewables # Local application imports -from .types import GeodeMeshType, cast_str, cast_list_str, cast_int, cast_bool +from .types import GeodeMeshType from .geode_surface_mesh3d import GeodeSurfaceMesh3D @@ -26,7 +26,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "PolygonalSurface3D" def native_extension(self) -> str: - return cast_str(self.polygonal_surface.native_extension()) + return self.polygonal_surface.native_extension() def builder(self) -> og.PolygonalSurfaceBuilder3D: return og.PolygonalSurfaceBuilder3D.create(self.polygonal_surface) @@ -45,36 +45,32 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast_list_str(og.PolygonalSurfaceInputFactory3D.list_creators()) + return og.PolygonalSurfaceInputFactory3D.list_creators() @classmethod def output_extensions(cls) -> list[str]: - return cast_list_str(og.PolygonalSurfaceOutputFactory3D.list_creators()) + return og.PolygonalSurfaceOutputFactory3D.list_creators() @classmethod def object_priority(cls, filename: str) -> int: - return cast_int(og.polygonal_surface_object_priority3D(filename)) + return og.polygonal_surface_object_priority3D(filename) def is_saveable(self, filename: str) -> bool: - return cast_bool( - og.is_polygonal_surface_saveable3D(self.polygonal_surface, filename) + return og.is_polygonal_surface_saveable3D(self.polygonal_surface, filename ) def save(self, filename: str) -> list[str]: - return cast_list_str( - og.save_polygonal_surface3D(self.polygonal_surface, filename) + return og.save_polygonal_surface3D(self.polygonal_surface, filename ) def save_viewable(self, filename_without_extension: str) -> str: - return cast_str( - viewables.save_viewable_polygonal_surface3D( + return viewables.save_viewable_polygonal_surface3D( self.polygonal_surface, filename_without_extension - ), + , ) def save_light_viewable(self, filename_without_extension: str) -> str: - return cast_str( - viewables.save_light_viewable_polygonal_surface3D( + return viewables.save_light_viewable_polygonal_surface3D( self.polygonal_surface, filename_without_extension - ), + , ) diff --git a/src/opengeodeweb_back/geode_objects/geode_polyhedral_solid3d.py b/src/opengeodeweb_back/geode_objects/geode_polyhedral_solid3d.py index 83f394d7..fd891fc2 100644 --- a/src/opengeodeweb_back/geode_objects/geode_polyhedral_solid3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_polyhedral_solid3d.py @@ -6,7 +6,7 @@ import geode_viewables as viewables # Local application imports -from .types import GeodeMeshType, cast_str, cast_list_str, cast_int, cast_bool +from .types import GeodeMeshType from .geode_solid_mesh3d import GeodeSolidMesh3D @@ -26,7 +26,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "PolyhedralSolid3D" def native_extension(self) -> str: - return cast_str(self.polyhedral_solid.native_extension()) + return self.polyhedral_solid.native_extension() def builder(self) -> og.PolyhedralSolidBuilder3D: return og.PolyhedralSolidBuilder3D.create(self.polyhedral_solid) @@ -45,36 +45,32 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast_list_str(og.PolyhedralSolidInputFactory3D.list_creators()) + return og.PolyhedralSolidInputFactory3D.list_creators() @classmethod def output_extensions(cls) -> list[str]: - return cast_list_str(og.PolyhedralSolidOutputFactory3D.list_creators()) + return og.PolyhedralSolidOutputFactory3D.list_creators() @classmethod def object_priority(cls, filename: str) -> int: - return cast_int(og.polyhedral_solid_object_priority3D(filename)) + return og.polyhedral_solid_object_priority3D(filename) def is_saveable(self, filename: str) -> bool: - return cast_bool( - og.is_polyhedral_solid_saveable3D(self.polyhedral_solid, filename) + return og.is_polyhedral_solid_saveable3D(self.polyhedral_solid, filename ) def save(self, filename: str) -> list[str]: - return cast_list_str( - og.save_polyhedral_solid3D(self.polyhedral_solid, filename) + return og.save_polyhedral_solid3D(self.polyhedral_solid, filename ) def save_viewable(self, filename_without_extension: str) -> str: - return cast_str( - viewables.save_viewable_polyhedral_solid3D( + return viewables.save_viewable_polyhedral_solid3D( self.polyhedral_solid, filename_without_extension - ), + , ) def save_light_viewable(self, filename_without_extension: str) -> str: - return cast_str( - viewables.save_light_viewable_polyhedral_solid3D( + return viewables.save_light_viewable_polyhedral_solid3D( self.polyhedral_solid, filename_without_extension - ), + , ) diff --git a/src/opengeodeweb_back/geode_objects/geode_raster_image2d.py b/src/opengeodeweb_back/geode_objects/geode_raster_image2d.py index ff51b18e..a7aae700 100644 --- a/src/opengeodeweb_back/geode_objects/geode_raster_image2d.py +++ b/src/opengeodeweb_back/geode_objects/geode_raster_image2d.py @@ -6,7 +6,7 @@ import geode_viewables as viewables # Local application imports -from .types import GeodeMeshType, cast_str, cast_list_str, cast_int, cast_bool +from .types import GeodeMeshType from .geode_mesh import GeodeMesh @@ -22,7 +22,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "RasterImage2D" def native_extension(self) -> str: - return cast_str(self.raster_image.native_extension()) + return self.raster_image.native_extension() @classmethod def is_3D(cls) -> bool: @@ -49,34 +49,32 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast_list_str(og.RasterImageInputFactory2D.list_creators()) + return og.RasterImageInputFactory2D.list_creators() @classmethod def output_extensions(cls) -> list[str]: - return cast_list_str(og.RasterImageOutputFactory2D.list_creators()) + return og.RasterImageOutputFactory2D.list_creators() @classmethod def object_priority(cls, filename: str) -> int: - return cast_int(og.raster_image_object_priority2D(filename)) + return og.raster_image_object_priority2D(filename) def is_saveable(self, filename: str) -> bool: - return cast_bool(og.is_raster_image_saveable2D(self.raster_image, filename)) + return og.is_raster_image_saveable2D(self.raster_image, filename) def save(self, filename: str) -> list[str]: - return cast_list_str(og.save_raster_image2D(self.raster_image, filename)) + return og.save_raster_image2D(self.raster_image, filename) def save_viewable(self, filename_without_extension: str) -> str: - return cast_str( - viewables.save_viewable_raster_image2D( + return viewables.save_viewable_raster_image2D( self.raster_image, filename_without_extension - ), + , ) def save_light_viewable(self, filename_without_extension: str) -> str: - return cast_str( - viewables.save_light_viewable_raster_image2D( + return viewables.save_light_viewable_raster_image2D( self.raster_image, filename_without_extension - ), + , ) def inspect(self) -> None: diff --git a/src/opengeodeweb_back/geode_objects/geode_raster_image3d.py b/src/opengeodeweb_back/geode_objects/geode_raster_image3d.py index 633610e2..06444bf7 100644 --- a/src/opengeodeweb_back/geode_objects/geode_raster_image3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_raster_image3d.py @@ -6,7 +6,7 @@ import geode_viewables as viewables # Local application imports -from .types import GeodeMeshType, cast_str, cast_list_str, cast_int, cast_bool +from .types import GeodeMeshType from .geode_mesh import GeodeMesh @@ -22,7 +22,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "RasterImage3D" def native_extension(self) -> str: - return cast_str(self.raster_image.native_extension()) + return self.raster_image.native_extension() @classmethod def is_3D(cls) -> bool: @@ -49,34 +49,32 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast_list_str(og.RasterImageInputFactory3D.list_creators()) + return og.RasterImageInputFactory3D.list_creators() @classmethod def output_extensions(cls) -> list[str]: - return cast_list_str(og.RasterImageOutputFactory3D.list_creators()) + return og.RasterImageOutputFactory3D.list_creators() @classmethod def object_priority(cls, filename: str) -> int: - return cast_int(og.raster_image_object_priority3D(filename)) + return og.raster_image_object_priority3D(filename) def is_saveable(self, filename: str) -> bool: - return cast_bool(og.is_raster_image_saveable3D(self.raster_image, filename)) + return og.is_raster_image_saveable3D(self.raster_image, filename) def save(self, filename: str) -> list[str]: - return cast_list_str(og.save_raster_image3D(self.raster_image, filename)) + return og.save_raster_image3D(self.raster_image, filename) def save_viewable(self, filename_without_extension: str) -> str: - return cast_str( - viewables.save_viewable_raster_image3D( + return viewables.save_viewable_raster_image3D( self.raster_image, filename_without_extension - ), + , ) def save_light_viewable(self, filename_without_extension: str) -> str: - return cast_str( - viewables.save_light_viewable_raster_image3D( + return viewables.save_light_viewable_raster_image3D( self.raster_image, filename_without_extension - ), + , ) def inspect(self) -> None: diff --git a/src/opengeodeweb_back/geode_objects/geode_regular_grid2d.py b/src/opengeodeweb_back/geode_objects/geode_regular_grid2d.py index 856ffd01..0580f0cc 100644 --- a/src/opengeodeweb_back/geode_objects/geode_regular_grid2d.py +++ b/src/opengeodeweb_back/geode_objects/geode_regular_grid2d.py @@ -7,7 +7,7 @@ import geode_viewables as viewables # Local application imports -from .types import GeodeMeshType, cast_str, cast_list_str, cast_int, cast_bool +from .types import GeodeMeshType from .geode_surface_mesh2d import GeodeSurfaceMesh2D from .geode_grid2d import GeodeGrid2D @@ -29,7 +29,7 @@ def inspect(self) -> og_inspector.SurfaceInspectionResult: return super().inspect() def native_extension(self) -> str: - return cast_str(self.regular_grid.native_extension()) + return self.regular_grid.native_extension() def builder(self) -> og.RegularGridBuilder2D: return og.RegularGridBuilder2D.create(self.regular_grid) @@ -48,34 +48,32 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast_list_str(og.RegularGridInputFactory2D.list_creators()) + return og.RegularGridInputFactory2D.list_creators() @classmethod def output_extensions(cls) -> list[str]: - return cast_list_str(og.RegularGridOutputFactory2D.list_creators()) + return og.RegularGridOutputFactory2D.list_creators() @classmethod def object_priority(cls, filename: str) -> int: - return cast_int(og.regular_grid_object_priority2D(filename)) + return og.regular_grid_object_priority2D(filename) def is_saveable(self, filename: str) -> bool: - return cast_bool(og.is_regular_grid_saveable2D(self.regular_grid, filename)) + return og.is_regular_grid_saveable2D(self.regular_grid, filename) def save(self, filename: str) -> list[str]: - return cast_list_str(og.save_regular_grid2D(self.regular_grid, filename)) + return og.save_regular_grid2D(self.regular_grid, filename) def save_viewable(self, filename_without_extension: str) -> str: - return cast_str( - viewables.save_viewable_regular_grid2D( + return viewables.save_viewable_regular_grid2D( self.regular_grid, filename_without_extension - ), + , ) def save_light_viewable(self, filename_without_extension: str) -> str: - return cast_str( - viewables.save_light_viewable_regular_grid2D( + return viewables.save_light_viewable_regular_grid2D( self.regular_grid, filename_without_extension - ), + , ) def cell_attribute_manager(self) -> og.AttributeManager: diff --git a/src/opengeodeweb_back/geode_objects/geode_regular_grid3d.py b/src/opengeodeweb_back/geode_objects/geode_regular_grid3d.py index 1317edc6..e2259b2b 100644 --- a/src/opengeodeweb_back/geode_objects/geode_regular_grid3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_regular_grid3d.py @@ -7,7 +7,7 @@ import geode_viewables as viewables # Local application imports -from .types import GeodeMeshType, cast_str, cast_list_str, cast_int, cast_bool +from .types import GeodeMeshType from .geode_solid_mesh3d import GeodeSolidMesh3D from .geode_grid3d import GeodeGrid3D @@ -26,7 +26,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "RegularGrid3D" def native_extension(self) -> str: - return cast_str(self.regular_grid.native_extension()) + return self.regular_grid.native_extension() def builder(self) -> og.RegularGridBuilder3D: return og.RegularGridBuilder3D.create(self.regular_grid) @@ -45,34 +45,32 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast_list_str(og.RegularGridInputFactory3D.list_creators()) + return og.RegularGridInputFactory3D.list_creators() @classmethod def output_extensions(cls) -> list[str]: - return cast_list_str(og.RegularGridOutputFactory3D.list_creators()) + return og.RegularGridOutputFactory3D.list_creators() @classmethod def object_priority(cls, filename: str) -> int: - return cast_int(og.regular_grid_object_priority3D(filename)) + return og.regular_grid_object_priority3D(filename) def is_saveable(self, filename: str) -> bool: - return cast_bool(og.is_regular_grid_saveable3D(self.regular_grid, filename)) + return og.is_regular_grid_saveable3D(self.regular_grid, filename) def save(self, filename: str) -> list[str]: - return cast_list_str(og.save_regular_grid3D(self.regular_grid, filename)) + return og.save_regular_grid3D(self.regular_grid, filename) def save_viewable(self, filename_without_extension: str) -> str: - return cast_str( - viewables.save_viewable_regular_grid3D( + return viewables.save_viewable_regular_grid3D( self.regular_grid, filename_without_extension - ), + , ) def save_light_viewable(self, filename_without_extension: str) -> str: - return cast_str( - viewables.save_light_viewable_regular_grid3D( + return viewables.save_light_viewable_regular_grid3D( self.regular_grid, filename_without_extension - ), + , ) def cell_attribute_manager(self) -> og.AttributeManager: diff --git a/src/opengeodeweb_back/geode_objects/geode_section.py b/src/opengeodeweb_back/geode_objects/geode_section.py index 812ce7f8..f5e8d4e6 100644 --- a/src/opengeodeweb_back/geode_objects/geode_section.py +++ b/src/opengeodeweb_back/geode_objects/geode_section.py @@ -9,7 +9,7 @@ import geode_viewables as viewables # Local application imports -from .types import GeodeModelType, cast_str, cast_list_str, cast_int, cast_bool +from .types import GeodeModelType from .geode_model import GeodeModel, ComponentRegistry @@ -25,7 +25,7 @@ def geode_object_type(cls) -> GeodeModelType: return "Section" def native_extension(self) -> str: - return cast_str(self.section.native_extension()) + return self.section.native_extension() @classmethod def is_3D(cls) -> bool: @@ -52,36 +52,36 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast_list_str(og.SectionInputFactory.list_creators()) + return og.SectionInputFactory.list_creators() @classmethod def output_extensions(cls) -> list[str]: - return cast_list_str(og.SectionOutputFactory.list_creators()) + return og.SectionOutputFactory.list_creators() @classmethod def object_priority(cls, filename: str) -> int: - return cast_int(og.section_object_priority(filename)) + return og.section_object_priority(filename) def is_saveable(self, filename: str) -> bool: - return cast_bool(og.is_section_saveable(self.section, filename)) + return og.is_section_saveable(self.section, filename) def save(self, filename: str) -> list[str]: - return cast_list_str(og.save_section(self.section, filename)) + return og.save_section(self.section, filename) def save_viewable(self, filename_without_extension: str) -> str: - return cast_str( - viewables.save_viewable_section(self.section, filename_without_extension), + return viewables.save_viewable_section( + self.section, + filename_without_extension, ) def save_light_viewable(self, filename_without_extension: str) -> str: - return cast_str( - viewables.save_light_viewable_section( - self.section, filename_without_extension - ), + return viewables.save_light_viewable_section( + self.section, + filename_without_extension, ) def mesh_components(self) -> ComponentRegistry: - return cast(ComponentRegistry, self.section.mesh_components()) + return self.section.mesh_components() def inspect(self) -> og_inspector.SectionInspectionResult: return og_inspector.inspect_section(self.section) diff --git a/src/opengeodeweb_back/geode_objects/geode_structural_model.py b/src/opengeodeweb_back/geode_objects/geode_structural_model.py index ecc2a559..0f6c0e6e 100644 --- a/src/opengeodeweb_back/geode_objects/geode_structural_model.py +++ b/src/opengeodeweb_back/geode_objects/geode_structural_model.py @@ -7,7 +7,7 @@ import geode_viewables as viewables # Local application imports -from .types import GeodeModelType, cast_str, cast_list_str, cast_int, cast_bool +from .types import GeodeModelType from .geode_brep import GeodeBRep @@ -29,7 +29,7 @@ def geode_object_type(cls) -> GeodeModelType: return "StructuralModel" def native_extension(self) -> str: - return cast_str(self.structural_model.native_extension()) + return self.structural_model.native_extension() def builder(self) -> og_geosciences.StructuralModelBuilder: return og_geosciences.StructuralModelBuilder(self.structural_model) @@ -48,40 +48,34 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast_list_str(og_geosciences.StructuralModelInputFactory.list_creators()) + return og_geosciences.StructuralModelInputFactory.list_creators() @classmethod def output_extensions(cls) -> list[str]: - return cast_list_str( - og_geosciences.StructuralModelOutputFactory.list_creators() - ) + return og_geosciences.StructuralModelOutputFactory.list_creators() @classmethod def object_priority(cls, filename: str) -> int: - return cast_int(og_geosciences.structural_model_object_priority(filename)) + return og_geosciences.structural_model_object_priority(filename) def is_saveable(self, filename: str) -> bool: - return cast_bool( - og_geosciences.is_structural_model_saveable( + return og_geosciences.is_structural_model_saveable( self.structural_model, filename - ), + , ) def save(self, filename: str) -> list[str]: - return cast_list_str( - og_geosciences.save_structural_model(self.structural_model, filename) + return og_geosciences.save_structural_model(self.structural_model, filename ) def save_viewable(self, filename_without_extension: str) -> str: - return cast_str( - viewables.save_viewable_structural_model( + return viewables.save_viewable_structural_model( self.structural_model, filename_without_extension - ), + , ) def save_light_viewable(self, filename_without_extension: str) -> str: - return cast_str( - viewables.save_light_viewable_structural_model( + return viewables.save_light_viewable_structural_model( self.structural_model, filename_without_extension - ), + , ) diff --git a/src/opengeodeweb_back/geode_objects/geode_tetrahedral_solid3d.py b/src/opengeodeweb_back/geode_objects/geode_tetrahedral_solid3d.py index 60f35d75..731ae392 100644 --- a/src/opengeodeweb_back/geode_objects/geode_tetrahedral_solid3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_tetrahedral_solid3d.py @@ -6,7 +6,7 @@ import geode_viewables as viewables # Local application imports -from .types import GeodeMeshType, cast_str, cast_list_str, cast_int, cast_bool +from .types import GeodeMeshType from .geode_solid_mesh3d import GeodeSolidMesh3D @@ -26,7 +26,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "TetrahedralSolid3D" def native_extension(self) -> str: - return cast_str(self.tetrahedral_solid.native_extension()) + return self.tetrahedral_solid.native_extension() def builder(self) -> og.TetrahedralSolidBuilder3D: return og.TetrahedralSolidBuilder3D.create(self.tetrahedral_solid) @@ -45,36 +45,32 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast_list_str(og.TetrahedralSolidInputFactory3D.list_creators()) + return og.TetrahedralSolidInputFactory3D.list_creators() @classmethod def output_extensions(cls) -> list[str]: - return cast_list_str(og.TetrahedralSolidOutputFactory3D.list_creators()) + return og.TetrahedralSolidOutputFactory3D.list_creators() @classmethod def object_priority(cls, filename: str) -> int: - return cast_int(og.tetrahedral_solid_object_priority3D(filename)) + return og.tetrahedral_solid_object_priority3D(filename) def is_saveable(self, filename: str) -> bool: - return cast_bool( - og.is_tetrahedral_solid_saveable3D(self.tetrahedral_solid, filename) + return og.is_tetrahedral_solid_saveable3D(self.tetrahedral_solid, filename ) def save(self, filename: str) -> list[str]: - return cast_list_str( - og.save_tetrahedral_solid3D(self.tetrahedral_solid, filename) + return og.save_tetrahedral_solid3D(self.tetrahedral_solid, filename ) def save_viewable(self, filename_without_extension: str) -> str: - return cast_str( - viewables.save_viewable_tetrahedral_solid3D( + return viewables.save_viewable_tetrahedral_solid3D( self.tetrahedral_solid, filename_without_extension - ), + , ) def save_light_viewable(self, filename_without_extension: str) -> str: - return cast_str( - viewables.save_light_viewable_tetrahedral_solid3D( + return viewables.save_light_viewable_tetrahedral_solid3D( self.tetrahedral_solid, filename_without_extension - ), + , ) diff --git a/src/opengeodeweb_back/geode_objects/geode_triangulated_surface2d.py b/src/opengeodeweb_back/geode_objects/geode_triangulated_surface2d.py index 98abdb40..c087613f 100644 --- a/src/opengeodeweb_back/geode_objects/geode_triangulated_surface2d.py +++ b/src/opengeodeweb_back/geode_objects/geode_triangulated_surface2d.py @@ -6,7 +6,7 @@ import geode_viewables as viewables # Local application imports -from .types import GeodeMeshType, cast_str, cast_list_str, cast_int, cast_bool +from .types import GeodeMeshType from .geode_surface_mesh2d import GeodeSurfaceMesh2D @@ -28,7 +28,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "TriangulatedSurface2D" def native_extension(self) -> str: - return cast_str(self.triangulated_surface.native_extension()) + return self.triangulated_surface.native_extension() def builder(self) -> og.TriangulatedSurfaceBuilder2D: return og.TriangulatedSurfaceBuilder2D.create(self.triangulated_surface) @@ -47,36 +47,32 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast_list_str(og.TriangulatedSurfaceInputFactory2D.list_creators()) + return og.TriangulatedSurfaceInputFactory2D.list_creators() @classmethod def output_extensions(cls) -> list[str]: - return cast_list_str(og.TriangulatedSurfaceOutputFactory2D.list_creators()) + return og.TriangulatedSurfaceOutputFactory2D.list_creators() @classmethod def object_priority(cls, filename: str) -> int: - return cast_int(og.triangulated_surface_object_priority2D(filename)) + return og.triangulated_surface_object_priority2D(filename) def is_saveable(self, filename: str) -> bool: - return cast_bool( - og.is_triangulated_surface_saveable2D(self.triangulated_surface, filename), + return og.is_triangulated_surface_saveable2D(self.triangulated_surface, filename, ) def save(self, filename: str) -> list[str]: - return cast_list_str( - og.save_triangulated_surface2D(self.triangulated_surface, filename), + return og.save_triangulated_surface2D(self.triangulated_surface, filename, ) def save_viewable(self, filename_without_extension: str) -> str: - return cast_str( - viewables.save_viewable_triangulated_surface2D( + return viewables.save_viewable_triangulated_surface2D( self.triangulated_surface, filename_without_extension - ), + , ) def save_light_viewable(self, filename_without_extension: str) -> str: - return cast_str( - viewables.save_light_viewable_triangulated_surface2D( + return viewables.save_light_viewable_triangulated_surface2D( self.triangulated_surface, filename_without_extension - ), + , ) diff --git a/src/opengeodeweb_back/geode_objects/geode_triangulated_surface3d.py b/src/opengeodeweb_back/geode_objects/geode_triangulated_surface3d.py index 1b9a76cf..ed25a1da 100644 --- a/src/opengeodeweb_back/geode_objects/geode_triangulated_surface3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_triangulated_surface3d.py @@ -6,7 +6,7 @@ import geode_viewables as viewables # Local application imports -from .types import GeodeMeshType, cast_str, cast_list_str, cast_int, cast_bool +from .types import GeodeMeshType from .geode_surface_mesh3d import GeodeSurfaceMesh3D @@ -28,7 +28,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "TriangulatedSurface3D" def native_extension(self) -> str: - return cast_str(self.triangulated_surface.native_extension()) + return self.triangulated_surface.native_extension() def builder(self) -> og.TriangulatedSurfaceBuilder3D: return og.TriangulatedSurfaceBuilder3D.create(self.triangulated_surface) @@ -47,36 +47,32 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast_list_str(og.TriangulatedSurfaceInputFactory3D.list_creators()) + return og.TriangulatedSurfaceInputFactory3D.list_creators() @classmethod def output_extensions(cls) -> list[str]: - return cast_list_str(og.TriangulatedSurfaceOutputFactory3D.list_creators()) + return og.TriangulatedSurfaceOutputFactory3D.list_creators() @classmethod def object_priority(cls, filename: str) -> int: - return cast_int(og.triangulated_surface_object_priority3D(filename)) + return og.triangulated_surface_object_priority3D(filename) def is_saveable(self, filename: str) -> bool: - return cast_bool( - og.is_triangulated_surface_saveable3D(self.triangulated_surface, filename), + return og.is_triangulated_surface_saveable3D(self.triangulated_surface, filename, ) def save(self, filename: str) -> list[str]: - return cast_list_str( - og.save_triangulated_surface3D(self.triangulated_surface, filename), + return og.save_triangulated_surface3D(self.triangulated_surface, filename, ) def save_viewable(self, filename_without_extension: str) -> str: - return cast_str( - viewables.save_viewable_triangulated_surface3D( + return viewables.save_viewable_triangulated_surface3D( self.triangulated_surface, filename_without_extension - ), + , ) def save_light_viewable(self, filename_without_extension: str) -> str: - return cast_str( - viewables.save_light_viewable_triangulated_surface3D( + return viewables.save_light_viewable_triangulated_surface3D( self.triangulated_surface, filename_without_extension - ), + , ) diff --git a/src/opengeodeweb_back/geode_objects/geode_vertex_set.py b/src/opengeodeweb_back/geode_objects/geode_vertex_set.py index fbf0869e..98d623ac 100644 --- a/src/opengeodeweb_back/geode_objects/geode_vertex_set.py +++ b/src/opengeodeweb_back/geode_objects/geode_vertex_set.py @@ -5,7 +5,7 @@ import opengeode as og # Local application imports -from .types import GeodeMeshType, cast_str, cast_list_str, cast_int, cast_bool +from .types import GeodeMeshType from .geode_mesh import GeodeMesh @@ -23,7 +23,7 @@ def geode_object_type(cls) -> GeodeMeshType: return "VertexSet" def native_extension(self) -> str: - return cast_str(self.vertex_set.native_extension()) + return self.vertex_set.native_extension() @classmethod def is_3D(cls) -> bool: @@ -50,21 +50,21 @@ def is_loadable(cls, filename: str) -> og.Percentage: @classmethod def input_extensions(cls) -> list[str]: - return cast_list_str(og.VertexSetInputFactory.list_creators()) + return og.VertexSetInputFactory.list_creators() @classmethod def output_extensions(cls) -> list[str]: - return cast_list_str(og.VertexSetOutputFactory.list_creators()) + return og.VertexSetOutputFactory.list_creators() @classmethod def object_priority(cls, filename: str) -> int: - return cast_int(og.vertex_set_object_priority(filename)) + return og.vertex_set_object_priority(filename) def is_saveable(self, filename: str) -> bool: - return cast_bool(og.is_vertex_set_saveable(self.vertex_set, filename)) + return og.is_vertex_set_saveable(self.vertex_set, filename) def save(self, filename: str) -> list[str]: - return cast_list_str(og.save_vertex_set(self.vertex_set, filename)) + return og.save_vertex_set(self.vertex_set, filename) def save_viewable(self, filename_without_extension: str) -> str: return "" diff --git a/src/opengeodeweb_back/geode_objects/types.py b/src/opengeodeweb_back/geode_objects/types.py index e726e7c2..57fbccf6 100644 --- a/src/opengeodeweb_back/geode_objects/types.py +++ b/src/opengeodeweb_back/geode_objects/types.py @@ -73,46 +73,3 @@ def geode_object_type(value: str) -> GeodeObjectType: ViewerType = Literal["mesh", "model"] - -# Type casting helpers for OpenGeode C++ bindings -# OpenGeode functions return 'Any' due to missing type stubs, - - -def cast_str(value: object) -> str: - """ - Args: - value: Return value from OpenGeode binding (typed as Any) - Returns: - The value cast to str for type checking purposes - """ - return cast(str, value) - - -def cast_list_str(value: object) -> list[str]: - """ - Args: - value: Return value from OpenGeode binding (typed as Any) - Returns: - The value cast to list[str] for type checking purposes - """ - return cast(list[str], value) - - -def cast_int(value: object) -> int: - """ - Args: - value: Return value from OpenGeode binding (typed as Any) - Returns: - The value cast to int for type checking purposes - """ - return cast(int, value) - - -def cast_bool(value: object) -> bool: - """ - Args: - value: Return value from OpenGeode binding (typed as Any) - Returns: - The value cast to bool for type checking purposes - """ - return cast(bool, value) diff --git a/src/opengeodeweb_back/routes/blueprint_routes.py b/src/opengeodeweb_back/routes/blueprint_routes.py index 6d6c06d9..e56e68d6 100644 --- a/src/opengeodeweb_back/routes/blueprint_routes.py +++ b/src/opengeodeweb_back/routes/blueprint_routes.py @@ -64,6 +64,8 @@ def upload_file() -> flask.Response: os.makedirs(UPLOAD_FOLDER, exist_ok=True) file = flask.request.files["file"] + if file.filename is None: + flask.abort(400, "Filename is required") filename = werkzeug.utils.secure_filename(os.path.basename(file.filename)) file.save(os.path.join(UPLOAD_FOLDER, filename)) return flask.make_response({"message": "File uploaded"}, 201) diff --git a/src/opengeodeweb_back/routes/create/blueprint_create.py b/src/opengeodeweb_back/routes/create/blueprint_create.py index 74cebb0a..b788f261 100644 --- a/src/opengeodeweb_back/routes/create/blueprint_create.py +++ b/src/opengeodeweb_back/routes/create/blueprint_create.py @@ -90,7 +90,7 @@ def create_voi() -> flask.Response: if not isinstance(aoi_object, GeodeEdgedCurve3D): flask.abort(400, f"AOI with id {params.aoi_id} is not a GeodeEdgedCurve3D") - aoi_curve = aoi_object.edged_curve # type: ignore[attr-defined] + aoi_curve = aoi_object.edged_curve nb_points = aoi_curve.nb_vertices() edged_curve = GeodeEdgedCurve3D() From be27ff226de8378b9f9705a9a63e9c87db03e1e1 Mon Sep 17 00:00:00 2001 From: MaxNumerique <144453705+MaxNumerique@users.noreply.github.com> Date: Mon, 5 Jan 2026 15:40:59 +0000 Subject: [PATCH 06/12] Apply prepare changes --- .../geode_objects/geode_edged_curve2d.py | 8 ++++---- .../geode_objects/geode_edged_curve3d.py | 8 ++++---- .../geode_objects/geode_hybrid_solid3d.py | 8 ++++---- .../geode_implicit_cross_section.py | 16 ++++++++-------- .../geode_objects/geode_light_regular_grid2d.py | 14 ++++++-------- .../geode_objects/geode_light_regular_grid3d.py | 14 ++++++-------- .../geode_objects/geode_point_set2d.py | 8 ++++---- .../geode_objects/geode_point_set3d.py | 8 ++++---- .../geode_objects/geode_polygonal_surface2d.py | 14 ++++++-------- .../geode_objects/geode_polygonal_surface3d.py | 14 ++++++-------- .../geode_objects/geode_polyhedral_solid3d.py | 14 ++++++-------- .../geode_objects/geode_raster_image2d.py | 8 ++++---- .../geode_objects/geode_raster_image3d.py | 8 ++++---- .../geode_objects/geode_regular_grid2d.py | 8 ++++---- .../geode_objects/geode_regular_grid3d.py | 8 ++++---- .../geode_objects/geode_structural_model.py | 15 +++++++-------- .../geode_objects/geode_tetrahedral_solid3d.py | 14 ++++++-------- .../geode_triangulated_surface2d.py | 16 ++++++++++------ .../geode_triangulated_surface3d.py | 16 ++++++++++------ 19 files changed, 107 insertions(+), 112 deletions(-) diff --git a/src/opengeodeweb_back/geode_objects/geode_edged_curve2d.py b/src/opengeodeweb_back/geode_objects/geode_edged_curve2d.py index a08552e8..e50aa671 100644 --- a/src/opengeodeweb_back/geode_objects/geode_edged_curve2d.py +++ b/src/opengeodeweb_back/geode_objects/geode_edged_curve2d.py @@ -71,14 +71,14 @@ def save(self, filename: str) -> list[str]: def save_viewable(self, filename_without_extension: str) -> str: return viewables.save_viewable_edged_curve2D( - self.edged_curve, filename_without_extension - , + self.edged_curve, + filename_without_extension, ) def save_light_viewable(self, filename_without_extension: str) -> str: return viewables.save_light_viewable_edged_curve2D( - self.edged_curve, filename_without_extension - , + self.edged_curve, + filename_without_extension, ) def inspect(self) -> og_inspector.EdgedCurveInspectionResult: diff --git a/src/opengeodeweb_back/geode_objects/geode_edged_curve3d.py b/src/opengeodeweb_back/geode_objects/geode_edged_curve3d.py index 44bf356f..7817d679 100644 --- a/src/opengeodeweb_back/geode_objects/geode_edged_curve3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_edged_curve3d.py @@ -71,14 +71,14 @@ def save(self, filename: str) -> list[str]: def save_viewable(self, filename_without_extension: str) -> str: return viewables.save_viewable_edged_curve3D( - self.edged_curve, filename_without_extension - , + self.edged_curve, + filename_without_extension, ) def save_light_viewable(self, filename_without_extension: str) -> str: return viewables.save_light_viewable_edged_curve3D( - self.edged_curve, filename_without_extension - , + self.edged_curve, + filename_without_extension, ) def inspect(self) -> og_inspector.EdgedCurveInspectionResult: diff --git a/src/opengeodeweb_back/geode_objects/geode_hybrid_solid3d.py b/src/opengeodeweb_back/geode_objects/geode_hybrid_solid3d.py index 50186ec6..11173495 100644 --- a/src/opengeodeweb_back/geode_objects/geode_hybrid_solid3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_hybrid_solid3d.py @@ -61,12 +61,12 @@ def save(self, filename: str) -> list[str]: def save_viewable(self, filename_without_extension: str) -> str: return viewables.save_viewable_hybrid_solid3D( - self.hybrid_solid, filename_without_extension - , + self.hybrid_solid, + filename_without_extension, ) def save_light_viewable(self, filename_without_extension: str) -> str: return viewables.save_light_viewable_hybrid_solid3D( - self.hybrid_solid, filename_without_extension - , + self.hybrid_solid, + filename_without_extension, ) diff --git a/src/opengeodeweb_back/geode_objects/geode_implicit_cross_section.py b/src/opengeodeweb_back/geode_objects/geode_implicit_cross_section.py index b7815637..3820e262 100644 --- a/src/opengeodeweb_back/geode_objects/geode_implicit_cross_section.py +++ b/src/opengeodeweb_back/geode_objects/geode_implicit_cross_section.py @@ -62,24 +62,24 @@ def object_priority(cls, filename: str) -> int: def is_saveable(self, filename: str) -> bool: return og_geosciences.is_implicit_cross_section_saveable( - self.implicit_cross_section, filename - , + self.implicit_cross_section, + filename, ) def save(self, filename: str) -> list[str]: return og_geosciences.save_implicit_cross_section( - self.implicit_cross_section, filename - , + self.implicit_cross_section, + filename, ) def save_viewable(self, filename_without_extension: str) -> str: return viewables.save_viewable_implicit_cross_section( - self.implicit_cross_section, filename_without_extension - , + self.implicit_cross_section, + filename_without_extension, ) def save_light_viewable(self, filename_without_extension: str) -> str: return viewables.save_light_viewable_implicit_cross_section( - self.implicit_cross_section, filename_without_extension - , + self.implicit_cross_section, + filename_without_extension, ) diff --git a/src/opengeodeweb_back/geode_objects/geode_light_regular_grid2d.py b/src/opengeodeweb_back/geode_objects/geode_light_regular_grid2d.py index 290f5093..3732b6be 100644 --- a/src/opengeodeweb_back/geode_objects/geode_light_regular_grid2d.py +++ b/src/opengeodeweb_back/geode_objects/geode_light_regular_grid2d.py @@ -49,23 +49,21 @@ def object_priority(cls, filename: str) -> int: return og.light_regular_grid_object_priority2D(filename) def is_saveable(self, filename: str) -> bool: - return og.is_light_regular_grid_saveable2D(self.light_regular_grid, filename - ) + return og.is_light_regular_grid_saveable2D(self.light_regular_grid, filename) def save(self, filename: str) -> list[str]: - return og.save_light_regular_grid2D(self.light_regular_grid, filename - ) + return og.save_light_regular_grid2D(self.light_regular_grid, filename) def save_viewable(self, filename_without_extension: str) -> str: return viewables.save_viewable_light_regular_grid2D( - self.light_regular_grid, filename_without_extension - , + self.light_regular_grid, + filename_without_extension, ) def save_light_viewable(self, filename_without_extension: str) -> str: return viewables.save_light_viewable_light_regular_grid2D( - self.light_regular_grid, filename_without_extension - , + self.light_regular_grid, + filename_without_extension, ) def vertex_attribute_manager(self) -> og.AttributeManager: diff --git a/src/opengeodeweb_back/geode_objects/geode_light_regular_grid3d.py b/src/opengeodeweb_back/geode_objects/geode_light_regular_grid3d.py index 3825af67..dba35bf1 100644 --- a/src/opengeodeweb_back/geode_objects/geode_light_regular_grid3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_light_regular_grid3d.py @@ -49,23 +49,21 @@ def object_priority(cls, filename: str) -> int: return og.light_regular_grid_object_priority3D(filename) def is_saveable(self, filename: str) -> bool: - return og.is_light_regular_grid_saveable3D(self.light_regular_grid, filename - ) + return og.is_light_regular_grid_saveable3D(self.light_regular_grid, filename) def save(self, filename: str) -> list[str]: - return og.save_light_regular_grid3D(self.light_regular_grid, filename - ) + return og.save_light_regular_grid3D(self.light_regular_grid, filename) def save_viewable(self, filename_without_extension: str) -> str: return viewables.save_viewable_light_regular_grid3D( - self.light_regular_grid, filename_without_extension - , + self.light_regular_grid, + filename_without_extension, ) def save_light_viewable(self, filename_without_extension: str) -> str: return viewables.save_light_viewable_light_regular_grid3D( - self.light_regular_grid, filename_without_extension - , + self.light_regular_grid, + filename_without_extension, ) def vertex_attribute_manager(self) -> og.AttributeManager: diff --git a/src/opengeodeweb_back/geode_objects/geode_point_set2d.py b/src/opengeodeweb_back/geode_objects/geode_point_set2d.py index 0b6d1263..56941e89 100644 --- a/src/opengeodeweb_back/geode_objects/geode_point_set2d.py +++ b/src/opengeodeweb_back/geode_objects/geode_point_set2d.py @@ -69,14 +69,14 @@ def save(self, filename: str) -> list[str]: def save_viewable(self, filename_without_extension: str) -> str: return viewables.save_viewable_point_set2D( - self.point_set, filename_without_extension - , + self.point_set, + filename_without_extension, ) def save_light_viewable(self, filename_without_extension: str) -> str: return viewables.save_light_viewable_point_set2D( - self.point_set, filename_without_extension - , + self.point_set, + filename_without_extension, ) def inspect(self) -> og_inspector.PointSetInspectionResult: diff --git a/src/opengeodeweb_back/geode_objects/geode_point_set3d.py b/src/opengeodeweb_back/geode_objects/geode_point_set3d.py index 0be20e40..feccc94c 100644 --- a/src/opengeodeweb_back/geode_objects/geode_point_set3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_point_set3d.py @@ -69,14 +69,14 @@ def save(self, filename: str) -> list[str]: def save_viewable(self, filename_without_extension: str) -> str: return viewables.save_viewable_point_set3D( - self.point_set, filename_without_extension - , + self.point_set, + filename_without_extension, ) def save_light_viewable(self, filename_without_extension: str) -> str: return viewables.save_light_viewable_point_set3D( - self.point_set, filename_without_extension - , + self.point_set, + filename_without_extension, ) def inspect(self) -> og_inspector.PointSetInspectionResult: diff --git a/src/opengeodeweb_back/geode_objects/geode_polygonal_surface2d.py b/src/opengeodeweb_back/geode_objects/geode_polygonal_surface2d.py index ddf7a38c..df89a257 100644 --- a/src/opengeodeweb_back/geode_objects/geode_polygonal_surface2d.py +++ b/src/opengeodeweb_back/geode_objects/geode_polygonal_surface2d.py @@ -56,21 +56,19 @@ def object_priority(cls, filename: str) -> int: return og.polygonal_surface_object_priority2D(filename) def is_saveable(self, filename: str) -> bool: - return og.is_polygonal_surface_saveable2D(self.polygonal_surface, filename - ) + return og.is_polygonal_surface_saveable2D(self.polygonal_surface, filename) def save(self, filename: str) -> list[str]: - return og.save_polygonal_surface2D(self.polygonal_surface, filename - ) + return og.save_polygonal_surface2D(self.polygonal_surface, filename) def save_viewable(self, filename_without_extension: str) -> str: return viewables.save_viewable_polygonal_surface2D( - self.polygonal_surface, filename_without_extension - , + self.polygonal_surface, + filename_without_extension, ) def save_light_viewable(self, filename_without_extension: str) -> str: return viewables.save_light_viewable_polygonal_surface2D( - self.polygonal_surface, filename_without_extension - , + self.polygonal_surface, + filename_without_extension, ) diff --git a/src/opengeodeweb_back/geode_objects/geode_polygonal_surface3d.py b/src/opengeodeweb_back/geode_objects/geode_polygonal_surface3d.py index 40f04f2d..9b9a5828 100644 --- a/src/opengeodeweb_back/geode_objects/geode_polygonal_surface3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_polygonal_surface3d.py @@ -56,21 +56,19 @@ def object_priority(cls, filename: str) -> int: return og.polygonal_surface_object_priority3D(filename) def is_saveable(self, filename: str) -> bool: - return og.is_polygonal_surface_saveable3D(self.polygonal_surface, filename - ) + return og.is_polygonal_surface_saveable3D(self.polygonal_surface, filename) def save(self, filename: str) -> list[str]: - return og.save_polygonal_surface3D(self.polygonal_surface, filename - ) + return og.save_polygonal_surface3D(self.polygonal_surface, filename) def save_viewable(self, filename_without_extension: str) -> str: return viewables.save_viewable_polygonal_surface3D( - self.polygonal_surface, filename_without_extension - , + self.polygonal_surface, + filename_without_extension, ) def save_light_viewable(self, filename_without_extension: str) -> str: return viewables.save_light_viewable_polygonal_surface3D( - self.polygonal_surface, filename_without_extension - , + self.polygonal_surface, + filename_without_extension, ) diff --git a/src/opengeodeweb_back/geode_objects/geode_polyhedral_solid3d.py b/src/opengeodeweb_back/geode_objects/geode_polyhedral_solid3d.py index fd891fc2..2017043f 100644 --- a/src/opengeodeweb_back/geode_objects/geode_polyhedral_solid3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_polyhedral_solid3d.py @@ -56,21 +56,19 @@ def object_priority(cls, filename: str) -> int: return og.polyhedral_solid_object_priority3D(filename) def is_saveable(self, filename: str) -> bool: - return og.is_polyhedral_solid_saveable3D(self.polyhedral_solid, filename - ) + return og.is_polyhedral_solid_saveable3D(self.polyhedral_solid, filename) def save(self, filename: str) -> list[str]: - return og.save_polyhedral_solid3D(self.polyhedral_solid, filename - ) + return og.save_polyhedral_solid3D(self.polyhedral_solid, filename) def save_viewable(self, filename_without_extension: str) -> str: return viewables.save_viewable_polyhedral_solid3D( - self.polyhedral_solid, filename_without_extension - , + self.polyhedral_solid, + filename_without_extension, ) def save_light_viewable(self, filename_without_extension: str) -> str: return viewables.save_light_viewable_polyhedral_solid3D( - self.polyhedral_solid, filename_without_extension - , + self.polyhedral_solid, + filename_without_extension, ) diff --git a/src/opengeodeweb_back/geode_objects/geode_raster_image2d.py b/src/opengeodeweb_back/geode_objects/geode_raster_image2d.py index a7aae700..74832eb8 100644 --- a/src/opengeodeweb_back/geode_objects/geode_raster_image2d.py +++ b/src/opengeodeweb_back/geode_objects/geode_raster_image2d.py @@ -67,14 +67,14 @@ def save(self, filename: str) -> list[str]: def save_viewable(self, filename_without_extension: str) -> str: return viewables.save_viewable_raster_image2D( - self.raster_image, filename_without_extension - , + self.raster_image, + filename_without_extension, ) def save_light_viewable(self, filename_without_extension: str) -> str: return viewables.save_light_viewable_raster_image2D( - self.raster_image, filename_without_extension - , + self.raster_image, + filename_without_extension, ) def inspect(self) -> None: diff --git a/src/opengeodeweb_back/geode_objects/geode_raster_image3d.py b/src/opengeodeweb_back/geode_objects/geode_raster_image3d.py index 06444bf7..80cbb7aa 100644 --- a/src/opengeodeweb_back/geode_objects/geode_raster_image3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_raster_image3d.py @@ -67,14 +67,14 @@ def save(self, filename: str) -> list[str]: def save_viewable(self, filename_without_extension: str) -> str: return viewables.save_viewable_raster_image3D( - self.raster_image, filename_without_extension - , + self.raster_image, + filename_without_extension, ) def save_light_viewable(self, filename_without_extension: str) -> str: return viewables.save_light_viewable_raster_image3D( - self.raster_image, filename_without_extension - , + self.raster_image, + filename_without_extension, ) def inspect(self) -> None: diff --git a/src/opengeodeweb_back/geode_objects/geode_regular_grid2d.py b/src/opengeodeweb_back/geode_objects/geode_regular_grid2d.py index 0580f0cc..de1f1038 100644 --- a/src/opengeodeweb_back/geode_objects/geode_regular_grid2d.py +++ b/src/opengeodeweb_back/geode_objects/geode_regular_grid2d.py @@ -66,14 +66,14 @@ def save(self, filename: str) -> list[str]: def save_viewable(self, filename_without_extension: str) -> str: return viewables.save_viewable_regular_grid2D( - self.regular_grid, filename_without_extension - , + self.regular_grid, + filename_without_extension, ) def save_light_viewable(self, filename_without_extension: str) -> str: return viewables.save_light_viewable_regular_grid2D( - self.regular_grid, filename_without_extension - , + self.regular_grid, + filename_without_extension, ) def cell_attribute_manager(self) -> og.AttributeManager: diff --git a/src/opengeodeweb_back/geode_objects/geode_regular_grid3d.py b/src/opengeodeweb_back/geode_objects/geode_regular_grid3d.py index e2259b2b..3357d1bd 100644 --- a/src/opengeodeweb_back/geode_objects/geode_regular_grid3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_regular_grid3d.py @@ -63,14 +63,14 @@ def save(self, filename: str) -> list[str]: def save_viewable(self, filename_without_extension: str) -> str: return viewables.save_viewable_regular_grid3D( - self.regular_grid, filename_without_extension - , + self.regular_grid, + filename_without_extension, ) def save_light_viewable(self, filename_without_extension: str) -> str: return viewables.save_light_viewable_regular_grid3D( - self.regular_grid, filename_without_extension - , + self.regular_grid, + filename_without_extension, ) def cell_attribute_manager(self) -> og.AttributeManager: diff --git a/src/opengeodeweb_back/geode_objects/geode_structural_model.py b/src/opengeodeweb_back/geode_objects/geode_structural_model.py index 0f6c0e6e..cf9a45fb 100644 --- a/src/opengeodeweb_back/geode_objects/geode_structural_model.py +++ b/src/opengeodeweb_back/geode_objects/geode_structural_model.py @@ -60,22 +60,21 @@ def object_priority(cls, filename: str) -> int: def is_saveable(self, filename: str) -> bool: return og_geosciences.is_structural_model_saveable( - self.structural_model, filename - , + self.structural_model, + filename, ) def save(self, filename: str) -> list[str]: - return og_geosciences.save_structural_model(self.structural_model, filename - ) + return og_geosciences.save_structural_model(self.structural_model, filename) def save_viewable(self, filename_without_extension: str) -> str: return viewables.save_viewable_structural_model( - self.structural_model, filename_without_extension - , + self.structural_model, + filename_without_extension, ) def save_light_viewable(self, filename_without_extension: str) -> str: return viewables.save_light_viewable_structural_model( - self.structural_model, filename_without_extension - , + self.structural_model, + filename_without_extension, ) diff --git a/src/opengeodeweb_back/geode_objects/geode_tetrahedral_solid3d.py b/src/opengeodeweb_back/geode_objects/geode_tetrahedral_solid3d.py index 731ae392..61d47683 100644 --- a/src/opengeodeweb_back/geode_objects/geode_tetrahedral_solid3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_tetrahedral_solid3d.py @@ -56,21 +56,19 @@ def object_priority(cls, filename: str) -> int: return og.tetrahedral_solid_object_priority3D(filename) def is_saveable(self, filename: str) -> bool: - return og.is_tetrahedral_solid_saveable3D(self.tetrahedral_solid, filename - ) + return og.is_tetrahedral_solid_saveable3D(self.tetrahedral_solid, filename) def save(self, filename: str) -> list[str]: - return og.save_tetrahedral_solid3D(self.tetrahedral_solid, filename - ) + return og.save_tetrahedral_solid3D(self.tetrahedral_solid, filename) def save_viewable(self, filename_without_extension: str) -> str: return viewables.save_viewable_tetrahedral_solid3D( - self.tetrahedral_solid, filename_without_extension - , + self.tetrahedral_solid, + filename_without_extension, ) def save_light_viewable(self, filename_without_extension: str) -> str: return viewables.save_light_viewable_tetrahedral_solid3D( - self.tetrahedral_solid, filename_without_extension - , + self.tetrahedral_solid, + filename_without_extension, ) diff --git a/src/opengeodeweb_back/geode_objects/geode_triangulated_surface2d.py b/src/opengeodeweb_back/geode_objects/geode_triangulated_surface2d.py index c087613f..b895e332 100644 --- a/src/opengeodeweb_back/geode_objects/geode_triangulated_surface2d.py +++ b/src/opengeodeweb_back/geode_objects/geode_triangulated_surface2d.py @@ -58,21 +58,25 @@ def object_priority(cls, filename: str) -> int: return og.triangulated_surface_object_priority2D(filename) def is_saveable(self, filename: str) -> bool: - return og.is_triangulated_surface_saveable2D(self.triangulated_surface, filename, + return og.is_triangulated_surface_saveable2D( + self.triangulated_surface, + filename, ) def save(self, filename: str) -> list[str]: - return og.save_triangulated_surface2D(self.triangulated_surface, filename, + return og.save_triangulated_surface2D( + self.triangulated_surface, + filename, ) def save_viewable(self, filename_without_extension: str) -> str: return viewables.save_viewable_triangulated_surface2D( - self.triangulated_surface, filename_without_extension - , + self.triangulated_surface, + filename_without_extension, ) def save_light_viewable(self, filename_without_extension: str) -> str: return viewables.save_light_viewable_triangulated_surface2D( - self.triangulated_surface, filename_without_extension - , + self.triangulated_surface, + filename_without_extension, ) diff --git a/src/opengeodeweb_back/geode_objects/geode_triangulated_surface3d.py b/src/opengeodeweb_back/geode_objects/geode_triangulated_surface3d.py index ed25a1da..83b1aba7 100644 --- a/src/opengeodeweb_back/geode_objects/geode_triangulated_surface3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_triangulated_surface3d.py @@ -58,21 +58,25 @@ def object_priority(cls, filename: str) -> int: return og.triangulated_surface_object_priority3D(filename) def is_saveable(self, filename: str) -> bool: - return og.is_triangulated_surface_saveable3D(self.triangulated_surface, filename, + return og.is_triangulated_surface_saveable3D( + self.triangulated_surface, + filename, ) def save(self, filename: str) -> list[str]: - return og.save_triangulated_surface3D(self.triangulated_surface, filename, + return og.save_triangulated_surface3D( + self.triangulated_surface, + filename, ) def save_viewable(self, filename_without_extension: str) -> str: return viewables.save_viewable_triangulated_surface3D( - self.triangulated_surface, filename_without_extension - , + self.triangulated_surface, + filename_without_extension, ) def save_light_viewable(self, filename_without_extension: str) -> str: return viewables.save_light_viewable_triangulated_surface3D( - self.triangulated_surface, filename_without_extension - , + self.triangulated_surface, + filename_without_extension, ) From c3526fb01afaa657ef0ee98d329d3f71ee161a3c Mon Sep 17 00:00:00 2001 From: MaxNumerique Date: Mon, 5 Jan 2026 16:50:49 +0100 Subject: [PATCH 07/12] continue --- .../geode_objects/geode_edged_curve2d.py | 6 ++---- .../geode_objects/geode_edged_curve3d.py | 6 ++---- .../geode_objects/geode_hybrid_solid3d.py | 6 ++---- .../geode_objects/geode_implicit_cross_section.py | 12 ++++-------- .../geode_implicit_structural_model.py | 12 ++++-------- .../geode_objects/geode_light_regular_grid2d.py | 6 ++---- .../geode_objects/geode_light_regular_grid3d.py | 6 ++---- .../geode_objects/geode_point_set2d.py | 6 ++---- .../geode_objects/geode_point_set3d.py | 6 ++---- .../geode_objects/geode_polygonal_surface2d.py | 6 ++---- .../geode_objects/geode_polygonal_surface3d.py | 6 ++---- .../geode_objects/geode_polyhedral_solid3d.py | 6 ++---- .../geode_objects/geode_raster_image2d.py | 6 ++---- .../geode_objects/geode_raster_image3d.py | 6 ++---- .../geode_objects/geode_regular_grid2d.py | 6 ++---- .../geode_objects/geode_regular_grid3d.py | 6 ++---- .../geode_objects/geode_section.py | 8 ++------ .../geode_objects/geode_structural_model.py | 6 ++---- .../geode_objects/geode_tetrahedral_solid3d.py | 6 ++---- .../geode_objects/geode_triangulated_surface2d.py | 14 ++++---------- .../geode_objects/geode_triangulated_surface3d.py | 14 ++++---------- 21 files changed, 50 insertions(+), 106 deletions(-) diff --git a/src/opengeodeweb_back/geode_objects/geode_edged_curve2d.py b/src/opengeodeweb_back/geode_objects/geode_edged_curve2d.py index e50aa671..a0124882 100644 --- a/src/opengeodeweb_back/geode_objects/geode_edged_curve2d.py +++ b/src/opengeodeweb_back/geode_objects/geode_edged_curve2d.py @@ -71,14 +71,12 @@ def save(self, filename: str) -> list[str]: def save_viewable(self, filename_without_extension: str) -> str: return viewables.save_viewable_edged_curve2D( - self.edged_curve, - filename_without_extension, + self.edged_curve, filename_without_extension ) def save_light_viewable(self, filename_without_extension: str) -> str: return viewables.save_light_viewable_edged_curve2D( - self.edged_curve, - filename_without_extension, + self.edged_curve, filename_without_extension ) def inspect(self) -> og_inspector.EdgedCurveInspectionResult: diff --git a/src/opengeodeweb_back/geode_objects/geode_edged_curve3d.py b/src/opengeodeweb_back/geode_objects/geode_edged_curve3d.py index 7817d679..632da9a7 100644 --- a/src/opengeodeweb_back/geode_objects/geode_edged_curve3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_edged_curve3d.py @@ -71,14 +71,12 @@ def save(self, filename: str) -> list[str]: def save_viewable(self, filename_without_extension: str) -> str: return viewables.save_viewable_edged_curve3D( - self.edged_curve, - filename_without_extension, + self.edged_curve, filename_without_extension ) def save_light_viewable(self, filename_without_extension: str) -> str: return viewables.save_light_viewable_edged_curve3D( - self.edged_curve, - filename_without_extension, + self.edged_curve, filename_without_extension ) def inspect(self) -> og_inspector.EdgedCurveInspectionResult: diff --git a/src/opengeodeweb_back/geode_objects/geode_hybrid_solid3d.py b/src/opengeodeweb_back/geode_objects/geode_hybrid_solid3d.py index 11173495..f9921935 100644 --- a/src/opengeodeweb_back/geode_objects/geode_hybrid_solid3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_hybrid_solid3d.py @@ -61,12 +61,10 @@ def save(self, filename: str) -> list[str]: def save_viewable(self, filename_without_extension: str) -> str: return viewables.save_viewable_hybrid_solid3D( - self.hybrid_solid, - filename_without_extension, + self.hybrid_solid, filename_without_extension ) def save_light_viewable(self, filename_without_extension: str) -> str: return viewables.save_light_viewable_hybrid_solid3D( - self.hybrid_solid, - filename_without_extension, + self.hybrid_solid, filename_without_extension ) diff --git a/src/opengeodeweb_back/geode_objects/geode_implicit_cross_section.py b/src/opengeodeweb_back/geode_objects/geode_implicit_cross_section.py index 3820e262..8f9a4e41 100644 --- a/src/opengeodeweb_back/geode_objects/geode_implicit_cross_section.py +++ b/src/opengeodeweb_back/geode_objects/geode_implicit_cross_section.py @@ -62,24 +62,20 @@ def object_priority(cls, filename: str) -> int: def is_saveable(self, filename: str) -> bool: return og_geosciences.is_implicit_cross_section_saveable( - self.implicit_cross_section, - filename, + self.implicit_cross_section, filename ) def save(self, filename: str) -> list[str]: return og_geosciences.save_implicit_cross_section( - self.implicit_cross_section, - filename, + self.implicit_cross_section, filename ) def save_viewable(self, filename_without_extension: str) -> str: return viewables.save_viewable_implicit_cross_section( - self.implicit_cross_section, - filename_without_extension, + self.implicit_cross_section, filename_without_extension ) def save_light_viewable(self, filename_without_extension: str) -> str: return viewables.save_light_viewable_implicit_cross_section( - self.implicit_cross_section, - filename_without_extension, + self.implicit_cross_section, filename_without_extension ) diff --git a/src/opengeodeweb_back/geode_objects/geode_implicit_structural_model.py b/src/opengeodeweb_back/geode_objects/geode_implicit_structural_model.py index 572b7e78..45900daa 100644 --- a/src/opengeodeweb_back/geode_objects/geode_implicit_structural_model.py +++ b/src/opengeodeweb_back/geode_objects/geode_implicit_structural_model.py @@ -65,24 +65,20 @@ def object_priority(cls, filename: str) -> int: def is_saveable(self, filename: str) -> bool: return og_geosciences.is_implicit_structural_model_saveable( - self.implicit_structural_model, - filename, + self.implicit_structural_model, filename ) def save(self, filename: str) -> list[str]: return og_geosciences.save_implicit_structural_model( - self.implicit_structural_model, - filename, + self.implicit_structural_model, filename ) def save_viewable(self, filename_without_extension: str) -> str: return viewables.save_viewable_implicit_structural_model( - self.implicit_structural_model, - filename_without_extension, + self.implicit_structural_model, filename_without_extension ) def save_light_viewable(self, filename_without_extension: str) -> str: return viewables.save_light_viewable_implicit_structural_model( - self.implicit_structural_model, - filename_without_extension, + self.implicit_structural_model, filename_without_extension ) diff --git a/src/opengeodeweb_back/geode_objects/geode_light_regular_grid2d.py b/src/opengeodeweb_back/geode_objects/geode_light_regular_grid2d.py index 3732b6be..4e7de6a9 100644 --- a/src/opengeodeweb_back/geode_objects/geode_light_regular_grid2d.py +++ b/src/opengeodeweb_back/geode_objects/geode_light_regular_grid2d.py @@ -56,14 +56,12 @@ def save(self, filename: str) -> list[str]: def save_viewable(self, filename_without_extension: str) -> str: return viewables.save_viewable_light_regular_grid2D( - self.light_regular_grid, - filename_without_extension, + self.light_regular_grid, filename_without_extension ) def save_light_viewable(self, filename_without_extension: str) -> str: return viewables.save_light_viewable_light_regular_grid2D( - self.light_regular_grid, - filename_without_extension, + self.light_regular_grid, filename_without_extension ) def vertex_attribute_manager(self) -> og.AttributeManager: diff --git a/src/opengeodeweb_back/geode_objects/geode_light_regular_grid3d.py b/src/opengeodeweb_back/geode_objects/geode_light_regular_grid3d.py index dba35bf1..2854cf89 100644 --- a/src/opengeodeweb_back/geode_objects/geode_light_regular_grid3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_light_regular_grid3d.py @@ -56,14 +56,12 @@ def save(self, filename: str) -> list[str]: def save_viewable(self, filename_without_extension: str) -> str: return viewables.save_viewable_light_regular_grid3D( - self.light_regular_grid, - filename_without_extension, + self.light_regular_grid, filename_without_extension ) def save_light_viewable(self, filename_without_extension: str) -> str: return viewables.save_light_viewable_light_regular_grid3D( - self.light_regular_grid, - filename_without_extension, + self.light_regular_grid, filename_without_extension ) def vertex_attribute_manager(self) -> og.AttributeManager: diff --git a/src/opengeodeweb_back/geode_objects/geode_point_set2d.py b/src/opengeodeweb_back/geode_objects/geode_point_set2d.py index 56941e89..2a35b97a 100644 --- a/src/opengeodeweb_back/geode_objects/geode_point_set2d.py +++ b/src/opengeodeweb_back/geode_objects/geode_point_set2d.py @@ -69,14 +69,12 @@ def save(self, filename: str) -> list[str]: def save_viewable(self, filename_without_extension: str) -> str: return viewables.save_viewable_point_set2D( - self.point_set, - filename_without_extension, + self.point_set, filename_without_extension ) def save_light_viewable(self, filename_without_extension: str) -> str: return viewables.save_light_viewable_point_set2D( - self.point_set, - filename_without_extension, + self.point_set, filename_without_extension ) def inspect(self) -> og_inspector.PointSetInspectionResult: diff --git a/src/opengeodeweb_back/geode_objects/geode_point_set3d.py b/src/opengeodeweb_back/geode_objects/geode_point_set3d.py index feccc94c..1c490b59 100644 --- a/src/opengeodeweb_back/geode_objects/geode_point_set3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_point_set3d.py @@ -69,14 +69,12 @@ def save(self, filename: str) -> list[str]: def save_viewable(self, filename_without_extension: str) -> str: return viewables.save_viewable_point_set3D( - self.point_set, - filename_without_extension, + self.point_set, filename_without_extension ) def save_light_viewable(self, filename_without_extension: str) -> str: return viewables.save_light_viewable_point_set3D( - self.point_set, - filename_without_extension, + self.point_set, filename_without_extension ) def inspect(self) -> og_inspector.PointSetInspectionResult: diff --git a/src/opengeodeweb_back/geode_objects/geode_polygonal_surface2d.py b/src/opengeodeweb_back/geode_objects/geode_polygonal_surface2d.py index df89a257..884866d8 100644 --- a/src/opengeodeweb_back/geode_objects/geode_polygonal_surface2d.py +++ b/src/opengeodeweb_back/geode_objects/geode_polygonal_surface2d.py @@ -63,12 +63,10 @@ def save(self, filename: str) -> list[str]: def save_viewable(self, filename_without_extension: str) -> str: return viewables.save_viewable_polygonal_surface2D( - self.polygonal_surface, - filename_without_extension, + self.polygonal_surface, filename_without_extension ) def save_light_viewable(self, filename_without_extension: str) -> str: return viewables.save_light_viewable_polygonal_surface2D( - self.polygonal_surface, - filename_without_extension, + self.polygonal_surface, filename_without_extension ) diff --git a/src/opengeodeweb_back/geode_objects/geode_polygonal_surface3d.py b/src/opengeodeweb_back/geode_objects/geode_polygonal_surface3d.py index 9b9a5828..2ba68194 100644 --- a/src/opengeodeweb_back/geode_objects/geode_polygonal_surface3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_polygonal_surface3d.py @@ -63,12 +63,10 @@ def save(self, filename: str) -> list[str]: def save_viewable(self, filename_without_extension: str) -> str: return viewables.save_viewable_polygonal_surface3D( - self.polygonal_surface, - filename_without_extension, + self.polygonal_surface, filename_without_extension ) def save_light_viewable(self, filename_without_extension: str) -> str: return viewables.save_light_viewable_polygonal_surface3D( - self.polygonal_surface, - filename_without_extension, + self.polygonal_surface, filename_without_extension ) diff --git a/src/opengeodeweb_back/geode_objects/geode_polyhedral_solid3d.py b/src/opengeodeweb_back/geode_objects/geode_polyhedral_solid3d.py index 2017043f..40232d2d 100644 --- a/src/opengeodeweb_back/geode_objects/geode_polyhedral_solid3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_polyhedral_solid3d.py @@ -63,12 +63,10 @@ def save(self, filename: str) -> list[str]: def save_viewable(self, filename_without_extension: str) -> str: return viewables.save_viewable_polyhedral_solid3D( - self.polyhedral_solid, - filename_without_extension, + self.polyhedral_solid, filename_without_extension ) def save_light_viewable(self, filename_without_extension: str) -> str: return viewables.save_light_viewable_polyhedral_solid3D( - self.polyhedral_solid, - filename_without_extension, + self.polyhedral_solid, filename_without_extension ) diff --git a/src/opengeodeweb_back/geode_objects/geode_raster_image2d.py b/src/opengeodeweb_back/geode_objects/geode_raster_image2d.py index 74832eb8..846ae7ac 100644 --- a/src/opengeodeweb_back/geode_objects/geode_raster_image2d.py +++ b/src/opengeodeweb_back/geode_objects/geode_raster_image2d.py @@ -67,14 +67,12 @@ def save(self, filename: str) -> list[str]: def save_viewable(self, filename_without_extension: str) -> str: return viewables.save_viewable_raster_image2D( - self.raster_image, - filename_without_extension, + self.raster_image, filename_without_extension ) def save_light_viewable(self, filename_without_extension: str) -> str: return viewables.save_light_viewable_raster_image2D( - self.raster_image, - filename_without_extension, + self.raster_image, filename_without_extension ) def inspect(self) -> None: diff --git a/src/opengeodeweb_back/geode_objects/geode_raster_image3d.py b/src/opengeodeweb_back/geode_objects/geode_raster_image3d.py index 80cbb7aa..de131c78 100644 --- a/src/opengeodeweb_back/geode_objects/geode_raster_image3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_raster_image3d.py @@ -67,14 +67,12 @@ def save(self, filename: str) -> list[str]: def save_viewable(self, filename_without_extension: str) -> str: return viewables.save_viewable_raster_image3D( - self.raster_image, - filename_without_extension, + self.raster_image, filename_without_extension ) def save_light_viewable(self, filename_without_extension: str) -> str: return viewables.save_light_viewable_raster_image3D( - self.raster_image, - filename_without_extension, + self.raster_image, filename_without_extension ) def inspect(self) -> None: diff --git a/src/opengeodeweb_back/geode_objects/geode_regular_grid2d.py b/src/opengeodeweb_back/geode_objects/geode_regular_grid2d.py index de1f1038..7fa45e07 100644 --- a/src/opengeodeweb_back/geode_objects/geode_regular_grid2d.py +++ b/src/opengeodeweb_back/geode_objects/geode_regular_grid2d.py @@ -66,14 +66,12 @@ def save(self, filename: str) -> list[str]: def save_viewable(self, filename_without_extension: str) -> str: return viewables.save_viewable_regular_grid2D( - self.regular_grid, - filename_without_extension, + self.regular_grid, filename_without_extension ) def save_light_viewable(self, filename_without_extension: str) -> str: return viewables.save_light_viewable_regular_grid2D( - self.regular_grid, - filename_without_extension, + self.regular_grid, filename_without_extension ) def cell_attribute_manager(self) -> og.AttributeManager: diff --git a/src/opengeodeweb_back/geode_objects/geode_regular_grid3d.py b/src/opengeodeweb_back/geode_objects/geode_regular_grid3d.py index 3357d1bd..8f158ca4 100644 --- a/src/opengeodeweb_back/geode_objects/geode_regular_grid3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_regular_grid3d.py @@ -63,14 +63,12 @@ def save(self, filename: str) -> list[str]: def save_viewable(self, filename_without_extension: str) -> str: return viewables.save_viewable_regular_grid3D( - self.regular_grid, - filename_without_extension, + self.regular_grid, filename_without_extension ) def save_light_viewable(self, filename_without_extension: str) -> str: return viewables.save_light_viewable_regular_grid3D( - self.regular_grid, - filename_without_extension, + self.regular_grid, filename_without_extension ) def cell_attribute_manager(self) -> og.AttributeManager: diff --git a/src/opengeodeweb_back/geode_objects/geode_section.py b/src/opengeodeweb_back/geode_objects/geode_section.py index f5e8d4e6..38a1b419 100644 --- a/src/opengeodeweb_back/geode_objects/geode_section.py +++ b/src/opengeodeweb_back/geode_objects/geode_section.py @@ -69,15 +69,11 @@ def save(self, filename: str) -> list[str]: return og.save_section(self.section, filename) def save_viewable(self, filename_without_extension: str) -> str: - return viewables.save_viewable_section( - self.section, - filename_without_extension, - ) + return viewables.save_viewable_section(self.section, filename_without_extension) def save_light_viewable(self, filename_without_extension: str) -> str: return viewables.save_light_viewable_section( - self.section, - filename_without_extension, + self.section, filename_without_extension ) def mesh_components(self) -> ComponentRegistry: diff --git a/src/opengeodeweb_back/geode_objects/geode_structural_model.py b/src/opengeodeweb_back/geode_objects/geode_structural_model.py index cf9a45fb..b0ae71c0 100644 --- a/src/opengeodeweb_back/geode_objects/geode_structural_model.py +++ b/src/opengeodeweb_back/geode_objects/geode_structural_model.py @@ -69,12 +69,10 @@ def save(self, filename: str) -> list[str]: def save_viewable(self, filename_without_extension: str) -> str: return viewables.save_viewable_structural_model( - self.structural_model, - filename_without_extension, + self.structural_model, filename_without_extension ) def save_light_viewable(self, filename_without_extension: str) -> str: return viewables.save_light_viewable_structural_model( - self.structural_model, - filename_without_extension, + self.structural_model, filename_without_extension ) diff --git a/src/opengeodeweb_back/geode_objects/geode_tetrahedral_solid3d.py b/src/opengeodeweb_back/geode_objects/geode_tetrahedral_solid3d.py index 61d47683..15bf2e53 100644 --- a/src/opengeodeweb_back/geode_objects/geode_tetrahedral_solid3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_tetrahedral_solid3d.py @@ -63,12 +63,10 @@ def save(self, filename: str) -> list[str]: def save_viewable(self, filename_without_extension: str) -> str: return viewables.save_viewable_tetrahedral_solid3D( - self.tetrahedral_solid, - filename_without_extension, + self.tetrahedral_solid, filename_without_extension ) def save_light_viewable(self, filename_without_extension: str) -> str: return viewables.save_light_viewable_tetrahedral_solid3D( - self.tetrahedral_solid, - filename_without_extension, + self.tetrahedral_solid, filename_without_extension ) diff --git a/src/opengeodeweb_back/geode_objects/geode_triangulated_surface2d.py b/src/opengeodeweb_back/geode_objects/geode_triangulated_surface2d.py index b895e332..14e448c2 100644 --- a/src/opengeodeweb_back/geode_objects/geode_triangulated_surface2d.py +++ b/src/opengeodeweb_back/geode_objects/geode_triangulated_surface2d.py @@ -59,24 +59,18 @@ def object_priority(cls, filename: str) -> int: def is_saveable(self, filename: str) -> bool: return og.is_triangulated_surface_saveable2D( - self.triangulated_surface, - filename, + self.triangulated_surface, filename ) def save(self, filename: str) -> list[str]: - return og.save_triangulated_surface2D( - self.triangulated_surface, - filename, - ) + return og.save_triangulated_surface2D(self.triangulated_surface, filename) def save_viewable(self, filename_without_extension: str) -> str: return viewables.save_viewable_triangulated_surface2D( - self.triangulated_surface, - filename_without_extension, + self.triangulated_surface, filename_without_extension ) def save_light_viewable(self, filename_without_extension: str) -> str: return viewables.save_light_viewable_triangulated_surface2D( - self.triangulated_surface, - filename_without_extension, + self.triangulated_surface, filename_without_extension ) diff --git a/src/opengeodeweb_back/geode_objects/geode_triangulated_surface3d.py b/src/opengeodeweb_back/geode_objects/geode_triangulated_surface3d.py index 83b1aba7..d5c998f8 100644 --- a/src/opengeodeweb_back/geode_objects/geode_triangulated_surface3d.py +++ b/src/opengeodeweb_back/geode_objects/geode_triangulated_surface3d.py @@ -59,24 +59,18 @@ def object_priority(cls, filename: str) -> int: def is_saveable(self, filename: str) -> bool: return og.is_triangulated_surface_saveable3D( - self.triangulated_surface, - filename, + self.triangulated_surface, filename ) def save(self, filename: str) -> list[str]: - return og.save_triangulated_surface3D( - self.triangulated_surface, - filename, - ) + return og.save_triangulated_surface3D(self.triangulated_surface, filename) def save_viewable(self, filename_without_extension: str) -> str: return viewables.save_viewable_triangulated_surface3D( - self.triangulated_surface, - filename_without_extension, + self.triangulated_surface, filename_without_extension ) def save_light_viewable(self, filename_without_extension: str) -> str: return viewables.save_light_viewable_triangulated_surface3D( - self.triangulated_surface, - filename_without_extension, + self.triangulated_surface, filename_without_extension ) From 447f2d7b1ceebd39e5964fca69e4b7d8b58f84cf Mon Sep 17 00:00:00 2001 From: MaxNumerique Date: Mon, 5 Jan 2026 16:58:03 +0100 Subject: [PATCH 08/12] continue --- .../geode_objects/geode_structural_model.py | 3 +-- src/opengeodeweb_back/routes/blueprint_routes.py | 5 ----- src/opengeodeweb_back/routes/models/blueprint_models.py | 1 - src/opengeodeweb_back/utils_functions.py | 2 +- 4 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/opengeodeweb_back/geode_objects/geode_structural_model.py b/src/opengeodeweb_back/geode_objects/geode_structural_model.py index b0ae71c0..e81466b4 100644 --- a/src/opengeodeweb_back/geode_objects/geode_structural_model.py +++ b/src/opengeodeweb_back/geode_objects/geode_structural_model.py @@ -60,8 +60,7 @@ def object_priority(cls, filename: str) -> int: def is_saveable(self, filename: str) -> bool: return og_geosciences.is_structural_model_saveable( - self.structural_model, - filename, + self.structural_model, filename ) def save(self, filename: str) -> list[str]: diff --git a/src/opengeodeweb_back/routes/blueprint_routes.py b/src/opengeodeweb_back/routes/blueprint_routes.py index e56e68d6..81e1c4cf 100644 --- a/src/opengeodeweb_back/routes/blueprint_routes.py +++ b/src/opengeodeweb_back/routes/blueprint_routes.py @@ -259,7 +259,6 @@ def texture_coordinates() -> flask.Response: geode_object = geode_functions.load_geode_object(params.id) if not isinstance(geode_object, GeodeSurfaceMesh2D | GeodeSurfaceMesh3D): flask.abort(400, f"{params.id} is not a GeodeSurfaceMesh") - assert isinstance(geode_object, GeodeSurfaceMesh2D | GeodeSurfaceMesh3D) texture_coordinates = geode_object.texture_manager().texture_names() return flask.make_response({"texture_coordinates": texture_coordinates}, 200) @@ -276,7 +275,6 @@ def vertex_attribute_names() -> flask.Response: geode_object = geode_functions.load_geode_object(params.id) if not isinstance(geode_object, GeodeMesh): flask.abort(400, f"{params.id} is not a GeodeMesh") - assert isinstance(geode_object, GeodeMesh) vertex_attribute_names = geode_object.vertex_attribute_manager().attribute_names() return flask.make_response( { @@ -298,7 +296,6 @@ def cell_attribute_names() -> flask.Response: geode_object = geode_functions.load_geode_object(params.id) if not isinstance(geode_object, GeodeGrid2D | GeodeGrid3D): flask.abort(400, f"{params.id} is not a GeodeGrid") - assert isinstance(geode_object, GeodeGrid2D | GeodeGrid3D) cell_attribute_names = geode_object.cell_attribute_manager().attribute_names() return flask.make_response( { @@ -320,7 +317,6 @@ def polygon_attribute_names() -> flask.Response: geode_object = geode_functions.load_geode_object(params.id) if not isinstance(geode_object, GeodeSurfaceMesh2D | GeodeSurfaceMesh3D): flask.abort(400, f"{params.id} is not a GeodeSurfaceMesh") - assert isinstance(geode_object, GeodeSurfaceMesh2D | GeodeSurfaceMesh3D) polygon_attribute_names = geode_object.polygon_attribute_manager().attribute_names() return flask.make_response( { @@ -342,7 +338,6 @@ def polyhedron_attribute_names() -> flask.Response: geode_object = geode_functions.load_geode_object(params.id) if not isinstance(geode_object, GeodeSolidMesh3D): flask.abort(400, f"{params.id} is not a GeodeSolidMesh") - assert isinstance(geode_object, GeodeSolidMesh3D) polyhedron_attribute_names = ( geode_object.polyhedron_attribute_manager().attribute_names() ) diff --git a/src/opengeodeweb_back/routes/models/blueprint_models.py b/src/opengeodeweb_back/routes/models/blueprint_models.py index 6bd17930..5d18349b 100644 --- a/src/opengeodeweb_back/routes/models/blueprint_models.py +++ b/src/opengeodeweb_back/routes/models/blueprint_models.py @@ -47,7 +47,6 @@ def extract_uuids_endpoint() -> flask.Response: model = geode_functions.load_geode_object(params.id) if not isinstance(model, GeodeModel): flask.abort(400, f"{params.id} is not a GeodeModel") - assert isinstance(model, GeodeModel) mesh_components = model.mesh_components() uuid_dict = {} for mesh_component, ids in mesh_components.items(): diff --git a/src/opengeodeweb_back/utils_functions.py b/src/opengeodeweb_back/utils_functions.py index 2ce1393c..d1b3cb70 100644 --- a/src/opengeodeweb_back/utils_functions.py +++ b/src/opengeodeweb_back/utils_functions.py @@ -115,7 +115,7 @@ def validate_request(request: flask.Request, schema: SchemaDict) -> dict[str, An error_msg = str(e) print("Validation failed:", error_msg, flush=True) flask.abort(400, error_msg) - return cast(dict[str, Any], json_data) + return json_data def set_interval( From dbce21af27667eda89791945dd5a660211b78f56 Mon Sep 17 00:00:00 2001 From: MaxNumerique Date: Tue, 6 Jan 2026 09:27:31 +0100 Subject: [PATCH 09/12] removed cast --- src/opengeodeweb_back/geode_objects/geode_section.py | 1 - src/opengeodeweb_back/utils_functions.py | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/opengeodeweb_back/geode_objects/geode_section.py b/src/opengeodeweb_back/geode_objects/geode_section.py index 38a1b419..af35be7f 100644 --- a/src/opengeodeweb_back/geode_objects/geode_section.py +++ b/src/opengeodeweb_back/geode_objects/geode_section.py @@ -1,6 +1,5 @@ # Standard library imports from __future__ import annotations -from typing import cast # Third party imports import opengeode as og diff --git a/src/opengeodeweb_back/utils_functions.py b/src/opengeodeweb_back/utils_functions.py index d1b3cb70..1264690d 100644 --- a/src/opengeodeweb_back/utils_functions.py +++ b/src/opengeodeweb_back/utils_functions.py @@ -5,7 +5,7 @@ import zipfile from collections.abc import Callable from concurrent.futures import ThreadPoolExecutor -from typing import Any, cast +from typing import Any # Third party imports From 89d196c50ad992d3c9402caab38c03932f506b83 Mon Sep 17 00:00:00 2001 From: MaxNumerique Date: Tue, 6 Jan 2026 11:13:02 +0100 Subject: [PATCH 10/12] add py.typed in tests section --- tests/py.typed | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 tests/py.typed diff --git a/tests/py.typed b/tests/py.typed new file mode 100644 index 00000000..e69de29b From d5fe16dd415eee28d53d08dea0f0be5e0898ceb8 Mon Sep 17 00:00:00 2001 From: MaxNumerique Date: Wed, 7 Jan 2026 10:09:56 +0100 Subject: [PATCH 11/12] fix(lint): fix some types From e6a6c2ba06bf996db8ba4c7772d830a7010f7023 Mon Sep 17 00:00:00 2001 From: MaxNumerique Date: Wed, 7 Jan 2026 11:27:00 +0100 Subject: [PATCH 12/12] rm py.typed --- tests/py.typed | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 tests/py.typed diff --git a/tests/py.typed b/tests/py.typed deleted file mode 100644 index e69de29b..00000000