-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
stubber: Merge overloads, fix adding unused overloads.
Signed-off-by: Jos Verlinde <[email protected]>
- Loading branch information
Showing
33 changed files
with
262 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 12 additions & 0 deletions
12
tests/codemods/codemod_test_cases/func_overload_101/output.pyi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# fmt: off | ||
""" | ||
Overloaded functions from python docs | ||
""" | ||
from typing import overload | ||
|
||
@overload | ||
def process(response: None) -> None: ... | ||
@overload | ||
def process(response: int) -> tuple[int, str]: ... | ||
@overload | ||
def process(response: bytes) -> str: ... |
File renamed without changes.
File renamed without changes.
File renamed without changes.
22 changes: 22 additions & 0 deletions
22
tests/codemods/codemod_test_cases/func_overload_add_2/output.pyi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# fmt: off | ||
""" | ||
Overloaded functions | ||
""" | ||
from typing import overload | ||
|
||
@overload | ||
def foo(value: int) -> None: | ||
""" | ||
Set foo value | ||
First overload | ||
""" | ||
... | ||
|
||
|
||
@overload | ||
def foo(value: None) -> str: | ||
""" | ||
Get foo value | ||
Second overload | ||
""" | ||
... |
File renamed without changes.
File renamed without changes.
File renamed without changes.
31 changes: 31 additions & 0 deletions
31
tests/codemods/codemod_test_cases/func_overload_add_3/output.pyi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# fmt: off | ||
""" | ||
Overloaded functions | ||
""" | ||
from typing import overload | ||
|
||
@overload | ||
def foo(value: int) -> None: | ||
""" | ||
Set foo value | ||
First overload | ||
""" | ||
... | ||
|
||
|
||
@overload | ||
def foo(value: None) -> str: | ||
""" | ||
Get foo value | ||
Second overload | ||
""" | ||
... | ||
|
||
|
||
@overload | ||
def foo(value: str) -> None: | ||
""" | ||
Get foo string | ||
Third overload | ||
""" | ||
... |
File renamed without changes.
File renamed without changes.
File renamed without changes.
34 changes: 34 additions & 0 deletions
34
tests/codemods/codemod_test_cases/func_overload_add_3_impl/output.pyi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# fmt: off | ||
""" | ||
Overloaded functions | ||
""" | ||
from typing import overload | ||
|
||
@overload | ||
def foo(value: int) -> None: | ||
""" | ||
Set foo value | ||
First overload | ||
""" | ||
... | ||
|
||
|
||
@overload | ||
def foo(value: None) -> str: | ||
""" | ||
Get foo value | ||
Second overload | ||
""" | ||
... | ||
|
||
|
||
@overload | ||
def foo(value: str) -> None: | ||
""" | ||
Get foo string | ||
Third overload | ||
""" | ||
... | ||
|
||
|
||
def process(): ... |
File renamed without changes.
File renamed without changes.
File renamed without changes.
34 changes: 34 additions & 0 deletions
34
tests/codemods/codemod_test_cases/func_overload_add_3_ordered/output.pyi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# fmt: off | ||
""" | ||
Overloaded functions | ||
""" | ||
from typing import overload | ||
|
||
@overload | ||
def foo(value: int) -> None: | ||
""" | ||
Set foo value | ||
First overload | ||
""" | ||
... | ||
|
||
|
||
@overload | ||
def foo(value: None) -> str: | ||
""" | ||
Get foo value | ||
Second overload | ||
""" | ||
... | ||
|
||
|
||
@overload | ||
def foo(value: str) -> None: | ||
""" | ||
Get foo string | ||
Third overload | ||
""" | ||
... | ||
|
||
|
||
def bar(): ... |
6 changes: 6 additions & 0 deletions
6
tests/codemods/codemod_test_cases/func_overload_add_no_match/before.pyi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# fmt: off | ||
""" | ||
Overloaded functions | ||
""" | ||
|
||
def bar(): ... |
23 changes: 23 additions & 0 deletions
23
tests/codemods/codemod_test_cases/func_overload_add_no_match/doc_stub.pyi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
""" | ||
Overloaded functions | ||
""" | ||
|
||
from typing import overload | ||
|
||
|
||
@overload | ||
def foo(value: int) -> None: | ||
""" | ||
Set foo value | ||
First overload | ||
""" | ||
... | ||
|
||
|
||
@overload | ||
def foo(value: None) -> str: | ||
""" | ||
Get foo value | ||
Second overload | ||
""" | ||
... |
7 changes: 7 additions & 0 deletions
7
tests/codemods/codemod_test_cases/func_overload_add_no_match/expected.pyi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# fmt: off | ||
""" | ||
Overloaded functions | ||
""" | ||
from typing import overload | ||
|
||
def bar(): ... |
7 changes: 7 additions & 0 deletions
7
tests/codemods/codemod_test_cases/func_overload_add_no_match/output.pyi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# fmt: off | ||
""" | ||
Overloaded functions | ||
""" | ||
from typing import overload | ||
|
||
def bar(): ... |
File renamed without changes.
File renamed without changes.
File renamed without changes.
22 changes: 22 additions & 0 deletions
22
tests/codemods/codemod_test_cases/meth_overload_add_2/output.pyi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# fmt: off | ||
""" | ||
Overloaded methods | ||
""" | ||
from typing import overload | ||
|
||
class Parrot: | ||
@overload | ||
def speak(number: int): | ||
""" | ||
Speak a number | ||
First overload | ||
""" | ||
... | ||
|
||
@overload | ||
def speak(words: str): | ||
""" | ||
Speak a word | ||
Second overload | ||
""" | ||
... |
11 changes: 11 additions & 0 deletions
11
tests/codemods/codemod_test_cases/meth_overload_add_no_match/before.pyi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# fmt: off | ||
""" | ||
Overloaded methods | ||
""" | ||
|
||
class Parrot: | ||
def talk(): ... | ||
|
||
|
||
class Dog: | ||
def speak(): ... |
24 changes: 24 additions & 0 deletions
24
tests/codemods/codemod_test_cases/meth_overload_add_no_match/doc_stub.pyi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
""" | ||
Overloaded methods | ||
""" | ||
|
||
from typing import overload | ||
|
||
|
||
class Parrot: | ||
|
||
@overload | ||
def speak(number: int): | ||
""" | ||
Speak a number | ||
First overload | ||
""" | ||
... | ||
|
||
@overload | ||
def speak(words: str): | ||
""" | ||
Speak a word | ||
Second overload | ||
""" | ||
... |
12 changes: 12 additions & 0 deletions
12
tests/codemods/codemod_test_cases/meth_overload_add_no_match/expected.pyi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# fmt: off | ||
""" | ||
Overloaded methods | ||
""" | ||
from typing import overload | ||
|
||
class Parrot: | ||
def talk(): ... | ||
|
||
|
||
class Dog: | ||
def speak(): ... |
12 changes: 12 additions & 0 deletions
12
tests/codemods/codemod_test_cases/meth_overload_add_no_match/output.pyi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# fmt: off | ||
""" | ||
Overloaded methods | ||
""" | ||
from typing import overload | ||
|
||
class Parrot: | ||
def talk(): ... | ||
|
||
|
||
class Dog: | ||
def speak(): ... |