diff options
author | Korn, Uwe <Uwe.Korn@blue-yonder.com> | 2018-07-09 11:54:38 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2018-08-01 12:30:57 -0400 |
commit | 85dd7668530612e2cf7de7f575d68fc7c683a988 (patch) | |
tree | 9bf842cca475f656162da04838b8f6818d2f3366 /lib/sqlalchemy/util/_collections.py | |
parent | 1c32206120b1a6555f8bb7a20a0c4c53ea2f52a8 (diff) | |
download | sqlalchemy-85dd7668530612e2cf7de7f575d68fc7c683a988.tar.gz |
Mention Properties keys in __dir__
The Python builtin ``dir()`` is now supported for a SQLAlchemy "properties"
object, such as that of a Core columns collection (e.g. ``.c``),
``mapper.attrs``, etc. Allows iPython autocompletion to work as well.
Pull request courtesy Uwe Korn.
Change-Id: I8696729542d1b74a566642a3a63fd500f64588cd
Pull-request: https://github.com/zzzeek/sqlalchemy/pull/458
Mention Properties keys in __dir__
Change-Id: I88939955857c8df5eed0b87bc27c45357780b17d
Diffstat (limited to 'lib/sqlalchemy/util/_collections.py')
-rw-r--r-- | lib/sqlalchemy/util/_collections.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/sqlalchemy/util/_collections.py b/lib/sqlalchemy/util/_collections.py index cc084a7c7..1d9383bc6 100644 --- a/lib/sqlalchemy/util/_collections.py +++ b/lib/sqlalchemy/util/_collections.py @@ -184,6 +184,9 @@ class Properties(object): def __iter__(self): return iter(list(self._data.values())) + def __dir__(self): + return dir(super(Properties, self)) + [str(k) for k in self._data.keys()] + def __add__(self, other): return list(self) + list(other) |