matthew-r
12/13/2017 - 2:10 AM

td-obscura-sample-extension

A block of sudo code that can shows an example of prefered formatting and doc string documentation for TouchDesigner extensions.

class SampleClass:
    '''
        This is a sample class.

        This sample class has several important features that can be described here.


        Notes
        ---------------
        Your notes about the class go here


        Args
        ---------------
        Args and descriptions would go here, see sample_method for an example


        Returns
        ---------------
        none
    '''

    def __init__( self ):
        print( "sample_class initialized" )
        return

    def Sample_method( self, name, age, height ):
        '''
            This is a sample method.

            This sample method is intended to help illustrate what method docstrings should look like.
                            
            Notes
            ---------------
            'self' does not need to be included in the Args section.

            Args
            ---------------
            name (str)
            > A string name, with spaces as underscores
            
            age (int)
            > Age as full year measurements
            
            height (float)
            > Height in meters to 2 significant digits, ex: 1.45

            Examples
            ---------------

            Returns
            ---------------
            formatted_profile (str)
            > A formatted string populated with the with the supplied information
        '''

        # profile (str): preformatted text with placeholders
        profile = '''
        The following was submitted for review:
        name : {}
        age : {}
        height : {}
        ''' 

        formatted_profile = profile.format( name, age, height )
                    
        return formatted_profile

        self.Sample_method