qcodes/sphinx_extensions/parse_parameter_attr.py
def qcodes_parameter_attr_getter(
    object_to_document_attr_on: Type[object], name: str, *default: Any
) -> Any:
    """
    Try to extract an attribute as a proxy object with a repr containing the code
    if the class the attribute is bound to is a subclass of ``InstrumentBase``
    and the attribute is not private.

    Args:
        object_to_document_attr_on: The type (not instance of the object to detect the
            attribute on.
        name: Name of the attribute to look for.
        *default: Default obejct to use as a replacement if the attribute could not be
            found.

    Returns:
        Attribute looked up, proxy object containing the code of the attribute as a
        repr or a default object.
    """
    if (
        inspect.isclass(object_to_document_attr_on)
        and issubclass(object_to_document_attr_on, InstrumentBase)
        and not name.startswith("_")
    ):
        try:
            attr = safe_getattr(object_to_document_attr_on, name)
        except AttributeError:
            LOGGER.debug(
                f"Attempting to load attribute {name} on "
                f"{object_to_document_attr_on} via parsing"
            )
            mro = inspect.getmro(object_to_document_attr_on)
            attr = None
            for classobj in mro:
                try:
                    param_dict = eval_params_from_code(
                        inspect.getsource(classobj), classobj.__name__
                    )
                    if param_dict.get(name) is not None:
                        attr = param_dict[name]
                        break
                except TypeError:
                    continue
            if attr is None:
                LOGGER.debug(
                    f"Falling back to default Sphinx attribute loader for {name}"
                    f" on {object_to_document_attr_on}"
                )
                attr = safe_getattr(object_to_document_attr_on, name, default)
    else:
        attr = safe_getattr(object_to_document_attr_on, name, default)
    return attr

    Try to extract an attribute as a proxy object with a repr containing the code
    if the class the attribute is bound to is a subclass of ``InstrumentBase``
    and the attribute is not private.

    Args:
        object_to_document_attr_on: The type (not instance of the object to detect the
            attribute on.
        name: Name of the attribute to look for.
        *default: Default obejct to use as a replacement if the attribute could not be
            found.

    Returns:
        Attribute looked up, proxy object containing the code of the attribute as a
        repr or a default object.
    
Try to extract an attribute as a proxy object with a repr containing the code
if the class the attribute is bound to is a subclass of ``InstrumentBase``
and the attribute is not private.
Try to extract an attribute as a proxy object with a repr containing the code if the class the attribute is bound to is a subclass of ` ` InstrumentBase ` ` and the attribute is not private .
def qcodes_parameter_attr_getter(
    object_to_document_attr_on: Type[object], name: str, *default: Any
) -> Any:
    if (
        inspect.isclass(object_to_document_attr_on)
        and issubclass(object_to_document_attr_on, InstrumentBase)
        and not name.startswith("_")
    ):
        try:
            attr = safe_getattr(object_to_document_attr_on, name)
        except AttributeError:
            LOGGER.debug(
                f"Attempting to load attribute {name} on "
                f"{object_to_document_attr_on} via parsing"
            )
            mro = inspect.getmro(object_to_document_attr_on)
            attr = None
            for classobj in mro:
                try:
                    param_dict = eval_params_from_code(
                        inspect.getsource(classobj), classobj.__name__
                    )
                    if param_dict.get(name) is not None:
                        attr = param_dict[name]
                        break
                except TypeError:
                    continue
            if attr is None:
                LOGGER.debug(
                    f"Falling back to default Sphinx attribute loader for {name}"
                    f" on {object_to_document_attr_on}"
                )
                attr = safe_getattr(object_to_document_attr_on, name, default)
    else:
        attr = safe_getattr(object_to_document_attr_on, name, default)
    return attr
def qcodes_parameter_attr_getter ( object_to_document_attr_on : Type [ object ] , name : str , * default : Any ) -> Any : if ( inspect . isclass ( object_to_document_attr_on ) and issubclass ( object_to_document_attr_on , InstrumentBase ) and not name . startswith ( "_" ) ) : try : attr = safe_getattr ( object_to_document_attr_on , name ) except AttributeError : LOGGER . debug ( f"Attempting to load attribute {name} on " f"{object_to_document_attr_on} via parsing" ) mro = inspect . getmro ( object_to_document_attr_on ) attr = None for classobj in mro : try : param_dict = eval_params_from_code ( inspect . getsource ( classobj ) , classobj . __name__ ) if param_dict . get ( name ) is not None : attr = param_dict [ name ] break except TypeError : continue if attr is None : LOGGER . debug ( f"Falling back to default Sphinx attribute loader for {name}" f" on {object_to_document_attr_on}" ) attr = safe_getattr ( object_to_document_attr_on , name , default ) else : attr = safe_getattr ( object_to_document_attr_on , name , default ) return attr
Try to extract an attribute as a proxy object with a repr containing the code
if the class the attribute is bound to is a subclass of ``InstrumentBase``
and the attribute is not private.
Try to extract an attribute as a proxy object with a repr containing the code if the class the attribute is bound to is a subclass of ` ` InstrumentBase ` ` and the attribute is not private .
"""
    Try to extract an attribute as a proxy object with a repr containing the code
    if the class the attribute is bound to is a subclass of ``InstrumentBase``
    and the attribute is not private.

    Args:
        object_to_document_attr_on: The type (not instance of the object to detect the
            attribute on.
        name: Name of the attribute to look for.
        *default: Default obejct to use as a replacement if the attribute could not be
            found.

    Returns:
        Attribute looked up, proxy object containing the code of the attribute as a
        repr or a default object.
    """
Attribute looked up, proxy object containing the code of the attribute as a
repr or a default object.
Attribute looked up proxy object containing the code of the attribute as a repr or a default object .
object_to_document_attr_on
Type[object]
The type (not instance of the object to detect the
attribute on.
The type ( not instance of the object to detect the attribute on .
name
str
Name of the attribute to look for.
Name of the attribute to look for .
default
Any
*default
Default obejct to use as a replacement if the attribute could not be
found.
Default obejct to use as a replacement if the attribute could not be found .