From 3cf3300a8c616b8f797c34811f09c5ab4b746e59 Mon Sep 17 00:00:00 2001 From: Yannick Augenstein Date: Mon, 29 Jul 2024 13:13:49 +0200 Subject: [PATCH] Update to ruff@0.5.5 --- .pre-commit-config.yaml | 2 +- poetry.lock | 43 ++++++++++++++------------- pyproject.toml | 2 +- tests/test_data/test_sim_data.py | 2 +- tidy3d/components/data/dataset.py | 2 +- tidy3d/components/field_projection.py | 13 ++------ 6 files changed, 29 insertions(+), 35 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 85a9a8615b..8440b0412a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.4.8" + rev: "v0.5.5" hooks: - id: ruff args: [ --fix ] diff --git a/poetry.lock b/poetry.lock index 210dc30213..77c0ace7ad 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand. [[package]] name = "absl-py" @@ -2637,8 +2637,8 @@ files = [ numpy = [ {version = ">=1.26.0", markers = "python_version >= \"3.12\""}, {version = ">=1.23.3", markers = "python_version >= \"3.11\" and python_version < \"3.12\""}, - {version = ">1.20", markers = "python_version < \"3.10\""}, {version = ">=1.21.2", markers = "python_version >= \"3.10\" and python_version < \"3.11\""}, + {version = ">1.20", markers = "python_version < \"3.10\""}, ] [package.extras] @@ -4436,28 +4436,29 @@ files = [ [[package]] name = "ruff" -version = "0.4.8" +version = "0.5.5" description = "An extremely fast Python linter and code formatter, written in Rust." optional = true python-versions = ">=3.7" files = [ - {file = "ruff-0.4.8-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:7663a6d78f6adb0eab270fa9cf1ff2d28618ca3a652b60f2a234d92b9ec89066"}, - {file = "ruff-0.4.8-py3-none-macosx_11_0_arm64.whl", hash = "sha256:eeceb78da8afb6de0ddada93112869852d04f1cd0f6b80fe464fd4e35c330913"}, - {file = "ruff-0.4.8-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:aad360893e92486662ef3be0a339c5ca3c1b109e0134fcd37d534d4be9fb8de3"}, - {file = "ruff-0.4.8-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:284c2e3f3396fb05f5f803c9fffb53ebbe09a3ebe7dda2929ed8d73ded736deb"}, - {file = "ruff-0.4.8-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a7354f921e3fbe04d2a62d46707e569f9315e1a613307f7311a935743c51a764"}, - {file = "ruff-0.4.8-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:72584676164e15a68a15778fd1b17c28a519e7a0622161eb2debdcdabdc71883"}, - {file = "ruff-0.4.8-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9678d5c9b43315f323af2233a04d747409d1e3aa6789620083a82d1066a35199"}, - {file = "ruff-0.4.8-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:704977a658131651a22b5ebeb28b717ef42ac6ee3b11e91dc87b633b5d83142b"}, - {file = "ruff-0.4.8-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d05f8d6f0c3cce5026cecd83b7a143dcad503045857bc49662f736437380ad45"}, - {file = "ruff-0.4.8-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:6ea874950daca5697309d976c9afba830d3bf0ed66887481d6bca1673fc5b66a"}, - {file = "ruff-0.4.8-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:fc95aac2943ddf360376be9aa3107c8cf9640083940a8c5bd824be692d2216dc"}, - {file = "ruff-0.4.8-py3-none-musllinux_1_2_i686.whl", hash = "sha256:384154a1c3f4bf537bac69f33720957ee49ac8d484bfc91720cc94172026ceed"}, - {file = "ruff-0.4.8-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:e9d5ce97cacc99878aa0d084c626a15cd21e6b3d53fd6f9112b7fc485918e1fa"}, - {file = "ruff-0.4.8-py3-none-win32.whl", hash = "sha256:6d795d7639212c2dfd01991259460101c22aabf420d9b943f153ab9d9706e6a9"}, - {file = "ruff-0.4.8-py3-none-win_amd64.whl", hash = "sha256:e14a3a095d07560a9d6769a72f781d73259655919d9b396c650fc98a8157555d"}, - {file = "ruff-0.4.8-py3-none-win_arm64.whl", hash = "sha256:14019a06dbe29b608f6b7cbcec300e3170a8d86efaddb7b23405cb7f7dcaf780"}, - {file = "ruff-0.4.8.tar.gz", hash = "sha256:16d717b1d57b2e2fd68bd0bf80fb43931b79d05a7131aa477d66fc40fbd86268"}, + {file = "ruff-0.5.5-py3-none-linux_armv6l.whl", hash = "sha256:605d589ec35d1da9213a9d4d7e7a9c761d90bba78fc8790d1c5e65026c1b9eaf"}, + {file = "ruff-0.5.5-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:00817603822a3e42b80f7c3298c8269e09f889ee94640cd1fc7f9329788d7bf8"}, + {file = "ruff-0.5.5-py3-none-macosx_11_0_arm64.whl", hash = "sha256:187a60f555e9f865a2ff2c6984b9afeffa7158ba6e1eab56cb830404c942b0f3"}, + {file = "ruff-0.5.5-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fe26fc46fa8c6e0ae3f47ddccfbb136253c831c3289bba044befe68f467bfb16"}, + {file = "ruff-0.5.5-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:4ad25dd9c5faac95c8e9efb13e15803cd8bbf7f4600645a60ffe17c73f60779b"}, + {file = "ruff-0.5.5-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f70737c157d7edf749bcb952d13854e8f745cec695a01bdc6e29c29c288fc36e"}, + {file = "ruff-0.5.5-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:cfd7de17cef6ab559e9f5ab859f0d3296393bc78f69030967ca4d87a541b97a0"}, + {file = "ruff-0.5.5-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a09b43e02f76ac0145f86a08e045e2ea452066f7ba064fd6b0cdccb486f7c3e7"}, + {file = "ruff-0.5.5-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d0b856cb19c60cd40198be5d8d4b556228e3dcd545b4f423d1ad812bfdca5884"}, + {file = "ruff-0.5.5-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3687d002f911e8a5faf977e619a034d159a8373514a587249cc00f211c67a091"}, + {file = "ruff-0.5.5-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:ac9dc814e510436e30d0ba535f435a7f3dc97f895f844f5b3f347ec8c228a523"}, + {file = "ruff-0.5.5-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:af9bdf6c389b5add40d89b201425b531e0a5cceb3cfdcc69f04d3d531c6be74f"}, + {file = "ruff-0.5.5-py3-none-musllinux_1_2_i686.whl", hash = "sha256:d40a8533ed545390ef8315b8e25c4bb85739b90bd0f3fe1280a29ae364cc55d8"}, + {file = "ruff-0.5.5-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:cab904683bf9e2ecbbe9ff235bfe056f0eba754d0168ad5407832928d579e7ab"}, + {file = "ruff-0.5.5-py3-none-win32.whl", hash = "sha256:696f18463b47a94575db635ebb4c178188645636f05e934fdf361b74edf1bb2d"}, + {file = "ruff-0.5.5-py3-none-win_amd64.whl", hash = "sha256:50f36d77f52d4c9c2f1361ccbfbd09099a1b2ea5d2b2222c586ab08885cf3445"}, + {file = "ruff-0.5.5-py3-none-win_arm64.whl", hash = "sha256:3191317d967af701f1b73a31ed5788795936e423b7acce82a2b63e26eb3e89d6"}, + {file = "ruff-0.5.5.tar.gz", hash = "sha256:cc5516bdb4858d972fbc31d246bdb390eab8df1a26e2353be2dbc0c2d7f5421a"}, ] [[package]] @@ -5540,4 +5541,4 @@ vtk = ["vtk"] [metadata] lock-version = "2.0" python-versions = ">=3.9,<4.0.0" -content-hash = "9628ba0740a5ac4eb7f4d84a206e9911dd7a0ba3a9dba28b89df3bb0719dce55" +content-hash = "08216f09c8fa651fa543bb32d2305396afde84c069e4a6059d1761e752923394" diff --git a/pyproject.toml b/pyproject.toml index f2c454382e..75a1be41b5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,7 +50,7 @@ joblib = "*" ### Optional dependencies ### # development core bump-my-version = { version = "*", optional = true } -ruff = { version = "0.4.8", optional = true } +ruff = { version = "0.5.5", optional = true } coverage = { version = "*", optional = true } dill = { version = "*", optional = true } ipython = { version = "*", optional = true } diff --git a/tests/test_data/test_sim_data.py b/tests/test_data/test_sim_data.py index 4715be9f92..d32cee36b5 100644 --- a/tests/test_data/test_sim_data.py +++ b/tests/test_data/test_sim_data.py @@ -290,7 +290,7 @@ def test_to_hdf5(tmp_path): sim_data.to_file(fname=FNAME) # Make sure data is loaded as Tidy3dDataArray and not xarray DataArray for data, data2 in zip(sim_data.data, sim_data2.data): - assert type(data) == type(data2) + assert type(data) is type(data2) assert sim_data == sim_data2 diff --git a/tidy3d/components/data/dataset.py b/tidy3d/components/data/dataset.py index 3864ce5bf3..5933ad6e32 100644 --- a/tidy3d/components/data/dataset.py +++ b/tidy3d/components/data/dataset.py @@ -2898,7 +2898,7 @@ def _check_same_coordinates( # we can have xarray.DataArray's of different types but still same coordinates # we will deal with that case separately both_xarrays = isinstance(a, xr.DataArray) and isinstance(b, xr.DataArray) - if (not both_xarrays) and type(a) != type(b): + if (not both_xarrays) and type(a) is type(b): return False if isinstance(a, UnstructuredGridDataset): diff --git a/tidy3d/components/field_projection.py b/tidy3d/components/field_projection.py index 2f5cc1dbf5..0f3db2f2ed 100644 --- a/tidy3d/components/field_projection.py +++ b/tidy3d/components/field_projection.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, List, Tuple, Union +from typing import List, Tuple, Union import numpy as np import pydantic.v1 as pydantic @@ -91,13 +91,6 @@ class FieldProjector(Tidy3dBaseModel): units=MICROMETER, ) - currents: Dict[str, xr.Dataset] = pydantic.Field( - None, - title="Surface current densities", - description="Dictionary mapping monitor name to an ``xarray.Dataset`` storing the " - "surface current densities.", - ) - @cached_property def is_2d_simulation(self) -> bool: non_zero_dims = sum(1 for size in self.sim_data.simulation.size if size != 0) @@ -362,7 +355,7 @@ def integrate_1d( pts_u: np.ndarray, ): """Trapezoidal integration in two dimensions.""" - return np.trapz(np.squeeze(function) * np.squeeze(phase), pts_u, axis=0) + return np.trapz(np.squeeze(function) * np.squeeze(phase), pts_u, axis=0) # noqa: NPY201 def integrate_2d( self, @@ -372,7 +365,7 @@ def integrate_2d( pts_v: np.ndarray, ): """Trapezoidal integration in two dimensions.""" - return np.trapz(np.trapz(np.squeeze(function) * phase, pts_u, axis=0), pts_v, axis=0) + return np.trapz(np.trapz(np.squeeze(function) * phase, pts_u, axis=0), pts_v, axis=0) # noqa: NPY201 def _far_fields_for_surface( self,