From d9d61a1cc443d6ab84feff87786f8de201991e37 Mon Sep 17 00:00:00 2001 From: vermeul <swen@ethz.ch> Date: Mon, 26 Jul 2021 15:59:56 +0200 Subject: [PATCH] add black format --- pybis/src/python/pybis/definitions.py | 350 +++++++++++++------------- 1 file changed, 169 insertions(+), 181 deletions(-) diff --git a/pybis/src/python/pybis/definitions.py b/pybis/src/python/pybis/definitions.py index a83646fb230..889439e2377 100644 --- a/pybis/src/python/pybis/definitions.py +++ b/pybis/src/python/pybis/definitions.py @@ -14,10 +14,10 @@ def openbis_definitions(entity): "attrs": "code permId description frozen frozenForProjects frozenForSamples registrator registrationDate modificationDate".split(), "multi": "".split(), "identifier": "spaceId", - "create": { "@type": "as.dto.space.create.SpaceCreation"}, - "update": { "@type": "as.dto.space.update.SpaceUpdate"}, - "delete": { "@type": "as.dto.space.delete.SpaceDeletionOptions"}, - "fetch": { "@type": "as.dto.space.fetchoptions.SpaceFetchOptions"}, + "create": {"@type": "as.dto.space.create.SpaceCreation"}, + "update": {"@type": "as.dto.space.update.SpaceUpdate"}, + "delete": {"@type": "as.dto.space.delete.SpaceDeletionOptions"}, + "fetch": {"@type": "as.dto.space.fetchoptions.SpaceFetchOptions"}, }, "project": { "attrs_new": "code description space attachments".split(), @@ -25,8 +25,8 @@ def openbis_definitions(entity): "attrs": "code description permId identifier space leader registrator registrationDate modifier modificationDate attachments frozen frozenForExperiments frozenForSamples".split(), "multi": "".split(), "identifier": "projectId", - "create": { "@type": "as.dto.project.create.ProjectCreation"}, - "update": { "@type": "as.dto.project.update.ProjectUpdate"}, + "create": {"@type": "as.dto.project.create.ProjectCreation"}, + "update": {"@type": "as.dto.project.update.ProjectUpdate"}, }, "experiment": { "attrs_new": "code type project tags attachments".split(), @@ -34,30 +34,30 @@ def openbis_definitions(entity): "attrs": "code permId identifier type project tags registrator registrationDate modifier modificationDate attachments frozen frozenForDataSets frozenForSamples".split(), "multi": "tags attachments".split(), "identifier": "experimentId", - "create": { "@type": "as.dto.experiment.create.ExperimentCreation"}, - "update": { "@type": "as.dto.experiment.update.ExperimentUpdate"}, + "create": {"@type": "as.dto.experiment.create.ExperimentCreation"}, + "update": {"@type": "as.dto.experiment.update.ExperimentUpdate"}, }, "externalDms": { "attrs_new": "code label address addressType creationId".split(), "attrs_up": "label address".split(), "attrs": "code permId label address addressType urlTemplate".split(), "identifier": "externalDmsId", - "create": { "@type": "as.dto.externaldms.create.ExternalDmsCreation"}, - "update": { "@type": "as.dto.externaldms.update.ExternalDmsUpdate"}, + "create": {"@type": "as.dto.externaldms.create.ExternalDmsCreation"}, + "update": {"@type": "as.dto.externaldms.update.ExternalDmsUpdate"}, }, "sample": { "attrs_new": "code type project parents children container components space experiment tags attachments".split(), "attrs_up": "project parents children container components space experiment tags attachments freeze freezeForComponents freezeForChildren freezeForParents freezeForDataSets".split(), "attrs": "code permId identifier type project parents children components space experiment tags registrator registrationDate modifier modificationDate attachments container frozen frozenForComponents frozenForChildren frozenForParents frozenForDataSets".split(), "ids2type": { - 'parentIds': {'permId': {'@type': 'as.dto.sample.id.SamplePermId'}}, - 'childIds': {'permId': {'@type': 'as.dto.sample.id.SamplePermId'}}, - 'componentIds': {'permId': {'@type': 'as.dto.sample.id.SamplePermId'}}, + "parentIds": {"permId": {"@type": "as.dto.sample.id.SamplePermId"}}, + "childIds": {"permId": {"@type": "as.dto.sample.id.SamplePermId"}}, + "componentIds": {"permId": {"@type": "as.dto.sample.id.SamplePermId"}}, }, "identifier": "sampleId", - "create": { "@type": "as.dto.sample.create.SampleCreation"}, - "update": { "@type": "as.dto.sample.update.SampleUpdate"}, - "delete": { "@type": "as.dto.sample.delete.SampleDeletionOptions"}, + "create": {"@type": "as.dto.sample.create.SampleCreation"}, + "update": {"@type": "as.dto.sample.update.SampleUpdate"}, + "delete": {"@type": "as.dto.sample.delete.SampleDeletionOptions"}, "cre_type": "as.dto.sample.create.SampleCreation", "multi": "parents children components tags attachments".split(), }, @@ -66,112 +66,79 @@ def openbis_definitions(entity): "attrs_up": "description autoGeneratedCode generatedCodePrefix subcodeUnique listable showContainer showParents showParentMetadata, validationPlugin".split(), "attrs": "permId code description autoGeneratedCode generatedCodePrefix subcodeUnique listable showContainer showParents showParentMetadata modificationDate validationPlugin".split(), "default_attribute_values": { - "autoGeneratedCode" : False, - "generatedCodePrefix" : "S", - "subcodeUnique" : False, - "description" : "", - "listable" : True, - "showContainer" : False, - "showParents" : True, - "showParentMetadata" : False - }, - "search": { - "@type": "as.dto.sample.search.SampleTypeSearchCriteria" - }, - "create": { - "@type": "as.dto.sample.create.SampleTypeCreation" - }, - "update": { - "@type": "as.dto.sample.update.SampleTypeUpdate" - }, - "delete": { - "@type": "as.dto.sample.delete.SampleTypeDeletionOptions" + "autoGeneratedCode": False, + "generatedCodePrefix": "S", + "subcodeUnique": False, + "description": "", + "listable": True, + "showContainer": False, + "showParents": True, + "showParentMetadata": False, }, + "search": {"@type": "as.dto.sample.search.SampleTypeSearchCriteria"}, + "create": {"@type": "as.dto.sample.create.SampleTypeCreation"}, + "update": {"@type": "as.dto.sample.update.SampleTypeUpdate"}, + "delete": {"@type": "as.dto.sample.delete.SampleTypeDeletionOptions"}, "identifier": "typeId", }, "materialType": { - "attrs_new": "code description validationPlugin".split(), - "attrs_up": "description validationPlugin".split(), + "attrs_new": "code description validationPlugin".split(), + "attrs_up": "description validationPlugin".split(), "attrs": "permId code description validationPlugin".split(), - "search": { - "@type": "as.dto.material.search.MaterialTypeSearchCriteria" - }, - "fetch": { - "@type": "as.dto.material.fetchoptions.MaterialTypeFetchOptions" - }, - "create": { - "@type": "as.dto.material.create.MaterialTypeCreation" - }, - "update": { - "@type": "as.dto.material.update.MaterialTypeUpdate" - }, - "delete": { - "@type": "as.dto.material.delete.MaterialTypeDeletionOptions" - }, + "search": {"@type": "as.dto.material.search.MaterialTypeSearchCriteria"}, + "fetch": {"@type": "as.dto.material.fetchoptions.MaterialTypeFetchOptions"}, + "create": {"@type": "as.dto.material.create.MaterialTypeCreation"}, + "update": {"@type": "as.dto.material.update.MaterialTypeUpdate"}, + "delete": {"@type": "as.dto.material.delete.MaterialTypeDeletionOptions"}, "identifier": "typeId", }, "dataSetType": { - "attrs_new": "code description mainDataSetPattern mainDataSetPath disallowDeletion validationPlugin".split(), - "attrs_up": "description mainDataSetPattern mainDataSetPath disallowDeletion validationPlugin".split(), + "attrs_new": "code description mainDataSetPattern mainDataSetPath disallowDeletion validationPlugin".split(), + "attrs_up": "description mainDataSetPattern mainDataSetPath disallowDeletion validationPlugin".split(), "attrs": "permId code description mainDataSetPattern mainDataSetPath disallowDeletion modificationDate validationPlugin".split(), - "search": { - "@type": "as.dto.dataset.search.DataSetTypeSearchCriteria" - }, - "fetch": { - "@type": "as.dto.dataset.fetchoptions.DataSetTypeFetchOptions" - }, - "create": { - "@type": "as.dto.dataset.create.DataSetTypeCreation" - }, - "update": { - "@type": "as.dto.dataset.update.DataSetTypeUpdate" - }, - "delete": { - "@type": "as.dto.dataset.delete.DataSetTypeDeletionOptions" - }, + "search": {"@type": "as.dto.dataset.search.DataSetTypeSearchCriteria"}, + "fetch": {"@type": "as.dto.dataset.fetchoptions.DataSetTypeFetchOptions"}, + "create": {"@type": "as.dto.dataset.create.DataSetTypeCreation"}, + "update": {"@type": "as.dto.dataset.update.DataSetTypeUpdate"}, + "delete": {"@type": "as.dto.dataset.delete.DataSetTypeDeletionOptions"}, "identifier": "typeId", }, "experimentType": { "attrs_new": "code description validationPlugin".split(), - "attrs_up": "description modificationDate validationPlugin".split(), - "attrs": "permId code description modificationDate validationPlugin".split(), + "attrs_up": "description modificationDate validationPlugin".split(), + "attrs": "permId code description modificationDate validationPlugin".split(), "search": { "@type": "as.dto.experiment.search.ExperimentTypeSearchCriteria" }, "fetch": { "@type": "as.dto.experiment.fetchoptions.ExperimentTypeFetchOptions" }, - "create": { - "@type": "as.dto.experiment.create.ExperimentTypeCreation" - }, - "update": { - "@type": "as.dto.experiment.update.ExperimentTypeUpdate" - }, + "create": {"@type": "as.dto.experiment.create.ExperimentTypeCreation"}, + "update": {"@type": "as.dto.experiment.update.ExperimentTypeUpdate"}, "delete": { "@type": "as.dto.experiment.delete.ExperimentTypeDeletionOptions" }, "identifier": "typeId", }, "propertyType": { - "attrs": "code label description managedInternally dataType vocabulary materialType schema transformation semanticAnnotations registrator registrationDate".split(), + "attrs": "code permId label description managedInternally dataType vocabulary materialType schema transformation semanticAnnotations registrator registrationDate metaData".split(), "attrs_new": "code label description managedInternally dataType vocabulary materialType schema transformation metaData".split(), "attrs_up": "label description schema transformation metaData".split(), - "search": { - "@type": "as.dto.property.search.PropertyTypeSearchCriteria" - }, - "create": { - "@type": "as.dto.property.create.PropertyTypeCreation" - }, - "update": { - "@type": "as.dto.property.update.PropertyTypeUpdate" - }, - "delete": { - "@type": "as.dto.property.delete.PropertyTypeDeletionOptions" - }, + "search": {"@type": "as.dto.property.search.PropertyTypeSearchCriteria"}, + "create": {"@type": "as.dto.property.create.PropertyTypeCreation"}, + "update": {"@type": "as.dto.property.update.PropertyTypeUpdate"}, + "delete": {"@type": "as.dto.property.delete.PropertyTypeDeletionOptions"}, "dataType": [ - "INTEGER", "VARCHAR", "MULTILINE_VARCHAR", - "REAL", "TIMESTAMP", "BOOLEAN", "CONTROLLEDVOCABULARY", - "MATERIAL", "HYPERLINK", "XML" + "INTEGER", + "VARCHAR", + "MULTILINE_VARCHAR", + "REAL", + "TIMESTAMP", + "BOOLEAN", + "CONTROLLEDVOCABULARY", + "MATERIAL", + "HYPERLINK", + "XML", ], "identifier": "typeId", }, @@ -180,12 +147,8 @@ def openbis_definitions(entity): "attrs_up": "entityType propertyType predicateOntologyId predicateOntologyVersion predicateAccessionId descriptorOntologyId descriptorOntologyVersion descriptorAccessionId ".split(), "attrs": "permId entityType propertyType predicateOntologyId predicateOntologyVersion predicateAccessionId descriptorOntologyId descriptorOntologyVersion descriptorAccessionId creationDate".split(), "ids2type": { - "propertyTypeId": { - "permId": "as.dto.property.id.PropertyTypePermId" - }, - "entityTypeId": { - "permId": "as.dto.entity.id.EntityTypePermId" - }, + "propertyTypeId": {"permId": "as.dto.property.id.PropertyTypePermId"}, + "entityTypeId": {"permId": "as.dto.entity.id.EntityTypePermId"}, }, "identifier": "permId", "cre_type": "as.dto.sample.create.SampleCreation", @@ -195,12 +158,15 @@ def openbis_definitions(entity): "attrs_new": "type code kind experiment sample parents children components containers tags".split(), "attrs_up": "parents children experiment sample components containers tags freeze freezeForChildren freezeForParents freezeForComponents freezeForContainers".split(), "attrs": "code permId type kind experiment sample parents children components containers tags accessDate dataProducer dataProductionDate registrator registrationDate modifier modificationDate dataStore measured postRegistered frozen frozenForChildren frozenForParents frozenForComponents frozenForContainers".split(), - "ids2type": { - 'parentIds': {'permId': {'@type': 'as.dto.dataset.id.DataSetPermId'}}, - 'childIds': {'permId': {'@type': 'as.dto.dataset.id.DataSetPermId'}}, - 'componentIds': {'permId': {'@type': 'as.dto.dataset.id.DataSetPermId'}}, - 'containerIds': {'permId': {'@type': 'as.dto.dataset.id.DataSetPermId'}}, + "parentIds": {"permId": {"@type": "as.dto.dataset.id.DataSetPermId"}}, + "childIds": {"permId": {"@type": "as.dto.dataset.id.DataSetPermId"}}, + "componentIds": { + "permId": {"@type": "as.dto.dataset.id.DataSetPermId"} + }, + "containerIds": { + "permId": {"@type": "as.dto.dataset.id.DataSetPermId"} + }, }, "multi": "parents children containers components".split(), "identifier": "dataSetId", @@ -225,11 +191,11 @@ def openbis_definitions(entity): "attrs": "code description managedInternally chosenFromList urlTemplate registrator registrationDate modifier modificationDate".split(), "multi": "".split(), "identifier": "vocabularyId", - "search": { "@type": "as.dto.vocabulary.search.VocabularySearchCriteria" }, - "create": { "@type": "as.dto.vocabulary.create.VocabularyCreation"}, - "update": { "@type": "as.dto.vocabulary.update.VocabularyUpdate"}, - "delete": { "@type": "as.dto.vocabulary.delete.VocabularyDeletionOptions"}, - "fetch": { "@type": "as.dto.vocabulary.fetchoptions.VocabularyFetchOptions"}, + "search": {"@type": "as.dto.vocabulary.search.VocabularySearchCriteria"}, + "create": {"@type": "as.dto.vocabulary.create.VocabularyCreation"}, + "update": {"@type": "as.dto.vocabulary.update.VocabularyUpdate"}, + "delete": {"@type": "as.dto.vocabulary.delete.VocabularyDeletionOptions"}, + "fetch": {"@type": "as.dto.vocabulary.fetchoptions.VocabularyFetchOptions"}, }, "vocabularyTerm": { "attrs_new": "code vocabularyCode label description official ordinal".split(), @@ -237,10 +203,14 @@ def openbis_definitions(entity): "attrs": "code vocabularyCode label description official ordinal registrator registrationDate modifier modificationDate".split(), "multi": "".split(), "identifier": "vocabularyTermId", - "create": { "@type": "as.dto.vocabulary.create.VocabularyTermCreation"}, - "update": { "@type": "as.dto.vocabulary.update.VocabularyTermUpdate"}, - "delete": { "@type": "as.dto.vocabulary.delete.VocabularyTermDeletionOptions"}, - "fetch": { "@type": "as.dto.vocabulary.fetchoptions.VocabularyTermFetchOptions"}, + "create": {"@type": "as.dto.vocabulary.create.VocabularyTermCreation"}, + "update": {"@type": "as.dto.vocabulary.update.VocabularyTermUpdate"}, + "delete": { + "@type": "as.dto.vocabulary.delete.VocabularyTermDeletionOptions" + }, + "fetch": { + "@type": "as.dto.vocabulary.fetchoptions.VocabularyTermFetchOptions" + }, }, "plugin": { "attrs_new": "name description pluginType script available entityKind".split(), @@ -248,8 +218,8 @@ def openbis_definitions(entity): "attrs": "permId name description registrator registrationDate pluginKind entityKinds pluginType script available".split(), "multi": "".split(), "identifier": "pluginId", - "pluginType": ['DYNAMIC_PROPERTY', 'MANAGED_PROPERTY', 'ENTITY_VALIDATION'], - "entityKind": ['MATERIAL', 'EXPERIMENT', 'SAMPLE', 'DATA_SET'], + "pluginType": ["DYNAMIC_PROPERTY", "MANAGED_PROPERTY", "ENTITY_VALIDATION"], + "entityKind": ["MATERIAL", "EXPERIMENT", "SAMPLE", "DATA_SET"], }, "person": { "attrs_new": "userId space".split(), @@ -258,18 +228,25 @@ def openbis_definitions(entity): "multi": "".split(), "identifier": "userId", }, - "authorizationGroup" : { + "authorizationGroup": { "attrs_new": "code description userIds".split(), "attrs_up": "code description userIds".split(), "attrs": "permId code description registrator registrationDate modificationDate users".split(), "multi": "users".split(), "identifier": "groupId", }, - "roleAssignment" : { + "roleAssignment": { "attrs": "id user authorizationGroup role roleLevel space project registrator registrationDate".split(), "attrs_new": "role roleLevel user authorizationGroup role space project".split(), "attrs_up": "role roleLevel user authorizationGroup role space project".split(), - "role": ['POWER_USER', 'OBSERVER', 'USER', 'DISABLED', 'ADMIN', 'ETL_SERVER'] + "role": [ + "POWER_USER", + "OBSERVER", + "USER", + "DISABLED", + "ADMIN", + "ETL_SERVER", + ], }, "attr2ids": { "space": "spaceId", @@ -295,20 +272,24 @@ def openbis_definitions(entity): "description": "description", "vocabulary": "vocabularyId", "validationPlugin": "validationPluginId", + "metaData": "metaData", }, "ids2type": { - 'spaceId': {'permId': {'@type': 'as.dto.space.id.SpacePermId'}}, - 'projectId': {'permId': {'@type': 'as.dto.project.id.ProjectPermId'}}, - 'experimentId': {'permId': {'@type': 'as.dto.experiment.id.ExperimentPermId'}}, - 'tagIds': {'code': {'@type': 'as.dto.tag.id.TagCode'}}, + "spaceId": {"permId": {"@type": "as.dto.space.id.SpacePermId"}}, + "projectId": {"permId": {"@type": "as.dto.project.id.ProjectPermId"}}, + "experimentId": { + "permId": {"@type": "as.dto.experiment.id.ExperimentPermId"} + }, + "tagIds": {"code": {"@type": "as.dto.tag.id.TagCode"}}, }, "dataSetFile": { - "search": { "@type": "dss.dto.datasetfile.search.DataSetFileSearchCriteria" } + "search": {"@type": "dss.dto.datasetfile.search.DataSetFileSearchCriteria"} }, } return entities[entity] -get_definition_for_entity = openbis_definitions # Alias + +get_definition_for_entity = openbis_definitions # Alias fetch_option = { @@ -318,20 +299,22 @@ fetch_option = { "space": {"@type": "as.dto.space.fetchoptions.SpaceFetchOptions"}, }, "person": {"@type": "as.dto.person.fetchoptions.PersonFetchOptions"}, - "users": {"@type": "as.dto.person.fetchoptions.PersonFetchOptions" }, - "user": {"@type": "as.dto.person.fetchoptions.PersonFetchOptions" }, - "owner": {"@type": "as.dto.person.fetchoptions.PersonFetchOptions" }, + "users": {"@type": "as.dto.person.fetchoptions.PersonFetchOptions"}, + "user": {"@type": "as.dto.person.fetchoptions.PersonFetchOptions"}, + "owner": {"@type": "as.dto.person.fetchoptions.PersonFetchOptions"}, "registrator": {"@type": "as.dto.person.fetchoptions.PersonFetchOptions"}, "modifier": {"@type": "as.dto.person.fetchoptions.PersonFetchOptions"}, "leader": {"@type": "as.dto.person.fetchoptions.PersonFetchOptions"}, - "authorizationGroup": {"@type": "as.dto.authorizationgroup.fetchoptions.AuthorizationGroupFetchOptions"}, + "authorizationGroup": { + "@type": "as.dto.authorizationgroup.fetchoptions.AuthorizationGroupFetchOptions" + }, "experiment": { "@type": "as.dto.experiment.fetchoptions.ExperimentFetchOptions", - "type": {"@type": "as.dto.experiment.fetchoptions.ExperimentTypeFetchOptions"} + "type": {"@type": "as.dto.experiment.fetchoptions.ExperimentTypeFetchOptions"}, }, "sample": { "@type": "as.dto.sample.fetchoptions.SampleFetchOptions", - "type": {"@type": "as.dto.sample.fetchoptions.SampleTypeFetchOptions"} + "type": {"@type": "as.dto.sample.fetchoptions.SampleTypeFetchOptions"}, }, "samples": {"@type": "as.dto.sample.fetchoptions.SampleFetchOptions"}, "sampleType": { @@ -341,13 +324,11 @@ fetch_option = { "propertyType": { "@type": "as.dto.property.fetchoptions.PropertyTypeFetchOptions" }, - "plugin": { - "@type": "as.dto.plugin.fetchoptions.PluginFetchOptions" - } + "plugin": {"@type": "as.dto.plugin.fetchoptions.PluginFetchOptions"}, }, "validationPlugin": { "@type": "as.dto.plugin.fetchoptions.PluginFetchOptions", - } + }, }, "materialType": { "@type": "as.dto.material.fetchoptions.MaterialTypeFetchOptions", @@ -356,13 +337,11 @@ fetch_option = { "propertyType": { "@type": "as.dto.property.fetchoptions.PropertyTypeFetchOptions", }, - "plugin": { - "@type": "as.dto.plugin.fetchoptions.PluginFetchOptions" - } + "plugin": {"@type": "as.dto.plugin.fetchoptions.PluginFetchOptions"}, }, "validationPlugin": { "@type": "as.dto.plugin.fetchoptions.PluginFetchOptions", - } + }, }, "dataSetType": { "@type": "as.dto.dataset.fetchoptions.DataSetTypeFetchOptions", @@ -371,13 +350,11 @@ fetch_option = { "propertyType": { "@type": "as.dto.property.fetchoptions.PropertyTypeFetchOptions", }, - "plugin": { - "@type": "as.dto.plugin.fetchoptions.PluginFetchOptions" - } + "plugin": {"@type": "as.dto.plugin.fetchoptions.PluginFetchOptions"}, }, "validationPlugin": { "@type": "as.dto.plugin.fetchoptions.PluginFetchOptions", - } + }, }, "experimentType": { "@type": "as.dto.experiment.fetchoptions.ExperimentTypeFetchOptions", @@ -386,19 +363,17 @@ fetch_option = { "propertyType": { "@type": "as.dto.property.fetchoptions.PropertyTypeFetchOptions", }, - "plugin": { - "@type": "as.dto.plugin.fetchoptions.PluginFetchOptions" - } - }, + "plugin": {"@type": "as.dto.plugin.fetchoptions.PluginFetchOptions"}, + }, "validationPlugin": { "@type": "as.dto.plugin.fetchoptions.PluginFetchOptions", - } + }, }, "dataSet": { "@type": "as.dto.dataset.fetchoptions.DataSetFetchOptions", - "type": {"@type": "as.dto.dataset.fetchoptions.DataSetTypeFetchOptions"}, - "parents": {"@type": "as.dto.dataset.fetchoptions.DataSetFetchOptions"}, - "children": {"@type": "as.dto.dataset.fetchoptions.DataSetFetchOptions"}, + "type": {"@type": "as.dto.dataset.fetchoptions.DataSetTypeFetchOptions"}, + "parents": {"@type": "as.dto.dataset.fetchoptions.DataSetFetchOptions"}, + "children": {"@type": "as.dto.dataset.fetchoptions.DataSetFetchOptions"}, "containers": {"@type": "as.dto.dataset.fetchoptions.DataSetFetchOptions"}, "components": {"@type": "as.dto.dataset.fetchoptions.DataSetFetchOptions"}, }, @@ -409,8 +384,10 @@ fetch_option = { }, "physicalData": {"@type": "as.dto.dataset.fetchoptions.PhysicalDataFetchOptions"}, "linkedData": { - "externalDms": {"@type": "as.dto.externaldms.fetchoptions.ExternalDmsFetchOptions"}, - "@type": "as.dto.dataset.fetchoptions.LinkedDataFetchOptions" + "externalDms": { + "@type": "as.dto.externaldms.fetchoptions.ExternalDmsFetchOptions" + }, + "@type": "as.dto.dataset.fetchoptions.LinkedDataFetchOptions", }, "roleAssignment": { "@type": "as.dto.roleassignment.fetchoptions.RoleAssignmentFetchOptions", @@ -425,23 +402,21 @@ fetch_option = { "@type": "as.dto.property.fetchoptions.PropertyTypeFetchOptions", "vocabulary": { "@type": "as.dto.vocabulary.fetchoptions.VocabularyFetchOptions", - } - } + }, + }, }, "propertyType": { "@type": "as.dto.property.fetchoptions.PropertyTypeFetchOptions", "vocabulary": { "@type": "as.dto.vocabulary.fetchoptions.VocabularyFetchOptions" }, - "materialType": { - "@type": "as.dto.material.fetchoptions.MaterialTypeFetchOptions" + "materialType": { + "@type": "as.dto.material.fetchoptions.MaterialTypeFetchOptions" }, "semanticAnnotations": { "@type": "as.dto.semanticannotation.fetchoptions.SemanticAnnotationFetchOptions" }, - "registrator": { - "@type": "as.dto.person.fetchoptions.PersonFetchOptions" - }, + "registrator": {"@type": "as.dto.person.fetchoptions.PersonFetchOptions"}, }, "semanticAnnotations": { "@type": "as.dto.semanticannotation.fetchoptions.SemanticAnnotationFetchOptions" @@ -451,9 +426,7 @@ fetch_option = { "attachments": {"@type": "as.dto.attachment.fetchoptions.AttachmentFetchOptions"}, "attachmentsWithContent": { "@type": "as.dto.attachment.fetchoptions.AttachmentFetchOptions", - "content": { - "@type": "as.dto.common.fetchoptions.EmptyFetchOptions" - }, + "content": {"@type": "as.dto.common.fetchoptions.EmptyFetchOptions"}, }, "script": { "@type": "as.dto.common.fetchoptions.EmptyFetchOptions", @@ -464,23 +437,31 @@ fetch_option = { "vocabulary": { "@type": "as.dto.vocabulary.fetchoptions.VocabularyFetchOptions", }, - "vocabularyTerm": {"@type": "as.dto.vocabulary.fetchoptions.VocabularyTermFetchOptions"}, - "deletedObjects": { "@type": "as.dto.deletion.fetchoptions.DeletedObjectFetchOptions" }, - "deletion": { "@type": "as.dto.deletion.fetchoptions.DeletionFetchOptions" }, - "externalDms": { "@type": "as.dto.externaldms.fetchoptions.ExternalDmsFetchOptions"}, - "dataSetFile": { "@type": "dss.dto.datasetfile.fetchoptions.DataSetFileFetchOptions"}, + "vocabularyTerm": { + "@type": "as.dto.vocabulary.fetchoptions.VocabularyTermFetchOptions" + }, + "deletedObjects": { + "@type": "as.dto.deletion.fetchoptions.DeletedObjectFetchOptions" + }, + "deletion": {"@type": "as.dto.deletion.fetchoptions.DeletionFetchOptions"}, + "externalDms": {"@type": "as.dto.externaldms.fetchoptions.ExternalDmsFetchOptions"}, + "dataSetFile": { + "@type": "dss.dto.datasetfile.fetchoptions.DataSetFileFetchOptions" + }, } + def get_fetchoption_for_entity(entity): - entity = entity[0].lower() + entity[1:] # make first character lowercase + entity = entity[0].lower() + entity[1:] # make first character lowercase try: return fetch_option[entity] except KeyError as e: return {} -def get_type_for_entity(entity, action, parents_or_children=''): + +def get_type_for_entity(entity, action, parents_or_children=""): if action not in "create update delete search".split(): - raise ValueError('unknown action: {}'.format(action)) + raise ValueError("unknown action: {}".format(action)) definition = openbis_definitions(entity) if action in definition and not parents_or_children: @@ -494,22 +475,30 @@ def get_type_for_entity(entity, action, parents_or_children=''): "delete": "DeletionOptions", "search": "SearchCriteria", } - + if parents_or_children: return { - "@type": "as.dto.{}.{}.{}{}{}" - .format(entity.lower(), action, cap_entity, parents_or_children, noun[action]) + "@type": "as.dto.{}.{}.{}{}{}".format( + entity.lower(), + action, + cap_entity, + parents_or_children, + noun[action], + ) } else: return { - "@type": "as.dto.{}.{}.{}{}" - .format(entity.lower(), action, cap_entity, noun[action]) + "@type": "as.dto.{}.{}.{}{}".format( + entity.lower(), action, cap_entity, noun[action] + ) } + def get_fetchoptions(entity, including=None): - if including is None: including = [] - including += ['@type'] - entity = entity[0].lower() + entity[1:] # make first character lowercase + if including is None: + including = [] + including += ["@type"] + entity = entity[0].lower() + entity[1:] # make first character lowercase fo = {} for inc in including: try: @@ -525,8 +514,7 @@ def get_method_for_entity(entity, action): if entity == "vocabulary": return "{}Vocabularies".format(action) - + cap_entity = entity[:1].upper() + entity[1:] return "{}{}s".format(action, cap_entity) - -- GitLab