Skip to content

Commit 53d222e

Browse files
committed
Merge branch 'main' into dev/add_type_annotations
# Conflicts: # adafruit_turtle.py
2 parents 012c3b3 + 93ea97b commit 53d222e

File tree

8 files changed

+32
-27
lines changed

8 files changed

+32
-27
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@
44

55
repos:
66
- repo: https://github.com/python/black
7-
rev: 22.3.0
7+
rev: 23.3.0
88
hooks:
99
- id: black
1010
- repo: https://github.com/fsfe/reuse-tool
11-
rev: v0.14.0
11+
rev: v1.1.2
1212
hooks:
1313
- id: reuse
1414
- repo: https://github.com/pre-commit/pre-commit-hooks
15-
rev: v4.2.0
15+
rev: v4.4.0
1616
hooks:
1717
- id: check-yaml
1818
- id: end-of-file-fixer
1919
- id: trailing-whitespace
2020
- repo: https://github.com/pycqa/pylint
21-
rev: v2.15.5
21+
rev: v2.17.4
2222
hooks:
2323
- id: pylint
2424
name: pylint (library code)

.pylintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,4 +396,4 @@ min-public-methods=1
396396

397397
# Exceptions that will emit a warning when being caught. Defaults to
398398
# "Exception"
399-
overgeneral-exceptions=Exception
399+
overgeneral-exceptions=builtins.Exception

adafruit_turtle.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# SPDX-FileCopyrightText: 2021 Dave Astels for Adafruit Industries
44
#
55
# SPDX-License-Identifier: MIT
6+
67
"""
78
`adafruit_turtle`
89
================================================================================

docs/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
# ones.
1818
extensions = [
1919
"sphinx.ext.autodoc",
20+
"sphinxcontrib.jquery",
2021
"sphinx.ext.intersphinx",
2122
"sphinx.ext.napoleon",
2223
"sphinx.ext.todo",

docs/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
# SPDX-License-Identifier: Unlicense
44

55
sphinx>=4.0.0
6+
sphinxcontrib-jquery

examples/turtle_koch.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,23 @@
88

99

1010
def f(side_length, depth, generation):
11-
if depth != 0:
12-
side = lambda: f(side_length / 3, depth - 1, generation + 1)
13-
side()
14-
turtle.left(60)
15-
side()
16-
turtle.right(120)
17-
side()
18-
turtle.left(60)
19-
side()
11+
if depth == 0:
12+
turtle.forward(side_length)
13+
return
14+
side = lambda: f(side_length / 3, depth - 1, generation + 1)
15+
side()
16+
turtle.left(60)
17+
side()
18+
turtle.right(120)
19+
side()
20+
turtle.left(60)
21+
side()
2022

2123

2224
turtle = turtle(board.DISPLAY)
2325

2426
unit = min(board.DISPLAY.width / 3, board.DISPLAY.height / 4)
2527
top_len = unit * 3
26-
print(top_len)
2728
turtle.penup()
2829
turtle.goto(-1.5 * unit, unit)
2930
turtle.pendown()

examples/turtle_overlayed_koch.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,21 @@
66
import board
77
from adafruit_turtle import turtle, Color
88

9-
generation_colors = [Color.RED, Color.BLUE, Color.GREEN]
9+
generation_colors = [Color.RED, Color.BLUE, Color.GREEN, Color.YELLOW]
1010

1111

1212
def f(side_length, depth, generation):
13-
if depth != 0:
14-
side = lambda: f(side_length / 3, depth - 1, generation + 1)
15-
side()
16-
turtle.left(60)
17-
side()
18-
turtle.right(120)
19-
side()
20-
turtle.left(60)
21-
side()
13+
if depth == 0:
14+
turtle.forward(side_length)
15+
return
16+
side = lambda: f(side_length / 3, depth - 1, generation + 1)
17+
side()
18+
turtle.left(60)
19+
side()
20+
turtle.right(120)
21+
side()
22+
turtle.left(60)
23+
side()
2224

2325

2426
def snowflake(num_generations, generation_color):
@@ -42,7 +44,7 @@ def snowflake(num_generations, generation_color):
4244
turtle.goto(-1.5 * unit, unit)
4345
turtle.pendown()
4446

45-
for generations in range(3):
47+
for generations in range(4):
4648
snowflake(generations, generation_colors[generations])
4749
turtle.right(120)
4850

examples/turtle_sierpinski.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ def getMid(p1, p2):
1010

1111

1212
def triangle(points, depth):
13-
1413
turtle.penup()
1514
turtle.goto(points[0][0], points[0][1])
1615
turtle.pendown()

0 commit comments

Comments
 (0)