[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot] 2022-10-06 16:51:28 +00:00
parent a12389bf35
commit 2f6467c94e
2 changed files with 5 additions and 2 deletions

View File

@ -23,6 +23,7 @@ def test_sanity():
def test_large_file_is_truncated():
import warnings
from unittest.mock import patch
try:
original_value = GimpPaletteFile._max_file_size
GimpPaletteFile._max_file_size = 100
@ -35,6 +36,7 @@ def test_large_file_is_truncated():
finally:
GimpPaletteFile._max_file_size = original_value
def test_get_palette():
# Arrange
with open("Tests/images/custom_gimp_palette.gpl", "rb") as fp:

View File

@ -28,7 +28,7 @@ class GimpPaletteFile:
#: override if reading larger palettes is needed
max_colors = 256
_max_line_size = 100
_max_file_size = 2 ** 20
_max_file_size = 2**20
def __init__(self, fp):
@ -47,7 +47,8 @@ class GimpPaletteFile:
read += len(s)
if read >= self._max_file_size:
warnings.warn(
f"Palette file truncated at {self._max_file_size - len(s)} bytes")
f"Palette file truncated at {self._max_file_size - len(s)} bytes"
)
break
# skip fields and comment lines