def override__dir__(f):
 if (sys.version_info[:2] < (3, 3)):
  @functools.wraps(f)
  def override__dir__wrapper(self):
   members = set()
   for cls in self.__class__.mro():
    members.update(dir(cls))
   members.update(six.iterkeys(self.__dict__))
   members.update(f(self))
   return sorted(members)
 else:
  @functools.wraps(f)
  def override__dir__wrapper(self):
   members = set(object.__dir__(self))
   members.update(f(self))
   return sorted(members)
 return override__dir__wrapper

def override__dir__ ( f ) : if ( sys . version_info [ : 2 ] < ( 3 , 3 ) ) : @ functools . wraps ( f ) def override__dir__wrapper ( self ) : members = set ( ) for cls in self . __class__ . mro ( ) : members . update ( dir ( cls ) ) members . update ( six . iterkeys ( self . __dict__ ) ) members . update ( f ( self ) ) return sorted ( members ) else : @ functools . wraps ( f ) def override__dir__wrapper ( self ) : members = set ( object . __dir__ ( self ) ) members . update ( f ( self ) ) return sorted ( members ) return override__dir__wrapper
when overriding a __dir__ method on an object .