mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 01:16:16 +03:00
Remove redundant parentheses
This commit is contained in:
parent
6a648c9ce7
commit
ee85e387ba
|
@ -458,7 +458,7 @@ class TestCoreResampleBox:
|
|||
def split_range(size, tiles):
|
||||
scale = size / tiles
|
||||
for i in range(tiles):
|
||||
yield (int(round(scale * i)), int(round(scale * (i + 1))))
|
||||
yield int(round(scale * i)), int(round(scale * (i + 1)))
|
||||
|
||||
tiled = Image.new(im.mode, dst_size)
|
||||
scale = (im.size[0] / tiled.size[0], im.size[1] / tiled.size[1])
|
||||
|
|
|
@ -20,7 +20,7 @@ def testimage():
|
|||
|
||||
>>> from PIL import Image, ImageDraw, ImageFilter, ImageMath
|
||||
>>> im = Image.new("1", (128, 128)) # monochrome
|
||||
>>> def _info(im): return (im.format, im.mode, im.size)
|
||||
>>> def _info(im): return im.format, im.mode, im.size
|
||||
>>> _info(im)
|
||||
(None, '1', (128, 128))
|
||||
>>> _info(Image.new("L", (128, 128))) # grayscale (luminance)
|
||||
|
|
2
setup.py
2
setup.py
|
@ -269,7 +269,7 @@ def _pkg_config(name):
|
|||
.strip()
|
||||
.replace("-I", "")
|
||||
)
|
||||
return (libs, cflags)
|
||||
return libs, cflags
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ def __getattr__(name):
|
|||
|
||||
|
||||
def unpack_565(i):
|
||||
return (((i >> 11) & 0x1F) << 3, ((i >> 5) & 0x3F) << 2, (i & 0x1F) << 3)
|
||||
return ((i >> 11) & 0x1F) << 3, ((i >> 5) & 0x3F) << 2, (i & 0x1F) << 3
|
||||
|
||||
|
||||
def decode_dxt1(data, alpha=False):
|
||||
|
|
|
@ -325,7 +325,7 @@ class EpsImageFile(ImageFile.ImageFile):
|
|||
else:
|
||||
raise SyntaxError("not an EPS file")
|
||||
|
||||
return (length, offset)
|
||||
return length, offset
|
||||
|
||||
def load(self, scale=1, transparency=False):
|
||||
# Load EPS via Ghostscript
|
||||
|
|
|
@ -114,7 +114,7 @@ class FtexImageFile(ImageFile.ImageFile):
|
|||
|
||||
if format == Format.DXT1:
|
||||
self.mode = "RGBA"
|
||||
self.tile = [("bcn", (0, 0) + self.size, 0, (1))]
|
||||
self.tile = [("bcn", (0, 0) + self.size, 0, 1)]
|
||||
elif format == Format.UNCOMPRESSED:
|
||||
self.tile = [("raw", (0, 0) + self.size, 0, ("RGB", 0, 1))]
|
||||
else:
|
||||
|
|
|
@ -162,7 +162,7 @@ FLAGS = {
|
|||
"SOFTPROOFING": 16384, # Do softproofing
|
||||
"PRESERVEBLACK": 32768, # Black preservation
|
||||
"NODEFAULTRESOURCEDEF": 16777216, # CRD special
|
||||
"GRIDPOINTS": lambda n: ((n) & 0xFF) << 16, # Gridpoints
|
||||
"GRIDPOINTS": lambda n: (n & 0xFF) << 16, # Gridpoints
|
||||
}
|
||||
|
||||
_MAX_FLAG = 0
|
||||
|
@ -1026,4 +1026,4 @@ def versions():
|
|||
(pyCMS) Fetches versions.
|
||||
"""
|
||||
|
||||
return (VERSION, core.littlecms_version, sys.version.split()[0], Image.__version__)
|
||||
return VERSION, core.littlecms_version, sys.version.split()[0], Image.__version__
|
||||
|
|
|
@ -45,7 +45,7 @@ def getrgb(color):
|
|||
|
||||
# check for known string formats
|
||||
if re.match("#[a-f0-9]{3}$", color):
|
||||
return (int(color[1] * 2, 16), int(color[2] * 2, 16), int(color[3] * 2, 16))
|
||||
return int(color[1] * 2, 16), int(color[2] * 2, 16), int(color[3] * 2, 16)
|
||||
|
||||
if re.match("#[a-f0-9]{4}$", color):
|
||||
return (
|
||||
|
@ -56,7 +56,7 @@ def getrgb(color):
|
|||
)
|
||||
|
||||
if re.match("#[a-f0-9]{6}$", color):
|
||||
return (int(color[1:3], 16), int(color[3:5], 16), int(color[5:7], 16))
|
||||
return int(color[1:3], 16), int(color[3:5], 16), int(color[5:7], 16)
|
||||
|
||||
if re.match("#[a-f0-9]{8}$", color):
|
||||
return (
|
||||
|
@ -68,7 +68,7 @@ def getrgb(color):
|
|||
|
||||
m = re.match(r"rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$", color)
|
||||
if m:
|
||||
return (int(m.group(1)), int(m.group(2)), int(m.group(3)))
|
||||
return int(m.group(1)), int(m.group(2)), int(m.group(3))
|
||||
|
||||
m = re.match(r"rgb\(\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d+)%\s*\)$", color)
|
||||
if m:
|
||||
|
@ -114,7 +114,7 @@ def getrgb(color):
|
|||
|
||||
m = re.match(r"rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$", color)
|
||||
if m:
|
||||
return (int(m.group(1)), int(m.group(2)), int(m.group(3)), int(m.group(4)))
|
||||
return int(m.group(1)), int(m.group(2)), int(m.group(3)), int(m.group(4))
|
||||
raise ValueError(f"unknown color specifier: {repr(color)}")
|
||||
|
||||
|
||||
|
@ -140,7 +140,7 @@ def getcolor(color, mode):
|
|||
# scaled to 24 bits to match the convert's implementation.
|
||||
color = (r * 19595 + g * 38470 + b * 7471 + 0x8000) >> 16
|
||||
if mode[-1] == "A":
|
||||
return (color, alpha)
|
||||
return color, alpha
|
||||
else:
|
||||
if mode[-1] == "A":
|
||||
return color + (alpha,)
|
||||
|
|
|
@ -571,7 +571,7 @@ class PyCodecState:
|
|||
self.yoff = 0
|
||||
|
||||
def extents(self):
|
||||
return (self.xoff, self.yoff, self.xoff + self.xsize, self.yoff + self.ysize)
|
||||
return self.xoff, self.yoff, self.xoff + self.xsize, self.yoff + self.ysize
|
||||
|
||||
|
||||
class PyCodec:
|
||||
|
@ -681,7 +681,7 @@ class PyDecoder(PyCodec):
|
|||
|
||||
if not rawmode:
|
||||
rawmode = self.mode
|
||||
d = Image._getdecoder(self.mode, "raw", (rawmode))
|
||||
d = Image._getdecoder(self.mode, "raw", rawmode)
|
||||
d.setimage(self.im, self.state.extents())
|
||||
s = d.decode(data)
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ def _parse_codestream(fp):
|
|||
else:
|
||||
mode = None
|
||||
|
||||
return (size, mode)
|
||||
return size, mode
|
||||
|
||||
|
||||
def _res_to_dpi(num, denom, exp):
|
||||
|
@ -191,7 +191,7 @@ def _parse_jp2_header(fp):
|
|||
if size is None or mode is None:
|
||||
raise SyntaxError("Malformed JP2 header")
|
||||
|
||||
return (size, mode, mimetype, dpi)
|
||||
return size, mode, mimetype, dpi
|
||||
|
||||
|
||||
##
|
||||
|
|
|
@ -444,7 +444,7 @@ class JpegImageFile(ImageFile.ImageFile):
|
|||
self.decoderconfig = (scale, 0)
|
||||
|
||||
box = (0, 0, original_size[0] / scale, original_size[1] / scale)
|
||||
return (self.mode, box)
|
||||
return self.mode, box
|
||||
|
||||
def load_djpeg(self):
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ class _PyAccess32_2(PyAccess):
|
|||
|
||||
def get_pixel(self, x, y):
|
||||
pixel = self.pixels[y][x]
|
||||
return (pixel.r, pixel.a)
|
||||
return pixel.r, pixel.a
|
||||
|
||||
def set_pixel(self, x, y, color):
|
||||
pixel = self.pixels[y][x]
|
||||
|
@ -152,7 +152,7 @@ class _PyAccess32_3(PyAccess):
|
|||
|
||||
def get_pixel(self, x, y):
|
||||
pixel = self.pixels[y][x]
|
||||
return (pixel.r, pixel.g, pixel.b)
|
||||
return pixel.r, pixel.g, pixel.b
|
||||
|
||||
def set_pixel(self, x, y, color):
|
||||
pixel = self.pixels[y][x]
|
||||
|
@ -171,7 +171,7 @@ class _PyAccess32_4(PyAccess):
|
|||
|
||||
def get_pixel(self, x, y):
|
||||
pixel = self.pixels[y][x]
|
||||
return (pixel.r, pixel.g, pixel.b, pixel.a)
|
||||
return pixel.r, pixel.g, pixel.b, pixel.a
|
||||
|
||||
def set_pixel(self, x, y, color):
|
||||
pixel = self.pixels[y][x]
|
||||
|
|
|
@ -353,10 +353,10 @@ class IFDRational(Rational):
|
|||
"""
|
||||
|
||||
if self.denominator == 0:
|
||||
return (self.numerator, self.denominator)
|
||||
return self.numerator, self.denominator
|
||||
|
||||
f = self._val.limit_denominator(max_denominator)
|
||||
return (f.numerator, f.denominator)
|
||||
return f.numerator, f.denominator
|
||||
|
||||
def __repr__(self):
|
||||
return str(float(self._val))
|
||||
|
|
Loading…
Reference in New Issue
Block a user