88"""
99
1010
11- def classify_number (value ):
11+ def classify_number (value ) -> str :
1212 """Classify a number using pattern matching with literals.
1313
1414 This demonstrates matching against specific literal values.
@@ -25,7 +25,7 @@ def classify_number(value):
2525 return "other"
2626
2727
28- def classify_http_status (status ):
28+ def classify_http_status (status ) -> str :
2929 """Classify HTTP status codes using pattern matching.
3030
3131 This shows how pattern matching can make code more readable
@@ -48,7 +48,7 @@ def classify_http_status(status):
4848 return "Unknown Status"
4949
5050
51- def process_point (point ):
51+ def process_point (point ) -> str :
5252 """Process a point tuple using pattern matching with sequences.
5353
5454 This demonstrates pattern matching against tuple structures
@@ -70,7 +70,7 @@ def process_point(point):
7070 return "Not a valid 2D point"
7171
7272
73- def analyze_sequence (data ):
73+ def analyze_sequence (data ) -> str :
7474 """Analyze sequences using pattern matching.
7575
7676 This shows how to match lists with specific structures
@@ -93,7 +93,7 @@ def analyze_sequence(data):
9393 return "Not a list" # pragma: no cover
9494
9595
96- def process_command (command ):
96+ def process_command (command ) -> str :
9797 """Process commands using pattern matching with guards.
9898
9999 Guards are if conditions that provide additional filtering
@@ -134,7 +134,7 @@ def __init__(self, center, radius):
134134 self .radius = radius
135135
136136
137- def describe_shape (shape ):
137+ def describe_shape (shape ) -> str :
138138 """Describe shapes using pattern matching with class patterns.
139139
140140 This demonstrates matching against class instances and
@@ -166,7 +166,7 @@ def describe_shape(shape):
166166 return "Unknown shape"
167167
168168
169- def process_json_data (data ):
169+ def process_json_data (data ) -> str :
170170 """Process JSON-like dictionary data with pattern matching.
171171
172172 This shows how to match against dictionary structures.
@@ -275,7 +275,7 @@ def main() -> None:
275275 assert process_json_data (invalid ) == "Invalid data"
276276
277277 # Pattern matching with OR patterns
278- def check_value (val ):
278+ def check_value (val ) -> str :
279279 match val :
280280 case 0 | 1 | 2 :
281281 # Match any of these values
@@ -291,7 +291,7 @@ def check_value(val):
291291 assert check_value (10 ) == "large"
292292
293293 # Pattern matching with AS patterns (walrus-like capture)
294- def process_range (data ):
294+ def process_range (data ) -> str :
295295 match data :
296296 case [x , y ] as pair if x < y :
297297 # Capture the entire matched value with 'as'
@@ -306,7 +306,7 @@ def process_range(data):
306306 assert process_range ("not a pair" ) == "Not a pair"
307307
308308 # Nested pattern matching
309- def analyze_nested (data ):
309+ def analyze_nested (data ) -> str :
310310 match data :
311311 case [["pair" , x , y ], ["pair" , a , b ]]:
312312 # Match nested structure
0 commit comments