8000 Missed a spot with the context manager · onware/document-api-python@be4c9c8 · GitHub
[go: up one dir, main page]

Skip to content

Commit be4c9c8

Browse files
committed
Missed a spot with the context manager
1 parent 813e079 commit be4c9c8

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

tableaudocumentapi/containerfile.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ def temporary_directory(*args, **kwargs):
1919
def find_file_in_zip(zip):
2020
for filename in zip.namelist():
2121
try:
22-
ET.parse(zip.open(filename)).getroot().tag in (
23-
'workbook', 'datasource')
24-
return filename
22+
with zip.open(filename) as xml_candidate:
23+
ET.parse(xml_candidate).getroot().tag in (
24+
'workbook', 'datasource')
25+
return filename
2526
except ET.ParseError:
2627
# That's not an XML file by gosh
2728
pass

0 commit comments

Comments
 (0)
0