fix: Automated ruff fixes.

uv-refactor
Sofus Albert Høgsbro Rose 2024-10-02 13:08:40 +02:00
parent 06ad0d62a5
commit fdcd52e937
Signed by: so-rose
GPG Key ID: AD901CB0F3701434
82 changed files with 28 additions and 103 deletions

View File

@ -20,7 +20,7 @@ repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.4.3
rev: v0.6.8
hooks:
# ruff lint
#- id: ruff
@ -29,8 +29,18 @@ repos:
- id: ruff-format
- repo: https://github.com/commitizen-tools/commitizen
rev: master
rev: v3.29.1
hooks:
- id: commitizen
- id: commitizen-branch
stages: [push]
- repo: local
hooks:
- id: pytest
name: pytest
entry: ./.venv/bin/pytest tests
language: system
types: [python]
pass_filenames: false
always_run: true

View File

@ -126,7 +126,7 @@ def write_modifier_geonodes(
modifier_altered = True
## TODO: More fine-grained alterations?
return modifier_altered # noqa: RET504
return modifier_altered
####################

View File

@ -38,7 +38,6 @@ Attributes:
"""
import bpy
from blender_maxwell.utils import logger as _logger
from . import contracts as ct

View File

@ -41,7 +41,6 @@ import jax.numpy as jnp
import sympy.physics.units as spu
import tidy3d as td
import xarray
from blender_maxwell.utils import bl_cache, logger, sim_symbols
from ... import contracts as ct

View File

@ -37,7 +37,6 @@ import typing as typ
import bpy
import sympy as sp
from blender_maxwell.utils import bl_cache, logger, sim_symbols
from blender_maxwell.utils import sympy_extra as spux

View File

@ -35,7 +35,6 @@
import typing as typ
import bpy
from blender_maxwell.utils import bl_cache, logger
from blender_maxwell.utils import sympy_extra as spux

View File

@ -38,7 +38,6 @@ See `blender_maxwell.maxwell_sim_nodes.math_system` for the actual mathematics i
import typing as typ
import bpy
from blender_maxwell.utils import bl_cache, logger
from blender_maxwell.utils import sympy_extra as spux

View File

@ -39,7 +39,6 @@ import bpy
import jax
import jax.numpy as jnp
import numpy as np
from blender_maxwell.utils import bl_cache, logger, sim_symbols
from .... import contracts as ct

View File

@ -37,7 +37,6 @@ import typing as typ
import bpy
import sympy as sp
from blender_maxwell.utils import bl_cache, logger, sim_symbols
from blender_maxwell.utils import sympy_extra as spux

View File

@ -38,10 +38,9 @@ import jaxtyping as jtyp
import matplotlib.axis as mpl_ax
import sympy as sp
import sympy.physics.units as spu
from frozendict import frozendict
from blender_maxwell.utils import bl_cache, image_ops, logger, sim_symbols
from blender_maxwell.utils import sympy_extra as spux
from frozendict import frozendict
from ... import contracts as ct
from ... import managed_objs, sockets

View File

@ -43,7 +43,6 @@ from collections import defaultdict
from types import MappingProxyType
import bpy
from blender_maxwell.utils import bl_cache, bl_instance, logger
from blender_maxwell.utils import sympy_extra as spux

View File

@ -36,14 +36,11 @@ import typing as typ
import uuid
from collections import defaultdict
from fractions import Fraction
from types import MappingProxyType
import bpy
import jax
import numpy as np
import pydantic as pyd
import sympy as sp
from blender_maxwell.utils import logger
from blender_maxwell.utils import sympy_extra as spux
from blender_maxwell.utils.frozendict import FrozenDict, frozendict

View File

@ -36,10 +36,9 @@ import typing as typ
import bpy
import sympy as sp
from frozendict import frozendict
from blender_maxwell.utils import bl_cache, sci_constants, sim_symbols
from blender_maxwell.utils import sympy_extra as spux
from frozendict import frozendict
from .... import contracts as ct
from .... import sockets

View File

@ -38,7 +38,6 @@ from fractions import Fraction
import bpy
import sympy as sp
from blender_maxwell.utils import bl_cache, logger, sim_symbols
from blender_maxwell.utils import sympy_extra as spux

View File

@ -39,7 +39,6 @@ from pathlib import Path
import bpy
import sympy as sp
import tidy3d as td
from blender_maxwell.utils import bl_cache, logger, sim_symbols
from blender_maxwell.utils import sympy_extra as spux

View File

@ -37,7 +37,6 @@ from pathlib import Path
import bpy
import tidy3d as td
from blender_maxwell.utils import bl_cache, logger
from .... import contracts as ct

View File

@ -37,7 +37,6 @@ import typing as typ
import bpy
import sympy as sp
import sympy.physics.units as spu
from blender_maxwell.utils import bl_cache, logger
from blender_maxwell.utils import sympy_extra as spux

View File

@ -36,7 +36,6 @@ import typing as typ
import bpy
import tidy3d as td
from blender_maxwell.services import tdcloud
from blender_maxwell.utils import bl_cache, logger, sim_symbols
from blender_maxwell.utils import sympy_extra as spux

View File

@ -40,11 +40,10 @@ import bpy
import sympy as sp
import sympy.physics.units as spu
import tidy3d as td
from tidy3d.material_library.material_library import MaterialItem as Tidy3DMediumItem
from tidy3d.material_library.material_library import VariantItem as Tidy3DMediumVariant
from blender_maxwell.utils import bl_cache, logger, sci_constants
from blender_maxwell.utils import sympy_extra as spux
from tidy3d.material_library.material_library import MaterialItem as Tidy3DMediumItem
from tidy3d.material_library.material_library import VariantItem as Tidy3DMediumVariant
from ... import contracts as ct
from ... import managed_objs, sockets

View File

@ -36,7 +36,6 @@ import functools
import typing as typ
import tidy3d as td
from blender_maxwell.utils import logger
from blender_maxwell.utils import sympy_extra as spux

View File

@ -36,7 +36,6 @@ import typing as typ
import bpy
import tidy3d as td
from blender_maxwell.utils import logger
from blender_maxwell.utils import sympy_extra as spux

View File

@ -36,7 +36,6 @@ import typing as typ
import bpy
import tidy3d as td
from blender_maxwell.utils import logger
from blender_maxwell.utils import sympy_extra as spux

View File

@ -36,7 +36,6 @@ import bpy
import sympy.physics.units as spu
import tidy3d as td
import tidy3d.plugins.dispersion as td_dispersion
from blender_maxwell.utils import bl_cache, logger
from blender_maxwell.utils import sympy_extra as spux

View File

@ -36,7 +36,6 @@ import bpy
import sympy as sp
import sympy.physics.units as spu
import tidy3d as td
from blender_maxwell.assets.geonodes import GeoNodes, import_geonodes
from blender_maxwell.utils import bl_cache, logger
from blender_maxwell.utils import sympy_extra as spux

View File

@ -39,7 +39,6 @@ import bpy
import sympy as sp
import sympy.physics.units as spu
import tidy3d as td
from blender_maxwell.assets.geonodes import GeoNodes, import_geonodes
from blender_maxwell.utils import bl_cache, logger
from blender_maxwell.utils import sympy_extra as spux

View File

@ -34,7 +34,6 @@ import typing as typ
import sympy as sp
import tidy3d as td
from blender_maxwell.assets.geonodes import GeoNodes, import_geonodes
from blender_maxwell.utils import logger
from blender_maxwell.utils import sympy_extra as spux

View File

@ -34,7 +34,6 @@ import typing as typ
from pathlib import Path
import bpy
from blender_maxwell.utils import bl_cache, logger
from blender_maxwell.utils import sympy_extra as spux

View File

@ -115,10 +115,9 @@ class JSONFileExporterNode(base.MaxwellSimNode):
return data.json()
# Pydantic Models: Call .model_dump_json()
elif isinstance(data, pyd.BaseModel):
if isinstance(data, pyd.BaseModel):
return data.model_dump_json()
else:
json.dumps(data)

View File

@ -35,7 +35,6 @@ import typing as typ
import bpy
import sympy as sp
import tidy3d as td
from blender_maxwell.utils import bl_cache, logger
from blender_maxwell.utils import sympy_extra as spux

View File

@ -36,7 +36,6 @@ import typing as typ
import bpy
import tidy3d as td
from blender_maxwell.services import tdcloud
from blender_maxwell.utils import bl_cache, logger, sim_symbols

View File

@ -37,7 +37,6 @@ import typing as typ
import bpy
import sympy as sp
import tidy3d as td
from blender_maxwell.utils import logger
from blender_maxwell.utils import sympy_extra as spux

View File

@ -36,7 +36,6 @@ import typing as typ
import bpy
import tidy3d as td
from blender_maxwell.utils import bl_cache, logger
from .... import contracts as ct

View File

@ -37,7 +37,6 @@ import typing as typ
import bpy
import sympy as sp
import tidy3d as td
from blender_maxwell.utils import logger
from blender_maxwell.utils import sympy_extra as spux

View File

@ -35,7 +35,6 @@
import typing as typ
import tidy3d as td
from blender_maxwell.utils import logger
from ... import contracts as ct

View File

@ -36,12 +36,9 @@ import itertools
import typing as typ
import bpy
import jax
import numpy as np
import sympy as sp
import sympy.physics.units as spu
import tidy3d as td
from blender_maxwell.utils import bl_cache, logger, sim_symbols
from blender_maxwell.utils import sympy_extra as spux
from blender_maxwell.utils.frozendict import frozendict

View File

@ -36,7 +36,6 @@ import typing as typ
import sympy as sp
import sympy.physics.units as spu
from blender_maxwell.assets.geonodes import GeoNodes, import_geonodes
from blender_maxwell.utils import logger
from blender_maxwell.utils import sympy_extra as spux

View File

@ -36,7 +36,6 @@ import typing as typ
import sympy.physics.units as spu
import tidy3d as td
from blender_maxwell.utils import logger
from ... import contracts as ct

View File

@ -36,7 +36,6 @@ import typing as typ
import sympy.physics.units as spu
import tidy3d as td
from blender_maxwell.utils import logger
from .... import contracts as ct

View File

@ -36,7 +36,6 @@ import typing as typ
import sympy.physics.units as spu
import tidy3d as td
from blender_maxwell.utils import logger
from .... import contracts as ct

View File

@ -35,7 +35,6 @@
import typing as typ
import bpy
from blender_maxwell.services import tdcloud
from blender_maxwell.utils import bl_cache, logger
from blender_maxwell.utils import sympy_extra as spux

View File

@ -38,7 +38,6 @@ import typing as typ
import bpy
import sympy as sp
import tidy3d as td
from blender_maxwell.utils import bl_cache, logger
from blender_maxwell.utils import sympy_extra as spux
from blender_maxwell.utils.frozendict import frozendict

View File

@ -37,7 +37,6 @@ import typing as typ
import bpy
import sympy as sp
import tidy3d as td
from blender_maxwell.assets.geonodes import GeoNodes, import_geonodes
from blender_maxwell.utils import bl_cache, logger
from blender_maxwell.utils import sympy_extra as spux

View File

@ -35,7 +35,6 @@
import typing as typ
import tidy3d as td
from blender_maxwell.utils import bl_cache, logger
from blender_maxwell.utils import sympy_extra as spux
from blender_maxwell.utils.frozendict import frozendict

View File

@ -37,7 +37,6 @@ import typing as typ
import bpy
import sympy as sp
import tidy3d as td
from blender_maxwell.assets.geonodes import GeoNodes, import_geonodes
from blender_maxwell.utils import bl_cache, logger
from blender_maxwell.utils import sympy_extra as spux

View File

@ -37,7 +37,6 @@ import typing as typ
import bpy
import sympy as sp
import tidy3d as td
from blender_maxwell.assets.geonodes import GeoNodes, import_geonodes
from blender_maxwell.utils import bl_cache, logger
from blender_maxwell.utils import sympy_extra as spux

View File

@ -40,14 +40,13 @@ import numpy as np
import sympy as sp
import sympy.physics.units as spu
import tidy3d as td
from blender_maxwell.utils import bl_cache, logger, sim_symbols
from blender_maxwell.utils import sympy_extra as spux
from tidy3d.components.data.data_array import TimeDataArray as td_TimeDataArray
from tidy3d.components.data.dataset import TimeDataset as td_TimeDataset
from blender_maxwell.utils import bl_cache, logger, sim_symbols
from blender_maxwell.utils import sympy_extra as spux
from ... import contracts as ct
from ... import managed_objs, sockets
from ... import sockets
from .. import base, events
log = logger.get(__name__)

View File

@ -38,7 +38,6 @@ import typing as typ
import sympy as sp
import sympy.physics.units as spu
import tidy3d as td
from blender_maxwell.utils import logger
from blender_maxwell.utils import sympy_extra as spux

View File

@ -37,7 +37,6 @@ import typing as typ
import sympy as sp
import sympy.physics.units as spu
import tidy3d as td
from blender_maxwell.assets.geonodes import GeoNodes, import_geonodes
from blender_maxwell.utils import logger
from blender_maxwell.utils import sympy_extra as spux

View File

@ -37,7 +37,6 @@ import typing as typ
import sympy as sp
import sympy.physics.units as spu
import tidy3d as td
from blender_maxwell.assets.geonodes import GeoNodes, import_geonodes
from blender_maxwell.utils import logger
from blender_maxwell.utils import sympy_extra as spux

View File

@ -37,7 +37,6 @@ import typing as typ
import sympy as sp
import sympy.physics.units as spu
import tidy3d as td
from blender_maxwell.assets.geonodes import GeoNodes, import_geonodes
from blender_maxwell.utils import logger
from blender_maxwell.utils import sympy_extra as spux

View File

@ -35,7 +35,6 @@ import typing as typ
import bpy
import sympy as sp
from blender_maxwell.utils import bl_cache, logger
from ... import contracts as ct

View File

@ -33,11 +33,7 @@
import typing as typ
import bpy
import sympy as sp
import tidy3d as td
from blender_maxwell.utils import bl_cache, logger
from blender_maxwell.utils import sympy_extra as spux
from ... import contracts as ct
from ... import sockets

View File

@ -38,7 +38,6 @@ import bpy
import jax.numpy as jnp
import sympy as sp
import sympy.physics.units as spu
from blender_maxwell.utils import bl_cache, logger, sci_constants, sim_symbols
from blender_maxwell.utils import sympy_extra as spux

View File

@ -35,7 +35,6 @@ import typing as typ
import bpy
import pydantic as pyd
from blender_maxwell.utils import bl_cache, bl_instance, logger, serialize
from .. import contracts as ct

View File

@ -31,7 +31,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import bpy
from blender_maxwell.utils import bl_cache
from ... import contracts as ct

View File

@ -33,7 +33,6 @@
from pathlib import Path
import bpy
from blender_maxwell.utils import bl_cache, logger
from ... import contracts as ct

View File

@ -31,7 +31,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import bpy
from blender_maxwell.utils import bl_cache
from ... import contracts as ct

View File

@ -31,7 +31,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import bpy
from blender_maxwell.utils import bl_cache, logger
from ... import contracts as ct

View File

@ -31,8 +31,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import bpy
from blender_maxwell.utils import bl_cache, logger
from blender_maxwell.utils import bl_cache
from ... import contracts as ct
from .. import base

View File

@ -31,8 +31,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import bpy
from blender_maxwell.utils import bl_cache, logger
from blender_maxwell.utils import bl_cache
from ... import contracts as ct
from .. import base

View File

@ -31,7 +31,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import bpy
from blender_maxwell.utils import bl_cache, logger
from ... import contracts as ct

View File

@ -31,7 +31,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import bpy
from blender_maxwell.utils import bl_cache, logger
from ... import contracts as ct

View File

@ -38,7 +38,6 @@ import typing as typ
import bpy
import pydantic as pyd
import sympy as sp
from blender_maxwell.utils import bl_cache, logger, sim_symbols
from blender_maxwell.utils import sympy_extra as spux
from blender_maxwell.utils.frozendict import frozendict

View File

@ -33,7 +33,6 @@
import bpy
import pydantic as pyd
import tidy3d as td
from blender_maxwell.utils import bl_cache, logger
from ... import contracts as ct

View File

@ -34,7 +34,6 @@
import bpy
import tidy3d as td
from blender_maxwell.utils import bl_cache, logger
from ... import contracts as ct

View File

@ -30,7 +30,6 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import typing as typ
from ... import contracts as ct
from .. import base

View File

@ -35,7 +35,6 @@ import scipy as sc
import sympy as sp
import sympy.physics.units as spu
import tidy3d as td
from blender_maxwell.utils import bl_cache, logger, sim_symbols
from blender_maxwell.utils import sympy_extra as spux

View File

@ -30,7 +30,6 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import typing as typ
from ... import contracts as ct
from .. import base

View File

@ -32,7 +32,6 @@
import bpy
import tidy3d as td
from blender_maxwell.utils import bl_cache, logger
from ... import contracts as ct

View File

@ -34,7 +34,6 @@ import bpy
import sympy as sp
import sympy.physics.optics.polarization as spo_pol
import sympy.physics.units as spu
from blender_maxwell.utils import sympy_extra as spux
from ... import contracts as ct

View File

@ -35,7 +35,6 @@
import enum
import bpy
from blender_maxwell.services import tdcloud
from blender_maxwell.utils import bl_cache

View File

@ -16,7 +16,6 @@
import dataclasses
import typing as typ
from types import MappingProxyType
from ..socket_types import SocketType
from .flow_kinds import FlowKind

View File

@ -36,7 +36,6 @@ import typing as typ
import jax.lax as jlax
import jax.numpy as jnp
from blender_maxwell.utils import logger, sim_symbols
from .. import contracts as ct
@ -158,7 +157,7 @@ class FilterOperation(enum.StrEnum):
## -> Mathematically valid (I suppose) for 2. But not so useful.
# if any(
# (dim.has_idx_discrete(dim) or dim.has_idx_labels(dim))
# and len(dim_idx) > 5 # noqa: PLR2004
# and len(dim_idx) > 5
# for dim, dim_idx in info.dims.items()
# ):
# ops += [FO.ZScore15, FO.ZScore30]

View File

@ -39,7 +39,6 @@ import jax.numpy as jnp
import jaxtyping as jtyp
import sympy as sp
import sympy.physics.units as spu
from blender_maxwell.utils import logger, sim_symbols
from blender_maxwell.utils import sympy_extra as spux

View File

@ -39,7 +39,6 @@ import typing as typ
import jax.numpy as jnp
import sympy as sp
import sympy.physics.units as spu
from blender_maxwell.utils import logger, sim_symbols
from blender_maxwell.utils import sympy_extra as spux
@ -76,7 +75,7 @@ PT = spux.PhysicalType
# for ax_l, ax_r in itertools.zip_longest(
# expanded_shape_l, expanded_shape_r, fillvalue=1
# ):
# if ax_l == 1 or ax_r == 1 or ax_l == ax_r: # noqa: PLR1714
# if ax_l == 1 or ax_r == 1 or ax_l == ax_r:
# new_shape.append(max([ax_l, ax_r]))
# else:
# return None

View File

@ -36,7 +36,6 @@ import typing as typ
import jax.numpy as jnp
import jaxtyping as jtyp
import sympy as sp
from blender_maxwell.utils import logger, sim_symbols
from blender_maxwell.utils import sympy_extra as spux

View File

@ -36,7 +36,6 @@ import typing as typ
import jax.numpy as jnp
import jaxtyping as jtyp
import sympy as sp
from blender_maxwell.utils import logger, sci_constants, sim_symbols
from blender_maxwell.utils import sympy_extra as spux

View File

@ -50,6 +50,7 @@ from blender_maxwell.utils import logger, sim_symbols
from blender_maxwell.utils import sympy_extra as spux
from .flow_kinds.info import InfoFlow
## TODO: Use a Protocol interface from data_pipelines/
log = logger.get(__name__)

View File

@ -40,7 +40,6 @@ from fractions import Fraction
import jax
import jaxtyping as jtyp
import sympy as sp
from blender_maxwell import contracts as ct
from .. import logger

View File

@ -34,7 +34,6 @@ import enum
import typing as typ
import sympy as sp
from blender_maxwell import contracts as ct

View File

@ -37,7 +37,6 @@ import functools
import typing as typ
import sympy.physics.units as spu
from blender_maxwell import contracts as ct
from ..staticproperty import staticproperty

View File

@ -30,7 +30,6 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import typing as typ
import sympy as sp
import sympy.physics.units as spu