Skip to content

Commit

Permalink
Run isort
Browse files Browse the repository at this point in the history
  • Loading branch information
yaugenst-flex committed Jun 4, 2024
1 parent b76342f commit 74fce58
Show file tree
Hide file tree
Showing 225 changed files with 1,926 additions and 1,595 deletions.
2 changes: 1 addition & 1 deletion docs/_ext/custom-sitemap.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import xml.etree.ElementTree as ET
import re
import xml.etree.ElementTree as ET


def match_exclude_url(app, url):
Expand Down
3 changes: 2 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
import datetime
import os
import re
import sys
import subprocess
import sys

import tidy3d

# import sphinxcontrib.divparams as divparams
Expand Down
8 changes: 6 additions & 2 deletions docs/generate_doc.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# Generate documentation for Material Library (Python)

import numpy as np

from tidy3d import material_library as lib
from tidy3d.constants import C_0
from tidy3d.material_library.material_library import MaterialItemUniaxial, MaterialItem
from tidy3d.material_library.material_library import MaterialItem2D
from tidy3d.material_library.material_library import (
MaterialItem,
MaterialItem2D,
MaterialItemUniaxial,
)

LOW_LOSS_THRESHOLD = 2e-5

Expand Down
148 changes: 74 additions & 74 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ dev = [
'divparams',
'gdspy',
'gdstk',
'gdstk',
'grcwa',
'ipython',
'ipython',
Expand Down Expand Up @@ -220,6 +219,7 @@ typing-modules = [
"tidy3d.components.types",
] # without this Literal["something fails"]
select = [
"I", # isort
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
Expand Down
6 changes: 3 additions & 3 deletions scripts/make_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
"""

import argparse
import os
import sys
import re
import argparse
import tempfile
import subprocess
import sys
import tempfile

import tidy3d as td

Expand Down
2 changes: 1 addition & 1 deletion scripts/sample.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Generates sample simulation json and h5 files in the tests/sims folder"""
from os.path import join
import sys
from os.path import join

sys.path.append("tests")

Expand Down
1 change: 1 addition & 0 deletions scripts/schema.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Generates schema for Simulation, saves it to file."""

import json

import tidy3d

FNAME = "tidy3d/schema.json"
Expand Down
6 changes: 4 additions & 2 deletions tests/_test_data/_test_datasets_no_vtk.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
"""Tests tidy3d/components/data/dataset.py"""

import pytest
import builtins
from ..test_data.test_datasets import test_triangular_dataset as _test_triangular_dataset

import pytest

from ..test_data.test_datasets import test_tetrahedral_dataset as _test_tetrahedral_dataset
from ..test_data.test_datasets import test_triangular_dataset as _test_triangular_dataset


@pytest.fixture
Expand Down
20 changes: 8 additions & 12 deletions tests/_test_local/_test_adjoint_performance.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,25 @@
import pytest
import numpy as np
import sys
from memory_profiler import profile
import matplotlib.pyplot as plt
import time

from jax import grad

import matplotlib.pyplot as plt
import numpy as np
import pytest
import tidy3d as td

from jax import grad
from memory_profiler import profile
from tidy3d.plugins.adjoint.components.data.data_array import JaxDataArray
from tidy3d.plugins.adjoint.components.data.dataset import JaxPermittivityDataset
from tidy3d.plugins.adjoint.components.geometry import JaxBox
from tidy3d.plugins.adjoint.components.medium import JaxCustomMedium
from tidy3d.plugins.adjoint.components.structure import JaxStructure
from tidy3d.plugins.adjoint.components.simulation import JaxSimulation
from tidy3d.plugins.adjoint.components.data.data_array import JaxDataArray
from tidy3d.plugins.adjoint.components.data.dataset import JaxPermittivityDataset
from tidy3d.plugins.adjoint.components.structure import JaxStructure
from tidy3d.plugins.adjoint.web import run

from ..utils import run_emulated


sys.path.append("/users/twhughes/Documents/Flexcompute/tidy3d-core")
from tidy3d_backend.utils import Profile


EPS = 2.0
SIZE = (1.0, 2.0, 3.0)
CENTER = (2.0, -1.0, 1.0)
Expand Down
11 changes: 5 additions & 6 deletions tests/_test_local/_test_adjoint_performance_multi.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import pytest
from memory_profiler import profile
import jax
import cProfile

import jax
import jax.numpy as jnp
from ..utils import run_emulated

import pytest
import tidy3d as td
import tidy3d.plugins.adjoint as tda
from memory_profiler import profile
from tidy3d.plugins.adjoint.web import run_local as run

import cProfile
from ..utils import run_emulated

# name of the output monitor used in tests
MNT_NAME = "field"
Expand Down
15 changes: 7 additions & 8 deletions tests/_test_local/_test_data_performance.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import numpy as np
import os
import sys
from memory_profiler import profile

from tidy3d.components.data.sim_data import SimulationData
from tidy3d.components.data.monitor_data import FieldData
import numpy as np
import tidy3d as td
from memory_profiler import profile
from tidy3d.components.data.data_array import ScalarFieldDataArray
from tidy3d.components.data.monitor_data import FieldData
from tidy3d.components.data.sim_data import SimulationData
from tidy3d.components.grid.grid_spec import GridSpec
from tidy3d.components.monitor import FieldMonitor
from tidy3d.components.simulation import Simulation
from tidy3d.components.source import PointDipole, GaussianPulse
from tidy3d.components.grid.grid_spec import GridSpec

import tidy3d as td
from tidy3d.components.source import GaussianPulse, PointDipole

sys.path.append("/users/twhughes/Documents/Flexcompute/tidy3d-core")
from tidy3d_backend.utils import Profile
Expand Down
4 changes: 2 additions & 2 deletions tests/_test_local/_test_fit_web.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import numpy as np
from math import isclose

from tidy3d.plugins.fitter import StableDispersionFitter, AdvancedFitterParam
import numpy as np
from tidy3d.plugins.fitter import AdvancedFitterParam, StableDispersionFitter

np.random.seed(4)
ATOL = 1e-50
Expand Down
3 changes: 1 addition & 2 deletions tests/_test_local/_test_plugins_web.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import numpy as np

from tidy3d.plugins.fitter import StableDispersionFitter, DispersionFitter
from tidy3d.plugins.fitter import DispersionFitter, StableDispersionFitter


def test_dispersion_load_list():
Expand Down
3 changes: 2 additions & 1 deletion tests/_test_local/_test_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
from unittest import TestCase, mock

import tidy3d.web as web
from tidy3d.web.auth import get_credentials, encode_password
from tidy3d.web.auth import encode_password, get_credentials

from ..utils import SIM_FULL as sim_original

CALLBACK_URL = "https://callbackurl"
Expand Down
6 changes: 2 additions & 4 deletions tests/_test_notebooks/full_test_notebooks.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import os
import sys

import pytest

# note: these libraries throw Deprecation warnings in python 3.9, so they are ignored in pytest.ini
import nbformat
from nbconvert.preprocessors import CellExecutionError
from nbconvert.preprocessors import ExecutePreprocessor
import pytest
from nbconvert.preprocessors import CellExecutionError, ExecutePreprocessor

sys.path.append("tidy3d")

Expand Down
1 change: 0 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import pytest

import tidy3d as td


Expand Down
5 changes: 3 additions & 2 deletions tests/test_cli/full_test_develop.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
These scripts just test the CLI commands for the develop command, and verify that they run properly.
"""

import pytest
import os
from unittest.mock import patch

import pytest
from click.testing import CliRunner
from tidy3d.web.cli import tidy3d_cli
from unittest.mock import patch


@pytest.fixture
Expand Down
19 changes: 9 additions & 10 deletions tests/test_components/test_IO.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
"""Tests file export and loading."""

import os
import json

import pytest
import numpy as np
import os
from time import time

import dill as pickle
import h5py

from tidy3d import __version__
import numpy as np
import pytest
import tidy3d as td
from tidy3d import __version__
from tidy3d.components.base import DATA_ARRAY_MAP
from ..utils import SIM_FULL as SIM
from ..utils import SIM_MONITORS as SIM2
from tidy3d.components.data.sim_data import DATA_TYPE_MAP

from ..test_data.test_monitor_data import make_flux_data
from ..test_data.test_sim_data import make_sim_data
from ..utils import SIM_FULL as SIM
from ..utils import SIM_MONITORS as SIM2
from ..utils import run_emulated

from tidy3d.components.data.sim_data import DATA_TYPE_MAP

# Store an example of every minor release simulation to test updater in the future
SIM_DIR = "tests/sims"

Expand Down
4 changes: 2 additions & 2 deletions tests/test_components/test_apodization.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"""Tests mode objects."""

import pytest
import matplotlib.pyplot as plt
import pydantic.v1 as pydantic
import pytest
import tidy3d as td
import matplotlib.pyplot as plt


def test_apodization():
Expand Down
9 changes: 4 additions & 5 deletions tests/test_components/test_autograd.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
# test autograd integration into tidy3d

import pytest
import matplotlib.pylab as plt
import numpy as np
import cProfile
import typing
from importlib import reload

import autograd as ag
import autograd.numpy as anp

import matplotlib.pylab as plt
import numpy as np
import pytest
import tidy3d as td
from tidy3d.web import run_async
from tidy3d.web.api.autograd.autograd import run

from ..utils import run_emulated, SIM_FULL, AssertLogLevel
from ..utils import SIM_FULL, AssertLogLevel, run_emulated

""" Test configuration """

Expand Down
4 changes: 1 addition & 3 deletions tests/test_components/test_base.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
"""Tests the base model."""

import pytest
import numpy as np

import pytest
import tidy3d as td
from tidy3d.components.base import Tidy3dBaseModel


M = td.Medium()


Expand Down
6 changes: 3 additions & 3 deletions tests/test_components/test_bc_placement.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from tidy3d.components.bc_placement import (
StructureBoundary,
StructureStructureInterface,
MediumMediumInterface,
SimulationBoundary,
StructureBoundary,
StructureSimulationBoundary,
MediumMediumInterface,
StructureStructureInterface,
)


Expand Down
20 changes: 14 additions & 6 deletions tests/test_components/test_boundaries.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
"""Tests boundary conditions."""

import pytest
import pydantic.v1 as pydantic

import pytest
import tidy3d as td
from tidy3d.components.boundary import BoundarySpec, Boundary
from tidy3d.components.boundary import Periodic, PECBoundary, PMCBoundary, BlochBoundary
from tidy3d.components.boundary import PML, StablePML, Absorber
from tidy3d.components.boundary import (
PML,
Absorber,
BlochBoundary,
Boundary,
BoundarySpec,
PECBoundary,
Periodic,
PMCBoundary,
StablePML,
)
from tidy3d.components.source import GaussianPulse, PlaneWave, PointDipole
from tidy3d.exceptions import SetupError, DataError
from tidy3d.exceptions import DataError, SetupError

from ..utils import assert_log_level


Expand Down
Loading

0 comments on commit 74fce58

Please sign in to comment.