scripts/collect_ad_boilerplate.py
def write_cam_class(boilerplate_file, pv_to_signal_mapping, include_file_base, dev_name, det_name, cam_name):
    """
    Function that writes the boilerplate cam class. This includes the default configuration
    attributes, along with all the attributes extracted from the template file.

    This function uses the inflection library's `underscore` function to convert a PV name
    into an attribute name

    Examples:

    EnableCallbacks -> enable_callbacks
    EVTLoadGainFile -> evt_load_gain_file

    Parameters
    ----------
    boilerplate_file : io.TextIOWrapper
        Open boilerplate file
    pv_to_signal_mapping : dict
        Dictionary mapping PVs to the EPICS signal they fall under
    include_file_base : bool
        If true, we extend the FileBase class, otherwise we don't
    dev_name : str
        Name of device type/make. Ex. PICam, Eiger, etc.
    det_name : str
        Name of detector class, ex. PICamDetector, EigerDetector, etc.
    cam_name : str
        Name of cam class, ex. PICamDetectorCam, EigerDetectorCam, etc.
    """

    # Extend from FileBase class as well if necessary
    file_base = ''
    if include_file_base:
        file_base = ', FileBase'

    # Write class boilerplate
    boilerplate_file.write(
        f'''
class {cam_name}(CamBase{file_base}):
    _html_docs = ['{dev_name}Doc.html']
    _default_configuration_attrs = (
        CamBase._default_configuration_attrs
    )
''')

    # Write attribute for each discovered PV, with appropriate EPICS signal class
    for pv in pv_to_signal_mapping.keys():
        pv_name = pv
        if pv_name.endswith('_RBV'):
            pv_name = pv[:-len('_RBV')]

        # Generate attribute name from PV name. Uses inflection library
        attribute_name = inflection.underscore(pv_name)
        # attribute_name = re.sub('(?<!^)(?=[A-Z])', '_', pv_name).lower()
        boilerplate_file.write(f"    {attribute_name} = ADCpt({pv_to_signal_mapping[pv]}, '{pv}')\n")

    Function that writes the boilerplate cam class. This includes the default configuration
    attributes, along with all the attributes extracted from the template file.

    This function uses the inflection library's `underscore` function to convert a PV name
    into an attribute name

    Examples:

    EnableCallbacks -> enable_callbacks
    EVTLoadGainFile -> evt_load_gain_file

    Parameters
    ----------
    boilerplate_file : io.TextIOWrapper
        Open boilerplate file
    pv_to_signal_mapping : dict
        Dictionary mapping PVs to the EPICS signal they fall under
    include_file_base : bool
        If true, we extend the FileBase class, otherwise we don't
    dev_name : str
        Name of device type/make. Ex. PICam, Eiger, etc.
    det_name : str
        Name of detector class, ex. PICamDetector, EigerDetector, etc.
    cam_name : str
        Name of cam class, ex. PICamDetectorCam, EigerDetectorCam, etc.
    
Function that writes the boilerplate cam class. This includes the default configuration
attributes, along with all the attributes extracted from the template file.

This function uses the inflection library's `underscore` function to convert a PV name
into an attribute name
Function that writes the boilerplate cam class . This includes the default configuration attributes along with all the attributes extracted from the template file . This function uses the inflection library ' s ` underscore ` function to convert a PV name into an attribute name
def write_cam_class(boilerplate_file, pv_to_signal_mapping, include_file_base, dev_name, det_name, cam_name):
    file_base = ''
    if include_file_base:
        file_base = ', FileBase'
    boilerplate_file.write(
        f'''
class {cam_name}(CamBase{file_base}):
    _html_docs = ['{dev_name}Doc.html']
    _default_configuration_attrs = (
        CamBase._default_configuration_attrs
    )
''')
    for pv in pv_to_signal_mapping.keys():
        pv_name = pv
        if pv_name.endswith('_RBV'):
            pv_name = pv[:-len('_RBV')]
        attribute_name = inflection.underscore(pv_name)
        boilerplate_file.write(f"    {attribute_name} = ADCpt({pv_to_signal_mapping[pv]}, '{pv}')\n")
def write_cam_class ( boilerplate_file , pv_to_signal_mapping , include_file_base , dev_name , det_name , cam_name ) : file_base = '' if include_file_base : file_base = ', FileBase' boilerplate_file . write ( f'''
class {cam_name}(CamBase{file_base}):
    _html_docs = ['{dev_name}Doc.html']
    _default_configuration_attrs = (
        CamBase._default_configuration_attrs
    )
''' ) for pv in pv_to_signal_mapping . keys ( ) : pv_name = pv if pv_name . endswith ( '_RBV' ) : pv_name = pv [ : - len ( '_RBV' ) ] attribute_name = inflection . underscore ( pv_name ) boilerplate_file . write ( f"    {attribute_name} = ADCpt({pv_to_signal_mapping[pv]}, '{pv}')\n" )
Function that writes the boilerplate cam class.
Function that writes the boilerplate cam class .
"""
    Function that writes the boilerplate cam class. This includes the default configuration
    attributes, along with all the attributes extracted from the template file.

    This function uses the inflection library's `underscore` function to convert a PV name
    into an attribute name

    Examples:

    EnableCallbacks -> enable_callbacks
    EVTLoadGainFile -> evt_load_gain_file

    Parameters
    ----------
    boilerplate_file : io.TextIOWrapper
        Open boilerplate file
    pv_to_signal_mapping : dict
        Dictionary mapping PVs to the EPICS signal they fall under
    include_file_base : bool
        If true, we extend the FileBase class, otherwise we don't
    dev_name : str
        Name of device type/make. Ex. PICam, Eiger, etc.
    det_name : str
        Name of detector class, ex. PICamDetector, EigerDetector, etc.
    cam_name : str
        Name of cam class, ex. PICamDetectorCam, EigerDetectorCam, etc.
    """ # Extend from FileBase class as well if necessary # Write class boilerplate # Write attribute for each discovered PV, with appropriate EPICS signal class # Generate attribute name from PV name. Uses inflection library # attribute_name = re.sub('(?<!^)(?=[A-Z])', '_', pv_name).lower()
boilerplate_file
pv_to_signal_mapping
include_file_base
dev_name
det_name
cam_name
examples
None