示例#1
0
class ICommand(interface.Interface):
    class IMeta:
        """Interface meta-data"""

        label = 'command'
        """The string identifier of the interface."""

        validator = cmd_interface_validator
        """The interface validator function."""

    Meta = interface.Attribute('Handler Meta-data')

    def _setup(app_obj):
        """
        The _setup function is called during application initialization and
        must 'setup' the handler object making it ready for the framework
        or the application to make further calls to it.
        
        :param app_obj: The application object. 
                                
        """

    def monitor(work_dir, idfile=None):
        """
        Check for process/job id file.
        
        :param work_dir: working directory
        :param idfile: process/job id file
        """

    def command(cmd_args, capture=True, ignore_error=False, cwd=None, **kw):
        """
        Run the command interface function

        Required arguments:

          cmd_args
            Command arguments <list>
          capture
            Capture output
          ignore_error
            Ignore errors
          cwd
            Working directory
          

        Optional arguments:

          kw
            keyword arguments
           
        """
        def runpipe():
            """
示例#2
0
 def test_attribute_class(self):
     i = interface.Attribute('Test attribute')
     self.eq(i.__repr__(), "<interface.Attribute - 'Test attribute'>")