MCPcopy Index your code
hub / github.com/python/cpython / __dir__

Method __dir__

Lib/enum.py:1295–1322  ·  view source on GitHub ↗

Returns public methods and other interesting attributes.

(self)

Source from the content-addressed store, hash-verified

1293 return "%s.%s" % (self.__class__.__name__, self._name_, )
1294
1295 def __dir__(self):
1296 """
1297 Returns public methods and other interesting attributes.
1298 """
1299 interesting = set()
1300 if self.__class__._member_type_ is not object:
1301 interesting = set(object.__dir__(self))
1302 for name in getattr(self, '__dict__', []):
1303 if name[0] != '_' and name not in self._member_map_:
1304 interesting.add(name)
1305 for cls in self.__class__.mro():
1306 for name, obj in cls.__dict__.items():
1307 if name[0] == '_':
1308 continue
1309 if isinstance(obj, property):
1310 # that's an enum.property
1311 if obj.fget is not None or name not in self._member_map_:
1312 interesting.add(name)
1313 else:
1314 # in case it was added by `dir(self)`
1315 interesting.discard(name)
1316 elif name not in self._member_map_:
1317 interesting.add(name)
1318 names = sorted(
1319 set(['__class__', '__doc__', '__eq__', '__hash__', '__module__'])
1320 | interesting
1321 )
1322 return names
1323
1324 def __format__(self, format_spec):
1325 return str.__format__(str(self), format_spec)

Callers 1

_get_safe___dir__Function · 0.45

Calls 5

setFunction · 0.85
addMethod · 0.45
mroMethod · 0.45
itemsMethod · 0.45
discardMethod · 0.45

Tested by

no test coverage detected