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

Class addclosehook

Lib/urllib/response.py:37–54  ·  view source on GitHub ↗

Class to add a close hook to an open file.

Source from the content-addressed store, hash-verified

35
36
37class addclosehook(addbase):
38 """Class to add a close hook to an open file."""
39
40 def __init__(self, fp, closehook, *hookargs):
41 super(addclosehook, self).__init__(fp)
42 self.closehook = closehook
43 self.hookargs = hookargs
44
45 def close(self):
46 try:
47 closehook = self.closehook
48 hookargs = self.hookargs
49 if closehook:
50 self.closehook = None
51 self.hookargs = None
52 closehook(*hookargs)
53 finally:
54 super(addclosehook, self).close()
55
56
57class addinfo(addbase):

Callers 1

retrfileMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…