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

Method get_original

Lib/unittest/mock.py:1462–1483  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1460
1461
1462 def get_original(self):
1463 target = self.getter()
1464 name = self.attribute
1465
1466 original = DEFAULT
1467 local = False
1468
1469 try:
1470 original = target.__dict__[name]
1471 except (AttributeError, KeyError):
1472 original = getattr(target, name, DEFAULT)
1473 else:
1474 local = True
1475
1476 if name in _builtins and isinstance(target, ModuleType):
1477 self.create = True
1478
1479 if not self.create and original is DEFAULT:
1480 raise AttributeError(
1481 "%s does not have the attribute %r" % (target, name)
1482 )
1483 return original, local
1484
1485
1486 def __enter__(self):

Callers 1

__enter__Method · 0.95

Calls 1

getterMethod · 0.45

Tested by

no test coverage detected