Skip to content

Commit

Permalink
Allow dunder methods use in PublicOnlyProxy (napari#4792)
Browse files Browse the repository at this point in the history
  • Loading branch information
brisvag authored Jul 20, 2022
1 parent a72d512 commit 5827a55
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion napari/utils/_proxies.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ class PublicOnlyProxy(wrapt.ObjectProxy, Generic[_T]):
__wrapped__: _T

def __getattr__(self, name: str):
if name.startswith("_"):
if name.startswith("_") and not (
name.startswith('__') and name.endswith('__')
):
# allow napari to access private attributes and get an non-proxy
frame = sys._getframe(1) if hasattr(sys, "_getframe") else None
if frame.f_code.co_filename.startswith(misc.ROOT_DIR):
Expand Down

0 comments on commit 5827a55

Please sign in to comment.