Beispiel #1
0
                 **kwargs):
        if repositoryName:
            kwargs['repositoryName'] = repositoryName
        super(DockerRepository, self).__init__(properties=properties,
                                               annotations=annotations,
                                               local_state=local_state,
                                               parent=parent,
                                               **kwargs)
        if 'repositoryName' not in self:
            raise SynapseMalformedEntityError(
                "DockerRepository must have a repositoryName.")


# Create a mapping from Synapse class (as a string) to the equivalent Python class.
_entity_type_to_class = {}
for cls in itersubclasses(Entity):
    _entity_type_to_class[cls._synapse_entity_type] = cls

_entity_types = [
    "project", "folder", "file", "table", "link", "entityview", "dockerrepo"
]


def split_entity_namespaces(entity):
    """
    Given a plain dictionary or an Entity object, splits the object into properties, annotations and local state.
    A dictionary will be processed as a specific type of Entity if it has a valid 'concreteType' field, otherwise it is
    treated as a generic Entity.

    :returns: a 3-tuple (properties, annotations, local_state).
    """
Beispiel #2
0
            cacheDir, basename = os.path.split(path)
            self.__dict__['cacheDir'] = cacheDir
            self.__dict__['files'] = [basename]
        else:
            self.__dict__['cacheDir'] = None
            self.__dict__['files'] = []
        self.__dict__['synapseStore'] = synapseStore
        super(File, self).__init__(concreteType=File._synapse_entity_type, properties=properties,
                                   annotations=annotations, local_state=local_state, parent=parent, **kwargs)
        # if not synapseStore:
        #     self.__setitem__('concreteType', 'org.sagebionetworks.repo.model.file.ExternalFileHandle')


# Create a mapping from Synapse class (as a string) to the equivalent Python class.
_entity_type_to_class = {}
for cls in itersubclasses(Entity):
    _entity_type_to_class[cls._synapse_entity_type] = cls


def split_entity_namespaces(entity):
    """
    Given a plain dictionary or an Entity object,
    splits the object into properties, annotations and local state.
    A dictionary will be processed as a specific type of Entity
    if it has a valid 'concreteType' field,
    otherwise it is treated as a generic Entity.

    :returns: a 3-tuple (properties, annotations, local_state).
    """
    if isinstance(entity, Entity):
        # Defensive programming: return copies