diff --git a/pybis/src/python/CHANGELOG.md b/pybis/src/python/CHANGELOG.md index d857b94747a9d903a952b99e87055c622ce17623..a2aeb52b069e3917bb34c1af40fc675b8086b17b 100644 --- a/pybis/src/python/CHANGELOG.md +++ b/pybis/src/python/CHANGELOG.md @@ -2,6 +2,7 @@ - throw error when invalid token is assigned - to not show an error message if stored token is invalid (just do not use it) +- fixed a bug which led to missing parents and children ## Changes with pybis-1.31.6 diff --git a/pybis/src/python/pybis/__init__.py b/pybis/src/python/pybis/__init__.py index 48ae574245e1fe9f7cb6f6ec59641d68af47529c..b1ad2c1edf6ceb4ced5016633528bf43ca3ee5e6 100644 --- a/pybis/src/python/pybis/__init__.py +++ b/pybis/src/python/pybis/__init__.py @@ -1,7 +1,7 @@ name = "pybis" __author__ = "Swen Vermeul" __email__ = "swen@ethz.ch" -__version__ = "1.31.6" +__version__ = "1.32.0" from . import pybis from .pybis import DataSet diff --git a/pybis/src/python/pybis/pybis.py b/pybis/src/python/pybis/pybis.py index 3e78318f20e0dfd6474123301f0aaad13b12060e..6106a95ad9fd3b9c0e00b6313d00708419046196 100644 --- a/pybis/src/python/pybis/pybis.py +++ b/pybis/src/python/pybis/pybis.py @@ -35,7 +35,6 @@ from texttable import Texttable from . import data_set as pbds from .dataset import DataSet from .definitions import ( - fetch_option, get_definition_for_entity, get_fetchoption_for_entity, get_fetchoptions, @@ -1617,9 +1616,9 @@ class Openbis: "@type": "as.dto.authorizationgroup.fetchoptions.AuthorizationGroupFetchOptions" } for option in ["roleAssignments", "users", "registrator"]: - fetchopts[option] = fetch_option[option] + fetchopts[option] = get_fetchoption_for_entity(option) - fetchopts["users"]["space"] = fetch_option["space"] + fetchopts["users"]["space"] = get_fetchoption_for_entity("space") request = { "method": "getAuthorizationGroups", @@ -1680,11 +1679,11 @@ class Openbis: search_criteria["criteria"] = sub_crit method_name = get_method_for_entity(entity, "search") - fetchopts = fetch_option[entity] + fetchopts = get_fetchoption_for_entity(entity) fetchopts["from"] = start_with fetchopts["count"] = count for option in ["space", "project", "user", "authorizationGroup", "registrator"]: - fetchopts[option] = fetch_option[option] + fetchopts[option] = get_fetchoption_for_entity(option) request = { "method": method_name, @@ -1722,9 +1721,9 @@ class Openbis: def get_role_assignment(self, techId, only_data=False): """Fetches one assigned role by its techId.""" - fetchopts = fetch_option["roleAssignment"] + fetchopts = get_fetchoption_for_entity("roleAssignment") for option in ["space", "project", "user", "authorizationGroup", "registrator"]: - fetchopts[option] = fetch_option[option] + fetchopts[option] = get_fetchoption_for_entity(option) request = { "method": "getRoleAssignments", @@ -1837,11 +1836,11 @@ class Openbis: search_criteria["criteria"] = criteria search_criteria["operator"] = "AND" - fetchopts = fetch_option["authorizationGroup"] + fetchopts = get_fetchoption_for_entity("authorizationGroup") fetchopts["from"] = start_with fetchopts["count"] = count for option in ["roleAssignments", "registrator", "users"]: - fetchopts[option] = fetch_option[option] + fetchopts[option] = get_fetchoption_for_entity(option) request = { "method": "searchAuthorizationGroups", "params": [self.token, search_criteria, fetchopts], @@ -1891,11 +1890,11 @@ class Openbis: """Get openBIS users""" search_criteria = get_search_criteria("person", **search_args) - fetchopts = fetch_option["person"] + fetchopts = get_fetchoption_for_entity("person") fetchopts["from"] = start_with fetchopts["count"] = count for option in ["space"]: - fetchopts[option] = fetch_option[option] + fetchopts[option] = get_fetchoption_for_entity(option) request = { "method": "searchPersons", "params": [self.token, search_criteria, fetchopts], @@ -1947,7 +1946,7 @@ class Openbis: fetchopts = {"@type": "as.dto.person.fetchoptions.PersonFetchOptions"} for option in ["roleAssignments", "space"]: - fetchopts[option] = fetch_option[option] + fetchopts[option] = get_fetchoption_for_entity(option) request = { "method": "getPersons", @@ -1980,7 +1979,7 @@ class Openbis: method = get_method_for_entity("space", "search") search_criteria = _subcriteria_for_code(code, "space") - fetchopts = fetch_option["space"] + fetchopts = get_fetchoption_for_entity("space") fetchopts["from"] = start_with fetchopts["count"] = count request = { @@ -2031,7 +2030,7 @@ class Openbis: fetchopts = {"@type": "as.dto.space.fetchoptions.SpaceFetchOptions"} for option in ["registrator"]: - fetchopts[option] = fetch_option[option] + fetchopts[option] = get_fetchoption_for_entity(option) method = get_method_for_entity("space", "get") @@ -2167,7 +2166,7 @@ class Openbis: } # build the various fetch options - fetchopts = copy.deepcopy(fetch_option["sample"]) + fetchopts = get_fetchoption_for_entity("sample") fetchopts["from"] = start_with fetchopts["count"] = count @@ -2184,13 +2183,13 @@ class Openbis: if self.get_server_information().project_samples_enabled: options.append("project") for option in options: - fetchopts[option] = fetch_option[option] + fetchopts[option] = get_fetchoption_for_entity(option) for relation in ["parents", "children", "components", "container"]: if relation in attrs: - fetchopts[relation] = fetch_option["sample"] + fetchopts[relation] = get_fetchoption_for_entity("sample") if props is not None: - fetchopts["properties"] = fetch_option["properties"] + fetchopts["properties"] = get_fetchoption_for_entity("properties") request = { "method": "searchSamples", @@ -2352,7 +2351,7 @@ class Openbis: search_criteria["criteria"] = sub_criteria search_criteria["operator"] = "AND" - fetchopts = fetch_option["experiment"] + fetchopts = get_fetchoption_for_entity("experiment") fetchopts["from"] = start_with fetchopts["count"] = count @@ -2360,7 +2359,7 @@ class Openbis: attrs = [] options = self._get_fetchopts_for_attrs(attrs) for option in ["tags", "properties", "registrator", "modifier"] + options: - fetchopts[option] = fetch_option[option] + fetchopts[option] = get_fetchoption_for_entity(option) request = { "method": "searchExperiments", @@ -2593,7 +2592,7 @@ class Openbis: fetchopts["count"] = count for relation in ["parents", "children", "components", "containers"]: if relation in attrs: - fetchopts[relation] = fetch_option["dataSet"] + fetchopts[relation] = get_fetchoption_for_entity("dataSet") for option in [ "tags", @@ -2606,9 +2605,9 @@ class Openbis: "registrator", "modifier", ]: - fetchopts[option] = fetch_option[option] + fetchopts[option] = get_fetchoption_for_entity(option) - fetchopts["experiment"]["project"] = fetch_option["project"] + fetchopts["experiment"]["project"] = get_fetchoption_for_entity("project") if kind: kind = kind.upper() @@ -2664,7 +2663,7 @@ class Openbis: if experiment: return experiment - fetchopts = fetch_option["experiment"] + fetchopts = get_fetchoption_for_entity("experiment") search_request = _type_for_id(code, "experiment") for option in [ @@ -2676,10 +2675,12 @@ class Openbis: "registrator", "modifier", ]: - fetchopts[option] = fetch_option[option] + fetchopts[option] = get_fetchoption_for_entity(option) if withAttachments: - fetchopts["attachments"] = fetch_option["attachmentsWithContent"] + fetchopts["attachments"] = get_fetchoption_for_entity( + "attachmentsWithContent" + ) request = { "method": "getExperiments", @@ -2774,8 +2775,8 @@ class Openbis: def get_deletions(self, start_with=None, count=None): search_criteria = {"@type": "as.dto.deletion.search.DeletionSearchCriteria"} - fetchopts = fetch_option["deletion"] - fetchoptsDeleted = fetch_option["deletedObjects"] + fetchopts = get_fetchoption_for_entity("deletion") + fetchoptsDeleted = get_fetchoption_for_entity("deletedObjects") fetchoptsDeleted["from"] = start_with fetchoptsDeleted["count"] = count fetchopts["deletedObjects"] = fetchoptsDeleted @@ -2808,7 +2809,7 @@ class Openbis: def _gen_fetchoptions(self, options, foType): fo = {"@type": foType} for option in options: - fo[option] = fetch_option[option] + fo[option] = get_fetchoption_for_entity(option) return fo def get_project(self, projectId, only_data=False, use_cache=True): @@ -2887,7 +2888,7 @@ class Openbis: fetchopts["from"] = start_with fetchopts["count"] = count for option in ["registrator", "modifier", "leader"]: - fetchopts[option] = fetch_option[option] + fetchopts[option] = get_fetchoption_for_entity(option) request = { "method": "searchProjects", @@ -2960,7 +2961,7 @@ class Openbis: fo = {"@type": foType} for option in options: - fo[option] = fetch_option[option] + fo[option] = get_fetchoption_for_entity(option) request = { "method": method_name, @@ -3019,7 +3020,7 @@ class Openbis: "@type" ] = "as.dto.vocabulary.search.VocabularyTermSearchCriteria" - fetchopts = fetch_option["vocabularyTerm"] + fetchopts = get_fetchoption_for_entity("vocabularyTerm") fetchopts["from"] = start_with fetchopts["count"] = count @@ -3122,11 +3123,11 @@ class Openbis: "operator": "AND", } - fetchopts = fetch_option["vocabulary"] + fetchopts = get_fetchoption_for_entity("vocabulary") fetchopts["from"] = start_with fetchopts["count"] = count for option in ["registrator"]: - fetchopts[option] = fetch_option[option] + fetchopts[option] = get_fetchoption_for_entity(option) request = { "method": "searchVocabularies", @@ -3178,7 +3179,7 @@ class Openbis: entity = "vocabulary" method_name = get_method_for_entity(entity, "get") objectIds = _type_for_id(code.upper(), entity) - fetchopts = fetch_option[entity] + fetchopts = get_fetchoption_for_entity(entity) request = { "method": method_name, @@ -3209,11 +3210,11 @@ class Openbis: search_criteria = get_search_type_for_entity("tag", "AND") criteria = [] - fetchopts = fetch_option["tag"] + fetchopts = get_fetchoption_for_entity("tag") fetchopts["from"] = start_with fetchopts["count"] = count for option in ["owner"]: - fetchopts[option] = fetch_option[option] + fetchopts[option] = get_fetchoption_for_entity(option) if code: criteria.append(_criteria_for_code(code)) search_criteria["criteria"] = criteria @@ -3246,9 +3247,9 @@ class Openbis: return tag identifiers.append(_type_for_id(permId, "tag")) - fetchopts = fetch_option["tag"] + fetchopts = get_fetchoption_for_entity("tag") for option in ["owner"]: - fetchopts[option] = fetch_option[option] + fetchopts[option] = get_fetchoption_for_entity(option) request = { "method": "getTags", "params": [self.token, identifiers, fetchopts], @@ -3496,9 +3497,9 @@ class Openbis: search_criteria = get_search_type_for_entity("plugin", "AND") search_criteria["criteria"] = criteria - fetchopts = fetch_option["plugin"] + fetchopts = get_fetchoption_for_entity("plugin") for option in ["registrator"]: - fetchopts[option] = fetch_option[option] + fetchopts[option] = get_fetchoption_for_entity(option) fetchopts["from"] = start_with fetchopts["count"] = count @@ -3557,13 +3558,13 @@ class Openbis: def get_plugin(self, permId, only_data=False, with_script=True): search_request = _type_for_id(permId, "plugin") - fetchopts = fetch_option["plugin"] + fetchopts = get_fetchoption_for_entity("plugin") options = ["registrator"] if with_script: options.append("script") for option in options: - fetchopts[option] = fetch_option[option] + fetchopts[option] = get_fetchoption_for_entity(option) request = { "method": "getPlugins", @@ -3676,10 +3677,10 @@ class Openbis: {"permId": c.upper(), "@type": "as.dto.property.id.PropertyTypePermId"} ) - fetchopts = fetch_option["propertyType"] + fetchopts = get_fetchoption_for_entity("propertyType") options = ["vocabulary", "materialType", "semanticAnnotations", "registrator"] for option in options: - fetchopts[option] = fetch_option[option] + fetchopts[option] = get_fetchoption_for_entity(option) request = { "method": "getPropertyTypes", @@ -3713,7 +3714,7 @@ class Openbis: ) def get_property_types(self, code=None, start_with=None, count=None): - fetchopts = fetch_option["propertyType"] + fetchopts = get_fetchoption_for_entity("propertyType") fetchopts["from"] = start_with fetchopts["count"] = count search_criteria = get_search_criteria("propertyType", code=code) @@ -4002,9 +4003,11 @@ class Openbis: search_request = _gen_search_criteria( {entity.lower(): entity + "Type", "operator": "AND", "code": type_name} ) - fetch_options["propertyAssignments"] = fetch_option["propertyAssignments"] + fetch_options["propertyAssignments"] = get_fetchoption_for_entity( + "propertyAssignments" + ) if self.get_server_information().api_version > "3.3": - fetch_options["validationPlugin"] = fetch_option["plugin"] + fetch_options["validationPlugin"] = get_fetchoption_for_entity("plugin") request = { "method": method_name, @@ -4125,7 +4128,7 @@ class Openbis: else: identifiers.append(_type_for_id(permIds, "dataset")) - fetchopts = fetch_option["dataSet"] + fetchopts = get_fetchoption_for_entity("dataSet") for option in [ "tags", @@ -4138,7 +4141,7 @@ class Openbis: "registrator", "modifier", ]: - fetchopts[option] = fetch_option[option] + fetchopts[option] = get_fetchoption_for_entity(option) request = { "method": "getDataSets", @@ -4357,7 +4360,7 @@ class Openbis: else: identifiers.append(_type_for_id(sample_ident, "sample")) - fetchopts = fetch_option["sample"] + fetchopts = get_fetchoption_for_entity("sample") options = [ "tags", "properties", @@ -4371,10 +4374,12 @@ class Openbis: if self.get_server_information().project_samples_enabled: options.append("project") for option in options: - fetchopts[option] = fetch_option[option] + fetchopts[option] = get_fetchoption_for_entity(option) if withAttachments: - fetchopts["attachments"] = fetch_option["attachmentsWithContent"] + fetchopts["attachments"] = get_fetchoption_for_entity( + "attachmentsWithContent" + ) for key in ["parents", "children", "container", "components"]: fetchopts[key] = {"@type": "as.dto.sample.fetchoptions.SampleFetchOptions"} diff --git a/pybis/src/python/setup.py b/pybis/src/python/setup.py index 77513791c50d2e6f790c6daf2a5fd48fcd237844..8248b021bd413ccc0be6c35e0453f5b8420fa413 100644 --- a/pybis/src/python/setup.py +++ b/pybis/src/python/setup.py @@ -13,7 +13,7 @@ with open("README.md", "r", encoding="utf-8") as fh: setup( name="PyBIS", - version="1.31.6", + version="1.32.0rc2", author="Swen Vermeul • ID SIS • ETH Zürich", author_email="swen@ethz.ch", description="openBIS connection and interaction, optimized for using with Jupyter",