Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions gplugins/common/utils/get_sparameters_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import hashlib
from functools import partial
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import Any

import gdsfactory as gf
Expand All @@ -20,9 +21,9 @@ def get_kwargs_hash(**kwargs: Any) -> str:


def get_component_hash(component: gf.Component) -> str:
gdspath = Path(component.write_gds(no_empty_cells=True, with_metadata=False))
h = hashlib.md5(gdspath.read_bytes()).hexdigest()
gdspath.unlink()
with TemporaryDirectory() as tmpdir:
gdspath = Path(component.write_gds(gdsdir=tmpdir, no_empty_cells=True, with_metadata=False))
h = hashlib.md5(gdspath.read_bytes()).hexdigest()
return h


Expand Down
Loading