Skip to content

Commit 21963fc

Browse files
Shree7676bosd
authored andcommitted
updating the read_pdf with a With block
1 parent 42c3a29 commit 21963fc

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

camelot/io.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,13 @@ def read_pdf(
129129
warnings.simplefilter("ignore")
130130

131131
validate_input(kwargs, flavor=flavor)
132-
p = PDFHandler(filepath, pages=pages, password=password, debug=debug)
133-
kwargs = remove_extra(kwargs, flavor=flavor)
134-
tables = p.parse(
135-
flavor=flavor,
136-
suppress_stdout=suppress_stdout,
137-
parallel=parallel,
138-
layout_kwargs=layout_kwargs,
139-
**kwargs,
140-
)
132+
with PDFHandler(filepath, pages=pages, password=password, debug=debug) as p:
133+
kwargs = remove_extra(kwargs, flavor=flavor)
134+
tables = p.parse(
135+
flavor=flavor,
136+
suppress_stdout=suppress_stdout,
137+
parallel=parallel,
138+
layout_kwargs=layout_kwargs,
139+
**kwargs,
140+
)
141141
return tables

0 commit comments

Comments
 (0)