mirror of
https://github.com/cedricbonhomme/Stegano.git
synced 2025-05-12 17:18:30 +02:00
fixed few mypy related issues.
This commit is contained in:
parent
6d87ba2921
commit
7abce7d5d9
1 changed files with 4 additions and 6 deletions
|
@ -1,6 +1,4 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
# Stegano - Stegano is a pure Python steganography module.
|
# Stegano - Stegano is a pure Python steganography module.
|
||||||
# Copyright (C) 2010-2022 Cédric Bonhomme - https://www.cedricbonhomme.org
|
# Copyright (C) 2010-2022 Cédric Bonhomme - https://www.cedricbonhomme.org
|
||||||
#
|
#
|
||||||
|
@ -28,7 +26,7 @@ __license__ = "GPLv3"
|
||||||
import base64
|
import base64
|
||||||
import itertools
|
import itertools
|
||||||
from functools import reduce
|
from functools import reduce
|
||||||
from typing import IO, Iterator, List, Tuple, Union
|
from typing import IO, List, Tuple, Union
|
||||||
|
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
|
@ -78,7 +76,7 @@ def setlsb(component: int, bit: str) -> int:
|
||||||
|
|
||||||
def n_at_a_time(
|
def n_at_a_time(
|
||||||
items: List[int], n: int, fillvalue: str
|
items: List[int], n: int, fillvalue: str
|
||||||
) -> Iterator[Tuple[Union[int, str]]]:
|
) -> itertools.zip_longest[Tuple[object, ...]]:
|
||||||
"""Returns an iterator which groups n items at a time.
|
"""Returns an iterator which groups n items at a time.
|
||||||
Any final partial tuple will be padded with the fillvalue
|
Any final partial tuple will be padded with the fillvalue
|
||||||
|
|
||||||
|
@ -134,7 +132,7 @@ class Hider:
|
||||||
|
|
||||||
if image.mode not in ["RGB", "RGBA"]:
|
if image.mode not in ["RGB", "RGBA"]:
|
||||||
if not auto_convert_rgb:
|
if not auto_convert_rgb:
|
||||||
print("The mode of the image is not RGB. Mode is {}".format(image.mode))
|
print(f"The mode of the image is not RGB. Mode is {image.mode}")
|
||||||
answer = input("Convert the image to RGB ? [Y / n]\n") or "Y"
|
answer = input("Convert the image to RGB ? [Y / n]\n") or "Y"
|
||||||
if answer.lower() == "n":
|
if answer.lower() == "n":
|
||||||
raise Exception("Not a RGB image.")
|
raise Exception("Not a RGB image.")
|
||||||
|
@ -154,7 +152,7 @@ class Hider:
|
||||||
|
|
||||||
if self._len_message_bits > npixels * 3:
|
if self._len_message_bits > npixels * 3:
|
||||||
raise Exception(
|
raise Exception(
|
||||||
"The message you want to hide is too long: {}".format(message_length)
|
f"The message you want to hide is too long: {message_length}"
|
||||||
)
|
)
|
||||||
|
|
||||||
def encode_another_pixel(self):
|
def encode_another_pixel(self):
|
||||||
|
|
Loading…
Add table
Reference in a new issue