make raw_mode an arg to read()`

This commit is contained in:
Jan Petykiewicz 2020-11-02 20:56:56 -08:00
parent 74a0a4f7d2
commit 6ead7231a8

View File

@ -188,6 +188,7 @@ def readfile(filename: Union[str, pathlib.Path],
def read(stream: BinaryIO, def read(stream: BinaryIO,
raw_mode: bool = True,
) -> Tuple[Dict[str, Pattern], Dict[str, Any]]: ) -> Tuple[Dict[str, Pattern], Dict[str, Any]]:
""" """
Read a gdsii file and translate it into a dict of Pattern objects. GDSII structures are Read a gdsii file and translate it into a dict of Pattern objects. GDSII structures are
@ -202,12 +203,12 @@ def read(stream: BinaryIO,
Args: Args:
stream: Stream to read from. stream: Stream to read from.
raw_mode: If True, constructs shapes in raw mode, bypassing most data validation, Default True.
Returns: Returns:
- Dict of pattern_name:Patterns generated from GDSII structures - Dict of pattern_name:Patterns generated from GDSII structures
- Dict of GDSII library info - Dict of GDSII library info
""" """
raw_mode = True # Whether to construct shapes in raw mode (less error checking)
library_info = _read_header(stream) library_info = _read_header(stream)
patterns = [] patterns = []
@ -253,7 +254,7 @@ def read_elements(stream: BinaryIO,
stream: Seekable stream, positioned at a record boundary. stream: Seekable stream, positioned at a record boundary.
Will be read until an ENDSTR record is consumed. Will be read until an ENDSTR record is consumed.
name: Name of the resulting Pattern name: Name of the resulting Pattern
raw_mode: If True, bypass per-shape consistency checking raw_mode: If True, bypass per-shape data validation. Default True.
Returns: Returns:
A pattern containing the elements that were read. A pattern containing the elements that were read.