Skip to content

Commit 1cd1bb9

Browse files
committed
Update black version
1 parent a3831af commit 1cd1bb9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+18
-219
lines changed

make_script.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717

1818
def main(args):
19-
2019
parser = argparse.ArgumentParser(description="Generate tidy3d script from a simulation file.")
2120

2221
parser.add_argument(

requirements/dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
# required for development
1111
pre-commit
12-
black==22.3.0
12+
black==23.12.1
1313
ruff
1414
tox
1515
pytest

tests/_test_local/_test_adjoint_performance.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@ def f(eps_values):
167167

168168

169169
def test_time_custom_medium(use_emulated_run):
170-
171170
num_tests = 50
172171
nxs = np.logspace(0, 2.0, num_tests)
173172
times_sec = np.zeros(num_tests)

tests/_test_local/_test_data_performance.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ def test_memory_2_load():
8282

8383

8484
def test_core_profile_small_1_save():
85-
8685
Nx, Ny, Nz, Nt = 100, 100, 100, 10
8786

8887
x = np.arange(Nx)
@@ -99,14 +98,12 @@ def test_core_profile_small_1_save():
9998

10099

101100
def test_core_profile_small_2_load():
102-
103101
with Profile():
104102
print(f"file_size = {os.path.getsize(PATH):.2e} Bytes")
105103
data = td.FieldTimeData.from_file(PATH)
106104

107105

108106
def test_core_profile_large():
109-
110107
sim_data = make_sim_data_1()
111108

112109
with Profile():
@@ -120,7 +117,6 @@ def test_core_profile_large():
120117

121118
@profile
122119
def test_speed_many_datasets():
123-
124120
Nx, Ny, Nz, Nf = 100, 100, 100, 1
125121

126122
x = np.arange(Nx)
@@ -162,7 +158,6 @@ def make_field_data(num_index: int):
162158
)
163159

164160
with Profile():
165-
166161
sim_data.to_file(PATH)
167162
sim_data2 = sim_data.from_file(PATH)
168163

tests/_test_local/_test_fit_web.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def test_dispersion_lossless():
3939
)
4040

4141
# a and c for each pole should be purely imaginary
42-
for (a, c) in best_medium.poles:
42+
for a, c in best_medium.poles:
4343
assert isclose(np.real(a), 0)
4444
assert isclose(np.real(c), 0)
4545

@@ -64,7 +64,6 @@ def test_dispersion_load_file():
6464

6565

6666
def test_dispersion_load_url():
67-
6867
url_csv = "https://refractiveindex.info/data_csv.php?datafile=data/main/Ag/Johnson.yml"
6968
fitter = StableDispersionFitter.from_url(url_csv)
7069

tests/test_components/test_apodization.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ def test_negative_times():
3838

3939

4040
def test_plot():
41-
4241
run_time = 1.0e-13
4342
times = [0, 2.0e-14, 4.0e-14, 6.0e-14, 8.0e-14, 1.0e-13]
4443

tests/test_components/test_base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ def test_updated_copy():
118118

119119

120120
def test_equality():
121-
122121
# test freqs / arraylike
123122
mnt1 = td.FluxMonitor(size=(1, 1, 0), freqs=np.array([1, 2, 3]) * 1e12, name="1")
124123
mnt2 = td.FluxMonitor(size=(1, 1, 0), freqs=np.array([1, 2, 3]) * 1e12, name="1")

tests/test_components/test_custom.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ def verify_custom_dispersive_medium_methods(mat):
477477
poles_interp = mat.pole_residue.poles_on_grid(coord_interp)
478478
assert len(poles_interp) == len(mat.pole_residue.poles)
479479
coord_shape = tuple(len(grid) for grid in coord_interp.to_list)
480-
for (a, c) in poles_interp:
480+
for a, c in poles_interp:
481481
assert a.shape == coord_shape
482482
assert c.shape == coord_shape
483483

tests/test_components/test_geometry.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,6 @@ def test_geometry():
572572

573573

574574
def test_geometry_sizes():
575-
576575
# negative in size kwargs errors
577576
for size in (-1, 1, 1), (1, -1, 1), (1, 1, -1):
578577
with pytest.raises(pydantic.ValidationError):
@@ -851,7 +850,6 @@ def test_custom_surface_geometry(tmp_path):
851850

852851

853852
def test_geo_group_sim():
854-
855853
geo_grp = td.TriangleMesh.from_stl("tests/data/two_boxes_separate.stl")
856854
geos_orig = list(geo_grp.geometries)
857855
geo_grp_full = geo_grp.updated_copy(geometries=geos_orig + [td.Box(size=(1, 1, 1))])

tests/test_components/test_grid.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ def test_field_grid():
3232

3333

3434
def test_grid():
35-
3635
boundaries_x = np.arange(-1, 2, 1)
3736
boundaries_y = np.arange(-2, 3, 1)
3837
boundaries_z = np.arange(-3, 4, 1)
@@ -205,7 +204,6 @@ def test_sim_nonuniform_large():
205204

206205

207206
def test_sim_grid():
208-
209207
sim = td.Simulation(
210208
size=(4, 4, 4),
211209
grid_spec=td.GridSpec.uniform(1.0),
@@ -252,7 +250,6 @@ def test_sim_symmetry_grid():
252250

253251

254252
def test_sim_pml_grid():
255-
256253
sim = td.Simulation(
257254
size=(4, 4, 4),
258255
grid_spec=td.GridSpec.uniform(1.0),
@@ -271,7 +268,6 @@ def test_sim_pml_grid():
271268

272269

273270
def test_sim_discretize_vol():
274-
275271
sim = td.Simulation(
276272
size=(4, 4, 4),
277273
grid_spec=td.GridSpec.uniform(1.0),
@@ -293,7 +289,6 @@ def test_sim_discretize_vol():
293289

294290

295291
def test_sim_discretize_plane():
296-
297292
sim = td.Simulation(
298293
size=(4, 4, 4),
299294
grid_spec=td.GridSpec.uniform(1.0),

tests/test_components/test_grid_spec.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ def test_make_coords_2d():
4848

4949

5050
def test_wvl_from_sources():
51-
5251
# no sources
5352
with pytest.raises(SetupError):
5453
td.GridSpec.wavelength_from_sources(sources=[])

tests/test_components/test_heat.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,6 @@ def test_heat_sim_bounds(shift_amount, log_level, log_capture):
340340
CENTER_SHIFT = (-1.0, 1.0, 100.0)
341341

342342
def place_box(center_offset):
343-
344343
shifted_center = tuple(c + s for (c, s) in zip(center_offset, CENTER_SHIFT))
345344

346345
_ = td.HeatSimulation(

tests/test_components/test_medium.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ def test_from_n_less_than_1():
5050

5151

5252
def test_medium():
53-
5453
# mediums error with unacceptable values
5554
with pytest.raises(pydantic.ValidationError):
5655
_ = td.Medium(permittivity=0.0)
@@ -82,12 +81,10 @@ def test_medium_conversions():
8281

8382

8483
def test_PEC():
85-
8684
_ = td.Structure(geometry=td.Box(size=(1, 1, 1)), medium=td.PEC)
8785

8886

8987
def test_medium_dispersion():
90-
9188
# construct media
9289
m_PR = td.PoleResidue(eps_inf=1.0, poles=[((-1 + 2j), (1 + 3j)), ((-2 + 4j), (1 + 5j))])
9390
m_SM = td.Sellmeier(coeffs=[(2, 3), (2, 4)])
@@ -126,7 +123,6 @@ def test_medium_dispersion():
126123

127124

128125
def test_medium_dispersion_conversion():
129-
130126
m_PR = td.PoleResidue(eps_inf=1.0, poles=[((-1 + 2j), (1 + 3j)), ((-2 + 4j), (1 + 5j))])
131127
m_SM = td.Sellmeier(coeffs=[(2, 3), (2, 4)])
132128
m_LZ = td.Lorentz(eps_inf=1.0, coeffs=[(1, 3, 2), (2, 4, 1)])
@@ -142,7 +138,6 @@ def test_medium_dispersion_conversion():
142138

143139

144140
def test_medium_dispersion_create():
145-
146141
m_PR = td.PoleResidue(eps_inf=1.0, poles=[((-1 + 2j), (1 + 3j)), ((-2 + 4j), (1 + 5j))])
147142
m_SM = td.Sellmeier(coeffs=[(2, 3), (2, 4)])
148143
m_LZ = td.Lorentz(eps_inf=1.0, coeffs=[(1, 3, 2), (2, 4, 1)])
@@ -174,7 +169,6 @@ def test_sellmeier_from_dispersion():
174169

175170

176171
def eps_compare(medium: td.Medium, expected: Dict, tol: float = 1e-5):
177-
178172
for freq, val in expected.items():
179173
assert np.abs(medium.eps_model(freq) - val) < tol
180174

@@ -464,7 +458,6 @@ def test_fully_anisotropic_media():
464458

465459

466460
def test_perturbation_medium():
467-
468461
# Non-dispersive
469462
pp_real = td.ParameterPerturbation(
470463
heat=td.LinearHeatPerturbation(

tests/test_components/test_meshgenerate.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,6 @@ def test_grid_in_interval():
279279

280280

281281
def test_grid_analytic_refinement():
282-
283282
max_dl_list = np.array([0.5, 0.5, 0.4, 0.1, 0.4])
284283
len_interval_list = np.array([2.0, 0.5, 0.2, 0.1, 0.3])
285284
max_scale = 1.5
@@ -291,7 +290,6 @@ def test_grid_analytic_refinement():
291290

292291

293292
def test_grid_refinement():
294-
295293
max_dl_list = np.array([0.5, 0.4, 0.1, 0.4])
296294
len_interval_list = np.array([0.5, 1.2, 0.1, 1.3])
297295
max_scale = 1.5
@@ -698,7 +696,6 @@ def test_small_structure_size(log_capture):
698696

699697

700698
def test_shapely_strtree_warnings():
701-
702699
with warnings.catch_warnings():
703700
warnings.simplefilter("error")
704701
_ = GradedMesher().parse_structures(

tests/test_components/test_mode.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77

88
def test_modes():
9-
109
_ = td.ModeSpec(num_modes=2)
1110
_ = td.ModeSpec(num_modes=1, target_neff=1.0)
1211

tests/test_components/test_monitor.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ def test_downsampled():
5353

5454

5555
def test_excluded_surfaces_flat():
56-
5756
with pytest.raises(pydantic.ValidationError):
5857
_ = td.FluxMonitor(size=(1, 1, 0), name="f", freqs=[1e12], exclude_surfaces=("x-",))
5958

@@ -296,7 +295,6 @@ def test_monitor_num_modes(log_capture, num_modes, log_level):
296295

297296

298297
def test_diffraction_validators():
299-
300298
# ensure error if boundaries are not periodic
301299
boundary_spec = td.BoundarySpec(
302300
x=td.Boundary.pml(),
@@ -322,7 +320,6 @@ def test_diffraction_validators():
322320

323321

324322
def test_monitor():
325-
326323
size = (1, 2, 3)
327324
center = (1, 2, 3)
328325

@@ -357,7 +354,6 @@ def test_monitor():
357354

358355

359356
def test_monitor_plane():
360-
361357
# make sure flux, mode and diffraction monitors fail with non planar geometries
362358
for size in ((0, 0, 0), (1, 0, 0), (1, 1, 1)):
363359
with pytest.raises(pydantic.ValidationError):
@@ -374,7 +370,6 @@ def _test_freqs_nonempty():
374370

375371

376372
def test_monitor_surfaces_from_volume():
377-
378373
center = (1, 2, 3)
379374

380375
# make sure that monitors with zero volume raise an error (adapted from test_monitor_plane())

tests/test_components/test_parameter_perturbation.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88

99
def test_heat_perturbation():
10-
1110
perturb = td.LinearHeatPerturbation(
1211
coeff=0.01,
1312
temperature_ref=300,
@@ -61,7 +60,6 @@ def test_heat_perturbation():
6160
perturb_data = td.HeatDataArray([1 + 1j, 3 + 1j, 1j], coords=dict(T=[200, 300, 400]))
6261

6362
for interp_method in ["linear", "nearest"]:
64-
6563
perturb = td.CustomHeatPerturbation(
6664
perturbation_values=perturb_data, interp_method=interp_method
6765
)
@@ -110,7 +108,6 @@ def test_heat_perturbation():
110108

111109

112110
def test_charge_perturbation():
113-
114111
perturb = td.LinearChargePerturbation(
115112
electron_coeff=1e-21,
116113
electron_ref=0,
@@ -216,7 +213,6 @@ def test_charge_perturbation():
216213
)
217214

218215
for interp_method in ["linear", "nearest"]:
219-
220216
perturb = td.CustomChargePerturbation(
221217
perturbation_values=perturb_data, interp_method=interp_method
222218
)
@@ -306,7 +302,6 @@ def test_charge_perturbation():
306302

307303

308304
def test_parameter_perturbation():
309-
310305
heat = td.LinearHeatPerturbation(
311306
coeff=0.01,
312307
temperature_ref=300,

tests/test_components/test_scene.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ def test_scene_init():
4343

4444

4545
def test_validate_components_none():
46-
4746
assert SCENE._validate_num_mediums(val=None) is None
4847

4948

@@ -169,7 +168,6 @@ def _test_names_default():
169168

170169

171170
def test_names_unique():
172-
173171
with pytest.raises(pd.ValidationError):
174172
_ = td.Scene(
175173
structures=[
@@ -188,7 +186,6 @@ def test_names_unique():
188186

189187

190188
def test_perturbed_mediums_copy():
191-
192189
# Non-dispersive
193190
pp_real = td.ParameterPerturbation(
194191
heat=td.LinearHeatPerturbation(

0 commit comments

Comments
 (0)