Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Nov 23, 2023
1 parent b709330 commit ed37e01
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pytesseract/pytesseract.py
Expand Up @@ -124,6 +124,7 @@ def __init__(self):
'ALTO output not supported. Tesseract >= 4.1.0 required',
)


class URLNotSupported(EnvironmentError):
def __init__(self):
super().__init__(
Expand Down Expand Up @@ -217,8 +218,9 @@ def save(image):
with NamedTemporaryFile(prefix='tess_', delete=False) as f:
if isinstance(image, str):
if image.startswith('http:') or image.startswith('https:'):
if get_tesseract_version(cached=True) < TESSERACT_URL_VERSION\
or not has_libcurl(cached=True):
if get_tesseract_version(
cached=True,
) < TESSERACT_URL_VERSION or not has_libcurl(cached=True):
raise URLNotSupported()
yield f.name, image
else:
Expand Down Expand Up @@ -497,7 +499,7 @@ def has_libcurl():
)
except OSError:
raise TesseractNotFoundError()

return 'libcurl' in output.decode(DEFAULT_ENCODING)


Expand Down

0 comments on commit ed37e01

Please sign in to comment.