Skip to content

Commit 8e2bbdc

Browse files
committed
some simplifications
1 parent 9a36448 commit 8e2bbdc

File tree

2 files changed

+4
-15
lines changed

2 files changed

+4
-15
lines changed

tidy3d/config/loader.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ def __init__(self, config_dir: Optional[Path] = None):
2525
self.config_dir = config_dir or resolve_config_directory()
2626
self.config_dir.mkdir(mode=0o700, parents=True, exist_ok=True)
2727
self._docs: dict[Path, tomlkit.TOMLDocument] = {}
28-
self._descriptions: Optional[dict[tuple[str, ...], str]] = None
2928

3029
def load_base(self) -> dict[str, Any]:
3130
"""Load base configuration from config.toml."""
@@ -101,8 +100,7 @@ def _atomic_write(self, path: Path, data: dict[str, Any]) -> None:
101100
tmp_dir = path.parent
102101

103102
cleaned = _clean_data(deepcopy(data))
104-
descriptions = self._descriptions or collect_descriptions()
105-
self._descriptions = descriptions
103+
descriptions = collect_descriptions()
106104

107105
base_document = self._docs.get(path)
108106
document = build_document(cleaned, base_document, descriptions)
@@ -175,7 +173,7 @@ def _merge_into(target: dict[str, Any], source: dict[str, Any]) -> None:
175173
if isinstance(node, dict):
176174
_merge_into(node, value)
177175
else:
178-
target[key] = _deep_copy_dict(value)
176+
target[key] = deepcopy(value)
179177
else:
180178
target[key] = value
181179

@@ -194,7 +192,7 @@ def deep_diff(base: dict[str, Any], target: dict[str, Any]) -> dict[str, Any]:
194192
diff[key] = nested
195193
elif target_value != base_value:
196194
if isinstance(target_value, dict):
197-
diff[key] = _deep_copy_dict(target_value)
195+
diff[key] = deepcopy(target_value)
198196
else:
199197
diff[key] = target_value
200198
return diff
@@ -207,13 +205,6 @@ def _assign_path(target: dict[str, Any], path: tuple[str, ...], value: Any) -> N
207205
node[path[-1]] = value
208206

209207

210-
def _deep_copy_dict(data: dict[str, Any]) -> dict[str, Any]:
211-
return {
212-
key: _deep_copy_dict(value) if isinstance(value, dict) else value
213-
for key, value in data.items()
214-
}
215-
216-
217208
def _clean_data(data: Any) -> Any:
218209
if isinstance(data, dict):
219210
cleaned: dict[str, Any] = {}

tidy3d/config/profiles.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,4 @@
5454
},
5555
}
5656

57-
INTERNAL_PROFILES = {key for key in BUILTIN_PROFILES if key not in {"default"}}
58-
59-
__all__ = ["BUILTIN_PROFILES", "INTERNAL_PROFILES"]
57+
__all__ = ["BUILTIN_PROFILES"]

0 commit comments

Comments
 (0)