Debian Codegraph @

tests/data/cases/pyi_overload_groups.py

raw
1 # flags: --preview --pyi
2 #
3 # Test cases for blank line handling around overload groups in .pyi files:
4 # - No blank lines between consecutive same-name decorated functions (overloads)
5 # - No blank lines between overloads even when a function has a docstring
6 # - Blank line enforced after an overload group before an unrelated statement
7 # - Blank line enforced before an overload group after an unrelated statement
8 # - Blank lines between differently-named decorated functions
9 # - Async overloaded functions
10 # - Class-level overload groups with various transitions
11 # - Transition from undecorated def to decorated overload group
12 # - Overload group immediately followed by undecorated function (no blank line)
13 # - Overload groups adjacent to if sys.version_info blocks
14 # - Overload groups inside if blocks adjacent to undecorated functions
15 # - Conditional overloads (if/else) with docstrings preceded/followed by undecorated defs
16 # - Undecorated function around @property-decorated function (with and without gaps)
17 # - Decorated class with undecorated methods (no spurious blank lines)
18 import sys
19 from typing import overload, type_check_only
20
21 def decorator(func): ...
22
23 @overload
24 def a(x: int) -> int: ...
25 @overload
26 def a(x: str) -> str: ...
27 def b(x): ...
28 @decorator
29 def c() -> None: ...
30 @overload
31 def d(x: int) -> int:
32 """Int overload."""
33 @overload
34 def d(x: str) -> str: ...
35 def e(x): ...
36
37 @overload
38 async def async_a(x: int) -> int: ...
39 @overload
40 async def async_a(x: str) -> str: ...
41 var: int
42
43 class MyClass:
44 @overload
45 def method(self, x: int) -> int: ...
46 @overload
47 def method(self, x: str) -> str: ...
48 def after_method(self, x): ...
49
50 @overload
51 def with_docs(self, x: int) -> int:
52 """Int."""
53 @overload
54 def with_docs(self, x: str) -> str: ...
55 def after_with_docs(self, x): ...
56
57 @overload
58 def no_gap(self, x: int) -> int: ...
59 @overload
60 def no_gap(self, x: str) -> str: ...
61 @decorator
62 def different_method(self) -> None: ...
63
64 @decorator
65 def another_dec(self) -> None: ...
66 @decorator
67 def yet_another_dec(self) -> None: ...
68
69 attr: int
70 @overload
71 def after_attr(self, x: int) -> int: ...
72 @overload
73 def after_attr(self, x: str) -> str: ...
74 attr2: str
75
76 @property
77 def prop1(self) -> int: ...
78 @property
79 def prop2(self) -> str: ...
80 @property
81 def prop3(self) -> bytes: ...
82 @property
83 def prop4_with_setter(self) -> int: ...
84 @prop4_with_setter.setter
85 def prop4_with_setter(self, value: int) -> None: ...
86 @property
87 def prop_5_with_setter(self) -> int: ...
88 @prop_5_with_setter.setter
89 def prop_5_with_setter(self, value: int) -> None: ...
90 @property
91 def prop6(self) -> int: ...
92 @property
93 def prop7(self) -> str: ...
94 @property
95 def prop8_with_setter(self) -> int: ...
96 @prop8_with_setter.setter
97 def prop8_with_setter(self, value: int) -> None: ...
98 @property
99 def prop9(self) -> int: ...
100 @property
101 def prop10_with_docstring(self) -> int:
102 """Prop with docstring."""
103 @property
104 def prop11_with_docstring(self) -> int:
105 """Another prop with docstring."""
106 @property
107 def prop12(self) -> int: ...
108
109 @classmethod
110 def make_myclass(cls) -> "MyClass": ...
111
112 @staticmethod
113 def static_method() -> None: ...
114
115
116 def plain() -> None: ...
117 @overload
118 def different(x: int) -> int: ...
119 @overload
120 def different(x: str) -> str: ...
121
122 def another_plain() -> None: ...
123 @decorator
124 def alpha() -> None: ...
125 @decorator
126 def beta() -> None: ...
127
128 @overload
129 def multi(x: int) -> int:
130 """Int version."""
131 @overload
132 def multi(x: str) -> str:
133 """Str version."""
134 @overload
135 def multi(x: bytes) -> bytes: ...
136
137 def next_func() -> None: ...
138
139 @overload
140 def three_overloads(x: int) -> int: ...
141 @overload
142 def three_overloads(x: str) -> str: ...
143 @overload
144 def three_overloads(x: bytes) -> bytes: ...
145
146 @overload
147 def four_overloads(x: int) -> int: ...
148 @overload
149 def four_overloads(x: str) -> str: ...
150
151 @overload
152 def four_overloads(x: bytes) -> bytes: ...
153 @overload
154 def four_overloads(x: float) -> float: ...
155
156 @overload
157 def before_if_no_gap(x: int) -> int: ...
158 @overload
159 def before_if_no_gap(x: str) -> str: ...
160 if sys.version_info >= (3, 10):
161 def conditional_func() -> None: ...
162
163 if sys.version_info >= (3, 10):
164 def other_conditional() -> None: ...
165 @overload
166 def after_if_no_gap(x: int) -> int: ...
167 @overload
168 def after_if_no_gap(x: str) -> str: ...
169
170 @overload
171 def before_if_with_gap(x: int) -> int: ...
172 @overload
173 def before_if_with_gap(x: str) -> str: ...
174
175 if sys.version_info >= (3, 10):
176 def conditional_func2() -> None: ...
177
178 if sys.version_info >= (3, 10):
179 def other_conditional2() -> None: ...
180
181 @overload
182 def after_if_with_gap(x: int) -> int: ...
183 @overload
184 def after_if_with_gap(x: str) -> str: ...
185
186 if sys.version_info >= (3, 10):
187 @overload
188 def nested_overload_before(x: int) -> int: ...
189 @overload
190 def nested_overload_before(x: str) -> str: ...
191 def undecorated_after() -> None: ...
192
193 if sys.version_info >= (3, 10):
194 def undecorated_before() -> None: ...
195 @overload
196 def nested_overload_after(x: int) -> int: ...
197 @overload
198 def nested_overload_after(x: str) -> str: ...
199
200 if sys.version_info >= (3, 10):
201 @overload
202 def nested_overload_before_with_gap(x: int) -> int: ...
203 @overload
204 def nested_overload_before_with_gap(x: str) -> str: ...
205
206 def undecorated_after_with_gap() -> None: ...
207
208 if sys.version_info >= (3, 10):
209 def undecorated_before_with_gap() -> None: ...
210
211 @overload
212 def nested_overload_after_with_gap(x: int) -> int: ...
213 @overload
214 def nested_overload_after_with_gap(x: str) -> str: ...
215
216 def before_conditional_overload() -> None: ...
217 if sys.version_info >= (3, 10):
218 @overload
219 def conditional_overload(x: int) -> int:
220 """Int."""
221 else:
222 @overload
223 def conditional_overload(x: int) -> int:
224 """Int old."""
225 @overload
226 def conditional_overload(x: str) -> str: ...
227 def after_conditional_overload() -> None: ...
228
229 def before_conditional_overload_with_gaps() -> None: ...
230
231 if sys.version_info >= (3, 10):
232 @overload
233 def conditional_overload_with_gaps(x: int) -> int:
234 """Int."""
235 else:
236 @overload
237 def conditional_overload_with_gaps(x: int) -> int:
238 """Int old."""
239
240 @overload
241 def conditional_overload_with_gaps(x: str) -> str: ...
242
243 def after_conditional_overload_with_gaps() -> None: ...
244
245 if sys.version_info >= (3, 10):
246 @overload
247 def if_else_different_names(x: int) -> int: ...
248 @overload
249 def if_else_different_names(x: str) -> str: ...
250 else:
251 @overload
252 def if_else_other_name(x: int) -> int: ...
253 @overload
254 def if_else_other_name(x: str) -> str: ...
255
256 @overload
257 def commented(x: int) -> int: ...
258 # comment in overload group
259 @overload
260 def commented(x: str) -> str: ...
261 def after_commented() -> None: ...
262
263 class MyClassWithComments:
264 @overload
265 def commented_method(self, x: int) -> int: ...
266 # comment between class overloads
267 @overload
268 def commented_method(self, x: str) -> str: ...
269 def after_commented_method(self) -> None: ...
270
271 @overload
272 def three_overload_methods(self, x: int) -> int: ...
273
274 # comment after first with gap above that is retained
275 @overload
276 def three_overload_methods(self, x: str) -> str: ...
277 # comment after second with gap below that is removed
278
279 @overload
280 def three_overload_methods(self, x: bytes) -> bytes: ...
281 def after_three_overloads(self) -> None: ...
282
283 @overload
284 def four_overload_methods(self, x: int) -> int: ...
285
286 # comment after first with gaps on both lines
287
288 @overload
289 def four_overload_methods(self, x: str) -> str: ...
290
291
292 # comment after second with too many gaps above
293 @overload
294 def four_overload_methods(self, x: bytes) -> bytes: ...
295
296
297 # comment after third with large gaps below and above
298
299
300 @overload
301 def four_overload_methods(self, x: list[bytes]) -> bytes: ...
302
303 @overload
304 def commented_gap_above(x: int) -> int: ...
305
306 # comment with gap above that is retained
307 @overload
308 def commented_gap_above(x: str) -> str: ...
309
310 @overload
311 def commented_gap_below(x: int) -> int: ...
312 # comment with gap below that is removed
313
314 @overload
315 def commented_gap_below(x: str) -> str: ...
316
317 @overload
318 def commented_gaps_both(x: int) -> int: ...
319
320 # comment with gaps on both sides
321
322 @overload
323 def commented_gaps_both(x: str) -> str: ...
324
325 @overload
326 def multi_comment(x: int) -> int: ...
327 # first comment
328 # second comment
329 @overload
330 def multi_comment(x: str) -> str: ...
331
332 @overload
333 def large_comment_gaps(x: int) -> int: ...
334
335
336 # comment with large gaps above that are collapsed
337 @overload
338 def large_comment_gaps(x: str) -> str: ...
339
340
341 # comment with large gaps above and below that are collapsed
342
343
344 @overload
345 def large_comment_gaps(x: int) -> int: ...
346
347 @overload
348 def conditional_commented(x: int) -> int: ...
349
350
351 # comment
352
353 if sys.version_info >= (3, 10):
354
355 # comment
356 @overload
357 def conditional_commented(x: str) -> str: ...
358 else:
359
360 # comment
361 @overload
362 def conditional_commented(x: str) -> str: ...
363
364 def before_comment_group() -> None: ...
365 # comment before overload group
366 @overload
367 def comment_before(x: int) -> int: ...
368 @overload
369 def comment_before(x: str) -> str: ...
370 def after_comment_group() -> None: ...
371
372 class ClassWithConditionalOverloads:
373 def method(self) -> None: ...
374 if sys.version_info >= (3, 10):
375 @overload
376 def conditional(self, x: int) -> int: ...
377 else:
378 @overload
379 def conditional(self, x: str) -> str: ...
380 @overload
381 def conditional(self, x: bytes) -> bytes: ...
382
383 @overload
384 def conditional_commented(self, x: int) -> int: ...
385
386 # comment
387
388 if sys.version_info >= (3, 10):
389
390 # comment
391
392 @overload
393 def conditional_commented(self, x: str) -> str: ...
394 else:
395
396 # comment
397
398 @overload
399 def conditional_commented(self, x: str) -> str: ...
400
401 class ClassWithOverloadThenConditional:
402 @overload
403 def method(self, x: int) -> int: ...
404 @overload
405 def method(self, x: str) -> str: ...
406 if sys.version_info >= (3, 10):
407 @overload
408 def method(self, x: bytes) -> bytes: ...
409
410 class ClassWithNonOverloadConditional:
411 def regular(self) -> None: ...
412 if sys.version_info < (3, 12):
413 @staticmethod
414 def legacy_method() -> str:
415 """Deprecated."""
416
417 @type_check_only
418 class DecoratedClassWithUndecoratedMethods:
419 def method_a(self) -> None: ...
420 def method_b(self) -> None: ...
421 def method_c(self) -> None: ...
422
423 if sys.version_info >= (3, 12):
424 @overload
425 def elif_overload(x: int) -> int: ...
426 elif sys.version_info >= (3, 10):
427 @overload
428 def elif_overload(x: float) -> float: ...
429 else:
430 @overload
431 def elif_overload(x: bytes) -> bytes: ...
432 @overload
433 def elif_overload(x: str) -> str: ...
434
435 @overload
436 def before_class(x: int) -> int: ...
437 @overload
438 def before_class(x: str) -> str: ...
439 class AfterOverloadGroup: ...
440
441 class AfterOverloadGroup2: ...
442 @overload
443 def after_class(x: int) -> int: ...
444 @overload
445 def after_class(x: str) -> str: ...
446
447 @overload
448 @decorator
449 def multi_decorated(x: int) -> int: ...
450 @overload
451 @decorator
452 def multi_decorated(x: str) -> str: ...
453 def after_multi_decorated() -> None: ...
454
455 class Outer:
456 class Inner:
457 @overload
458 def method(self, x: int) -> int: ...
459 @overload
460 def method(self, x: str) -> str: ...
461 @overload
462 def method(self, x: int) -> int: ...
463 @overload
464 def method(self, x: str) -> str: ...
465
466
467 # output
468 #
469 # Test cases for blank line handling around overload groups in .pyi files:
470 # - No blank lines between consecutive same-name decorated functions (overloads)
471 # - No blank lines between overloads even when a function has a docstring
472 # - Blank line enforced after an overload group before an unrelated statement
473 # - Blank line enforced before an overload group after an unrelated statement
474 # - Blank lines between differently-named decorated functions
475 # - Async overloaded functions
476 # - Class-level overload groups with various transitions
477 # - Transition from undecorated def to decorated overload group
478 # - Overload group immediately followed by undecorated function (no blank line)
479 # - Overload groups adjacent to if sys.version_info blocks
480 # - Overload groups inside if blocks adjacent to undecorated functions
481 # - Conditional overloads (if/else) with docstrings preceded/followed by undecorated defs
482 # - Undecorated function around @property-decorated function (with and without gaps)
483 # - Decorated class with undecorated methods (no spurious blank lines)
484 import sys
485 from typing import overload, type_check_only
486
487 def decorator(func): ...
488
489 @overload
490 def a(x: int) -> int: ...
491 @overload
492 def a(x: str) -> str: ...
493
494 def b(x): ...
495 @decorator
496 def c() -> None: ...
497
498 @overload
499 def d(x: int) -> int:
500 """Int overload."""
501 @overload
502 def d(x: str) -> str: ...
503
504 def e(x): ...
505
506 @overload
507 async def async_a(x: int) -> int: ...
508 @overload
509 async def async_a(x: str) -> str: ...
510
511 var: int
512
513 class MyClass:
514 @overload
515 def method(self, x: int) -> int: ...
516 @overload
517 def method(self, x: str) -> str: ...
518
519 def after_method(self, x): ...
520
521 @overload
522 def with_docs(self, x: int) -> int:
523 """Int."""
524 @overload
525 def with_docs(self, x: str) -> str: ...
526
527 def after_with_docs(self, x): ...
528
529 @overload
530 def no_gap(self, x: int) -> int: ...
531 @overload
532 def no_gap(self, x: str) -> str: ...
533
534 @decorator
535 def different_method(self) -> None: ...
536 @decorator
537 def another_dec(self) -> None: ...
538 @decorator
539 def yet_another_dec(self) -> None: ...
540
541 attr: int
542
543 @overload
544 def after_attr(self, x: int) -> int: ...
545 @overload
546 def after_attr(self, x: str) -> str: ...
547
548 attr2: str
549
550 @property
551 def prop1(self) -> int: ...
552 @property
553 def prop2(self) -> str: ...
554 @property
555 def prop3(self) -> bytes: ...
556
557 @property
558 def prop4_with_setter(self) -> int: ...
559 @prop4_with_setter.setter
560 def prop4_with_setter(self, value: int) -> None: ...
561
562 @property
563 def prop_5_with_setter(self) -> int: ...
564 @prop_5_with_setter.setter
565 def prop_5_with_setter(self, value: int) -> None: ...
566
567 @property
568 def prop6(self) -> int: ...
569 @property
570 def prop7(self) -> str: ...
571
572 @property
573 def prop8_with_setter(self) -> int: ...
574 @prop8_with_setter.setter
575 def prop8_with_setter(self, value: int) -> None: ...
576
577 @property
578 def prop9(self) -> int: ...
579 @property
580 def prop10_with_docstring(self) -> int:
581 """Prop with docstring."""
582
583 @property
584 def prop11_with_docstring(self) -> int:
585 """Another prop with docstring."""
586
587 @property
588 def prop12(self) -> int: ...
589 @classmethod
590 def make_myclass(cls) -> "MyClass": ...
591 @staticmethod
592 def static_method() -> None: ...
593
594 def plain() -> None: ...
595
596 @overload
597 def different(x: int) -> int: ...
598 @overload
599 def different(x: str) -> str: ...
600
601 def another_plain() -> None: ...
602 @decorator
603 def alpha() -> None: ...
604 @decorator
605 def beta() -> None: ...
606
607 @overload
608 def multi(x: int) -> int:
609 """Int version."""
610 @overload
611 def multi(x: str) -> str:
612 """Str version."""
613 @overload
614 def multi(x: bytes) -> bytes: ...
615
616 def next_func() -> None: ...
617
618 @overload
619 def three_overloads(x: int) -> int: ...
620 @overload
621 def three_overloads(x: str) -> str: ...
622 @overload
623 def three_overloads(x: bytes) -> bytes: ...
624
625 @overload
626 def four_overloads(x: int) -> int: ...
627 @overload
628 def four_overloads(x: str) -> str: ...
629 @overload
630 def four_overloads(x: bytes) -> bytes: ...
631 @overload
632 def four_overloads(x: float) -> float: ...
633
634 @overload
635 def before_if_no_gap(x: int) -> int: ...
636 @overload
637 def before_if_no_gap(x: str) -> str: ...
638
639 if sys.version_info >= (3, 10):
640 def conditional_func() -> None: ...
641
642 if sys.version_info >= (3, 10):
643 def other_conditional() -> None: ...
644
645 @overload
646 def after_if_no_gap(x: int) -> int: ...
647 @overload
648 def after_if_no_gap(x: str) -> str: ...
649
650 @overload
651 def before_if_with_gap(x: int) -> int: ...
652 @overload
653 def before_if_with_gap(x: str) -> str: ...
654
655 if sys.version_info >= (3, 10):
656 def conditional_func2() -> None: ...
657
658 if sys.version_info >= (3, 10):
659 def other_conditional2() -> None: ...
660
661 @overload
662 def after_if_with_gap(x: int) -> int: ...
663 @overload
664 def after_if_with_gap(x: str) -> str: ...
665
666 if sys.version_info >= (3, 10):
667 @overload
668 def nested_overload_before(x: int) -> int: ...
669 @overload
670 def nested_overload_before(x: str) -> str: ...
671
672 def undecorated_after() -> None: ...
673
674 if sys.version_info >= (3, 10):
675 def undecorated_before() -> None: ...
676
677 @overload
678 def nested_overload_after(x: int) -> int: ...
679 @overload
680 def nested_overload_after(x: str) -> str: ...
681
682 if sys.version_info >= (3, 10):
683 @overload
684 def nested_overload_before_with_gap(x: int) -> int: ...
685 @overload
686 def nested_overload_before_with_gap(x: str) -> str: ...
687
688 def undecorated_after_with_gap() -> None: ...
689
690 if sys.version_info >= (3, 10):
691 def undecorated_before_with_gap() -> None: ...
692
693 @overload
694 def nested_overload_after_with_gap(x: int) -> int: ...
695 @overload
696 def nested_overload_after_with_gap(x: str) -> str: ...
697
698 def before_conditional_overload() -> None: ...
699
700 if sys.version_info >= (3, 10):
701 @overload
702 def conditional_overload(x: int) -> int:
703 """Int."""
704 else:
705 @overload
706 def conditional_overload(x: int) -> int:
707 """Int old."""
708
709 @overload
710 def conditional_overload(x: str) -> str: ...
711
712 def after_conditional_overload() -> None: ...
713 def before_conditional_overload_with_gaps() -> None: ...
714
715 if sys.version_info >= (3, 10):
716 @overload
717 def conditional_overload_with_gaps(x: int) -> int:
718 """Int."""
719 else:
720 @overload
721 def conditional_overload_with_gaps(x: int) -> int:
722 """Int old."""
723
724 @overload
725 def conditional_overload_with_gaps(x: str) -> str: ...
726
727 def after_conditional_overload_with_gaps() -> None: ...
728
729 if sys.version_info >= (3, 10):
730 @overload
731 def if_else_different_names(x: int) -> int: ...
732 @overload
733 def if_else_different_names(x: str) -> str: ...
734
735 else:
736 @overload
737 def if_else_other_name(x: int) -> int: ...
738 @overload
739 def if_else_other_name(x: str) -> str: ...
740
741 @overload
742 def commented(x: int) -> int: ...
743 # comment in overload group
744 @overload
745 def commented(x: str) -> str: ...
746
747 def after_commented() -> None: ...
748
749 class MyClassWithComments:
750 @overload
751 def commented_method(self, x: int) -> int: ...
752 # comment between class overloads
753 @overload
754 def commented_method(self, x: str) -> str: ...
755
756 def after_commented_method(self) -> None: ...
757
758 @overload
759 def three_overload_methods(self, x: int) -> int: ...
760
761 # comment after first with gap above that is retained
762 @overload
763 def three_overload_methods(self, x: str) -> str: ...
764 # comment after second with gap below that is removed
765 @overload
766 def three_overload_methods(self, x: bytes) -> bytes: ...
767
768 def after_three_overloads(self) -> None: ...
769
770 @overload
771 def four_overload_methods(self, x: int) -> int: ...
772
773 # comment after first with gaps on both lines
774 @overload
775 def four_overload_methods(self, x: str) -> str: ...
776
777 # comment after second with too many gaps above
778 @overload
779 def four_overload_methods(self, x: bytes) -> bytes: ...
780
781 # comment after third with large gaps below and above
782 @overload
783 def four_overload_methods(self, x: list[bytes]) -> bytes: ...
784
785 @overload
786 def commented_gap_above(x: int) -> int: ...
787
788 # comment with gap above that is retained
789 @overload
790 def commented_gap_above(x: str) -> str: ...
791
792 @overload
793 def commented_gap_below(x: int) -> int: ...
794 # comment with gap below that is removed
795 @overload
796 def commented_gap_below(x: str) -> str: ...
797
798 @overload
799 def commented_gaps_both(x: int) -> int: ...
800
801 # comment with gaps on both sides
802 @overload
803 def commented_gaps_both(x: str) -> str: ...
804
805 @overload
806 def multi_comment(x: int) -> int: ...
807 # first comment
808 # second comment
809 @overload
810 def multi_comment(x: str) -> str: ...
811
812 @overload
813 def large_comment_gaps(x: int) -> int: ...
814
815 # comment with large gaps above that are collapsed
816 @overload
817 def large_comment_gaps(x: str) -> str: ...
818
819 # comment with large gaps above and below that are collapsed
820 @overload
821 def large_comment_gaps(x: int) -> int: ...
822
823 @overload
824 def conditional_commented(x: int) -> int: ...
825
826 # comment
827
828 if sys.version_info >= (3, 10):
829
830 # comment
831 @overload
832 def conditional_commented(x: str) -> str: ...
833 else:
834
835 # comment
836 @overload
837 def conditional_commented(x: str) -> str: ...
838
839 def before_comment_group() -> None: ...
840
841 # comment before overload group
842 @overload
843 def comment_before(x: int) -> int: ...
844 @overload
845 def comment_before(x: str) -> str: ...
846
847 def after_comment_group() -> None: ...
848
849 class ClassWithConditionalOverloads:
850 def method(self) -> None: ...
851
852 if sys.version_info >= (3, 10):
853 @overload
854 def conditional(self, x: int) -> int: ...
855 else:
856 @overload
857 def conditional(self, x: str) -> str: ...
858
859 @overload
860 def conditional(self, x: bytes) -> bytes: ...
861
862 @overload
863 def conditional_commented(self, x: int) -> int: ...
864
865 # comment
866
867 if sys.version_info >= (3, 10):
868
869 # comment
870 @overload
871 def conditional_commented(self, x: str) -> str: ...
872 else:
873
874 # comment
875 @overload
876 def conditional_commented(self, x: str) -> str: ...
877
878 class ClassWithOverloadThenConditional:
879 @overload
880 def method(self, x: int) -> int: ...
881 @overload
882 def method(self, x: str) -> str: ...
883 if sys.version_info >= (3, 10):
884 @overload
885 def method(self, x: bytes) -> bytes: ...
886
887 class ClassWithNonOverloadConditional:
888 def regular(self) -> None: ...
889 if sys.version_info < (3, 12):
890 @staticmethod
891 def legacy_method() -> str:
892 """Deprecated."""
893
894 @type_check_only
895 class DecoratedClassWithUndecoratedMethods:
896 def method_a(self) -> None: ...
897 def method_b(self) -> None: ...
898 def method_c(self) -> None: ...
899
900 if sys.version_info >= (3, 12):
901 @overload
902 def elif_overload(x: int) -> int: ...
903 elif sys.version_info >= (3, 10):
904 @overload
905 def elif_overload(x: float) -> float: ...
906 else:
907 @overload
908 def elif_overload(x: bytes) -> bytes: ...
909
910 @overload
911 def elif_overload(x: str) -> str: ...
912
913 @overload
914 def before_class(x: int) -> int: ...
915 @overload
916 def before_class(x: str) -> str: ...
917
918 class AfterOverloadGroup: ...
919 class AfterOverloadGroup2: ...
920
921 @overload
922 def after_class(x: int) -> int: ...
923 @overload
924 def after_class(x: str) -> str: ...
925
926 @overload
927 @decorator
928 def multi_decorated(x: int) -> int: ...
929 @overload
930 @decorator
931 def multi_decorated(x: str) -> str: ...
932
933 def after_multi_decorated() -> None: ...
934
935 class Outer:
936 class Inner:
937 @overload
938 def method(self, x: int) -> int: ...
939 @overload
940 def method(self, x: str) -> str: ...
941
942 @overload
943 def method(self, x: int) -> int: ...
944 @overload
945 def method(self, x: str) -> str: ...