Skip to content

Commit

Permalink
Add comments for context.context.
Browse files Browse the repository at this point in the history
  • Loading branch information
ynikitenko committed Oct 21, 2020
1 parent 2c2d1ce commit b4dec65
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lena/context/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ def __init__(self, d=None, formatter=None):
can be got or set using dot notation
(for example, *context["data_path"]*
is equal to *context.data_path*).
Only one level of nesting is accessible
using dot notation.
Tip
---
Expand Down Expand Up @@ -82,11 +84,14 @@ def __call__(self, value):
return (data, Context(context))

def __getattr__(self, name):
# see comment for Variable
# we don't implement getting nested attributes,
# because that would require creating proxy objects
# - maybe in the future if needed.
if name.startswith('_'):
# this is not LenaAttributeError,
# as it wouldn't be so for other Lena classes
# that don't implement __getattr__
# see comment for Variable
raise AttributeError(name)
try:
return self[name]
Expand Down

0 comments on commit b4dec65

Please sign in to comment.