Fix pylint warnings in matricizer.py

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2024-08-02 10:29:50 -07:00
parent 71cf881305
commit b2d1e4773f
2 changed files with 46 additions and 42 deletions

View File

@@ -3,13 +3,16 @@ import abc
import re
from typing import Mapping, Sequence
from .palettes import Palette, DEFAULT_PALETTES, GRADIENT_PALETTES, MULTICOLOR_PALETTES
from .palettes import (DEFAULT_PALETTES, GRADIENT_PALETTES,
MULTICOLOR_PALETTES, Palette)
Matrix = Sequence[Sequence[int]]
def detect_hash_algorithm(hash_or_algo: str | bytes) -> str | None:
"""
Detect the hash algorithm based on a string.
"""
dimensions: Mapping[int, str] = {
32: "md5",
40: "sha1",
@@ -22,6 +25,7 @@ def detect_hash_algorithm(hash_or_algo: str | bytes) -> str | None:
return dimensions.get(len(hash_or_algo) * 2)
hoa = hash_or_algo.lower()
if re.match(r"^([0-9a-fA-F]{2})+$", hoa):
return dimensions.get(len(hoa))
elif hoa in list(dimensions.values()):

View File

@@ -1,42 +1,42 @@
<svg width="256" height="160" xmlns="http://www.w3.org/2000/svg">
<rect x="0" y="0" width="32" height="32" fill="hsl(0.00,0.00%,36.67%)" />
<rect x="32" y="0" width="32" height="32" fill="hsl(0.00,0.00%,16.67%)" />
<rect x="64" y="0" width="32" height="32" fill="hsl(0.00,0.00%,13.33%)" />
<rect x="96" y="0" width="32" height="32" fill="hsl(0.00,0.00%,30.00%)" />
<rect x="128" y="0" width="32" height="32" fill="hsl(0.00,0.00%,26.67%)" />
<rect x="160" y="0" width="32" height="32" fill="hsl(0.00,0.00%,36.67%)" />
<rect x="192" y="0" width="32" height="32" fill="hsl(0.00,0.00%,3.33%)" />
<rect x="224" y="0" width="32" height="32" fill="hsl(0.00,0.00%,26.67%)" />
<rect x="0" y="32" width="32" height="32" fill="hsl(0.00,0.00%,36.67%)" />
<rect x="32" y="32" width="32" height="32" fill="hsl(0.00,0.00%,46.67%)" />
<rect x="64" y="32" width="32" height="32" fill="hsl(0.00,0.00%,6.67%)" />
<rect x="96" y="32" width="32" height="32" fill="hsl(0.00,0.00%,43.33%)" />
<rect x="128" y="32" width="32" height="32" fill="hsl(0.00,0.00%,0.00%)" />
<rect x="160" y="32" width="32" height="32" fill="hsl(0.00,0.00%,36.67%)" />
<rect x="192" y="32" width="32" height="32" fill="hsl(0.00,0.00%,13.33%)" />
<rect x="224" y="32" width="32" height="32" fill="hsl(0.00,0.00%,26.67%)" />
<rect x="0" y="64" width="32" height="32" fill="hsl(0.00,0.00%,16.67%)" />
<rect x="32" y="64" width="32" height="32" fill="hsl(0.00,0.00%,0.00%)" />
<rect x="64" y="64" width="32" height="32" fill="hsl(0.00,0.00%,20.00%)" />
<rect x="96" y="64" width="32" height="32" fill="hsl(0.00,0.00%,40.00%)" />
<rect x="128" y="64" width="32" height="32" fill="hsl(0.00,0.00%,46.67%)" />
<rect x="160" y="64" width="32" height="32" fill="hsl(0.00,0.00%,33.33%)" />
<rect x="192" y="64" width="32" height="32" fill="hsl(0.00,0.00%,23.33%)" />
<rect x="224" y="64" width="32" height="32" fill="hsl(0.00,0.00%,10.00%)" />
<rect x="0" y="96" width="32" height="32" fill="hsl(0.00,0.00%,0.00%)" />
<rect x="32" y="96" width="32" height="32" fill="hsl(0.00,0.00%,46.67%)" />
<rect x="64" y="96" width="32" height="32" fill="hsl(0.00,0.00%,16.67%)" />
<rect x="96" y="96" width="32" height="32" fill="hsl(0.00,0.00%,26.67%)" />
<rect x="128" y="96" width="32" height="32" fill="hsl(0.00,0.00%,30.00%)" />
<rect x="160" y="96" width="32" height="32" fill="hsl(0.00,0.00%,50.00%)" />
<rect x="192" y="96" width="32" height="32" fill="hsl(0.00,0.00%,26.67%)" />
<rect x="224" y="96" width="32" height="32" fill="hsl(0.00,0.00%,43.33%)" />
<rect x="0" y="128" width="32" height="32" fill="hsl(0.00,0.00%,30.00%)" />
<rect x="32" y="128" width="32" height="32" fill="hsl(0.00,0.00%,0.00%)" />
<rect x="64" y="128" width="32" height="32" fill="hsl(0.00,0.00%,10.00%)" />
<rect x="96" y="128" width="32" height="32" fill="hsl(0.00,0.00%,26.67%)" />
<rect x="128" y="128" width="32" height="32" fill="hsl(0.00,0.00%,36.67%)" />
<rect x="160" y="128" width="32" height="32" fill="hsl(0.00,0.00%,20.00%)" />
<rect x="192" y="128" width="32" height="32" fill="hsl(0.00,0.00%,50.00%)" />
<rect x="224" y="128" width="32" height="32" fill="hsl(0.00,0.00%,6.67%)" />
<rect x="0" y="0" width="32" height="32" fill="hsl(0.00,100.00%,23.33%)" />
<rect x="32" y="0" width="32" height="32" fill="hsl(0.00,100.00%,3.33%)" />
<rect x="64" y="0" width="32" height="32" fill="hsl(0.00,100.00%,40.00%)" />
<rect x="96" y="0" width="32" height="32" fill="hsl(0.00,100.00%,50.00%)" />
<rect x="128" y="0" width="32" height="32" fill="hsl(0.00,100.00%,26.67%)" />
<rect x="160" y="0" width="32" height="32" fill="hsl(0.00,100.00%,26.67%)" />
<rect x="192" y="0" width="32" height="32" fill="hsl(0.00,100.00%,3.33%)" />
<rect x="224" y="0" width="32" height="32" fill="hsl(0.00,100.00%,10.00%)" />
<rect x="0" y="32" width="32" height="32" fill="hsl(0.00,100.00%,0.00%)" />
<rect x="32" y="32" width="32" height="32" fill="hsl(0.00,100.00%,16.67%)" />
<rect x="64" y="32" width="32" height="32" fill="hsl(0.00,100.00%,30.00%)" />
<rect x="96" y="32" width="32" height="32" fill="hsl(0.00,100.00%,6.67%)" />
<rect x="128" y="32" width="32" height="32" fill="hsl(0.00,100.00%,20.00%)" />
<rect x="160" y="32" width="32" height="32" fill="hsl(0.00,100.00%,50.00%)" />
<rect x="192" y="32" width="32" height="32" fill="hsl(0.00,100.00%,23.33%)" />
<rect x="224" y="32" width="32" height="32" fill="hsl(0.00,100.00%,30.00%)" />
<rect x="0" y="64" width="32" height="32" fill="hsl(0.00,100.00%,6.67%)" />
<rect x="32" y="64" width="32" height="32" fill="hsl(0.00,100.00%,26.67%)" />
<rect x="64" y="64" width="32" height="32" fill="hsl(0.00,100.00%,20.00%)" />
<rect x="96" y="64" width="32" height="32" fill="hsl(0.00,100.00%,6.67%)" />
<rect x="128" y="64" width="32" height="32" fill="hsl(0.00,100.00%,43.33%)" />
<rect x="160" y="64" width="32" height="32" fill="hsl(0.00,100.00%,3.33%)" />
<rect x="192" y="64" width="32" height="32" fill="hsl(0.00,100.00%,16.67%)" />
<rect x="224" y="64" width="32" height="32" fill="hsl(0.00,100.00%,26.67%)" />
<rect x="0" y="96" width="32" height="32" fill="hsl(0.00,100.00%,13.33%)" />
<rect x="32" y="96" width="32" height="32" fill="hsl(0.00,100.00%,13.33%)" />
<rect x="64" y="96" width="32" height="32" fill="hsl(0.00,100.00%,43.33%)" />
<rect x="96" y="96" width="32" height="32" fill="hsl(0.00,100.00%,6.67%)" />
<rect x="128" y="96" width="32" height="32" fill="hsl(0.00,100.00%,10.00%)" />
<rect x="160" y="96" width="32" height="32" fill="hsl(0.00,100.00%,40.00%)" />
<rect x="192" y="96" width="32" height="32" fill="hsl(0.00,100.00%,33.33%)" />
<rect x="224" y="96" width="32" height="32" fill="hsl(0.00,100.00%,3.33%)" />
<rect x="0" y="128" width="32" height="32" fill="hsl(0.00,100.00%,33.33%)" />
<rect x="32" y="128" width="32" height="32" fill="hsl(0.00,100.00%,3.33%)" />
<rect x="64" y="128" width="32" height="32" fill="hsl(0.00,100.00%,40.00%)" />
<rect x="96" y="128" width="32" height="32" fill="hsl(0.00,100.00%,26.67%)" />
<rect x="128" y="128" width="32" height="32" fill="hsl(0.00,100.00%,33.33%)" />
<rect x="160" y="128" width="32" height="32" fill="hsl(0.00,100.00%,6.67%)" />
<rect x="192" y="128" width="32" height="32" fill="hsl(0.00,100.00%,46.67%)" />
<rect x="224" y="128" width="32" height="32" fill="hsl(0.00,100.00%,26.67%)" />
</svg>

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB