ParsedDynamicAttributes_Component

class ParsedDynamicAttributes_Component(component: QComponent, key_list: List[str] = None)[source]

Provides a parsing view of the component options.

When accessed, returns parse versions of the user options. Works with nested options too.

Example

component.options = {'x':'1nm'}
print(component.p.x)

>> float(1e7)

Parameters:
  • component (QComponent) – Component to get options from.

  • key_list (List[str]) – List of keys. Defaults to None.

Methods

__getitem__(name: str)[source]

Get the item associated with the given name.

Parameters:

name (str) – Name of the item

Returns:

Parse value

Return type:

str, float, list, tuple, or ast eval

Raises:

AttributeError – The given name is a magic method not in the dictionary

__len__()[source]

Return the length.

items()[source]

Produces tuples consisting of keys and respective parsed values for iterating over a dictionary.