Skip to content

Commit

Permalink
fix(__init__.py): simplify __getattr__
Browse files Browse the repository at this point in the history
  • Loading branch information
domcharrier committed Apr 25, 2024
1 parent 9849f95 commit 20bba27
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions dask_cuda/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,11 @@ def nvmlDeviceGetCount(self):
# TODO: no equivalent found: nvmlDeviceGetUUID

def __getattr__ (self, name: str):
'''"Automatically delegates ``nvml<Name>`` attribute names to `pyrsmi.rocml`'''
if hasattr(rocml,name):
return getattr(rocml,name)
return super().__getattr__(name)
'''"Automatically delegates ``nvml<Name>`` attribute names to `pyrsmi.rocml`
Note:
__getattr__ is only called if the attribute is not found the usual way.
'''
return getattr(rocml,name)
# overwrite/set 'pynvml' entry in module registry:
sys.modules["pynvml"] = Pynvml()

Expand Down

0 comments on commit 20bba27

Please sign in to comment.