From 85dd7668530612e2cf7de7f575d68fc7c683a988 Mon Sep 17 00:00:00 2001 From: "Korn, Uwe" Date: Mon, 9 Jul 2018 11:54:38 -0400 Subject: 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 --- lib/sqlalchemy/util/_collections.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib/sqlalchemy') 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) -- cgit v1.2.1