oplus/epm/table.py
def get_documented_add(self, record_descriptors):
    """
    this hack is used to document add function
    a methods __doc__ attribute is read-only (or must use metaclasses, what I certainly don't want to do...)
    we therefore create a function (who's __doc__ attribute is read/write), and will bind it to Table in __init__
    """
    def add(data=None, **or_data):
        """
        Parameters
        ----------
        data: dictionary containing field lowercase names or index as keys, and field values as values (dict syntax)
        or_data: keyword arguments containing field names as keys (kwargs syntax)

        A lowercase name is the lowercase EnergyPlus name, for which all non alpha-numeric characters have been replaced
        by underscores. All multiple consecutive underscores are then replaced by one unique underscore.

        The two syntaxes are not meant to cohabit. The kwargs syntax is nicer, but does not enable to use indexes
        instead of names.

        Examples
        --------
        for Schedule:Compact table:

        schedule = table.add(  # kwarg syntax
            name="Heating Setpoint Schedule - new[1]",
            schedule_type_limits_name="Any Number",
            field_1="Through: 12/31",
            field_2="For: AllDays",
            field_3="Until: 24:00,20.0"
        )

        schedule = table.add({  # dict syntax, mixing names and index keys
            name="Heating Setpoint Schedule - new[1]",
            schedule_type_limits_name="Any Number",
            2="Through: 12/31",
            3="For: AllDays",
            4="Until: 24:00,20.0"
        })

        Returns
        -------
        Created Record instance
        """
        return self.batch_add([or_data if data is None else data])[0]

    add.__doc__ = "\n".join([fd.ref.lower() for fd in record_descriptors if fd.ref is not None])

    return add
def get_documented_add(self, record_descriptors):
    """
    this hack is used to document add function
    a methods __doc__ attribute is read-only (or must use metaclasses, what I certainly don't want to do...)
    we therefore create a function (who's __doc__ attribute is read/write), and will bind it to Table in __init__
    """
    def add(data=None, **or_data):
        """
        Parameters
        ----------
        data: dictionary containing field lowercase names or index as keys, and field values as values (dict syntax)
        or_data: keyword arguments containing field names as keys (kwargs syntax)

        A lowercase name is the lowercase EnergyPlus name, for which all non alpha-numeric characters have been replaced
        by underscores. All multiple consecutive underscores are then replaced by one unique underscore.

        The two syntaxes are not meant to cohabit. The kwargs syntax is nicer, but does not enable to use indexes
        instead of names.

        Examples
        --------
        for Schedule:Compact table:

        schedule = table.add(  # kwarg syntax
            name="Heating Setpoint Schedule - new[1]",
            schedule_type_limits_name="Any Number",
            field_1="Through: 12/31",
            field_2="For: AllDays",
            field_3="Until: 24:00,20.0"
        )

        schedule = table.add({  # dict syntax, mixing names and index keys
            name="Heating Setpoint Schedule - new[1]",
            schedule_type_limits_name="Any Number",
            2="Through: 12/31",
            3="For: AllDays",
            4="Until: 24:00,20.0"
        })

        Returns
        -------
        Created Record instance
        """
        return self.batch_add([or_data if data is None else data])[0]

    add.__doc__ = "\n".join([fd.ref.lower() for fd in record_descriptors if fd.ref is not None])

    return add
this hack is used to document add function
    a methods __doc__ attribute is read-only (or must use metaclasses, what I certainly don't want to do...)
    we therefore create a function (who's __doc__ attribute is read/write), and will bind it to Table in __init__