Skip to content

Commit 0941b21

Browse files
authored
docs: fix indexing kwarg typing in meshgrid
PR-URL: #915 Reviewed-by: Athan Reines <kgryte@gmail.com> Reviewed-by: Lucas Colley
1 parent 772fb46 commit 0941b21

File tree

5 files changed

+15
-10
lines changed

5 files changed

+15
-10
lines changed

src/array_api_stubs/_2021_12/creation_functions.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from ._types import (
22
List,
3+
Literal,
34
NestedSequence,
45
Optional,
56
SupportsBufferProtocol,
@@ -311,15 +312,15 @@ def linspace(
311312
"""
312313

313314

314-
def meshgrid(*arrays: array, indexing: str = "xy") -> List[array]:
315+
def meshgrid(*arrays: array, indexing: Literal["xy", "ij"] = "xy") -> List[array]:
315316
"""
316317
Returns coordinate matrices from coordinate vectors.
317318
318319
Parameters
319320
----------
320321
arrays: array
321322
an arbitrary number of one-dimensional arrays representing grid coordinates. Each array should have the same numeric data type.
322-
indexing: str
323+
indexing: Literal["xy", "ij"]
323324
Cartesian ``'xy'`` or matrix ``'ij'`` indexing of output. If provided zero or one one-dimensional vector(s) (i.e., the zero- and one-dimensional cases, respectively), the ``indexing`` keyword has no effect and should be ignored. Default: ``'xy'``.
324325
325326
Returns

src/array_api_stubs/_2022_12/creation_functions.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from ._types import (
22
List,
3+
Literal,
34
NestedSequence,
45
Optional,
56
SupportsBufferProtocol,
@@ -372,15 +373,15 @@ def linspace(
372373
"""
373374

374375

375-
def meshgrid(*arrays: array, indexing: str = "xy") -> List[array]:
376+
def meshgrid(*arrays: array, indexing: Literal["xy", "ij"] = "xy") -> List[array]:
376377
"""
377378
Returns coordinate matrices from coordinate vectors.
378379
379380
Parameters
380381
----------
381382
arrays: array
382383
an arbitrary number of one-dimensional arrays representing grid coordinates. Each array should have the same numeric data type.
383-
indexing: str
384+
indexing: Literal["xy", "ij"]
384385
Cartesian ``'xy'`` or matrix ``'ij'`` indexing of output. If provided zero or one one-dimensional vector(s) (i.e., the zero- and one-dimensional cases, respectively), the ``indexing`` keyword has no effect and should be ignored. Default: ``'xy'``.
385386
386387
Returns

src/array_api_stubs/_2023_12/creation_functions.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
from ._types import (
2222
List,
23+
Literal,
2324
NestedSequence,
2425
Optional,
2526
SupportsBufferProtocol,
@@ -454,15 +455,15 @@ def linspace(
454455
"""
455456

456457

457-
def meshgrid(*arrays: array, indexing: str = "xy") -> List[array]:
458+
def meshgrid(*arrays: array, indexing: Literal["xy", "ij"] = "xy") -> List[array]:
458459
"""
459460
Returns coordinate matrices from coordinate vectors.
460461
461462
Parameters
462463
----------
463464
arrays: array
464465
an arbitrary number of one-dimensional arrays representing grid coordinates. Each array should have the same numeric data type.
465-
indexing: str
466+
indexing: Literal["xy", "ij"]
466467
Cartesian ``'xy'`` or matrix ``'ij'`` indexing of output. If provided zero or one one-dimensional vector(s) (i.e., the zero- and one-dimensional cases, respectively), the ``indexing`` keyword has no effect and should be ignored. Default: ``'xy'``.
467468
468469
Returns

src/array_api_stubs/_2024_12/creation_functions.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
from ._types import (
2222
List,
23+
Literal,
2324
NestedSequence,
2425
Optional,
2526
SupportsBufferProtocol,
@@ -454,15 +455,15 @@ def linspace(
454455
"""
455456

456457

457-
def meshgrid(*arrays: array, indexing: str = "xy") -> List[array]:
458+
def meshgrid(*arrays: array, indexing: Literal["xy", "ij"] = "xy") -> List[array]:
458459
"""
459460
Returns coordinate matrices from coordinate vectors.
460461
461462
Parameters
462463
----------
463464
arrays: array
464465
an arbitrary number of one-dimensional arrays representing grid coordinates. Each array should have the same numeric data type.
465-
indexing: str
466+
indexing: Literal["xy", "ij"]
466467
Cartesian ``'xy'`` or matrix ``'ij'`` indexing of output. If provided zero or one one-dimensional vector(s) (i.e., the zero- and one-dimensional cases, respectively), the ``indexing`` keyword has no effect and should be ignored. Default: ``'xy'``.
467468
468469
Returns

src/array_api_stubs/_draft/creation_functions.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
from ._types import (
2222
List,
23+
Literal,
2324
NestedSequence,
2425
Optional,
2526
SupportsBufferProtocol,
@@ -454,15 +455,15 @@ def linspace(
454455
"""
455456

456457

457-
def meshgrid(*arrays: array, indexing: str = "xy") -> List[array]:
458+
def meshgrid(*arrays: array, indexing: Literal["xy", "ij"] = "xy") -> List[array]:
458459
"""
459460
Returns coordinate matrices from coordinate vectors.
460461
461462
Parameters
462463
----------
463464
arrays: array
464465
an arbitrary number of one-dimensional arrays representing grid coordinates. Each array should have the same numeric data type.
465-
indexing: str
466+
indexing: Literal["xy", "ij"]
466467
Cartesian ``'xy'`` or matrix ``'ij'`` indexing of output. If provided zero or one one-dimensional vector(s) (i.e., the zero- and one-dimensional cases, respectively), the ``indexing`` keyword has no effect and should be ignored. Default: ``'xy'``.
467468
468469
Returns

0 commit comments

Comments
 (0)