Returns public methods and other interesting attributes.
(self)
| 1198 | return "%s.%s" % (self.__class__.__name__, self._name_, ) |
| 1199 | |
| 1200 | def __dir__(self): |
| 1201 | """ |
| 1202 | Returns public methods and other interesting attributes. |
| 1203 | """ |
| 1204 | interesting = set() |
| 1205 | if self.__class__._member_type_ is not object: |
| 1206 | interesting = set(object.__dir__(self)) |
| 1207 | for name in getattr(self, '__dict__', []): |
| 1208 | if name[0] != '_' and name not in self._member_map_: |
| 1209 | interesting.add(name) |
| 1210 | for cls in self.__class__.mro(): |
| 1211 | for name, obj in cls.__dict__.items(): |
| 1212 | if name[0] == '_': |
| 1213 | continue |
| 1214 | if isinstance(obj, property): |
| 1215 | # that's an enum.property |
| 1216 | if obj.fget is not None or name not in self._member_map_: |
| 1217 | interesting.add(name) |
| 1218 | else: |
| 1219 | # in case it was added by `dir(self)` |
| 1220 | interesting.discard(name) |
| 1221 | elif name not in self._member_map_: |
| 1222 | interesting.add(name) |
| 1223 | names = sorted( |
| 1224 | set(['__class__', '__doc__', '__eq__', '__hash__', '__module__']) |
| 1225 | | interesting |
| 1226 | ) |
| 1227 | return names |
| 1228 | |
| 1229 | def __format__(self, format_spec): |
| 1230 | return str.__format__(str(self), format_spec) |