Skip to content

Commit

Permalink
Fixing lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
fhightower committed Jun 18, 2021
1 parent ec89fd5 commit 08f7eb6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions d8s_pdfs/pdfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def pdf_read(pdf_path: str) -> Iterable[str]:

# check if the pdf_path is a url
if is_url(pdf_path):
temp_file = tempfile.TemporaryFile()
temp_file = tempfile.TemporaryFile() # pylint: disable=R1732
temp_file_path = str(temp_file.name)
file_write(temp_file_path, get(pdf_path, process_response_as_bytes=True))
pdf_path = temp_file_path
Expand All @@ -23,12 +23,12 @@ def pdf_read(pdf_path: str) -> Iterable[str]:
pdf = PyPDF2.PdfFileReader(f)
except PyPDF2.utils.PdfReadError as e:
message = 'Unable to read the pdf at {}: {}'.format(pdf_path, e)
raise RuntimeError(message)
raise RuntimeError(message) from e
else:
for i in range(0, pdf.numPages):
page = pdf.getPage(i)
page_content = page.extractText()
yield page_content

if temp_file is not None:
result = temp_file.close()
temp_file.close()

0 comments on commit 08f7eb6

Please sign in to comment.