I parse text or text files defining the specifications of a device.

A single attribute value is defined with the construct name = value or name value.

A dict of values is defined with just the dict name on a line by itself followed by a line of hyphens, e.g., -----. Then, after the hyphens, one or more key value lines. (Zero lines should make an empty dict, but is not supported.) Then another line of hyphens.

But dicts can be stacked! If a key has two parts separated by a colon, the first part is an entry in the top-level dict that is actually another dict, and the second part is an entry in that dict. The file RFP12N10L.specs included in the lib sub-package uses this for its params dict:

   params
   -------------------------------------------
   351:Rg        990
   351:ttrig     2E-4
   351:Vbatt     62.7
   361:Rg        82000
   361:ttrig     2E-4
   361:Vbatt     63.343
   371:ttrig     2E-3
   371:Vbatt     63.42
   -------------------------------------------

There are three sub-dicts inside params, accessible with the keys 351, 361, and 371.

Construct me with an instance of Setups and call my instance to obtain a Specs object with the specifications as its attributes.

Comments (lines beginning with '#', and trailing parts of a line after a '#') and blank lines are ignored.

Method __init__ Undocumented
Method parseName I call this when I encounter a line defining a new entry, with the first and possibly only token being the entry's name.
Method parse I call this when I encounter a line defining just one or more space-delimited values, once per value.
Method add Adds something to my Specs instance s. There are three possibilities.
Method __call__ Returns a new populated instance of Specs.

Inherited from ParserBase:

Method readLines Undocumented
def __init__(self, setups):
def parseName(self, tokens):

I call this when I encounter a line defining a new entry, with the first and possibly only token being the entry's name.

def parse(self, value):

I call this when I encounter a line defining just one or more space-delimited values, once per value.

def add(self, name, key, value):

Adds something to my Specs instance s. There are three possibilities.

  1. If key is None and I have no DictStack in progress, adds an attribute name with value to my Specs object.
  2. If key is None and I have a DictStack in progress, adds an entry to its top level, referenced by name with the value.
  3. With a key, adds a new sub-dict to my DictStack (one must be in progress) and an entry to that, referenced by key with the value.
def __call__(self):

Returns a new populated instance of Specs.

API Documentation for pingspice, generated by pydoctor at 2021-09-18 08:41:11.