format with black

This commit is contained in:
Johannes Schauer Marin Rodrigues 2021-04-12 14:13:34 +02:00
parent 2a8779295f
commit cd1088a5a9
Signed by untrusted user: josch
GPG key ID: F2CBA5C78FBD83E1
3 changed files with 22 additions and 8 deletions

View file

@ -40,7 +40,9 @@ setup(
include_package_data=True,
zip_safe=True,
install_requires=INSTALL_REQUIRES,
extras_require={"gui": ("tkinter"),},
extras_require={
"gui": ("tkinter"),
},
entry_points={
"setuptools.installation": ["eggsecutable = img2pdf:main"],
"console_scripts": ["img2pdf = img2pdf:main"],

View file

@ -2283,6 +2283,7 @@ def input_images(path_expr):
# glob won't return files that don't exist so we only use it for wildcards
# paths without wildcards that do not exist will trigger "does not exist"
from glob import glob
paths = glob(path_expr)
for path in paths:
try:

View file

@ -603,9 +603,9 @@ def icc_profile():
b"desc\x00\x00\x00\x00" + struct.pack(">I", 5) + b"fake" + 79 * b"\x00",
b"XYZ \x00\x00\x00\x00" + struct.pack(">III", *getxyz(white)),
# by mixing up red, green and blue, we create a test profile
b"XYZ \x00\x00\x00\x00" + struct.pack(">III", *getxyz(blue)), # red
b"XYZ \x00\x00\x00\x00" + struct.pack(">III", *getxyz(red)), # green
b"XYZ \x00\x00\x00\x00" + struct.pack(">III", *getxyz(green)), # blue
b"XYZ \x00\x00\x00\x00" + struct.pack(">III", *getxyz(blue)), # red
b"XYZ \x00\x00\x00\x00" + struct.pack(">III", *getxyz(red)), # green
b"XYZ \x00\x00\x00\x00" + struct.pack(">III", *getxyz(green)), # blue
# by only supplying two values, we create the most trivial "curve",
# where the remaining values will be linearly interpolated between them
b"curv\x00\x00\x00\x00" + struct.pack(">IHH", 2, 0, 65535),
@ -776,6 +776,7 @@ def tmp_icc_profile(tmp_path_factory):
yield tmp_icc_profile
tmp_icc_profile.unlink()
@pytest.fixture(scope="session")
def tmp_icc_png(tmp_path_factory, alpha, tmp_icc_profile):
normal16 = alpha[:, :, 0:3]
@ -6542,9 +6543,13 @@ def test_general(general_input, engine):
assert cur_page.Resources.XObject.keys() == {"/Im0"}
if engine != img2pdf.Engine.pikepdf:
assert cur_page.Contents.Length == len(cur_page.Contents.read_bytes())
assert cur_page.Contents.read_bytes() == b"q\n%.4f 0 0 %.4f 0.0000 0.0000 cm\n/Im0 Do\nQ" % (
pagewidth,
pageheight,
assert (
cur_page.Contents.read_bytes()
== b"q\n%.4f 0 0 %.4f 0.0000 0.0000 cm\n/Im0 Do\nQ"
% (
pagewidth,
pageheight,
)
)
imgprops = cur_page.Resources.XObject.Im0
@ -6682,7 +6687,7 @@ def test_general(general_input, engine):
def main():
normal16 = alpha_value()[:, :, 0:3]
pathlib.Path('test.icc').write_bytes(icc_profile())
pathlib.Path("test.icc").write_bytes(icc_profile())
write_png(
normal16 / 0xFFFF * 0xFF,
"icc.png",
@ -6690,6 +6695,12 @@ def main():
2,
iccp="test.icc",
)
write_png(
normal16 / 0xFFFF * 0xFF,
"normal.png",
8,
2,
)
if __name__ == "__main__":