MCPcopy Index your code
hub / github.com/RustPython/RustPython / __dir__

Method __dir__

Lib/enum.py:1267–1294  ·  view source on GitHub ↗

Returns public methods and other interesting attributes.

(self)

Source from the content-addressed store, hash-verified

1265 return "%s.%s" % (self.__class__.__name__, self._name_, )
1266
1267 def __dir__(self):
1268 """
1269 Returns public methods and other interesting attributes.
1270 """
1271 interesting = set()
1272 if self.__class__._member_type_ is not object:
1273 interesting = set(object.__dir__(self))
1274 for name in getattr(self, '__dict__', []):
1275 if name[0] != '_' and name not in self._member_map_:
1276 interesting.add(name)
1277 for cls in self.__class__.mro():
1278 for name, obj in cls.__dict__.items():
1279 if name[0] == '_':
1280 continue
1281 if isinstance(obj, property):
1282 # that's an enum.property
1283 if obj.fget is not None or name not in self._member_map_:
1284 interesting.add(name)
1285 else:
1286 # in case it was added by `dir(self)`
1287 interesting.discard(name)
1288 elif name not in self._member_map_:
1289 interesting.add(name)
1290 names = sorted(
1291 set(['__class__', '__doc__', '__eq__', '__hash__', '__module__'])
1292 | interesting
1293 )
1294 return names
1295
1296 def __format__(self, format_spec):
1297 return str.__format__(str(self), format_spec)

Callers

nothing calls this directly

Calls 8

setFunction · 0.85
getattrFunction · 0.85
isinstanceFunction · 0.85
sortedFunction · 0.85
addMethod · 0.45
mroMethod · 0.45
itemsMethod · 0.45
discardMethod · 0.45

Tested by

no test coverage detected