Skip to content

Commit 2bda015

Browse files
committed
Fixed some type hint issues and updated requirements
1 parent d8ae63c commit 2bda015

File tree

5 files changed

+11
-10
lines changed

5 files changed

+11
-10
lines changed

.github/workflows/python-package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ jobs:
4040
run: |
4141
python -m unittest discover -s tests
4242
- name: Check Type Hints with Pyright
43-
uses: jakebailey/pyright-action@v2.3.1
43+
uses: jakebailey/pyright-action@v2

Impressionist/impressionist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def create_output(self, out_file: str, height: int, vector: bool, animation_leng
143143
output_size = (int(original_width * ratio), int(original_height * ratio))
144144
output_image = Image.new("RGB", output_size, average_color)
145145
output_draw = ImageDraw.Draw(output_image)
146-
svg = SVG(*output_size, average_color) if vector else None
146+
svg = SVG(*output_size, average_color) if vector else None # type: ignore
147147
animation_frames = [] if animation_length > 0 else None
148148
for coordinate_list, color in self.shapes:
149149
coordinates = [int(x * ratio) for x in coordinate_list]

Impressionist/svg.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ def __init__(self, width: int, height: int, background_color: tuple[int, int, in
2323

2424
def draw_ellipse(self, x1: int, y1: int, x2: int, y2: int, color: tuple[int, int, int]):
2525
self.content += f'<ellipse cx="{(x1 + x2) // 2}" cy="{(y1 + y2) // 2}" ' \
26-
(f'rx="{abs(x1 - x2) // 2}" ry="{abs(y1 - y2) // 2}'
27-
f'" fill="rgb{color}" />\n')
26+
f'rx="{abs(x1 - x2) // 2}" ry="{abs(y1 - y2) // 2}" ' \
27+
f'fill="rgb{color}" />\n'
2828

2929
def draw_line(self, x1: int, y1: int, x2: int, y2: int, color: tuple[int, int, int]):
3030
self.content += f'<line x1="{x1}" y1="{y1}" x2="{x2}" y2="{y2}" stroke="rgb{color}" ' \

RetroDither/dither.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,20 @@ def diffuse(c: int, r: int, error: int, pattern: list[PatternPart]):
4242
row = r + part.dr
4343
if col < 0 or col >= image.width or row >= image.height:
4444
continue
45+
current_pixel: float = image.getpixel((col, row)) # type: ignore
4546
# Add *error_part* to the pixel at (*col*, *row*) in *image*
4647
error_part = (error * part.numerator) // part.denominator
47-
image.putpixel((col, row), image.getpixel((col, row)) + error_part)
48+
image.putpixel((col, row), current_pixel + error_part)
4849

4950
result = array('B', [0] * (image.width * image.height))
5051
for y in range(image.height):
5152
for x in range(image.width):
52-
old_pixel = image.getpixel((x, y))
53+
old_pixel: float = image.getpixel((x, y)) # type: ignore
5354
# Every new pixel is either solid white or solid black
5455
# since this is all that the original Macintosh supported
5556
new_pixel = 255 if old_pixel > THRESHOLD else 0
5657
result[y * image.width + x] = new_pixel
57-
difference = (old_pixel - new_pixel)
58+
difference = int(old_pixel - new_pixel)
5859
# Disperse error amongst nearby upcoming pixels
5960
diffuse(x, y, difference, ATKINSON)
6061

requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
Pillow~=10.3.0
2-
pygame~=2.5.2
3-
numpy~=1.26.4
1+
Pillow~=11.0.0
2+
pygame~=2.6.1
3+
numpy~=2.1.3

0 commit comments

Comments
 (0)