1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-17 17:42:20 +03:00

additional info in docstrings

This commit is contained in:
A_D 2021-08-22 21:45:02 +02:00
parent b86a010596
commit afa0217ed8
No known key found for this signature in database
GPG Key ID: 4BE9EB7DF45076C4

View File

@ -47,6 +47,7 @@ class SingleKill(NamedTuple):
Note that this MODIFIES DATA IN PLACE. Note that this MODIFIES DATA IN PLACE.
:param target: data to apply a rule to :param target: data to apply a rule to
:raises: Any and all exceptions _deep_apply and _apply can raise.
""" """
for key, value in (self.set_fields if self .set_fields is not None else {}).items(): for key, value in (self.set_fields if self .set_fields is not None else {}).items():
_deep_apply(target, key, value) _deep_apply(target, key, value)
@ -69,6 +70,7 @@ def _apply(target: UPDATABLE_DATA, key: str, to_set: Any = None, delete: bool =
:param to_set: the data to set, if any, defaults to None :param to_set: the data to set, if any, defaults to None
:param delete: whether or not to delete the key or index, defaults to False :param delete: whether or not to delete the key or index, defaults to False
:raises ValueError: when an unexpected target type is passed :raises ValueError: when an unexpected target type is passed
:raises IndexError: when an invalid index is set or deleted
""" """
if isinstance(target, MutableMapping): if isinstance(target, MutableMapping):
if delete: if delete:
@ -106,6 +108,8 @@ def _deep_apply(target: UPDATABLE_DATA, path: str, to_set=None, delete=False):
:param target: the dict to modify :param target: the dict to modify
:param to_set: the data to set, defaults to None :param to_set: the data to set, defaults to None
:param delete: whether or not to delete the key rather than set it :param delete: whether or not to delete the key rather than set it
:raises IndexError: when an invalid index is traversed into
:raises KeyError: when an invalid key is traversed into
""" """
current = target current = target
key: str = "" key: str = ""