-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve handling of long type annotations (#173)
- Loading branch information
Showing
7 changed files
with
123 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
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
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
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,32 @@ | ||
# This edge case was reported in https://github.com/jsh9/pydoclint/issues/164 | ||
|
||
# fmt: off | ||
import numpy as np | ||
|
||
|
||
def func( | ||
arg1: tuple[ | ||
np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, | ||
np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, | ||
np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, | ||
], | ||
) -> tuple[ | ||
np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, | ||
np.ndarray, np.ndarray, np.ndarray]: | ||
""" | ||
The docstring parser for the Google style does not support line breaking | ||
in type hints. Therefore, in order to pass pydoclint's checks, we can only | ||
put long type hints in one line. | ||
Args: | ||
arg1 (tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray]): A parameter | ||
Returns: | ||
tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray]: The return value | ||
""" | ||
return ( | ||
np.array([]), np.array([]), np.array([]), np.array([]), np.array([]), | ||
np.array([]), np.array([]), np.array([]), np.array([]), | ||
) | ||
|
||
# fmt: on |
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,37 @@ | ||
# This edge case was reported in https://github.com/jsh9/pydoclint/issues/164 | ||
|
||
# fmt: off | ||
|
||
import numpy as np | ||
|
||
|
||
def func( | ||
arg1: tuple[ | ||
np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, | ||
np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, | ||
np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, | ||
], | ||
) -> tuple[ | ||
np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, | ||
np.ndarray, np.ndarray, np.ndarray]: | ||
""" | ||
The docstring parser for the numpy style does not support line breaking | ||
in type hints. Therefore, in order to pass pydoclint's checks, we can only | ||
put long type hints in one line. | ||
Parameters | ||
---------- | ||
arg1 : tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray] | ||
A parameter | ||
Returns | ||
------- | ||
tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray] | ||
The return value | ||
""" | ||
return ( | ||
np.array([]), np.array([]), np.array([]), np.array([]), np.array([]), | ||
np.array([]), np.array([]), np.array([]), np.array([]), | ||
) | ||
|
||
# fmt: on |
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,36 @@ | ||
# This edge case was reported in https://github.com/jsh9/pydoclint/issues/164 | ||
|
||
# fmt: off | ||
|
||
import numpy as np | ||
|
||
|
||
def func( | ||
arg1: tuple[ | ||
np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, | ||
np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, | ||
np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, | ||
], | ||
) -> tuple[ | ||
np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, | ||
np.ndarray, np.ndarray, np.ndarray]: | ||
"""Something | ||
:param arg1: A parameter | ||
:type arg1: tuple[ | ||
np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, | ||
np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, | ||
np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, | ||
] | ||
:returns: Numpy arrays | ||
:rtype: tuple[ | ||
np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray, | ||
np.ndarray, np.ndarray, np.ndarray] | ||
""" | ||
return ( | ||
np.array([]), np.array([]), np.array([]), np.array([]), np.array([]), | ||
np.array([]), np.array([]), np.array([]), np.array([]), | ||
) | ||
|
||
# fmt: on |
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