def _attr_name_to_object( model, name ):
  # Temporarily creates the names 'self' and 's' in the current
  # scope.  SUPER HACKY
  self = s = model
  # If slice or list, get name components previous to indexing
  if name in '[?]':
    name, extra = name.split('[?]', 1)
  # Try to return the Python object attached to the name. If the
  # object is not a  SignalValue or a list, we can't add it to
  # the sensitivity list.  Sometimes this is okay (eg. constants),
  # but sometimes this indicates an error in the user's code, so
  # display a warning.
  # In the case of a list, we need to reconstruct the name of each
  # item in the list so we can try to add it to the sensitivity
  # list. Return a tuple containing the list object, the list name
  # and the attribute string the appears after the list indexing.
  try:
    x = eval( name )
    if   isinstance( x, SignalValue ): return x
    elif isinstance( x, list        ): return ( x, name, extra )
    else:                              raise NameError
  except NameError:
    if model._debug:
      warnings.warn( "Cannot add variable '{}' to sensitivity list."
                     "".format( name ), Warning )
    return None


#-----------------------------------------------------------------------
# create_slice_callbacks
#-----------------------------------------------------------------------
# All ConnectionEdges that contain bit slicing need to be turned into
# combinational blocks.  This significantly simplifies the connection
# graph update logic.
dataset/ETHPy150Open cornell-brg/pymtl/pymtl/tools/simulation/sim_utils.py/_attr_name_to_object/swapped operands of `in`