Skip to content

Commit

Permalink
overwrite getattr to comply with pyright type warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiao-Chenguang committed Oct 23, 2024
1 parent a732ea5 commit c2a5997
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions fedmind/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,13 @@ def __setattr__(self, name, value):

__setitem__ = __setattr__

def __getattr__(self, name):
if name in self:
return self[name]
raise AttributeError(
f"'{type(self).__name__}' object has no attribute '{name}'"
)

def update(self, e=None, **f):
d = e or dict()
d.update(f)
Expand Down

0 comments on commit c2a5997

Please sign in to comment.