Skip to content

Commit

Permalink
apply the missing annotations codemod
Browse files Browse the repository at this point in the history
  • Loading branch information
jorenham committed Oct 17, 2024
1 parent f9a7265 commit 76f46bf
Show file tree
Hide file tree
Showing 69 changed files with 941 additions and 818 deletions.
6 changes: 3 additions & 3 deletions codemods.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# /// script
# requires-python = ">=3.11"
# requires-python = ">=3.10"
# dependencies = [
# "libcst>=1.5.0",
# ]
Expand All @@ -13,11 +13,11 @@


class AnnotateMissing(VisitorBasedCodemodCommand):
DESCRIPTION: str = "Sets the default return type to `None`, and other missing annotations to `scipy._typing.Untyped`"
DESCRIPTION = "Sets the default return type to `None`, and other missing annotations to `scipy._typing.Untyped`"

@override
def leave_Param(self, /, original_node: cst.Param, updated_node: cst.Param) -> cst.Param:
if updated_node.annotation is not None or updated_node.name.value in {"self", "cls"}:
if updated_node.annotation is not None or updated_node.name.value in {"self", "cls", "_cls"}:
return updated_node

AddImportsVisitor.add_needed_import(self.context, "scipy._typing", "Untyped")
Expand Down
10 changes: 5 additions & 5 deletions scipy-stubs/fft/_backend.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ from scipy._typing import Untyped
class _ScipyBackend:
__ua_domain__: str
@staticmethod
def __ua_function__(method, args, kwargs) -> Untyped: ...
def __ua_function__(method: Untyped, args: Untyped, kwargs: Untyped) -> Untyped: ...

def set_global_backend(backend, coerce: bool = False, only: bool = False, try_last: bool = False): ...
def register_backend(backend): ...
def set_backend(backend, coerce: bool = False, only: bool = False) -> Untyped: ...
def skip_backend(backend) -> Untyped: ...
def set_global_backend(backend: Untyped, coerce: bool = False, only: bool = False, try_last: bool = False) -> None: ...
def register_backend(backend: Untyped) -> None: ...
def set_backend(backend: Untyped, coerce: bool = False, only: bool = False) -> Untyped: ...
def skip_backend(backend: Untyped) -> Untyped: ...
48 changes: 24 additions & 24 deletions scipy-stubs/fft/_basic.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from scipy._typing import Untyped

def fft(
x,
x: Untyped,
n: Untyped | None = None,
axis: int = -1,
norm: Untyped | None = None,
Expand All @@ -11,7 +11,7 @@ def fft(
plan: Untyped | None = None,
) -> Untyped: ...
def ifft(
x,
x: Untyped,
n: Untyped | None = None,
axis: int = -1,
norm: Untyped | None = None,
Expand All @@ -21,7 +21,7 @@ def ifft(
plan: Untyped | None = None,
) -> Untyped: ...
def rfft(
x,
x: Untyped,
n: Untyped | None = None,
axis: int = -1,
norm: Untyped | None = None,
Expand All @@ -31,7 +31,7 @@ def rfft(
plan: Untyped | None = None,
) -> Untyped: ...
def irfft(
x,
x: Untyped,
n: Untyped | None = None,
axis: int = -1,
norm: Untyped | None = None,
Expand All @@ -41,7 +41,7 @@ def irfft(
plan: Untyped | None = None,
) -> Untyped: ...
def hfft(
x,
x: Untyped,
n: Untyped | None = None,
axis: int = -1,
norm: Untyped | None = None,
Expand All @@ -51,7 +51,7 @@ def hfft(
plan: Untyped | None = None,
) -> Untyped: ...
def ihfft(
x,
x: Untyped,
n: Untyped | None = None,
axis: int = -1,
norm: Untyped | None = None,
Expand All @@ -61,7 +61,7 @@ def ihfft(
plan: Untyped | None = None,
) -> Untyped: ...
def fftn(
x,
x: Untyped,
s: Untyped | None = None,
axes: Untyped | None = None,
norm: Untyped | None = None,
Expand All @@ -71,7 +71,7 @@ def fftn(
plan: Untyped | None = None,
) -> Untyped: ...
def ifftn(
x,
x: Untyped,
s: Untyped | None = None,
axes: Untyped | None = None,
norm: Untyped | None = None,
Expand All @@ -81,27 +81,27 @@ def ifftn(
plan: Untyped | None = None,
) -> Untyped: ...
def fft2(
x,
x: Untyped,
s: Untyped | None = None,
axes=(-2, -1),
axes: Untyped = (-2, -1),
norm: Untyped | None = None,
overwrite_x: bool = False,
workers: Untyped | None = None,
*,
plan: Untyped | None = None,
) -> Untyped: ...
def ifft2(
x,
x: Untyped,
s: Untyped | None = None,
axes=(-2, -1),
axes: Untyped = (-2, -1),
norm: Untyped | None = None,
overwrite_x: bool = False,
workers: Untyped | None = None,
*,
plan: Untyped | None = None,
) -> Untyped: ...
def rfftn(
x,
x: Untyped,
s: Untyped | None = None,
axes: Untyped | None = None,
norm: Untyped | None = None,
Expand All @@ -111,17 +111,17 @@ def rfftn(
plan: Untyped | None = None,
) -> Untyped: ...
def rfft2(
x,
x: Untyped,
s: Untyped | None = None,
axes=(-2, -1),
axes: Untyped = (-2, -1),
norm: Untyped | None = None,
overwrite_x: bool = False,
workers: Untyped | None = None,
*,
plan: Untyped | None = None,
) -> Untyped: ...
def irfftn(
x,
x: Untyped,
s: Untyped | None = None,
axes: Untyped | None = None,
norm: Untyped | None = None,
Expand All @@ -131,17 +131,17 @@ def irfftn(
plan: Untyped | None = None,
) -> Untyped: ...
def irfft2(
x,
x: Untyped,
s: Untyped | None = None,
axes=(-2, -1),
axes: Untyped = (-2, -1),
norm: Untyped | None = None,
overwrite_x: bool = False,
workers: Untyped | None = None,
*,
plan: Untyped | None = None,
) -> Untyped: ...
def hfftn(
x,
x: Untyped,
s: Untyped | None = None,
axes: Untyped | None = None,
norm: Untyped | None = None,
Expand All @@ -151,17 +151,17 @@ def hfftn(
plan: Untyped | None = None,
) -> Untyped: ...
def hfft2(
x,
x: Untyped,
s: Untyped | None = None,
axes=(-2, -1),
axes: Untyped = (-2, -1),
norm: Untyped | None = None,
overwrite_x: bool = False,
workers: Untyped | None = None,
*,
plan: Untyped | None = None,
) -> Untyped: ...
def ihfftn(
x,
x: Untyped,
s: Untyped | None = None,
axes: Untyped | None = None,
norm: Untyped | None = None,
Expand All @@ -171,9 +171,9 @@ def ihfftn(
plan: Untyped | None = None,
) -> Untyped: ...
def ihfft2(
x,
x: Untyped,
s: Untyped | None = None,
axes=(-2, -1),
axes: Untyped = (-2, -1),
norm: Untyped | None = None,
overwrite_x: bool = False,
workers: Untyped | None = None,
Expand Down
48 changes: 24 additions & 24 deletions scipy-stubs/fft/_basic_backend.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from scipy._typing import Untyped

def fft(
x,
x: Untyped,
n: Untyped | None = None,
axis: int = -1,
norm: Untyped | None = None,
Expand All @@ -11,7 +11,7 @@ def fft(
plan: Untyped | None = None,
) -> Untyped: ...
def ifft(
x,
x: Untyped,
n: Untyped | None = None,
axis: int = -1,
norm: Untyped | None = None,
Expand All @@ -21,7 +21,7 @@ def ifft(
plan: Untyped | None = None,
) -> Untyped: ...
def rfft(
x,
x: Untyped,
n: Untyped | None = None,
axis: int = -1,
norm: Untyped | None = None,
Expand All @@ -31,7 +31,7 @@ def rfft(
plan: Untyped | None = None,
) -> Untyped: ...
def irfft(
x,
x: Untyped,
n: Untyped | None = None,
axis: int = -1,
norm: Untyped | None = None,
Expand All @@ -41,7 +41,7 @@ def irfft(
plan: Untyped | None = None,
) -> Untyped: ...
def hfft(
x,
x: Untyped,
n: Untyped | None = None,
axis: int = -1,
norm: Untyped | None = None,
Expand All @@ -51,7 +51,7 @@ def hfft(
plan: Untyped | None = None,
) -> Untyped: ...
def ihfft(
x,
x: Untyped,
n: Untyped | None = None,
axis: int = -1,
norm: Untyped | None = None,
Expand All @@ -61,7 +61,7 @@ def ihfft(
plan: Untyped | None = None,
) -> Untyped: ...
def fftn(
x,
x: Untyped,
s: Untyped | None = None,
axes: Untyped | None = None,
norm: Untyped | None = None,
Expand All @@ -71,7 +71,7 @@ def fftn(
plan: Untyped | None = None,
) -> Untyped: ...
def ifftn(
x,
x: Untyped,
s: Untyped | None = None,
axes: Untyped | None = None,
norm: Untyped | None = None,
Expand All @@ -81,27 +81,27 @@ def ifftn(
plan: Untyped | None = None,
) -> Untyped: ...
def fft2(
x,
x: Untyped,
s: Untyped | None = None,
axes=(-2, -1),
axes: Untyped = (-2, -1),
norm: Untyped | None = None,
overwrite_x: bool = False,
workers: Untyped | None = None,
*,
plan: Untyped | None = None,
) -> Untyped: ...
def ifft2(
x,
x: Untyped,
s: Untyped | None = None,
axes=(-2, -1),
axes: Untyped = (-2, -1),
norm: Untyped | None = None,
overwrite_x: bool = False,
workers: Untyped | None = None,
*,
plan: Untyped | None = None,
) -> Untyped: ...
def rfftn(
x,
x: Untyped,
s: Untyped | None = None,
axes: Untyped | None = None,
norm: Untyped | None = None,
Expand All @@ -111,17 +111,17 @@ def rfftn(
plan: Untyped | None = None,
) -> Untyped: ...
def rfft2(
x,
x: Untyped,
s: Untyped | None = None,
axes=(-2, -1),
axes: Untyped = (-2, -1),
norm: Untyped | None = None,
overwrite_x: bool = False,
workers: Untyped | None = None,
*,
plan: Untyped | None = None,
) -> Untyped: ...
def irfftn(
x,
x: Untyped,
s: Untyped | None = None,
axes: Untyped | None = None,
norm: Untyped | None = None,
Expand All @@ -131,17 +131,17 @@ def irfftn(
plan: Untyped | None = None,
) -> Untyped: ...
def irfft2(
x,
x: Untyped,
s: Untyped | None = None,
axes=(-2, -1),
axes: Untyped = (-2, -1),
norm: Untyped | None = None,
overwrite_x: bool = False,
workers: Untyped | None = None,
*,
plan: Untyped | None = None,
) -> Untyped: ...
def hfftn(
x,
x: Untyped,
s: Untyped | None = None,
axes: Untyped | None = None,
norm: Untyped | None = None,
Expand All @@ -151,17 +151,17 @@ def hfftn(
plan: Untyped | None = None,
) -> Untyped: ...
def hfft2(
x,
x: Untyped,
s: Untyped | None = None,
axes=(-2, -1),
axes: Untyped = (-2, -1),
norm: Untyped | None = None,
overwrite_x: bool = False,
workers: Untyped | None = None,
*,
plan: Untyped | None = None,
) -> Untyped: ...
def ihfftn(
x,
x: Untyped,
s: Untyped | None = None,
axes: Untyped | None = None,
norm: Untyped | None = None,
Expand All @@ -171,9 +171,9 @@ def ihfftn(
plan: Untyped | None = None,
) -> Untyped: ...
def ihfft2(
x,
x: Untyped,
s: Untyped | None = None,
axes=(-2, -1),
axes: Untyped = (-2, -1),
norm: Untyped | None = None,
overwrite_x: bool = False,
workers: Untyped | None = None,
Expand Down
Loading

0 comments on commit 76f46bf

Please sign in to comment.