Ejemplo n.º 1
0
 def do_copy(self, new_ids=False, id_scope=None, id_remap=None):
     cp = DBPort.do_copy(self, new_ids, id_scope, id_remap)
     cp.__class__ = Port
     cp.optional = self.optional
     cp.sort_key = self.sort_key
     cp.spec = copy.copy(self.spec)
     return cp
Ejemplo n.º 2
0
    def __init__(self, *args, **kwargs):
        """The preferred way to create a port is to pass a PortSpec with
        new information.  The construcotr pulls name, type, and signature 
        info from the PortSpec.
        
        Example: Port(id=<id>, spec=<port_spec>, moduleId=<id>, 
                      moduleName=<name>)

        You can also pass the name, type, and signature, separately.
        
        Example: Port(id=<id>, name=<name>, type=[source|destination],
                      signature=<sig>, moduleId=<id>, moduleName=<name>)

        """

        self._spec = None
        self._descriptors = None
        if 'spec' in kwargs:
            self._spec = kwargs['spec']
            del kwargs['spec']
            if 'name' not in kwargs:
                kwargs['name'] = self._spec.name
            if 'type' not in kwargs:
                if self._spec.type in PortSpec.port_type_map:
                    kwargs['type'] = PortSpec.port_type_map[self._spec.type]
            if 'signature' not in kwargs:
                kwargs['signature'] = self._spec.sigstring
#         else:
#             self.spec = None
        if 'id' not in kwargs:
            kwargs['id'] = -1
        if 'moduleId' not in kwargs:
            kwargs['moduleId'] = 0
        if 'moduleName' not in kwargs:
            kwargs['moduleName'] = ""
        if 'name' not in kwargs:
            kwargs['name'] = ""
        if 'signature' not in kwargs:
            kwargs['signature'] = ""

	DBPort.__init__(self, *args, **kwargs)

        self.set_defaults()
Ejemplo n.º 3
0
    def __init__(self, *args, **kwargs):
        """The preferred way to create a port is to pass a PortSpec with
        new information.  The construcotr pulls name, type, and signature 
        info from the PortSpec.
        
        Example: Port(id=<id>, spec=<port_spec>, moduleId=<id>, 
                      moduleName=<name>)

        You can also pass the name, type, and signature, separately.
        
        Example: Port(id=<id>, name=<name>, type=[source|destination],
                      signature=<sig>, moduleId=<id>, moduleName=<name>)

        """

        self._spec = None
        self._descriptors = None
        if 'spec' in kwargs:
            self._spec = kwargs['spec']
            del kwargs['spec']
            if 'name' not in kwargs:
                kwargs['name'] = self._spec.name
            if 'type' not in kwargs:
                if self._spec.type in PortSpec.port_type_map:
                    kwargs['type'] = PortSpec.port_type_map[self._spec.type]
            if 'signature' not in kwargs:
                kwargs['signature'] = self._spec.sigstring
#         else:
#             self.spec = None
        if 'id' not in kwargs:
            kwargs['id'] = -1
        if 'moduleId' not in kwargs:
            kwargs['moduleId'] = 0
        if 'moduleName' not in kwargs:
            kwargs['moduleName'] = ""
        if 'name' not in kwargs:
            kwargs['name'] = ""
        if 'signature' not in kwargs:
            kwargs['signature'] = ""

        DBPort.__init__(self, *args, **kwargs)

        self.set_defaults()
Ejemplo n.º 4
0
    def __init__(self, *args, **kwargs):
        if 'optional' in kwargs:
            self.optional = kwargs['optional']
            del kwargs['optional']
        else:
            self.optional = False
	DBPort.__init__(self, *args, **kwargs)
        if self.db_id is None:
            self.db_id = -1
        if self.db_moduleId is None:
            self.db_moduleId = 0
        if self.db_moduleName is None:
            self.db_moduleName = ""
        if self.db_name is None:
            self.db_name = ""
        if self.db_spec is None:
            self.db_spec = ""
        
        self.sort_key = -1
        self._spec = None
Ejemplo n.º 5
0
 def do_copy(self, new_ids=False, id_scope=None, id_remap=None):
     cp = DBPort.do_copy(self, new_ids, id_scope, id_remap)
     cp.__class__ = Port
     cp.set_defaults(self)
     return cp
Ejemplo n.º 6
0
 def do_copy(self, new_ids=False, id_scope=None, id_remap=None):
     cp = DBPort.do_copy(self, new_ids, id_scope, id_remap)
     cp.__class__ = Port
     cp.set_defaults(self)
     return cp