Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ exclude: |
repos:

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.12
rev: v0.13.3
hooks:
- id: ruff
- id: ruff-format
Expand All @@ -37,7 +37,7 @@ repos:

# This validates our github workflow files
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.33.3
rev: 0.34.0
hooks:
- id: check-github-workflows

Expand Down
1 change: 1 addition & 0 deletions doc/changelog.d/725.maintenance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Pre-commit autoupdate
1 change: 1 addition & 0 deletions examples/kernel/modify-scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
from pathlib import Path

from ansys.api.speos.sensor.v1 import camera_sensor_pb2

from ansys.speos.core import Speos, launcher
from ansys.speos.core.kernel.scene import ProtoScene
from ansys.speos.core.kernel.sensor_template import ProtoSensorTemplate
Expand Down
8 changes: 4 additions & 4 deletions src/ansys/speos/core/bsdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@
from typing import Union
import warnings

from google.protobuf.empty_pb2 import Empty
import grpc
import numpy as np

import ansys.api.speos.bsdf.v1.anisotropic_bsdf_pb2 as anisotropic_bsdf__v1__pb2
import ansys.api.speos.bsdf.v1.anisotropic_bsdf_pb2_grpc as anisotropic_bsdf__v1__pb2_grpc
import ansys.api.speos.bsdf.v1.bsdf_creation_pb2 as bsdf_creation__v1__pb2
import ansys.api.speos.bsdf.v1.bsdf_creation_pb2_grpc as bsdf_creation__v1__pb2_grpc
import ansys.api.speos.bsdf.v1.spectral_bsdf_pb2 as spectral_bsdf__v1__pb2
import ansys.api.speos.bsdf.v1.spectral_bsdf_pb2_grpc as spectral_bsdf__v1__pb2_grpc
from google.protobuf.empty_pb2 import Empty
import grpc
import numpy as np

import ansys.speos.core
from ansys.speos.core.speos import Speos

Expand Down
5 changes: 2 additions & 3 deletions src/ansys/speos/core/generic/general_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
from typing import List, Optional, Union, cast
import warnings

from ansys.tools.path import get_available_ansys_installations
import numpy as np

from ansys.speos.core.generic.constants import DEFAULT_VERSION
from ansys.tools.path import get_available_ansys_installations

_GRAPHICS_AVAILABLE = None

Expand Down Expand Up @@ -90,9 +90,8 @@ def run_if_graphics_required(warning=False):
global _GRAPHICS_AVAILABLE
if _GRAPHICS_AVAILABLE is None:
try:
import pyvista as pv # noqa: F401

from ansys.tools.visualization_interface import Plotter # noqa: F401
import pyvista as pv # noqa: F401

_GRAPHICS_AVAILABLE = True
except ImportError: # pragma: no cover
Expand Down
1 change: 1 addition & 0 deletions src/ansys/speos/core/kernel/body.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
body_pb2 as messages,
body_pb2_grpc as service,
)

from ansys.speos.core.kernel.crud import CrudItem, CrudStub
from ansys.speos.core.kernel.proto_message_utils import protobuf_message_to_str

Expand Down
2 changes: 1 addition & 1 deletion src/ansys/speos/core/kernel/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
from typing import TYPE_CHECKING, List, Optional, Union
import warnings

from ansys.api.speos.part.v1 import body_pb2, face_pb2, part_pb2
import grpc
from grpc._channel import _InactiveRpcError

from ansys.api.speos.part.v1 import body_pb2, face_pb2, part_pb2
from ansys.speos.core.generic.constants import (
DEFAULT_HOST,
DEFAULT_PORT,
Expand Down
4 changes: 2 additions & 2 deletions src/ansys/speos/core/kernel/face.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@

from typing import Iterator, List

from grpc import RpcError

from ansys.api.speos.part.v1 import (
face_pb2 as messages,
face_pb2_grpc as service,
)
from grpc import RpcError

from ansys.speos.core.generic.general_methods import min_speos_version
from ansys.speos.core.kernel.crud import CrudItem, CrudStub
from ansys.speos.core.kernel.proto_message_utils import protobuf_message_to_str
Expand Down
1 change: 1 addition & 0 deletions src/ansys/speos/core/kernel/intensity_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
intensity_pb2 as messages,
intensity_pb2_grpc as service,
)

from ansys.speos.core.kernel.crud import CrudItem, CrudStub
from ansys.speos.core.kernel.proto_message_utils import protobuf_message_to_str

Expand Down
1 change: 1 addition & 0 deletions src/ansys/speos/core/kernel/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

from ansys.api.speos.job.v2 import job_pb2 as messages, job_pb2_grpc as service
from ansys.api.speos.results.v1.ray_path_pb2 import RayPath

from ansys.speos.core.kernel.crud import CrudItem, CrudStub
from ansys.speos.core.kernel.proto_message_utils import protobuf_message_to_str

Expand Down
1 change: 1 addition & 0 deletions src/ansys/speos/core/kernel/part.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
part_pb2 as messages,
part_pb2_grpc as service,
)

from ansys.speos.core.kernel.crud import CrudItem, CrudStub
from ansys.speos.core.kernel.proto_message_utils import protobuf_message_to_str

Expand Down
1 change: 1 addition & 0 deletions src/ansys/speos/core/kernel/scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
scene_pb2 as messages,
scene_pb2_grpc as service,
)

from ansys.speos.core.kernel.crud import CrudItem, CrudStub
from ansys.speos.core.kernel.proto_message_utils import protobuf_message_to_str
from ansys.speos.core.kernel.sop_template import ProtoSOPTemplate, SOPTemplateStub
Expand Down
1 change: 1 addition & 0 deletions src/ansys/speos/core/kernel/sensor_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
sensor_pb2 as messages,
sensor_pb2_grpc as service,
)

from ansys.speos.core.kernel.crud import CrudItem, CrudStub
from ansys.speos.core.kernel.proto_message_utils import protobuf_message_to_str

Expand Down
1 change: 1 addition & 0 deletions src/ansys/speos/core/kernel/simulation_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
simulation_template_pb2 as messages,
simulation_template_pb2_grpc as service,
)

from ansys.speos.core.kernel.crud import CrudItem, CrudStub
from ansys.speos.core.kernel.proto_message_utils import protobuf_message_to_str

Expand Down
1 change: 1 addition & 0 deletions src/ansys/speos/core/kernel/sop_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from typing import List

from ansys.api.speos.sop.v1 import sop_pb2 as messages, sop_pb2_grpc as service

from ansys.speos.core.kernel.crud import CrudItem, CrudStub
from ansys.speos.core.kernel.proto_message_utils import protobuf_message_to_str

Expand Down
1 change: 1 addition & 0 deletions src/ansys/speos/core/kernel/source_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
source_pb2 as messages,
source_pb2_grpc as service,
)

from ansys.speos.core.kernel.crud import CrudItem, CrudStub
from ansys.speos.core.kernel.proto_message_utils import protobuf_message_to_str

Expand Down
1 change: 1 addition & 0 deletions src/ansys/speos/core/kernel/spectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
spectrum_pb2 as messages,
spectrum_pb2_grpc as service,
)

from ansys.speos.core.kernel.crud import CrudItem, CrudStub
from ansys.speos.core.kernel.proto_message_utils import protobuf_message_to_str

Expand Down
1 change: 1 addition & 0 deletions src/ansys/speos/core/kernel/vop_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from typing import List

from ansys.api.speos.vop.v1 import vop_pb2 as messages, vop_pb2_grpc as service

from ansys.speos.core.kernel.crud import CrudItem, CrudStub
from ansys.speos.core.kernel.proto_message_utils import protobuf_message_to_str

Expand Down
1 change: 1 addition & 0 deletions src/ansys/speos/core/lxp.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

import ansys.api.speos.lpf.v2.lpf_file_reader_pb2 as lpf_file_reader__v2__pb2
import ansys.api.speos.lpf.v2.lpf_file_reader_pb2_grpc as lpf_file_reader__v2__pb2_grpc

from ansys.speos.core.generic.general_methods import graphics_required, wavelength_to_rgb
from ansys.speos.core.project import Project, Speos

Expand Down
6 changes: 2 additions & 4 deletions src/ansys/speos/core/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,8 @@
raise err

if TYPE_CHECKING: # pragma: no cover
import pyvista as pv

from ansys.tools.visualization_interface import Plotter
import pyvista as pv


class Project:
Expand Down Expand Up @@ -1035,9 +1034,8 @@ def _create_preview(self, viz_args=None) -> Plotter:
- {'style': 'surface', 'color':'white'},
- {'opacity': 0.7, 'color':'white', 'show_edges': False},
"""
import pyvista as pv

from ansys.tools.visualization_interface import Plotter
import pyvista as pv

def find_all_subparts(target_part):
subparts = []
Expand Down
2 changes: 1 addition & 1 deletion src/ansys/speos/core/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
import uuid
import warnings

from ansys.api.speos.sensor.v1 import camera_sensor_pb2, common_pb2, sensor_pb2
import grpc
import numpy as np

from ansys.api.speos.sensor.v1 import camera_sensor_pb2, common_pb2, sensor_pb2
import ansys.speos.core as core
import ansys.speos.core.generic.general_methods as general_methods
from ansys.speos.core.generic.visualization_methods import _VisualData, local2absolute
Expand Down
1 change: 1 addition & 0 deletions src/ansys/speos/core/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
from ansys.api.speos.job.v2.job_pb2 import Result
from ansys.api.speos.scene.v2 import scene_pb2 as messages
from ansys.api.speos.simulation.v1 import simulation_template_pb2

from ansys.speos.core.generic.general_methods import min_speos_version
from ansys.speos.core.kernel.job import ProtoJob
from ansys.speos.core.kernel.proto_message_utils import protobuf_message_to_str
Expand Down
2 changes: 1 addition & 1 deletion src/ansys/speos/core/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
from typing import List, Mapping, Optional, Union
import uuid

from ansys.api.speos.scene.v2 import scene_pb2
import numpy as np

from ansys.api.speos.scene.v2 import scene_pb2
from ansys.speos.core import (
project as project,
proto_message_utils as proto_message_utils,
Expand Down
2 changes: 1 addition & 1 deletion tests/core/test_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
import math
from pathlib import Path

from ansys.api.speos.sensor.v1 import camera_sensor_pb2
import pytest

from ansys.api.speos.sensor.v1 import camera_sensor_pb2
from ansys.speos.core import Body, GeoRef, Project, Speos, sensor
from ansys.speos.core.sensor import (
Sensor3DIrradiance,
Expand Down
2 changes: 1 addition & 1 deletion tests/core/test_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@

from pathlib import Path

from ansys.api.speos.simulation.v1 import simulation_template_pb2
import pytest

from ansys.api.speos.simulation.v1 import simulation_template_pb2
from ansys.speos.core import Body, GeoRef, Project, Speos
from ansys.speos.core.sensor import BaseSensor, Sensor3DIrradiance, SensorIrradiance
from ansys.speos.core.simulation import (
Expand Down
2 changes: 1 addition & 1 deletion tests/kernel/test_intensity_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@

from pathlib import Path

from ansys.api.speos.common.v1 import data_pb2
import pytest

from ansys.api.speos.common.v1 import data_pb2
from ansys.speos.core.kernel.intensity_template import ProtoIntensityTemplate
from ansys.speos.core.speos import Speos
from tests.conftest import test_path
Expand Down
4 changes: 2 additions & 2 deletions tests/kernel/test_scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
from pathlib import Path
from typing import List, Mapping, Optional

from ansys.api.speos.sensor.v1 import common_pb2, irradiance_sensor_pb2
from ansys.api.speos.simulation.v1 import simulation_template_pb2
import numpy as np
import pytest

from ansys.api.speos.sensor.v1 import common_pb2, irradiance_sensor_pb2
from ansys.api.speos.simulation.v1 import simulation_template_pb2
from ansys.speos.core.kernel.body import ProtoBody
from ansys.speos.core.kernel.face import FaceStub, ProtoFace
from ansys.speos.core.kernel.intensity_template import ProtoIntensityTemplate
Expand Down
1 change: 1 addition & 0 deletions tests/kernel/test_sensor_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
common_pb2,
irradiance_sensor_pb2,
)

from ansys.speos.core.kernel.sensor_template import ProtoSensorTemplate
from ansys.speos.core.speos import Speos
from tests.conftest import test_path
Expand Down
1 change: 1 addition & 0 deletions tests/kernel/test_simulation_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"""Test basic sop template database connection."""

from ansys.api.speos.simulation.v1 import simulation_template_pb2

from ansys.speos.core.kernel.simulation_template import ProtoSimulationTemplate
from ansys.speos.core.speos import Speos

Expand Down
2 changes: 1 addition & 1 deletion tests/kernel/test_source_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
import json
from pathlib import Path

from ansys.api.speos.common.v1 import data_pb2
import grpc
import pytest

from ansys.api.speos.common.v1 import data_pb2
from ansys.speos.core.kernel.intensity_template import ProtoIntensityTemplate
from ansys.speos.core.kernel.source_template import ProtoSourceTemplate
from ansys.speos.core.kernel.spectrum import ProtoSpectrum
Expand Down
4 changes: 2 additions & 2 deletions tests/stubs/test_anisotropic_bsdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
import math
from pathlib import Path

from google.protobuf.empty_pb2 import Empty

import ansys.api.speos.bsdf.v1.anisotropic_bsdf_pb2 as anisotropic_bsdf__v1__pb2
import ansys.api.speos.bsdf.v1.anisotropic_bsdf_pb2_grpc as anisotropic_bsdf__v1__pb2_grpc
from google.protobuf.empty_pb2 import Empty

from ansys.speos.core.speos import Speos
from tests.conftest import test_path
import tests.helper as helper
Expand Down
1 change: 1 addition & 0 deletions tests/stubs/test_bsdf_creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

import ansys.api.speos.bsdf.v1.bsdf_creation_pb2 as bsdf_creation__v1__pb2
import ansys.api.speos.bsdf.v1.bsdf_creation_pb2_grpc as bsdf_creation__v1__pb2_grpc

from ansys.speos.core.speos import Speos
from tests.conftest import test_path
import tests.helper as helper
Expand Down
1 change: 1 addition & 0 deletions tests/stubs/test_eulumdat_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
eulumdat_pb2,
eulumdat_pb2_grpc,
)

from ansys.speos.core.speos import Speos
from tests.conftest import test_path
import tests.helper as helper
Expand Down
1 change: 1 addition & 0 deletions tests/stubs/test_file_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import ansys.api.speos.file.v1.file_transfer as file_transfer_helper__v1
import ansys.api.speos.file.v1.file_transfer_pb2 as file_transfer__v1__pb2
import ansys.api.speos.file.v1.file_transfer_pb2_grpc as file_transfer__v1__pb2_grpc

from ansys.speos.core.speos import Speos
from tests.conftest import local_test_path

Expand Down
1 change: 1 addition & 0 deletions tests/stubs/test_ies_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from pathlib import Path

from ansys.api.speos.intensity_distributions.v1 import ies_pb2, ies_pb2_grpc

from ansys.speos.core.speos import Speos
from tests.conftest import test_path
import tests.helper as helper
Expand Down
4 changes: 2 additions & 2 deletions tests/stubs/test_lpf_file_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@

from pathlib import Path

import pytest

import ansys.api.speos.file.v1.file_transfer as file_transfer_helper__v1
import ansys.api.speos.file.v1.file_transfer_pb2 as file_transfer__v1__pb2
import ansys.api.speos.file.v1.file_transfer_pb2_grpc as file_transfer__v1__pb2_grpc
import ansys.api.speos.lpf.v2.lpf_file_reader_pb2 as lpf_file_reader__v2__pb2
import ansys.api.speos.lpf.v2.lpf_file_reader_pb2_grpc as lpf_file_reader__v2__pb2_grpc
import pytest

from ansys.speos.core.speos import Speos
from tests.conftest import local_test_path, test_path

Expand Down
4 changes: 2 additions & 2 deletions tests/stubs/test_spectral_bsdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
import math
from pathlib import Path

from google.protobuf.empty_pb2 import Empty

import ansys.api.speos.bsdf.v1.spectral_bsdf_pb2 as spectral_bsdf__v1__pb2
import ansys.api.speos.bsdf.v1.spectral_bsdf_pb2_grpc as spectral_bsdf__v1__pb2_grpc
from google.protobuf.empty_pb2 import Empty

from ansys.speos.core.speos import Speos
from tests.conftest import test_path
import tests.helper as helper
Expand Down
Loading