def __init__(self, *args, **kwargs):
        signature = None
        if 'signature' in kwargs:
            signature = kwargs['signature']
            del kwargs['signature']
        if 'optional' not in kwargs:
            kwargs['optional'] = 0 # False
        elif type(kwargs['optional']) != type(0):
            if type(kwargs['optional']) == type(True):
                if kwargs['optional']:
                    kwargs['optional'] = 1
                else:
                    kwargs['optional'] = 0
            else:
                raise VistrailsInternalError("Cannot parse 'optional' kw "
                                             "-- must be an int or bool")
        if 'sort_key' not in kwargs:
            kwargs['sort_key'] = -1
        if 'id' not in kwargs:
            kwargs['id'] = -1
        if 'tooltip' in kwargs:
            self._tooltip = kwargs['tooltip']
            del kwargs['tooltip']
        else:
            self._tooltip = None
        DBPortSpec.__init__(self, *args, **kwargs)

        self._entries = None
        self._descriptors = None
        self._short_sigstring = None
        self._labels = None
        self._defaults = None
        if signature is not None:
            self.create_entries(signature)
        if not self.sigstring and self._entries is not None:
            # create sigstring from entries
            self.create_sigstring_and_descriptors()
# DAKOOP: removed this---we will check in module_registry and pipeline 
# validation, this way, we can let errors go all the way up
#         elif self._entries is None and self.sigstring:
#             # create entries from sigstring
#             self.create_entries_and_descriptors()
#         else:
#             raise VistrailsInternalError("Need to specify signature or "
#                                          "sigstring to create PortSpec")
        if self._entries is not None and self._tooltip is None:
            self.create_tooltip()
        self.is_valid = True
예제 #2
0
    def __init__(self, *args, **kwargs):
        signature = None
        if 'signature' in kwargs:
            signature = kwargs['signature']
            del kwargs['signature']
        if 'optional' not in kwargs:
            kwargs['optional'] = 0  # False
        elif type(kwargs['optional']) != type(0):
            if type(kwargs['optional']) == type(True):
                if kwargs['optional']:
                    kwargs['optional'] = 1
                else:
                    kwargs['optional'] = 0
            else:
                raise VistrailsInternalError("Cannot parse 'optional' kw "
                                             "-- must be an int or bool")
        if 'sort_key' not in kwargs:
            kwargs['sort_key'] = -1
        if 'id' not in kwargs:
            kwargs['id'] = -1
        if 'tooltip' in kwargs:
            self._tooltip = kwargs['tooltip']
            del kwargs['tooltip']
        else:
            self._tooltip = None
        DBPortSpec.__init__(self, *args, **kwargs)

        self._entries = None
        self._descriptors = None
        self._short_sigstring = None
        self._labels = None
        self._defaults = None
        if signature is not None:
            self.create_entries(signature)
        if not self.sigstring and self._entries is not None:
            # create sigstring from entries
            self.create_sigstring_and_descriptors()
# DAKOOP: removed this---we will check in module_registry and pipeline
# validation, this way, we can let errors go all the way up
#         elif self._entries is None and self.sigstring:
#             # create entries from sigstring
#             self.create_entries_and_descriptors()
#         else:
#             raise VistrailsInternalError("Need to specify signature or "
#                                          "sigstring to create PortSpec")
        if self._entries is not None and self._tooltip is None:
            self.create_tooltip()
        self.is_valid = True
 def do_copy(self, new_ids=False, id_scope=None, id_remap=None):
     cp = DBPortSpec.do_copy(self, new_ids, id_scope, id_remap)
     cp._entries = copy.copy(self._entries)
     cp._descriptors = copy.copy(self._descriptors)
     cp._short_sigstring = self._short_sigstring
     cp._labels = self._labels
     cp._defaults = self._defaults
     cp._tooltip = self._tooltip
     cp.is_valid = self.is_valid
     cp.__class__ = PortSpec
     if cp._entries is not None:
         cp.create_tooltip()
     return cp
예제 #4
0
 def do_copy(self, new_ids=False, id_scope=None, id_remap=None):
     cp = DBPortSpec.do_copy(self, new_ids, id_scope, id_remap)
     cp._entries = copy.copy(self._entries)
     cp._descriptors = copy.copy(self._descriptors)
     cp._short_sigstring = self._short_sigstring
     cp._labels = self._labels
     cp._defaults = self._defaults
     cp._tooltip = self._tooltip
     cp.is_valid = self.is_valid
     cp.__class__ = PortSpec
     if cp._entries is not None:
         cp.create_tooltip()
     return cp
예제 #5
0
 def do_copy(self, new_ids=False, id_scope=None, id_remap=None):
     cp = DBPortSpec.do_copy(self, new_ids, id_scope, id_remap)
     cp.__class__ = PortSpec
     return cp
예제 #6
0
 def __init__(self, *args, **kwargs):
     DBPortSpec.__init__(self, *args, **kwargs)
     if self.id is None:
         self.id = -1