Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 43e4ea1 commit 764d612Copy full SHA for 764d612
1 file changed
Lib/importlib/_bootstrap.py
@@ -80,20 +80,6 @@ def _path_absolute(path):
80
return _path_join(_os.getcwd(), path)
81
82
83
-class _closing:
84
-
85
- """Simple replacement for contextlib.closing."""
86
87
- def __init__(self, obj):
88
- self.obj = obj
89
90
- def __enter__(self):
91
- return self.obj
92
93
- def __exit__(self, *args):
94
- self.obj.close()
95
96
97
def _wrap(new, old):
98
"""Simple substitute for functools.wraps."""
99
for replace in ['__module__', '__name__', '__doc__']:
@@ -468,7 +454,7 @@ def get_filename(self, fullname):
468
454
469
455
def get_data(self, path):
470
456
"""Return the data from path as raw bytes."""
471
- with _closing(_io.FileIO(path, 'r')) as file:
457
+ with _io.FileIO(path, 'r') as file:
472
458
return file.read()
473
459
474
460
0 commit comments