Skip to content

Commit 15d7f16

Browse files
committed
Fix flake8 errors in image_service.py
1 parent 00b0247 commit 15d7f16

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

datafog/services/image_service.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717
import certifi
1818
from PIL import Image
1919

20-
# Check if the PYTEST_DONUT flag is set to enable OCR testing
21-
DONUT_TESTING_ENABLED = os.environ.get("PYTEST_DONUT", "").lower() == "yes"
22-
2320
from datafog.processing.image_processing.donut_processor import DonutProcessor
2421
from datafog.processing.image_processing.pytesseract_processor import (
2522
PytesseractProcessor,
2623
)
2724

25+
# Check if the PYTEST_DONUT flag is set to enable OCR testing
26+
DONUT_TESTING_ENABLED = os.environ.get("PYTEST_DONUT", "").lower() == "yes"
27+
2828

2929
class ImageDownloader:
3030
"""Asynchronous image downloader with SSL support."""
@@ -56,18 +56,26 @@ def __init__(self, use_donut: bool = False, use_tesseract: bool = True):
5656
self.downloader = ImageDownloader()
5757

5858
# Check if we're in a test environment
59-
in_test_env = "PYTEST_CURRENT_TEST" in os.environ or "TOX_ENV_NAME" in os.environ
59+
in_test_env = (
60+
"PYTEST_CURRENT_TEST" in os.environ or "TOX_ENV_NAME" in os.environ
61+
)
6062

6163
# Log the initial OCR processor selection
62-
logging.info(f"Initial OCR processor selection: use_donut={use_donut}, use_tesseract={use_tesseract}")
63-
64+
logging.info(
65+
f"Initial OCR processor selection: use_donut={use_donut}, use_tesseract={use_tesseract}"
66+
)
67+
6468
# In test environment without PYTEST_DONUT=yes, we should still allow Donut for testing
6569
# but the DonutProcessor will return mock results
6670
if in_test_env:
6771
if DONUT_TESTING_ENABLED:
68-
logging.info("PYTEST_DONUT=yes is set, enabling real Donut OCR in test environment")
72+
logging.info(
73+
"PYTEST_DONUT=yes is set, enabling real Donut OCR in test environment"
74+
)
6975
else:
70-
logging.info("Test environment detected without PYTEST_DONUT=yes, Donut will use mock results")
76+
logging.info(
77+
"Test environment detected without PYTEST_DONUT=yes, Donut will use mock results"
78+
)
7179

7280
if use_donut and use_tesseract:
7381
raise ValueError(

0 commit comments

Comments
 (0)