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

Method __enter__

Lib/test/test_mmap.py:1007–1019  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1005 self.access = access
1006
1007 def __enter__(self):
1008 self.f = open(TESTFN, "w+b")
1009 self.f.write(random.randbytes(100))
1010 self.f.flush()
1011
1012 m = mmap.mmap(self.f.fileno(), 100, access=self.access)
1013
1014 class X:
1015 def __index__(self):
1016 m.close()
1017 return 10
1018
1019 return (m, X)
1020
1021 def __exit__(self, exc_type, exc_value, traceback):
1022 self.f.close()

Callers

nothing calls this directly

Calls 5

openFunction · 0.50
writeMethod · 0.45
randbytesMethod · 0.45
flushMethod · 0.45
filenoMethod · 0.45

Tested by

no test coverage detected