documentation updates

This commit is contained in:
Jan Petykiewicz 2020-09-10 20:03:19 -07:00
parent 3627b63658
commit 3ca999fa2e
3 changed files with 44 additions and 30 deletions

View File

@ -1730,9 +1730,9 @@ def read_property_value(stream: io.BufferedIOBase) -> property_value_t:
10: ASCII string (`AString`) 10: ASCII string (`AString`)
11: binary string (`bytes`) 11: binary string (`bytes`)
12: name string (`NString`) 12: name string (`NString`)
13: `PropstringReference` to `AString` 13: `PropStringReference` to `AString`
14: `PropstringReference` to `bstring` (i.e., to `bytes`) 14: `PropStringReference` to `bstring` (i.e., to `bytes`)
15: `PropstringReference` to `NString` 15: `PropStringReference` to `NString`
Args: Args:
stream: Stream to read from. stream: Stream to read from.

View File

@ -16,6 +16,7 @@ from .basic import OffsetEntry, OffsetTable, NString, AString, real_t, Validatio
__author__ = 'Jan Petykiewicz' __author__ = 'Jan Petykiewicz'
#logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -86,7 +87,6 @@ class OasisLayout:
propstrings: Dict[int, AString] propstrings: Dict[int, AString]
layers: List[records.LayerName] layers: List[records.LayerName]
def __init__(self, unit: real_t, validation: Validation = None): def __init__(self, unit: real_t, validation: Validation = None):
""" """
Args: Args:
@ -202,16 +202,19 @@ class OasisLayout:
raise InvalidRecordError('Unknown record id: {}'.format(record_id)) raise InvalidRecordError('Unknown record id: {}'.format(record_id))
if record_id == 0: if record_id == 0:
# Pad ''' Pad '''
pass pass
elif record_id == 1: elif record_id == 1:
''' Start '''
record = records.Start.read(stream, record_id) record = records.Start.read(stream, record_id)
record.merge_with_modals(modals) record.merge_with_modals(modals)
self.unit = record.unit self.unit = record.unit
self.version = record.version self.version = record.version
file_state.end_has_offset_table = record.offset_table is None file_state.end_has_offset_table = record.offset_table is None
file_state.property_target = self.properties
# TODO Offset table strict check # TODO Offset table strict check
elif record_id == 2: elif record_id == 2:
''' End '''
record = records.End.read(stream, record_id, file_state.end_has_offset_table) record = records.End.read(stream, record_id, file_state.end_has_offset_table)
record.merge_with_modals(modals) record.merge_with_modals(modals)
self.validation = record.validation self.validation = record.validation
@ -219,6 +222,7 @@ class OasisLayout:
raise InvalidRecordError('Stream continues past End record') raise InvalidRecordError('Stream continues past End record')
return True return True
elif record_id in (3, 4): elif record_id in (3, 4):
''' CellName '''
implicit = record_id == 3 implicit = record_id == 3
if file_state.cellname_implicit is None: if file_state.cellname_implicit is None:
file_state.cellname_implicit = implicit file_state.cellname_implicit = implicit
@ -235,6 +239,7 @@ class OasisLayout:
self.cellnames[key] = cellname self.cellnames[key] = cellname
file_state.property_target = cellname.properties file_state.property_target = cellname.properties
elif record_id in (5, 6): elif record_id in (5, 6):
''' TextString '''
implicit = record_id == 5 implicit = record_id == 5
if file_state.textstring_implicit is None: if file_state.textstring_implicit is None:
file_state.textstring_implicit = implicit file_state.textstring_implicit = implicit
@ -248,6 +253,7 @@ class OasisLayout:
key = len(self.textstrings) key = len(self.textstrings)
self.textstrings[key] = record.astring self.textstrings[key] = record.astring
elif record_id in (7, 8): elif record_id in (7, 8):
''' PropName '''
implicit = record_id == 7 implicit = record_id == 7
if file_state.propname_implicit is None: if file_state.propname_implicit is None:
file_state.propname_implicit = implicit file_state.propname_implicit = implicit
@ -261,6 +267,7 @@ class OasisLayout:
key = len(self.propnames) key = len(self.propnames)
self.propnames[key] = record.nstring self.propnames[key] = record.nstring
elif record_id in (9, 10): elif record_id in (9, 10):
''' PropString '''
implicit = record_id == 9 implicit = record_id == 9
if file_state.propstring_implicit is None: if file_state.propstring_implicit is None:
file_state.propstring_implicit = implicit file_state.propstring_implicit = implicit
@ -274,14 +281,17 @@ class OasisLayout:
key = len(self.propstrings) key = len(self.propstrings)
self.propstrings[key] = record.astring self.propstrings[key] = record.astring
elif record_id in (11, 12): elif record_id in (11, 12):
''' LayerName '''
record = records.LayerName.read(stream, record_id) record = records.LayerName.read(stream, record_id)
record.merge_with_modals(modals) record.merge_with_modals(modals)
self.layers.append(record) self.layers.append(record)
elif record_id in (28, 29): elif record_id in (28, 29):
''' Property '''
record = records.Property.read(stream, record_id) record = records.Property.read(stream, record_id)
record.merge_with_modals(modals) record.merge_with_modals(modals)
file_state.property_target.append(record) file_state.property_target.append(record)
elif record_id in (30, 31): elif record_id in (30, 31):
''' XName '''
implicit = record_id == 30 implicit = record_id == 30
if file_state.xname_implicit is None: if file_state.xname_implicit is None:
file_state.xname_implicit = implicit file_state.xname_implicit = implicit
@ -300,20 +310,24 @@ class OasisLayout:
# Cell and elements # Cell and elements
# #
elif record_id in (13, 14): elif record_id in (13, 14):
''' Cell '''
record = records.Cell.read(stream, record_id) record = records.Cell.read(stream, record_id)
record.merge_with_modals(modals) record.merge_with_modals(modals)
cell = Cell(record.name) cell = Cell(record.name)
self.cells.append(cell) self.cells.append(cell)
file_state.property_target = cell.properties file_state.property_target = cell.properties
elif record_id in (15, 16): elif record_id in (15, 16):
''' XYMode '''
record = records.XYMode.read(stream, record_id) record = records.XYMode.read(stream, record_id)
record.merge_with_modals(modals) record.merge_with_modals(modals)
elif record_id in (17, 18): elif record_id in (17, 18):
''' Placement '''
record = records.Placement.read(stream, record_id) record = records.Placement.read(stream, record_id)
record.merge_with_modals(modals) record.merge_with_modals(modals)
self.cells[-1].placements.append(record) self.cells[-1].placements.append(record)
file_state.property_target = record.properties file_state.property_target = record.properties
elif record_id in _GEOMETRY: elif record_id in _GEOMETRY:
''' Geometry '''
record = _GEOMETRY[record_id].read(stream, record_id) record = _GEOMETRY[record_id].read(stream, record_id)
record.merge_with_modals(modals) record.merge_with_modals(modals)
self.cells[-1].geometry.append(record) self.cells[-1].geometry.append(record)
@ -507,7 +521,7 @@ class XName:
# Mapping from record id to record class. # Mapping from record id to record class.
_GEOMETRY: Dict[int, Type] = { _GEOMETRY: Dict[int, Type[records.geometry_t]] = {
19: records.Text, 19: records.Text,
20: records.Rectangle, 20: records.Rectangle,
21: records.Polygon, 21: records.Polygon,

View File

@ -16,6 +16,30 @@ setup(name='fatamorgana',
author='Jan Petykiewicz', author='Jan Petykiewicz',
author_email='anewusername@gmail.com', author_email='anewusername@gmail.com',
url='https://mpxd.net/code/jan/fatamorgana', url='https://mpxd.net/code/jan/fatamorgana',
packages=find_packages(),
package_data={
'fatamorgana': ['VERSION',
'py.typed',
],
},
install_requires=[
'typing',
],
extras_require={
'numpy': ['numpy'],
},
classifiers=[
'Programming Language :: Python :: 3',
'Development Status :: 3 - Alpha',
'Environment :: Other Environment',
'Intended Audience :: Developers',
'Intended Audience :: Information Technology',
'Intended Audience :: Manufacturing',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: GNU Affero General Public License v3',
'Topic :: Scientific/Engineering',
'Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)',
],
keywords=[ keywords=[
'OASIS', 'OASIS',
'layout', 'layout',
@ -36,29 +60,5 @@ setup(name='fatamorgana',
'polygon', 'polygon',
'gds', 'gds',
], ],
classifiers=[
'Programming Language :: Python :: 3',
'Development Status :: 3 - Alpha',
'Environment :: Other Environment',
'Intended Audience :: Developers',
'Intended Audience :: Information Technology',
'Intended Audience :: Manufacturing',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: GNU Affero General Public License v3',
'Topic :: Scientific/Engineering',
'Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)',
],
packages=find_packages(),
package_data={
'fatamorgana': ['VERSION',
'py.typed',
],
},
install_requires=[
'typing',
],
extras_require={
'numpy': ['numpy'],
},
) )