Newer
Older
isNew=True,
entityType=entityType,
propertyType=propertyType,
**kwargs,
def new_vocabulary(
self, code, terms, managedInternally=False, chosenFromList=True, **kwargs
):
"""Creates a new vocabulary
Usage::
new_vocabulary(
code = 'vocabulary_code',
description = '',
terms = [
{ "code": "term1", "label": "label1", "description": "description1" },
{ "code": "term2", "label": "label2", "description": "description2" },
]
)
"""
kwargs["code"] = code
kwargs["managedInternally"] = managedInternally
kwargs["chosenFromList"] = chosenFromList
return Vocabulary(self, data=None, terms=terms, **kwargs)
"""internal method to get the downloadURL of a datastore."""
Swen Vermeul
committed
dss = self.get_datastores()
if dss_code is None:
else:
return dss[dss["code"] == dss_code]["downloadUrl"][0]
class ExternalDMS:
"""managing openBIS external data management systems"""
Swen Vermeul
committed
def __init__(self, openbis_obj, data=None, **kwargs):
Swen Vermeul
committed
Swen Vermeul
committed
if kwargs is not None:
for key in kwargs:
setattr(self, key, kwargs[key])
Swen Vermeul
committed
def __getattr__(self, name):
Swen Vermeul
committed
"""all the available methods and attributes that should be displayed
when using the autocompletion feature (TAB) in Jupyter
"""
return ["code", "label", "urlTemplate", "address", "addressType", "openbis"]
Swen Vermeul
committed
def __str__(self):
def __init__(self, info):
self._info = info
self.attrs = [
"api_version",
"archiving_configured",
"authentication_service",
"enabled_technologies",
"project_samples_enabled",
def __dir__(self):
return self.attrs
def __getattr__(self, name):
Fuentes Serna Juan Mariano (ID SIS)
committed
def get_major_version(self):
return int(self._info["api-version"].split(".")[0])
Fuentes Serna Juan Mariano (ID SIS)
committed
def get_minor_version(self):
return int(self._info["api-version"].split(".")[1])
Fuentes Serna Juan Mariano (ID SIS)
committed
def is_openbis_1605(self):
return (self.get_major_version() == 3) and (self.get_minor_version() <= 2)
Fuentes Serna Juan Mariano (ID SIS)
committed
def is_openbis_1806(self):
return (self.get_major_version() == 3) and (self.get_minor_version() >= 5)
def _repr_html_(self):
html = """
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th>attribute</th>
<th>value</th>
</tr>
</thead>
<tbody>
"""
for attr in self.attrs:
html += "<tr> <td>{}</td> <td>{}</td> </tr>".format(
)
html += """
</tbody>
</table>
"""
return html
Swen Vermeul
committed
class PropertyType(
OpenBisObject, entity="propertyType", single_item_method_name="get_property_type"
Swen Vermeul
committed
):
pass
class Plugin(OpenBisObject, entity="plugin", single_item_method_name="get_plugin"):