Skip to content

Commit be59b53

Browse files
authored
Merge pull request #396 from abe-101/add-type-hints
Add type hints
2 parents 7ac7708 + ca8706a commit be59b53

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

patterns/behavioral/iterator.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"""
88

99

10-
def count_to(count):
10+
def count_to(count: int):
1111
"""Counts by word numbers, up to a maximum of five"""
1212
numbers = ["one", "two", "three", "four", "five"]
1313
yield from numbers[:count]

patterns/behavioral/template.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,28 @@
1010
"""
1111

1212

13-
def get_text():
13+
def get_text() -> str:
1414
return "plain-text"
1515

1616

17-
def get_pdf():
17+
def get_pdf() -> str:
1818
return "pdf"
1919

2020

21-
def get_csv():
21+
def get_csv() -> str:
2222
return "csv"
2323

2424

25-
def convert_to_text(data):
25+
def convert_to_text(data: str) -> str:
2626
print("[CONVERT]")
2727
return f"{data} as text"
2828

2929

30-
def saver():
30+
def saver() -> None:
3131
print("[SAVE]")
3232

3333

34-
def template_function(getter, converter=False, to_save=False):
34+
def template_function(getter, converter=False, to_save=False) -> None:
3535
data = getter()
3636
print(f"Got `{data}`")
3737

0 commit comments

Comments
 (0)