PhfStream¶
- class photonforge.PhfStream(filename, mode='r', set_config=True)¶
Create a PhfStream object for writing or loading phf files.
- Parameters:
filename (str) – Phf file name.
mode (Literal["r", "w"]) – Either
"r"or"w"to open the file for reading or writing, respectively.set_config (bool) – If
Trueandmode == 'r', set thefile. (configuration with values loaded from the)
Methods
close()Close the stream.
contents([only_explicit])Index of the stream contents.
data()List of all objects stored in the phf stream file.
load_component([name, only_explicit])Load components from this stream.
load_technology([name, version, only_explicit])Load technologies from this stream.
write(*args)Write objects to this phf stream file.
Attributes
Configuration present in phf files (read only).
Object properties.
- close()¶
Close the stream.
- config¶
Configuration present in phf files (read only).
- Type:
dict[str, Any] | None
- contents(only_explicit=True)¶
Index of the stream contents.
- Parameters:
only_explicit (bool) – If set, only explicitly written component and technology entries are returned (excludes automatically included dependencies).
- Returns:
dict[Literal[“components”, “technologies”], set[str] | set[tuple[str, str]]] Dictionary with keys
"components"and"technologies". The former holds a set ofComponentnames, and the latter a set of tuples withTechnologynames and versions.
- data()¶
List of all objects stored in the phf stream file.
- Returns:
Objects stored in the phf stream, in the order they were originally stored.
- Return type:
list[Any]
- load_component(name=None, only_explicit=True)¶
Load components from this stream.
- Parameters:
name (str | None) – If given, only the named component is returned, otherwise all components in the stream.
only_explicit (bool) – If set, only explicitly stored components are returned. This argument is ignored if name is given.
- Returns:
Loaded components.
- Return type:
list[Component]
- load_technology(name=None, version=None, only_explicit=True)¶
Load technologies from this stream.
- Parameters:
name (str | None) – If given, only technologies with this name are returned, otherwise all technologies in the stream.
version (str | None) – If given, only technologies with this version are returned, otherwise all technologies in the stream.
only_explicit (bool) – If set, only explicitly stored technologies are returned. This argument is ignored if both name and version are given.
- Returns:
Loaded technologies.
- Return type:
list[Technology]
- properties¶
Object properties.
- Type: