Extend Python's dir() function on entity instances with attribute and inverse attribute names of entities

This commit is contained in:
Thomas Krijnen
2015-02-27 13:41:33 +00:00
parent d41dbc386e
commit 9bbbc6e7d9
9 changed files with 413 additions and 292 deletions
@@ -21,6 +21,7 @@ import os
import sys
import platform
import functools
import itertools
from functools import reduce
@@ -79,6 +80,12 @@ class entity_instance(object):
def __repr__(self): return repr(self.wrapped_data)
def is_a(self, *args): return self.wrapped_data.is_a(*args)
def id(self): return self.wrapped_data.id()
def __dir__(self):
return sorted(set(itertools.chain(
dir(type(self)),
self.wrapped_data.get_attribute_names(),
self.wrapped_data.get_inverse_attribute_names()
)))
class file(object):