Skip to content
Snippets Groups Projects
Verified Commit 2bc3ccd9 authored by Daniel Hornung's avatar Daniel Hornung
Browse files

Merge remote-tracking branch 'origin/dev' into dev

parents e9c369e2 364746b6
Branches
Tags
1 merge request!149Release 0.15.1
Pipeline #54272 passed with warnings
...@@ -9,6 +9,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ...@@ -9,6 +9,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added ### ### Added ###
### Changed ###
### Deprecated ###
- `connection.get_username`. Use `la.Info().user_info.name` instead.
### Removed ###
### Fixed ###
### Security ###
### Documentation ###
* Added docstrings for `linkahead.models.Info` and `linkahead.models.UserInfo`.
## [0.15.0] - 2024-07-09 ##
### Added ###
* Support for Python 3.12 * Support for Python 3.12
* The `linkahead` module now opts into type checking and supports mypy. * The `linkahead` module now opts into type checking and supports mypy.
* [#112](https://gitlab.com/linkahead/linkahead-pylib/-/issues/112) * [#112](https://gitlab.com/linkahead/linkahead-pylib/-/issues/112)
...@@ -21,8 +40,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ...@@ -21,8 +40,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Using environment variable PYLINKAHEADINI instead of PYCAOSDBINI. * Using environment variable PYLINKAHEADINI instead of PYCAOSDBINI.
### Deprecated ###
### Removed ### ### Removed ###
* Support for Python 3.7 * Support for Python 3.7
...@@ -37,8 +54,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ...@@ -37,8 +54,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* [#120](https://gitlab.com/linkahead/linkahead-pylib/-/issues/120) Unwanted * [#120](https://gitlab.com/linkahead/linkahead-pylib/-/issues/120) Unwanted
subproperties in reference properties. subproperties in reference properties.
### Security ###
### Documentation ### ### Documentation ###
* Added documentation and a tutorial example for the usage of the `page_length` * Added documentation and a tutorial example for the usage of the `page_length`
......
...@@ -20,6 +20,6 @@ authors: ...@@ -20,6 +20,6 @@ authors:
given-names: Stefan given-names: Stefan
orcid: https://orcid.org/0000-0001-7214-8125 orcid: https://orcid.org/0000-0001-7214-8125
title: CaosDB - Pylib title: CaosDB - Pylib
version: 0.14.0 version: 0.15.0
doi: 10.3390/data4020083 doi: 10.3390/data4020083
date-released: 2024-02-20 date-released: 2024-07-09
...@@ -48,7 +48,7 @@ from setuptools import find_packages, setup ...@@ -48,7 +48,7 @@ from setuptools import find_packages, setup
ISRELEASED = False ISRELEASED = False
MAJOR = 0 MAJOR = 0
MINOR = 14 MINOR = 15
MICRO = 1 MICRO = 1
# Do not tag as pre-release until this commit # Do not tag as pre-release until this commit
# https://github.com/pypa/packaging/pull/515 # https://github.com/pypa/packaging/pull/515
......
...@@ -29,10 +29,10 @@ copyright = '2023, IndiScale GmbH' ...@@ -29,10 +29,10 @@ copyright = '2023, IndiScale GmbH'
author = 'Daniel Hornung' author = 'Daniel Hornung'
# The short X.Y version # The short X.Y version
version = '0.14.1' version = '0.15.1'
# The full version, including alpha/beta/rc tags # The full version, including alpha/beta/rc tags
# release = '0.5.2-rc2' # release = '0.5.2-rc2'
release = '0.14.1-dev' release = '0.15.1-dev'
# -- General configuration --------------------------------------------------- # -- General configuration ---------------------------------------------------
......
...@@ -1996,8 +1996,6 @@ class Property(Entity): ...@@ -1996,8 +1996,6 @@ class Property(Entity):
def add_parent(self, parent=None, id=None, name=None, inheritance=FIX): def add_parent(self, parent=None, id=None, name=None, inheritance=FIX):
"""Add a parent Entity to this Property. """Add a parent Entity to this Property.
Parameters
----------
Parameters Parameters
---------- ----------
parent : Entity or int or str or None parent : Entity or int or str or None
...@@ -3192,9 +3190,15 @@ class Container(list): ...@@ -3192,9 +3190,15 @@ class Container(list):
"""Get an xml tree representing this Container or append all entities """Get an xml tree representing this Container or append all entities
to the given xml element. to the given xml element.
@param add_to_element=None: optional element to which all entities of this container is to Parameters
be appended. ----------
@return xml element add_to_element : etree._Element, optional
optional element to which all entities of this container is to
be appended. Default is None
Returns
-------
xml_element : etree._Element
""" """
tmpid = 0 tmpid = 0
...@@ -4072,13 +4076,21 @@ class Container(list): ...@@ -4072,13 +4076,21 @@ class Container(list):
warnings as errors. This prevents the server from inserting this entity if any warning warnings as errors. This prevents the server from inserting this entity if any warning
occurs. occurs.
@param strict=False: Flag for strict mode. Parameters
@param sync=True: synchronize this container with the response from the server. Otherwise, ----------
this method returns a new container with the inserted entities and leaves strict : bool, optional
this container untouched. Flag for strict mode. Default is False.
@param unique=True: Flag for unique mode. If set to True, the server will check if the name sync : bool, optional
of the entity is unique. If not, the server will return an error. synchronize this container with the response from the
@param flags=None: Additional flags for the server. server. Otherwise, this method returns a new container with the
inserted entities and leaves this container untouched. Default is
True.
unique : bool, optional
Flag for unique mode. If set to True, the server will check if the
name of the entity is unique. If not, the server will return an
error. Default is True.
flags : dict, optional
Additional flags for the server. Default is None.
""" """
...@@ -5019,6 +5031,17 @@ class DropOffBox(list): ...@@ -5019,6 +5031,17 @@ class DropOffBox(list):
class UserInfo(): class UserInfo():
"""User information from a server response.
Attributes
----------
name : str
Username
realm : str
Realm in which this user lives, e.g., CaosDB or LDAP.
roles : list[str]
List of roles assigned to this user.
"""
def __init__(self, xml: etree._Element): def __init__(self, xml: etree._Element):
self.roles = [role.text for role in xml.findall("Roles/Role")] self.roles = [role.text for role in xml.findall("Roles/Role")]
...@@ -5027,6 +5050,21 @@ class UserInfo(): ...@@ -5027,6 +5050,21 @@ class UserInfo():
class Info(): class Info():
"""Info about the LinkAhead instance that you are connected to. It has a
simple string representation in the form of "Connected to a LinkAhead with N
Records".
Attributes
----------
messages : Messages
Collection of messages that the server's ``Info`` response contained.
user_info : UserInfo
Information about the user that is connected to the server, such as
name, realm or roles.
time_zone : TimeZone
The timezone information returned by the server.
"""
def __init__(self): def __init__(self):
self.messages = Messages() self.messages = Messages()
...@@ -5035,6 +5073,7 @@ class Info(): ...@@ -5035,6 +5073,7 @@ class Info():
self.sync() self.sync()
def sync(self): def sync(self):
"""Retrieve server information from the server's ``Info`` response."""
c = get_connection() c = get_connection()
try: try:
http_response = c.retrieve(["Info"]) http_response = c.retrieve(["Info"])
......
...@@ -757,6 +757,8 @@ class _Connection(object): # pylint: disable=useless-object-inheritance ...@@ -757,6 +757,8 @@ class _Connection(object): # pylint: disable=useless-object-inheritance
Shortcut for: get_connection()._authenticator._credentials_provider.username Shortcut for: get_connection()._authenticator._credentials_provider.username
""" """
warnings.warn("Deprecated. Please use ``la.Info().user_info.name`` instead.",
DeprecationWarning)
if self._authenticator is None: if self._authenticator is None:
raise ValueError( raise ValueError(
"No authenticator set. Please call configure_connection() first.") "No authenticator set. Please call configure_connection() first.")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment