[docs]classSymbolTable:""" Symbol table contains all objects parsed from the specification in the following format: .. list-table:: :header-rows: 1 * - symbol - symbol_type - item - config - * - e1 - encoding - EncodingObject - {..} - -> SymbolTableEntry object * - seq1 - preprocessing - [ClonesPerRepertoireFilter(), MetadataRepertoireFilter()] - {..} - -> SymbolTableEntry object """def__init__(self):self._items={}
[docs]defadd(self,symbol:str,symbol_type:SymbolType,item,config:dict=None):ifsymbolinself._items.keys()andself._items[symbol]isnotNone:warnings.warn("An item with the key {} was already set in the SymbolTable during parsing. If overwriting ""it was the intended behavior, please ignore this warning.".format(symbol),Warning)self._items[symbol]=SymbolTableEntry(symbol=symbol,symbol_type=symbol_type,item=item,config=config)
[docs]defget(self,symbol):ifsymbolisnotNone:ifself.contains(symbol):returnself._items[symbol].itemelse:raiseKeyError(f"SymbolTable: item with key {symbol} was not defined previously so it could not be retrieved during "f"parsing. Please check if an item with key {symbol} was defined in the specification. "f"If it was present, check if its parent keys were correctly defined. ")else:returnNone