Add pyupgrade to pre-commit

This commit is contained in:
Hugo van Kemenade 2023-09-09 13:07:12 +03:00
parent b723e9e62e
commit 0d1e83098d
4 changed files with 11 additions and 5 deletions

View File

@ -1,4 +1,10 @@
repos: repos:
- repo: https://github.com/asottile/pyupgrade
rev: v3.13.0
hooks:
- id: pyupgrade
args: [--py38-plus]
- repo: https://github.com/psf/black - repo: https://github.com/psf/black
rev: 23.7.0 rev: 23.7.0
hooks: hooks:

View File

@ -68,11 +68,11 @@ def bdf_char(f):
# followed by the width in x (BBw), height in y (BBh), # followed by the width in x (BBw), height in y (BBh),
# and x and y displacement (BBxoff0, BByoff0) # and x and y displacement (BBxoff0, BByoff0)
# of the lower left corner from the origin of the character. # of the lower left corner from the origin of the character.
width, height, x_disp, y_disp = [int(p) for p in props["BBX"].split()] width, height, x_disp, y_disp = (int(p) for p in props["BBX"].split())
# The word DWIDTH # The word DWIDTH
# followed by the width in x and y of the character in device pixels. # followed by the width in x and y of the character in device pixels.
dwx, dwy = [int(p) for p in props["DWIDTH"].split()] dwx, dwy = (int(p) for p in props["DWIDTH"].split())
bbox = ( bbox = (
(dwx, dwy), (dwx, dwy),

View File

@ -339,9 +339,9 @@ class EpsImageFile(ImageFile.ImageFile):
# data start identifier (the image data follows after a single line # data start identifier (the image data follows after a single line
# consisting only of this quoted value) # consisting only of this quoted value)
image_data_values = byte_arr[11:bytes_read].split(None, 7) image_data_values = byte_arr[11:bytes_read].split(None, 7)
columns, rows, bit_depth, mode_id = [ columns, rows, bit_depth, mode_id = (
int(value) for value in image_data_values[:4] int(value) for value in image_data_values[:4]
] )
if bit_depth == 1: if bit_depth == 1:
self._mode = "1" self._mode = "1"

View File

@ -166,7 +166,7 @@ def grabclipboard():
msg = "wl-paste or xclip is required for ImageGrab.grabclipboard() on Linux" msg = "wl-paste or xclip is required for ImageGrab.grabclipboard() on Linux"
raise NotImplementedError(msg) raise NotImplementedError(msg)
p = subprocess.run(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) p = subprocess.run(args, capture_output=True)
err = p.stderr err = p.stderr
if err: if err:
msg = f"{args[0]} error: {err.strip().decode()}" msg = f"{args[0]} error: {err.strip().decode()}"