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

Class M2

Lib/test/test_descr.py:508–523  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

506 class _instance(object):
507 pass
508 class M2(object):
509 @staticmethod
510 def __new__(cls, name, bases, dict):
511 self = object.__new__(cls)
512 self.name = name
513 self.bases = bases
514 self.dict = dict
515 return self
516 def __call__(self):
517 it = _instance()
518 # Early binding of methods
519 for key in self.dict:
520 if key.startswith("__"):
521 continue
522 setattr(it, key, self.dict[key].__get__(it, self))
523 return it
524 class C(metaclass=M2):
525 def spam(self):
526 return 42

Callers 1

test_dirMethod · 0.70

Calls 1

propertyClass · 0.85

Tested by 1

test_dirMethod · 0.56