From 646db2d293e7b8814366d42ee7adad39f92a49f1 Mon Sep 17 00:00:00 2001 From: Roberto Pastor Muela <37798125+RobPasMue@users.noreply.github.com> Date: Wed, 17 Jul 2024 10:05:40 +0200 Subject: [PATCH] chore: enable ruff formatter on pre-commit (#1312) Co-authored-by: pyansys-ci-bot <92810346+pyansys-ci-bot@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- doc/changelog.d/1312.changed.md | 1 + doc/source/conf.py | 1 - docker/build_docker_windows.py | 2 +- pyproject.toml | 1 + src/ansys/geometry/core/connection/backend.py | 1 + .../core/connection/docker_instance.py | 1 + .../geometry/core/connection/launcher.py | 1 + .../core/connection/product_instance.py | 1 + .../geometry/core/connection/validate.py | 1 + src/ansys/geometry/core/designer/body.py | 79 ++++++------------- src/ansys/geometry/core/designer/component.py | 2 +- src/ansys/geometry/core/designer/part.py | 1 + src/ansys/geometry/core/logger.py | 18 ++--- src/ansys/geometry/core/math/matrix.py | 1 + src/ansys/geometry/core/math/misc.py | 1 - src/ansys/geometry/core/math/vector.py | 1 + src/ansys/geometry/core/misc/accuracy.py | 1 - src/ansys/geometry/core/misc/auxiliary.py | 10 ++- src/ansys/geometry/core/misc/checks.py | 4 +- src/ansys/geometry/core/misc/measurements.py | 16 ++-- src/ansys/geometry/core/misc/options.py | 1 + src/ansys/geometry/core/modeler.py | 2 +- src/ansys/geometry/core/plotting/plotter.py | 1 + .../core/plotting/widgets/__init__.py | 1 + src/ansys/geometry/core/shapes/box_uv.py | 1 + .../geometry/core/shapes/curves/__init__.py | 1 + .../geometry/core/shapes/curves/circle.py | 1 + .../geometry/core/shapes/curves/curve.py | 1 + .../core/shapes/curves/curve_evaluation.py | 1 + .../core/shapes/curves/trimmed_curve.py | 1 + .../geometry/core/shapes/surfaces/__init__.py | 1 + .../geometry/core/shapes/surfaces/plane.py | 1 + .../geometry/core/shapes/surfaces/surface.py | 1 + src/ansys/geometry/core/sketch/arc.py | 6 +- .../geometry/core/tools/prepare_tools.py | 15 ++-- .../geometry/core/tools/problem_areas.py | 1 + .../core/tools/repair_tool_message.py | 1 - tests/conftest.py | 3 +- tests/integration/conftest.py | 1 + tests/integration/test_client.py | 1 + tests/integration/test_design.py | 2 + tests/integration/test_issues.py | 4 +- tests/integration/test_launcher_remote.py | 1 + tests/integration/test_logging_client.py | 3 +- tests/integration/test_measurement_tools.py | 2 +- tests/integration/test_prepare_tools.py | 8 +- tests/integration/test_repair_tools.py | 3 +- tests/integration/test_runscript.py | 5 -- tests/integration/test_tessellation.py | 1 + tests/integration/test_trimmed_geometry.py | 1 + tests/test_logging.py | 3 +- tests/test_primitives.py | 4 +- tests/test_sketch.py | 1 + 54 files changed, 110 insertions(+), 116 deletions(-) create mode 100644 doc/changelog.d/1312.changed.md diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index dc51925b0c..17199d09ec 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,6 +10,7 @@ repos: rev: v0.5.2 hooks: - id: ruff + - id: ruff-format - repo: https://github.com/codespell-project/codespell rev: v2.3.0 @@ -29,7 +30,6 @@ repos: rev: v0.3.1 hooks: - id: add-license-headers - files: '(src|examples|tests|docker)/.*\.(py)|\.(proto)' args: - --start_year=2023 diff --git a/doc/changelog.d/1312.changed.md b/doc/changelog.d/1312.changed.md new file mode 100644 index 0000000000..bd0b6fc882 --- /dev/null +++ b/doc/changelog.d/1312.changed.md @@ -0,0 +1 @@ +chore: enable ruff formatter on pre-commit \ No newline at end of file diff --git a/doc/source/conf.py b/doc/source/conf.py index 81701c0bd1..ac4f52d96f 100755 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -43,7 +43,6 @@ def get_wheelhouse_assets_dictionary(): assets_context_runners = ["ubuntu-latest", "windows-latest", "macos-latest"] assets_context_python_versions = ["3.9", "3.10", "3.11", "3.12"] if get_version_match(__version__) == "dev": - # Try to retrieve the content three times before failing content = None for _ in range(3): diff --git a/docker/build_docker_windows.py b/docker/build_docker_windows.py index a0f613b207..81fceb36ca 100644 --- a/docker/build_docker_windows.py +++ b/docker/build_docker_windows.py @@ -80,7 +80,7 @@ # Copy the Geometry Service files to the temporary directory print(f">>> Copying Geometry Service files to temporary directory to {TMP_DIR}") -BIN_DIR = TMP_DIR / "bins" / "DockerWindows" /"bin" /"x64"/"Release_Headless" /"net472" +BIN_DIR = TMP_DIR / "bins" / "DockerWindows" / "bin" / "x64" / "Release_Headless" / "net472" # Create the directory structure shutil.copytree( diff --git a/pyproject.toml b/pyproject.toml index f493f9170b..25d0f984c0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -114,6 +114,7 @@ name = "ansys.geometry.core" [tool.ruff] line-length = 100 fix = true +extend-exclude = ["tests/integration/files"] [tool.ruff.format] quote-style = "double" diff --git a/src/ansys/geometry/core/connection/backend.py b/src/ansys/geometry/core/connection/backend.py index 6196f5f6c7..040e87f083 100644 --- a/src/ansys/geometry/core/connection/backend.py +++ b/src/ansys/geometry/core/connection/backend.py @@ -20,6 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. """Module providing definitions for the backend types.""" + from enum import Enum, unique diff --git a/src/ansys/geometry/core/connection/docker_instance.py b/src/ansys/geometry/core/connection/docker_instance.py index 4e557ea3b4..4aac2fe4b2 100644 --- a/src/ansys/geometry/core/connection/docker_instance.py +++ b/src/ansys/geometry/core/connection/docker_instance.py @@ -20,6 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. """Module for connecting to a local Geometry Service Docker container.""" + from enum import Enum from functools import wraps import os diff --git a/src/ansys/geometry/core/connection/launcher.py b/src/ansys/geometry/core/connection/launcher.py index 9dae2d4937..a40aa9a2ec 100644 --- a/src/ansys/geometry/core/connection/launcher.py +++ b/src/ansys/geometry/core/connection/launcher.py @@ -20,6 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. """Module for connecting to instances of the Geometry service.""" + import logging import os diff --git a/src/ansys/geometry/core/connection/product_instance.py b/src/ansys/geometry/core/connection/product_instance.py index 6f3d82ceaa..00dbce0c3c 100644 --- a/src/ansys/geometry/core/connection/product_instance.py +++ b/src/ansys/geometry/core/connection/product_instance.py @@ -20,6 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. """Module containing the ``ProductInstance`` class.""" + import logging import os from pathlib import Path diff --git a/src/ansys/geometry/core/connection/validate.py b/src/ansys/geometry/core/connection/validate.py index 2de7f12ae2..6aa9d212d0 100644 --- a/src/ansys/geometry/core/connection/validate.py +++ b/src/ansys/geometry/core/connection/validate.py @@ -30,6 +30,7 @@ python -c "from ansys.geometry.core.connection import validate; validate()" """ + from ansys.geometry.core.connection.client import GrpcClient diff --git a/src/ansys/geometry/core/designer/body.py b/src/ansys/geometry/core/designer/body.py index 3ac82aff28..4fa5e27877 100644 --- a/src/ansys/geometry/core/designer/body.py +++ b/src/ansys/geometry/core/designer/body.py @@ -20,6 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. """Provides for managing a body.""" + from abc import ABC, abstractmethod from enum import Enum, unique from functools import wraps @@ -223,9 +224,7 @@ def add_midsurface_offset(self, offset: "MidSurfaceOffsetType") -> None: return @abstractmethod - def imprint_curves( - self, faces: List[Face], sketch: Sketch - ) -> Tuple[List[Edge], List[Face]]: + def imprint_curves(self, faces: List[Face], sketch: Sketch) -> Tuple[List[Edge], List[Face]]: """Imprint all specified geometries onto specified faces of the body. Parameters @@ -318,9 +317,7 @@ def imprint_projected_curves( return @abstractmethod - def translate( - self, direction: UnitVector3D, distance: Union[Quantity, Distance, Real] - ) -> None: + def translate(self, direction: UnitVector3D, distance: Union[Quantity, Distance, Real]) -> None: """Translate the body in a specified direction and distance. Parameters @@ -443,9 +440,7 @@ def copy(self, parent: "Component", name: str = None) -> "Body": return @abstractmethod - def tessellate( - self, merge: Optional[bool] = False - ) -> Union["PolyData", "MultiBlock"]: + def tessellate(self, merge: Optional[bool] = False) -> Union["PolyData", "MultiBlock"]: """Tessellate the body and return the geometry as triangles. Parameters @@ -479,7 +474,7 @@ def tessellate( >>> body = my_comp.extrude_sketch("my-sketch", sketch, 1 * u.m) >>> blocks = body.tessellate() >>> blocks - >>> MultiBlock (0x7f94ec757460) + >>> MultiBlock(0x7F94EC757460) N Blocks: 6 X Bounds: 0.000, 4.000 Y Bounds: -1.000, 0.000 @@ -600,7 +595,7 @@ def subtract(self, other: Union["Body", Iterable["Body"]], keep_other: bool = Fa return @protect_grpc - def unite(self, other: Union["Body", Iterable["Body"]], keep_other : bool = False) -> None: + def unite(self, other: Union["Body", Iterable["Body"]], keep_other: bool = False) -> None: """Unite two (or more) bodies. Notes @@ -665,7 +660,7 @@ def __init__( self._commands_stub = CommandsStub(self._grpc_client.channel) self._tessellation = None - def reset_tessellation_cache(func): # noqa: N805 + def reset_tessellation_cache(func): # noqa: N805 """Decorate ``MasterBody`` methods that need tessellation cache update. Parameters @@ -751,23 +746,17 @@ def is_alive(self) -> bool: # noqa: D102 @protect_grpc def volume(self) -> Quantity: # noqa: D102 if self.is_surface: - self._grpc_client.log.debug( - "Dealing with planar surface. Returning 0 as the volume." - ) + self._grpc_client.log.debug("Dealing with planar surface. Returning 0 as the volume.") return Quantity(0, DEFAULT_UNITS.SERVER_VOLUME) else: - self._grpc_client.log.debug( - f"Retrieving volume for body {self.id} from server." - ) + self._grpc_client.log.debug(f"Retrieving volume for body {self.id} from server.") volume_response = self._bodies_stub.GetVolume(self._grpc_id) return Quantity(volume_response.volume, DEFAULT_UNITS.SERVER_VOLUME) @protect_grpc @check_input_types def assign_material(self, material: Material) -> None: # noqa: D102 - self._grpc_client.log.debug( - f"Assigning body {self.id} material {material.name}." - ) + self._grpc_client.log.debug(f"Assigning body {self.id} material {material.name}.") self._bodies_stub.SetAssignedMaterial( SetAssignedMaterialRequest(id=self._id, material=material.name) ) @@ -911,16 +900,12 @@ def map(self, frame: Frame) -> None: # noqa: D102 @min_backend_version(24, 2, 0) def mirror(self, plane: Plane) -> None: # noqa: D102 self._grpc_client.log.debug(f"Mirroring body {self.id}.") - self._bodies_stub.Mirror( - MirrorRequest(id=self.id, plane=plane_to_grpc_plane(plane)) - ) + self._bodies_stub.Mirror(MirrorRequest(id=self.id, plane=plane_to_grpc_plane(plane))) @protect_grpc @min_backend_version(24, 2, 0) def get_collision(self, body: "Body") -> CollisionType: # noqa: D102 - self._grpc_client.log.debug( - f"Get collision between body {self.id} and body {body.id}." - ) + self._grpc_client.log.debug(f"Get collision between body {self.id} and body {body.id}.") response = self._bodies_stub.GetCollision( GetCollisionRequest( body_1_id=self.id, @@ -1037,16 +1022,14 @@ class Body(IBody): Master body that this body is an occurrence of. """ - def __init__( - self, id, name, parent_component: "Component", template: MasterBody - ) -> None: + def __init__(self, id, name, parent_component: "Component", template: MasterBody) -> None: """Initialize the ``Body`` class.""" self._id = id self._name = name self._parent_component = parent_component self._template = template - def reset_tessellation_cache(func): # noqa: N805 + def reset_tessellation_cache(func): # noqa: N805 """Decorate ``Body`` methods that require a tessellation cache update. Parameters @@ -1083,9 +1066,7 @@ def parent_component(self) -> "Component": # noqa: D102 @protect_grpc @ensure_design_is_active def faces(self) -> List[Face]: # noqa: D102 - self._template._grpc_client.log.debug( - f"Retrieving faces for body {self.id} from server." - ) + self._template._grpc_client.log.debug(f"Retrieving faces for body {self.id} from server.") grpc_faces = self._template._bodies_stub.GetFaces(EntityIdentifier(id=self.id)) return [ Face( @@ -1102,9 +1083,7 @@ def faces(self) -> List[Face]: # noqa: D102 @protect_grpc @ensure_design_is_active def edges(self) -> List[Edge]: # noqa: D102 - self._template._grpc_client.log.debug( - f"Retrieving edges for body {self.id} from server." - ) + self._template._grpc_client.log.debug(f"Retrieving edges for body {self.id} from server.") grpc_edges = self._template._bodies_stub.GetEdges(EntityIdentifier(id=self.id)) return [ Edge( @@ -1190,9 +1169,7 @@ def imprint_curves( # noqa: D102 is_found = True break if not is_found: - raise ValueError( - f"Face with ID {provided_face.id} is not part of this body." - ) + raise ValueError(f"Face with ID {provided_face.id} is not part of this body.") self._template._grpc_client.log.debug( f"Imprinting curves provided on {self.id} " @@ -1202,9 +1179,7 @@ def imprint_curves( # noqa: D102 imprint_response = self._template._commands_stub.ImprintCurves( ImprintCurvesRequest( body=self._id, - curves=sketch_shapes_to_grpc_geometries( - sketch._plane, sketch.edges, sketch.faces - ), + curves=sketch_shapes_to_grpc_geometries(sketch._plane, sketch.edges, sketch.faces), faces=[face._id for face in faces], ) ) @@ -1243,9 +1218,7 @@ def project_curves( # noqa: D102 curves = sketch_shapes_to_grpc_geometries( sketch._plane, sketch.edges, sketch.faces, only_one_curve=only_one_curve ) - self._template._grpc_client.log.debug( - f"Projecting provided curves on {self.id}." - ) + self._template._grpc_client.log.debug(f"Projecting provided curves on {self.id}.") project_response = self._template._commands_stub.ProjectCurves( ProjectCurvesRequest( @@ -1281,9 +1254,7 @@ def imprint_projected_curves( # noqa: D102 curves = sketch_shapes_to_grpc_geometries( sketch._plane, sketch.edges, sketch.faces, only_one_curve=only_one_curve ) - self._template._grpc_client.log.debug( - f"Projecting provided curves on {self.id}." - ) + self._template._grpc_client.log.debug(f"Projecting provided curves on {self.id}.") response = self._template._commands_stub.ImprintProjectedCurves( ProjectCurvesRequest( @@ -1345,9 +1316,7 @@ def copy(self, parent: "Component", name: str = None) -> "Body": # noqa: D102 def tessellate( # noqa: D102 self, merge: Optional[bool] = False ) -> Union["PolyData", "MultiBlock"]: - return self._template.tessellate( - merge, self.parent_component.get_world_transform() - ) + return self._template.tessellate(merge, self.parent_component.get_world_transform()) def plot( # noqa: D102 self, @@ -1373,7 +1342,7 @@ def intersect(self, other: Union["Body", Iterable["Body"]], keep_other: bool = F self.__generic_boolean_op(other, keep_other, "intersect", "bodies do not intersect") def subtract(self, other: Union["Body", Iterable["Body"]], keep_other: bool = False) -> None: # noqa: D102 - self.__generic_boolean_op(other, keep_other,"subtract", "empty (complete) subtraction") + self.__generic_boolean_op(other, keep_other, "subtract", "empty (complete) subtraction") def unite(self, other: Union["Body", Iterable["Body"]], keep_other: bool = False) -> None: # noqa: D102 self.__generic_boolean_op(other, keep_other, "unite", "union operation failed") @@ -1415,9 +1384,7 @@ def __generic_boolean_op( all_response = [] for body2 in other: response = self._template._bodies_stub.Boolean( - BooleanRequest( - body1=self.id, body2=body2.id, method=type_bool_op - ) + BooleanRequest(body1=self.id, body2=body2.id, method=type_bool_op) ).empty_result all_response.append(response) diff --git a/src/ansys/geometry/core/designer/component.py b/src/ansys/geometry/core/designer/component.py index 3bf6aad346..866301055a 100644 --- a/src/ansys/geometry/core/designer/component.py +++ b/src/ansys/geometry/core/designer/component.py @@ -1426,7 +1426,7 @@ def plot( ... ) >>> for x, y in zip(xx.ravel(), yy.ravel()): ... sketch = Sketch(plane) - ... sketch.circle(Point2D([x, y]), 0.2*u.m) + ... sketch.circle(Point2D([x, y]), 0.2 * u.m) ... mycomp.extrude_sketch(f"body-{x}-{y}", sketch, 1 * u.m) >>> mycomp ansys.geometry.core.designer.Component 0x2203cc9ec50 diff --git a/src/ansys/geometry/core/designer/part.py b/src/ansys/geometry/core/designer/part.py index eef67c1c49..fc7e52f7bb 100644 --- a/src/ansys/geometry/core/designer/part.py +++ b/src/ansys/geometry/core/designer/part.py @@ -20,6 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. """Module providing fundamental data of an assembly.""" + from beartype.typing import TYPE_CHECKING, List from ansys.geometry.core.designer.body import MasterBody diff --git a/src/ansys/geometry/core/logger.py b/src/ansys/geometry/core/logger.py index 845df3d421..f4b4bef085 100644 --- a/src/ansys/geometry/core/logger.py +++ b/src/ansys/geometry/core/logger.py @@ -205,9 +205,9 @@ def __init__(self, logger, extra=None): # noqa: D107 def process(self, msg, kwargs): # noqa: D102 kwargs["extra"] = {} # This are the extra parameters sent to log - kwargs["extra"][ - "instance_name" - ] = self.extra.get_name() # here self.extra is the argument passed to the log records. + kwargs["extra"]["instance_name"] = ( + self.extra.get_name() + ) # here self.extra is the argument passed to the log records. return msg, kwargs def log_to_file(self, filename: str = FILE_NAME, level: int = LOG_LEVEL): @@ -241,7 +241,7 @@ def log_to_stdout(self, level=LOG_LEVEL): self.logger = add_stdout_handler(self.logger, level=level) self.std_out_handler = self.logger.std_out_handler - def setLevel(self, level="DEBUG"): # noqa: N802 + def setLevel(self, level="DEBUG"): # noqa: N802 """Change the log level of the object and the attached handlers. Parameters @@ -337,15 +337,15 @@ class Logger: created when a Geometry service instance is created. >>> from ansys.geometry.core import Modeler - >>> modeler = Modeler(loglevel='DEBUG') - >>> modeler._log.info('This is a useful message') + >>> modeler = Modeler(loglevel="DEBUG") + >>> modeler._log.info("This is a useful message") INFO - - - - This is LOG debug message. Import the global PyAnsys Geometry logger and add a file output handler. >>> import os >>> from ansys.geometry.core import LOG - >>> file_path = os.path.join(os.getcwd(), 'pyansys-geometry.log') + >>> file_path = os.path.join(os.getcwd(), "pyansys-geometry.log") >>> LOG.log_to_file(file_path) """ @@ -411,7 +411,7 @@ def log_to_file(self, filename=FILE_NAME, level=LOG_LEVEL): >>> from ansys.geometry.core import LOG >>> import os - >>> file_path = os.path.join(os.getcwd(), 'pyansys-geometry.log') + >>> file_path = os.path.join(os.getcwd(), "pyansys-geometry.log") >>> LOG.log_to_file(file_path) """ self = addfile_handler(self, filename=filename, level=level, write_headers=True) @@ -427,7 +427,7 @@ def log_to_stdout(self, level=LOG_LEVEL): """ self = add_stdout_handler(self, level=level) - def setLevel(self, level="DEBUG"): # noqa: N802 + def setLevel(self, level="DEBUG"): # noqa: N802 """Change the log level of the object and the attached handlers.""" self.logger.setLevel(level) for each_handler in self.logger.handlers: diff --git a/src/ansys/geometry/core/math/matrix.py b/src/ansys/geometry/core/math/matrix.py index 45eb78ae7a..f5c3041cb7 100644 --- a/src/ansys/geometry/core/math/matrix.py +++ b/src/ansys/geometry/core/math/matrix.py @@ -20,6 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. """Provides matrix primitive representations.""" + from beartype import beartype as check_input_types from beartype.typing import Optional, Union import numpy as np diff --git a/src/ansys/geometry/core/math/misc.py b/src/ansys/geometry/core/math/misc.py index 4b710f7036..b87899f8a1 100644 --- a/src/ansys/geometry/core/math/misc.py +++ b/src/ansys/geometry/core/math/misc.py @@ -21,7 +21,6 @@ # SOFTWARE. """Provides auxiliary math functions for PyAnsys Geometry.""" - from beartype import beartype as check_input_types from beartype.typing import Tuple, Union import numpy as np diff --git a/src/ansys/geometry/core/math/vector.py b/src/ansys/geometry/core/math/vector.py index 18f4998944..bfbe43a8fc 100644 --- a/src/ansys/geometry/core/math/vector.py +++ b/src/ansys/geometry/core/math/vector.py @@ -20,6 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. """Provides for creating and managing 2D and 3D vectors.""" + from io import UnsupportedOperation from beartype import beartype as check_input_types diff --git a/src/ansys/geometry/core/misc/accuracy.py b/src/ansys/geometry/core/misc/accuracy.py index 2c01510e0e..a18e20acfd 100644 --- a/src/ansys/geometry/core/misc/accuracy.py +++ b/src/ansys/geometry/core/misc/accuracy.py @@ -21,7 +21,6 @@ # SOFTWARE. """Provides for evaluating decimal precision.""" - import math from ansys.geometry.core.typing import Real diff --git a/src/ansys/geometry/core/misc/auxiliary.py b/src/ansys/geometry/core/misc/auxiliary.py index 101e31cefe..b7d90bf746 100644 --- a/src/ansys/geometry/core/misc/auxiliary.py +++ b/src/ansys/geometry/core/misc/auxiliary.py @@ -111,6 +111,7 @@ def get_design_from_edge(edge: "Edge") -> "Design": # Get the design of the body return get_design_from_body(body) + def __traverse_all_bodies(comp: Union["Design", "Component"]) -> List["Body"]: """Traverse all bodies in a design and all its subcomponents. @@ -138,6 +139,7 @@ def __traverse_all_bodies(comp: Union["Design", "Component"]) -> List["Body"]: return bodies + def get_bodies_from_ids(design: "Design", body_ids: List[str]) -> List["Body"]: """Find the ``Body`` objects inside a ``Design`` from its ids. @@ -179,7 +181,9 @@ def get_faces_from_ids(design: "Design", face_ids: List[str]) -> List["Face"]: List[Face] List of Face objects. """ - return [face for body in __traverse_all_bodies(design) for face in body.faces if face.id in face_ids] # noqa: E501 + return [ + face for body in __traverse_all_bodies(design) for face in body.faces if face.id in face_ids + ] # noqa: E501 def get_edges_from_ids(design: "Design", edge_ids: List[str]) -> List["Edge"]: @@ -201,4 +205,6 @@ def get_edges_from_ids(design: "Design", edge_ids: List[str]) -> List["Edge"]: List[Edge] List of Edge objects. """ - return [edge for body in __traverse_all_bodies(design) for edge in body.edges if edge.id in edge_ids] # noqa: E501 + return [ + edge for body in __traverse_all_bodies(design) for edge in body.edges if edge.id in edge_ids + ] # noqa: E501 diff --git a/src/ansys/geometry/core/misc/checks.py b/src/ansys/geometry/core/misc/checks.py index 3408c3535e..2a5559b39d 100644 --- a/src/ansys/geometry/core/misc/checks.py +++ b/src/ansys/geometry/core/misc/checks.py @@ -20,6 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. """Provides functions for performing common checks.""" + import warnings from beartype.typing import TYPE_CHECKING, Any, Iterable, Optional, Tuple, Union @@ -333,7 +334,6 @@ def wrapper(self, *args, **kwargs): comp = method_version.compare(self._grpc_client.backend_version) # if comp is 1, method version is higher than backend version. if comp == 1: - # Check if the version is "0.0.0" (i.e., the version is not available) if str(self._grpc_client.backend_version) == "0.0.0": raise GeometryRuntimeError( @@ -369,7 +369,6 @@ def deprecated_method(alternative: Optional[str] = None, info: Optional[str] = N """ def deprecated_decorator(method): - def wrapper(*args, **kwargs): msg = f"The method '{method.__name__}' is deprecated." if alternative: @@ -399,7 +398,6 @@ def deprecated_argument(arg: str, alternative: Optional[str] = None, info: Optio """ def deprecated_decorator(method): - def wrapper(*args, **kwargs): if arg in kwargs and kwargs[arg] is not None: msg = f"The argument '{arg}' in '{method.__name__}' is deprecated." diff --git a/src/ansys/geometry/core/misc/measurements.py b/src/ansys/geometry/core/misc/measurements.py index f9042ccc4d..d32198d9da 100644 --- a/src/ansys/geometry/core/misc/measurements.py +++ b/src/ansys/geometry/core/misc/measurements.py @@ -78,29 +78,29 @@ def __init__(self) -> None: self._server_angle: Unit = UNITS.radian @property - def LENGTH(self) -> Unit: # noqa: N802 + def LENGTH(self) -> Unit: # noqa: N802 """Default length unit for PyAnsys Geometry.""" return self._length @LENGTH.setter @check_input_types - def LENGTH(self, value: Unit) -> None: # noqa: N802 + def LENGTH(self, value: Unit) -> None: # noqa: N802 check_pint_unit_compatibility(value, self._length) self._length = value @property - def ANGLE(self) -> Unit: # noqa: N802 + def ANGLE(self) -> Unit: # noqa: N802 """Default angle unit for PyAnsys Geometry.""" return self._angle @ANGLE.setter @check_input_types - def ANGLE(self, value: Unit) -> None: # noqa: N802 + def ANGLE(self, value: Unit) -> None: # noqa: N802 check_pint_unit_compatibility(value, self._angle) self._angle = value @property - def SERVER_LENGTH(self) -> Unit: # noqa: N802 + def SERVER_LENGTH(self) -> Unit: # noqa: N802 """Default length unit for gRPC messages. Notes @@ -110,7 +110,7 @@ def SERVER_LENGTH(self) -> Unit: # noqa: N802 return self._server_length @property - def SERVER_AREA(self) -> Unit: # noqa: N802 + def SERVER_AREA(self) -> Unit: # noqa: N802 """Default area unit for gRPC messages. Notes @@ -120,7 +120,7 @@ def SERVER_AREA(self) -> Unit: # noqa: N802 return self._server_length * self._server_length @property - def SERVER_VOLUME(self) -> Unit: # noqa: N802 + def SERVER_VOLUME(self) -> Unit: # noqa: N802 """Default volume unit for gRPC messages. Notes @@ -130,7 +130,7 @@ def SERVER_VOLUME(self) -> Unit: # noqa: N802 return self._server_length * self._server_length * self._server_length @property - def SERVER_ANGLE(self) -> Unit: # noqa: N802 + def SERVER_ANGLE(self) -> Unit: # noqa: N802 """Default angle unit for gRPC messages. Notes diff --git a/src/ansys/geometry/core/misc/options.py b/src/ansys/geometry/core/misc/options.py index acfb67cef9..db901ada0c 100644 --- a/src/ansys/geometry/core/misc/options.py +++ b/src/ansys/geometry/core/misc/options.py @@ -20,6 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. """Provides various option classes.""" + from dataclasses import asdict, dataclass diff --git a/src/ansys/geometry/core/modeler.py b/src/ansys/geometry/core/modeler.py index ef180e87f2..78ca6e1297 100644 --- a/src/ansys/geometry/core/modeler.py +++ b/src/ansys/geometry/core/modeler.py @@ -20,6 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. """Provides for interacting with the Geometry service.""" + import logging from pathlib import Path @@ -186,7 +187,6 @@ def get_active_design(self, sync_with_backend: bool = True) -> "Design": """ for _, design in self._designs.items(): if design._is_active: - # Check if sync_with_backend is requested if sync_with_backend: design._update_design_inplace() diff --git a/src/ansys/geometry/core/plotting/plotter.py b/src/ansys/geometry/core/plotting/plotter.py index cc15e90dc0..2380eb483e 100644 --- a/src/ansys/geometry/core/plotting/plotter.py +++ b/src/ansys/geometry/core/plotting/plotter.py @@ -20,6 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. """Provides plotting for various PyAnsys Geometry objects.""" + from ansys.tools.visualization_interface import ( Color, EdgePlot, diff --git a/src/ansys/geometry/core/plotting/widgets/__init__.py b/src/ansys/geometry/core/plotting/widgets/__init__.py index b195e42a1b..b8c3798417 100644 --- a/src/ansys/geometry/core/plotting/widgets/__init__.py +++ b/src/ansys/geometry/core/plotting/widgets/__init__.py @@ -20,4 +20,5 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. """Submodule providing widgets for the PyAnsys Geometry plotter.""" + from ansys.geometry.core.plotting.widgets.show_design_point import ShowDesignPoints diff --git a/src/ansys/geometry/core/shapes/box_uv.py b/src/ansys/geometry/core/shapes/box_uv.py index a9385ce05e..554da402c3 100644 --- a/src/ansys/geometry/core/shapes/box_uv.py +++ b/src/ansys/geometry/core/shapes/box_uv.py @@ -20,6 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. """Provides the ``BoxUV`` class.""" + from enum import Enum from ansys.geometry.core.shapes.parameterization import Interval, ParamUV diff --git a/src/ansys/geometry/core/shapes/curves/__init__.py b/src/ansys/geometry/core/shapes/curves/__init__.py index ee2e523fd8..d43ada973e 100644 --- a/src/ansys/geometry/core/shapes/curves/__init__.py +++ b/src/ansys/geometry/core/shapes/curves/__init__.py @@ -20,6 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. """Provides the PyAnsys Geometry ``curves`` subpackage.""" + from ansys.geometry.core.shapes.curves.circle import Circle, CircleEvaluation from ansys.geometry.core.shapes.curves.curve import Curve from ansys.geometry.core.shapes.curves.curve_evaluation import CurveEvaluation diff --git a/src/ansys/geometry/core/shapes/curves/circle.py b/src/ansys/geometry/core/shapes/curves/circle.py index c18858a4bb..4237524f70 100644 --- a/src/ansys/geometry/core/shapes/curves/circle.py +++ b/src/ansys/geometry/core/shapes/curves/circle.py @@ -20,6 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. """Provides for creating and managing a circle.""" + from functools import cached_property from beartype import beartype as check_input_types diff --git a/src/ansys/geometry/core/shapes/curves/curve.py b/src/ansys/geometry/core/shapes/curves/curve.py index f34f5a1177..cae9f19d60 100644 --- a/src/ansys/geometry/core/shapes/curves/curve.py +++ b/src/ansys/geometry/core/shapes/curves/curve.py @@ -20,6 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. """Provides the ``Curve`` class.""" + from abc import ABC, abstractmethod from beartype.typing import TYPE_CHECKING diff --git a/src/ansys/geometry/core/shapes/curves/curve_evaluation.py b/src/ansys/geometry/core/shapes/curves/curve_evaluation.py index db84f9d898..348a996937 100644 --- a/src/ansys/geometry/core/shapes/curves/curve_evaluation.py +++ b/src/ansys/geometry/core/shapes/curves/curve_evaluation.py @@ -20,6 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. """Provides for creating and managing a curve.""" + from functools import cached_property from ansys.geometry.core.math.point import Point3D diff --git a/src/ansys/geometry/core/shapes/curves/trimmed_curve.py b/src/ansys/geometry/core/shapes/curves/trimmed_curve.py index 5f05354ac5..2d814936d4 100644 --- a/src/ansys/geometry/core/shapes/curves/trimmed_curve.py +++ b/src/ansys/geometry/core/shapes/curves/trimmed_curve.py @@ -20,6 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. """Trimmed curve class.""" + from ansys.api.geometry.v0.commands_pb2 import IntersectCurvesRequest from ansys.api.geometry.v0.commands_pb2_grpc import CommandsStub from beartype.typing import List diff --git a/src/ansys/geometry/core/shapes/surfaces/__init__.py b/src/ansys/geometry/core/shapes/surfaces/__init__.py index fcba4132e1..05f8d721d5 100644 --- a/src/ansys/geometry/core/shapes/surfaces/__init__.py +++ b/src/ansys/geometry/core/shapes/surfaces/__init__.py @@ -20,6 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. """Provides the PyAnsys Geometry ``surface`` subpackage.""" + from ansys.geometry.core.shapes.surfaces.cone import Cone, ConeEvaluation from ansys.geometry.core.shapes.surfaces.cylinder import Cylinder, CylinderEvaluation from ansys.geometry.core.shapes.surfaces.plane import PlaneEvaluation, PlaneSurface diff --git a/src/ansys/geometry/core/shapes/surfaces/plane.py b/src/ansys/geometry/core/shapes/surfaces/plane.py index 62e6e28f64..3e9e89a145 100644 --- a/src/ansys/geometry/core/shapes/surfaces/plane.py +++ b/src/ansys/geometry/core/shapes/surfaces/plane.py @@ -20,6 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. """Provides for creating and managing a cylinder.""" + from functools import cached_property from beartype import beartype as check_input_types diff --git a/src/ansys/geometry/core/shapes/surfaces/surface.py b/src/ansys/geometry/core/shapes/surfaces/surface.py index b4471edd79..9ee038c8ab 100644 --- a/src/ansys/geometry/core/shapes/surfaces/surface.py +++ b/src/ansys/geometry/core/shapes/surfaces/surface.py @@ -20,6 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. """Provides the ``Surface`` class.""" + from abc import ABC, abstractmethod from beartype.typing import TYPE_CHECKING, Tuple diff --git a/src/ansys/geometry/core/sketch/arc.py b/src/ansys/geometry/core/sketch/arc.py index 7674e0e86b..23ff954cab 100644 --- a/src/ansys/geometry/core/sketch/arc.py +++ b/src/ansys/geometry/core/sketch/arc.py @@ -385,9 +385,9 @@ def from_start_end_and_radius( raise ValueError("Radius must be a real positive value.") # Unpack the points into its coordinates (in DEFAULT_UNITS.LENGTH) - x_s, y_s = start.tolist() # Always in meters - x_e, y_e = end.tolist() # Always in meters - r0 = r1 = radius.value.m_as(UNITS.meter) # Convert to meters as well + x_s, y_s = start.tolist() # Always in meters + x_e, y_e = end.tolist() # Always in meters + r0 = r1 = radius.value.m_as(UNITS.meter) # Convert to meters as well # Compute the potential centers of the circle centers = get_two_circle_intersections(x0=x_s, y0=y_s, r0=r0, x1=x_e, y1=y_e, r1=r1) diff --git a/src/ansys/geometry/core/tools/prepare_tools.py b/src/ansys/geometry/core/tools/prepare_tools.py index 5ff905730e..5f3dbf204d 100644 --- a/src/ansys/geometry/core/tools/prepare_tools.py +++ b/src/ansys/geometry/core/tools/prepare_tools.py @@ -44,6 +44,7 @@ from ansys.geometry.core.designer.edge import Edge from ansys.geometry.core.designer.face import Face + class PrepareTools: """Prepare tools for PyAnsys Geometry. @@ -89,14 +90,14 @@ def extract_volume_from_faces( response = self._prepare_stub.ExtractVolumeFromFaces( ExtractVolumeFromFacesRequest( - sealing_faces=[EntityIdentifier(id = face.id) for face in sealing_faces], - inside_faces=[EntityIdentifier(id = face.id) for face in inside_faces], + sealing_faces=[EntityIdentifier(id=face.id) for face in sealing_faces], + inside_faces=[EntityIdentifier(id=face.id) for face in inside_faces], ) ) if response.success: bodies_ids = [created_body.id for created_body in response.created_bodies] - if (len(bodies_ids) > 0): + if len(bodies_ids) > 0: parent_design._update_design_inplace() return get_bodies_from_ids(parent_design, bodies_ids) else: @@ -134,18 +135,16 @@ def extract_volume_from_edge_loops( response = self._prepare_stub.ExtractVolumeFromEdgeLoops( ExtractVolumeFromEdgeLoopsRequest( - sealing_edges=[EntityIdentifier(id = face.id) for face in sealing_edges], - inside_faces=[EntityIdentifier(id = face.id) for face in inside_faces], + sealing_edges=[EntityIdentifier(id=face.id) for face in sealing_edges], + inside_faces=[EntityIdentifier(id=face.id) for face in inside_faces], ) ) if response.success: bodies_ids = [created_body.id for created_body in response.created_bodies] - if (len(bodies_ids) > 0): + if len(bodies_ids) > 0: parent_design._update_design_inplace() return get_bodies_from_ids(parent_design, bodies_ids) else: self._grpc_client.log.info("Failed to extract volume from edge loops...") return [] - - diff --git a/src/ansys/geometry/core/tools/problem_areas.py b/src/ansys/geometry/core/tools/problem_areas.py index eeb405672a..ab824fb53b 100644 --- a/src/ansys/geometry/core/tools/problem_areas.py +++ b/src/ansys/geometry/core/tools/problem_areas.py @@ -20,6 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. """The problem area definition.""" + from abc import abstractmethod from ansys.api.geometry.v0.repairtools_pb2 import ( diff --git a/src/ansys/geometry/core/tools/repair_tool_message.py b/src/ansys/geometry/core/tools/repair_tool_message.py index 59ceb41610..861fec3443 100644 --- a/src/ansys/geometry/core/tools/repair_tool_message.py +++ b/src/ansys/geometry/core/tools/repair_tool_message.py @@ -21,7 +21,6 @@ # SOFTWARE. """Module for repair tool message.""" - from beartype.typing import List diff --git a/tests/conftest.py b/tests/conftest.py index a01c792b25..ee21071054 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -19,7 +19,8 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -""""General testing fixtures.""" +""" "General testing fixtures.""" + import logging as deflogging # Default logging import pytest diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index 55dfe81cc2..b8bdb8f9da 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -27,6 +27,7 @@ - export ANSRV_GEO_HOST=127.0.0.1 - export ANSRV_GEO_PORT=50051 """ + import logging from pathlib import Path diff --git a/tests/integration/test_client.py b/tests/integration/test_client.py index ed1481f761..effa6465e4 100644 --- a/tests/integration/test_client.py +++ b/tests/integration/test_client.py @@ -20,6 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. """Test basic client connection.""" + from grpc import insecure_channel import pytest diff --git a/tests/integration/test_design.py b/tests/integration/test_design.py index d474f41c5f..9aed5ac511 100644 --- a/tests/integration/test_design.py +++ b/tests/integration/test_design.py @@ -1805,6 +1805,7 @@ def test_multiple_bodies_boolean_operations(modeler: Modeler): assert len(comp1.bodies) == 1 assert len(comp3.bodies) == 1 + def test_bool_operations_with_keep_other(modeler: Modeler): """Test boolean operations with keep other option.""" # Create the design and bodies @@ -1844,6 +1845,7 @@ def test_bool_operations_with_keep_other(modeler: Modeler): assert len(comp2.bodies) == 1 assert len(comp3.bodies) == 1 + def test_child_component_instances(modeler: Modeler): """Test creation of child ``Component`` instances and check the data model reflects that. diff --git a/tests/integration/test_issues.py b/tests/integration/test_issues.py index 656abbd4bb..30b0dc8c09 100644 --- a/tests/integration/test_issues.py +++ b/tests/integration/test_issues.py @@ -55,7 +55,6 @@ def test_issue_834_design_import_with_surfaces(modeler: Modeler): assert design.bodies[1].is_surface is True - def test_issue_1195_sketch_pyconus2024_voglster(): """Test sketching unexpected behavior observed in PyConUS 2024 by @voglster. @@ -93,12 +92,13 @@ def test_issue_1184_sphere_creation_crashes(modeler: Modeler): box_plane.box(Point2D([0.0, 0.0]), width=1, height=1) box = design.extrude_sketch("Matrix", box_plane, 1) - sphere_body = design.create_sphere("particle", Point3D([0.0,0.0,0.0]), Distance(0.5)) + sphere_body = design.create_sphere("particle", Point3D([0.0, 0.0, 0.0]), Distance(0.5)) assert len(design.bodies) == 2 assert design.bodies[0].name == box.name assert design.bodies[1].name == sphere_body.name + def test_issue_1304_arc_sketch_creation(): """Test that creating an arc sketch does not crash the program. diff --git a/tests/integration/test_launcher_remote.py b/tests/integration/test_launcher_remote.py index 61067ac51c..e18d8ef14b 100644 --- a/tests/integration/test_launcher_remote.py +++ b/tests/integration/test_launcher_remote.py @@ -20,6 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. """Test the PyPIM integration.""" + import os from unittest.mock import create_autospec diff --git a/tests/integration/test_logging_client.py b/tests/integration/test_logging_client.py index ab9aca44ec..4e27c5b4c8 100644 --- a/tests/integration/test_logging_client.py +++ b/tests/integration/test_logging_client.py @@ -19,7 +19,8 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -""""Testing of log module with client connection.""" +""" "Testing of log module with client connection.""" + import logging as deflogging # Default logging from pathlib import Path import re diff --git a/tests/integration/test_measurement_tools.py b/tests/integration/test_measurement_tools.py index ccebe59b93..e08222e356 100644 --- a/tests/integration/test_measurement_tools.py +++ b/tests/integration/test_measurement_tools.py @@ -19,7 +19,7 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -""""Testing of measurement tools.""" +""" "Testing of measurement tools.""" from ansys.geometry.core.misc.measurements import Distance from ansys.geometry.core.modeler import Modeler diff --git a/tests/integration/test_prepare_tools.py b/tests/integration/test_prepare_tools.py index 354dfcba30..911adf9cd0 100644 --- a/tests/integration/test_prepare_tools.py +++ b/tests/integration/test_prepare_tools.py @@ -21,7 +21,6 @@ # SOFTWARE. """Testing of prepare tools.""" - from ansys.geometry.core.modeler import Modeler from .conftest import FILES_DIR, skip_if_linux @@ -30,7 +29,8 @@ def test_volume_extract_from_faces(modeler: Modeler): """Test a volume is created from the provided faces.""" skip_if_linux( - modeler, test_volume_extract_from_faces.__name__, "prepare_tools") #Skip test on Linux + modeler, test_volume_extract_from_faces.__name__, "prepare_tools" + ) # Skip test on Linux design = modeler.open_file(FILES_DIR / "hollowCylinder.scdocx") body = design.bodies[0] @@ -40,10 +40,12 @@ def test_volume_extract_from_faces(modeler: Modeler): assert len(created_bodies) == 1 + def test_volume_extract_from_edge_loops(modeler: Modeler): """Test a volume is created from the provided edges.""" skip_if_linux( - modeler, test_volume_extract_from_edge_loops.__name__, "prepare_tools") #Skip test on Linux + modeler, test_volume_extract_from_edge_loops.__name__, "prepare_tools" + ) # Skip test on Linux design = modeler.open_file(FILES_DIR / "hollowCylinder.scdocx") body = design.bodies[0] diff --git a/tests/integration/test_repair_tools.py b/tests/integration/test_repair_tools.py index 7946d247fa..438d8d4d5d 100644 --- a/tests/integration/test_repair_tools.py +++ b/tests/integration/test_repair_tools.py @@ -19,8 +19,7 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -""""Testing of repair tools.""" - +""" "Testing of repair tools.""" from ansys.geometry.core.modeler import Modeler diff --git a/tests/integration/test_runscript.py b/tests/integration/test_runscript.py index dfe751287b..5d1f30cae8 100644 --- a/tests/integration/test_runscript.py +++ b/tests/integration/test_runscript.py @@ -35,7 +35,6 @@ # Python (.py) def test_python_simple_script(modeler: Modeler): - # Skip on Linux skip_if_linux(modeler, test_python_simple_script.__name__, "run_discovery_script_file") @@ -48,7 +47,6 @@ def test_python_simple_script(modeler: Modeler): def test_python_failing_script(modeler: Modeler): - # Skip on Linux skip_if_linux(modeler, test_python_failing_script.__name__, "run_discovery_script_file") with pytest.raises(GeometryRuntimeError): @@ -56,7 +54,6 @@ def test_python_failing_script(modeler: Modeler): def test_python_integrated_script(modeler: Modeler): - # Skip on Linux skip_if_linux(modeler, test_python_integrated_script.__name__, "run_discovery_script_file") @@ -80,7 +77,6 @@ def test_python_integrated_script(modeler: Modeler): # SpaceClaim (.scscript) def test_scscript_simple_script(modeler: Modeler): - # Skip on Linux skip_if_linux(modeler, test_scscript_simple_script.__name__, "run_discovery_script_file") @@ -95,7 +91,6 @@ def test_scscript_simple_script(modeler: Modeler): # Discovery (.dscript) def test_dscript_simple_script(modeler: Modeler): - # Skip on Linux skip_if_linux(modeler, test_dscript_simple_script.__name__, "run_discovery_script_file") diff --git a/tests/integration/test_tessellation.py b/tests/integration/test_tessellation.py index 42941b5a19..eb87cae6a1 100644 --- a/tests/integration/test_tessellation.py +++ b/tests/integration/test_tessellation.py @@ -20,6 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. """Test tessellation and plotting.""" + import pytest from ansys.geometry.core import Modeler diff --git a/tests/integration/test_trimmed_geometry.py b/tests/integration/test_trimmed_geometry.py index dbb93d8c91..eb2eb4e9b7 100644 --- a/tests/integration/test_trimmed_geometry.py +++ b/tests/integration/test_trimmed_geometry.py @@ -20,6 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. """Tests trimmed geometry.""" + from ansys.api.geometry.v0.commands_pb2 import CreateSketchLineRequest import numpy as np import pytest diff --git a/tests/test_logging.py b/tests/test_logging.py index bd86672668..4c6055c545 100644 --- a/tests/test_logging.py +++ b/tests/test_logging.py @@ -19,7 +19,8 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -""""Testing of log module.""" +""" "Testing of log module.""" + import logging as deflogging # Default logging import re diff --git a/tests/test_primitives.py b/tests/test_primitives.py index 8eb87e3cba..ba6bc515ac 100644 --- a/tests/test_primitives.py +++ b/tests/test_primitives.py @@ -700,9 +700,7 @@ def test_circle(): # Test expected errors with pytest.raises(ValueError): - _ = Circle( - origin, radius, reference=UNITVECTOR3D_X, axis=UnitVector3D([1, 1, 1]) - ) + _ = Circle(origin, radius, reference=UNITVECTOR3D_X, axis=UnitVector3D([1, 1, 1])) origin = Point3D([42, 99, 13]) radius = 200 diff --git a/tests/test_sketch.py b/tests/test_sketch.py index c0f725bdd3..8e2b1834fc 100644 --- a/tests/test_sketch.py +++ b/tests/test_sketch.py @@ -778,6 +778,7 @@ def test_polydata_methods(): assert len(pd_edges) == 1 assert len(pd_faces) == 1 + def test_arc_start_end_radius_default(): """Test arc generation from a start and an end point with a certain radius.