def auto_add_ports(self, module):
        """Add input/output ports to the registry.

        This isn't meant to be called directly -- it is used by the
        PackageManager to register modules automatically by inspecting a
        package's contents.
        """
        if '_input_ports' in module.__dict__:
            for port_info in module._input_ports:
                name = None
                try:
                    name, sig, kwargs = self.decode_input_port(port_info)
                    self.add_input_port(module, name, sig, **kwargs)
                except Exception, e:
                    debug.unexpected_exception(e)
                    debug.critical(
                            "Failed to add input port %s to module '%s'" % (
                                '"%s"' % name if name is not None
                                else "(unknown)", module.__name__),
                            e)
                    raise

        if '_output_ports' in module.__dict__:
            for port_info in module._output_ports:
                name = None
                try:
                    name, sig, kwargs = self.decode_output_port(port_info)
                    self.add_output_port(module, name, sig, **kwargs)
                except Exception, e:
                    debug.unexpected_exception(e)
                    debug.critical(
                             "Failed to add output port %s to module '%s'" % (
                                 '"%s"' % name if name is not None
                                 else "(unknown)", module.__name__),
                             e)
                    raise
dataset/ETHPy150Open VisTrails/VisTrails/vistrails/core/modules/module_registry.py/ModuleRegistry.auto_add_ports/original