Skip to content

Commit f5ee17a

Browse files
Simplify psm_parameter() with a conditional expression.
It is a bit more compact and arguably more Pythonic.
1 parent b95bdbc commit f5ee17a

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/pyocr/tesseract.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,7 @@ def can_detect_orientation():
164164
def psm_parameter():
165165
"""Return the psm option string depending on the Tesseract version."""
166166
version = get_version()
167-
if version[0] <= 3:
168-
return "-psm"
169-
170-
return "--psm"
167+
return "--psm" if version[0] > 3 else "-psm"
171168

172169

173170
def detect_orientation(image, lang=None):

0 commit comments

Comments
 (0)