Browse Source

Nested with

master
Ricardo Branco 6 years ago
parent
commit
3742bc9e49
1 changed files with 2 additions and 4 deletions
  1. 2
    4
      clean_registry.py

+ 2
- 4
clean_registry.py View File

@@ -204,10 +204,8 @@ class RegistryCleaner():
204 204
         try:
205 205
             with BytesIO(
206 206
                 b"".join(_ for _ in self.docker.api.get_archive(self.container, path)[0])
207
-            ) as buf:
208
-                with tarfile.open(fileobj=buf) as tar:
209
-                    with tar.extractfile(os.path.basename(path)) as infile:
210
-                        data = infile.read()
207
+            ) as buf, tarfile.open(fileobj=buf) as tar, tar.extractfile(os.path.basename(path)) as infile:
208
+                data = infile.read()
211 209
         except NotFound as err:
212 210
             error(err)
213 211
         return data

Loading…
Cancel
Save