Skip to content

Commit

Permalink
.asy: SYMATTR Prefix is case senstitive (better) #99
Browse files Browse the repository at this point in the history
  • Loading branch information
hb020 committed Sep 27, 2024
1 parent 4593800 commit f9da167
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions spicelib/editor/asc_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ def reset_netlist(self, create_blank: bool = False) -> None:
# then create the attribute "SUBCKT"
component.attributes["_SUBCKT"] = self._get_subcircuit(symbol)
else:
# make sure prefix is uppercase, as this is used in a lot of places
if ref.upper() == "PREFIX":
text = text.upper()
component.attributes[ref] = text
elif line.startswith("TEXT"):
match = TEXT_REGEX.match(line)
Expand Down
6 changes: 5 additions & 1 deletion spicelib/editor/asy_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ def __init__(self, asy_file: Union[Path, str]):
else:
continue
text = text.strip() # Gets rid of the \n terminator
# make sure prefix is uppercase, as this is used in a lot of places
if ref.upper() == "PREFIX":
text = text.upper()
self.attributes[ref] = text
elif line.startswith("Version"):
tag, version = line.split()
Expand Down Expand Up @@ -255,7 +258,8 @@ def to_qsch(self, *args):
return symbol

def is_subcircuit(self):
return self.symbol_type == 'BLOCK' or self.attributes.get('Prefix').upper() == 'X'
# Prefix is guaranteed to be uppercase
return self.symbol_type == 'BLOCK' or self.attributes.get('Prefix') == 'X'

def get_library(self) -> str:
"""Returns the library name of the model. If not found, returns None."""
Expand Down

0 comments on commit f9da167

Please sign in to comment.