mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ConfirmEdit
synced 2024-11-23 15:56:50 +00:00
*.py: Fixup a couple more linting issues
Change-Id: Ic0ba59dc1af1bdefab606a939887752b3b3b3c80
This commit is contained in:
parent
5d6a6aaedf
commit
602906527e
|
@ -40,12 +40,13 @@ try:
|
|||
from PIL import ImageDraw
|
||||
from PIL import ImageEnhance
|
||||
from PIL import ImageOps
|
||||
except:
|
||||
except ImportError:
|
||||
sys.exit(
|
||||
"This script requires the Python Imaging Library - http://www.pythonware.com/products/pil/"
|
||||
)
|
||||
|
||||
nonalpha = re.compile("[^a-z]") # regex to test for suitability of words
|
||||
# regex to test for suitability of words
|
||||
nonalpha = re.compile("[^a-z]")
|
||||
|
||||
# Pillow 9.2 added getbbox to replace getsize, and getsize() was removed in Pillow 10
|
||||
# https://pillow.readthedocs.io/en/stable/releasenotes/10.0.0.html#font-size-and-offset-methods
|
||||
|
@ -63,7 +64,7 @@ def wobbly_copy(src, wob, col, scale, ang):
|
|||
rot = src.rotate(rr, Image.BILINEAR)
|
||||
# Do a cheap bounding-box op here to try to limit work below
|
||||
bbx = rot.getbbox()
|
||||
if bbx == None:
|
||||
if bbx is None:
|
||||
return src
|
||||
else:
|
||||
l, t, r, b = bbx
|
||||
|
|
12
captcha.py
12
captcha.py
|
@ -40,15 +40,19 @@ try:
|
|||
from PIL import ImageDraw
|
||||
from PIL import ImageEnhance
|
||||
from PIL import ImageOps
|
||||
except:
|
||||
except ImportError:
|
||||
sys.exit(
|
||||
"This script requires the Python Imaging Library - http://www.pythonware.com/products/pil/"
|
||||
)
|
||||
|
||||
nonalpha = re.compile("[^a-z]") # regex to test for suitability of words
|
||||
# regex to test for suitability of words
|
||||
nonalpha = re.compile("[^a-z]")
|
||||
|
||||
# when il beside each other, hard to read
|
||||
confusedletters = re.compile(
|
||||
"[ijtlr][ijtl]|r[nompqr]|[il]"
|
||||
) # when il beside each other, hard to read.
|
||||
)
|
||||
|
||||
# Pillow 9.2 added getbbox to replace getsize, and getsize() was removed in Pillow 10
|
||||
# https://pillow.readthedocs.io/en/stable/releasenotes/10.0.0.html#font-size-and-offset-methods
|
||||
# We don't have a requirements.txt, and therefore don't declare any specific supported or min version...
|
||||
|
@ -65,7 +69,7 @@ def wobbly_copy(src, wob, col, scale, ang):
|
|||
rot = src.rotate(rr, Image.BILINEAR)
|
||||
# Do a cheap bounding-box op here to try to limit work below
|
||||
bbx = rot.getbbox()
|
||||
if bbx == None:
|
||||
if bbx is None:
|
||||
return src
|
||||
else:
|
||||
l, t, r, b = bbx
|
||||
|
|
6
tox.ini
6
tox.ini
|
@ -17,9 +17,7 @@ basepython = python3
|
|||
[flake8]
|
||||
exclude = .tox
|
||||
max_line_length = 80
|
||||
; E128 continuation line under-indented for visual indent
|
||||
; E501 line too long (X > 80 characters)
|
||||
; E711 comparison to None should be 'if cond is None:'
|
||||
; E722 do not use bare 'except'
|
||||
; Deprecated best practice - https://www.flake8rules.com/rules/W503.html
|
||||
; W503 line break before binary operator
|
||||
ignore = E128,E501,E711,E722,W503
|
||||
ignore = E501,W503
|
||||
|
|
Loading…
Reference in a new issue