Apply suggestions from code review

Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
Co-authored-by: Alexander Karpinsky <homm86@gmail.com>
This commit is contained in:
Hugo van Kemenade 2023-12-04 16:34:39 +02:00 committed by GitHub
parent 27d7bd10c8
commit e92c07f402
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -557,7 +557,7 @@ def invert(image):
:param image: The image to invert. :param image: The image to invert.
:return: An image. :return: An image.
""" """
lut = [255 - i for i in range(256)] lut = list(range(255, -1, -1))
return image.point(lut) if image.mode == "1" else _lut(image, lut) return image.point(lut) if image.mode == "1" else _lut(image, lut)

View File

@ -129,7 +129,7 @@ class PcfFontFile(FontFile.FontFile):
nprops = i32(fp.read(4)) nprops = i32(fp.read(4))
# read property description # read property description
p = [(i32(fp.read(4)), i8(fp.read(1)), i32(fp.read(4))) for i in range(nprops)] p = [(i32(fp.read(4)), i8(fp.read(1)), i32(fp.read(4))) for _ in range(nprops)]
if nprops & 3: if nprops & 3:
fp.seek(4 - (nprops & 3), io.SEEK_CUR) # pad fp.seek(4 - (nprops & 3), io.SEEK_CUR) # pad

View File

@ -238,7 +238,7 @@ def makeSpiderHeader(im):
if nvalues < 23: if nvalues < 23:
return [] return []
hdr = [0.0 for _ in range(nvalues)] hdr = [0.0] * nvalues
# NB these are Fortran indices # NB these are Fortran indices
hdr[1] = 1.0 # nslice (=1 for an image) hdr[1] = 1.0 # nslice (=1 for an image)