From 19856ee258eed84d997e58a0bbe642f9512fc8c3 Mon Sep 17 00:00:00 2001 From: Gil Forsyth Date: Sat, 13 Jul 2019 12:08:18 -0400 Subject: [PATCH] Add `__dir__` to `DynamicAccessProxy` This restores tab-completion to objects proxied through DynamicAccessProxy --- news/fix_DAP_completion.rst | 24 ++++++++++++++++++++++++ xonsh/built_ins.py | 3 +++ 2 files changed, 27 insertions(+) create mode 100644 news/fix_DAP_completion.rst diff --git a/news/fix_DAP_completion.rst b/news/fix_DAP_completion.rst new file mode 100644 index 000000000..785a177c1 --- /dev/null +++ b/news/fix_DAP_completion.rst @@ -0,0 +1,24 @@ +**Added:** + +* + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* Added proxied ``__dir__`` method to ``DynamicAccessProxy`` to restore + tab-completion for objects that use the proxy (especially ``events``) + +**Security:** + +* diff --git a/xonsh/built_ins.py b/xonsh/built_ins.py index c8f2205b4..c7aa01033 100644 --- a/xonsh/built_ins.py +++ b/xonsh/built_ins.py @@ -1489,6 +1489,9 @@ class DynamicAccessProxy: def __call__(self, *args, **kwargs): return self.obj.__call__(*args, **kwargs) + def __dir__(self): + return self.obj.__dir__() + class DeprecationWarningProxy: """Proxies access, but warns in the process."""