Skip to content

Commit

Permalink
🎨 fix and run the FixTrailingComma codemod (#397)
Browse files Browse the repository at this point in the history
  • Loading branch information
jorenham authored Jan 3, 2025
2 parents c95437a + 2cc995a commit 4ab7aed
Show file tree
Hide file tree
Showing 5 changed files with 434 additions and 75 deletions.
3 changes: 2 additions & 1 deletion codegen/mods.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ class FixTrailingComma(_BaseMod):

@override
def leave_FunctionDef(self, /, original_node: cst.FunctionDef, updated_node: cst.FunctionDef) -> cst.FunctionDef:
params = updated_node.params.params
params_node = updated_node.params
params = *params_node.posonly_params, *params_node.params, *params_node.kwonly_params

if (
# the parameters start on a new line
Expand Down
9 changes: 7 additions & 2 deletions scipy-stubs/interpolate/_bary_rational.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,15 @@ class AAA(_BarycentricRational[_SCT_co, tuple[int]], Generic[_SCT_co]):
weights: onp.Array1D[_SCT_co]

@property
def support_points(self) -> onp.Array1D[_SCT_co]: ...
def support_points(self, /) -> onp.Array1D[_SCT_co]: ...
@property
def support_values(self) -> onp.Array1D[_SCT_co]: ...
def support_values(self, /) -> onp.Array1D[_SCT_co]: ...

#
@overload
def __init__(
self,
/,
x: onp.CanArrayND[_SCT_co] | Sequence[_SCT_co],
y: onp.CanArrayND[_SCT_co | _ToFloat16] | Sequence[_SCT_co | _ToFloat16],
*,
Expand All @@ -63,6 +64,7 @@ class AAA(_BarycentricRational[_SCT_co, tuple[int]], Generic[_SCT_co]):
@overload
def __init__(
self: AAA[np.float64],
/,
x: Sequence[float],
y: onp.CanArrayND[_ToFloat64] | Sequence[float | _ToFloat64],
*,
Expand All @@ -74,6 +76,7 @@ class AAA(_BarycentricRational[_SCT_co, tuple[int]], Generic[_SCT_co]):
@overload
def __init__(
self: AAA[np.float64],
/,
x: onp.CanArrayND[_ToFloat64] | Sequence[float | _ToFloat64],
y: Sequence[float],
*,
Expand All @@ -85,6 +88,7 @@ class AAA(_BarycentricRational[_SCT_co, tuple[int]], Generic[_SCT_co]):
@overload
def __init__(
self: AAA[np.complex128],
/,
x: Sequence[complex],
y: onp.CanArrayND[_ToFloat64] | Sequence[complex | _ToComplex128],
*,
Expand All @@ -96,6 +100,7 @@ class AAA(_BarycentricRational[_SCT_co, tuple[int]], Generic[_SCT_co]):
@overload
def __init__(
self: AAA[np.complex128],
/,
x: onp.CanArrayND[_ToComplex128] | Sequence[complex | _ToComplex128],
y: Sequence[complex],
*,
Expand Down
1 change: 1 addition & 0 deletions scipy-stubs/stats/_distribution_infrastructure.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ class ContinuousDistribution(_BaseDistribution[_FloatT_co, _ShapeT_co], Generic[
def reset_cache(self, /) -> None: ...
def plot(
self,
/,
x: _PlotQuantity = "x",
y: _PlotQuantity = "pdf",
*,
Expand Down
Loading

0 comments on commit 4ab7aed

Please sign in to comment.