Skip to content

Commit

Permalink
deprecate dict_item
Browse files Browse the repository at this point in the history
  • Loading branch information
soxofaan committed Sep 20, 2023
1 parent ccffe3e commit 301e344
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions openeo_driver/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,9 @@ class dict_item:
"Descriptor" trick to easily add attribute-style access
to standard dictionary items (with optional default values).
Note: instead of this simple trick, consider using any of the more standard, widely used solutions
like dataclasses from Python stdlib, or something like attrs (https://www.attrs.org).
Create an attribute in a custom dict subclass that accesses
the dict value keyed by the attribute's name:
Expand Down Expand Up @@ -250,6 +253,9 @@ class dict_item:
This class implements the descriptor protocol.
"""

# TODO: deprecate usage of this descriptor trick and migrate to dataclasses or attrs

_DEFAULT_UNSET = object()

def __init__(self, default=_DEFAULT_UNSET):
Expand Down

0 comments on commit 301e344

Please sign in to comment.