Skip to content

Move __all__ to PEP-8 recommended location #683

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/array_api_stubs/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
from . import _2021_12, _2022_12, _draft

47 changes: 25 additions & 22 deletions src/array_api_stubs/_draft/_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,27 @@
"""
from __future__ import annotations

__all__ = [
"Any",
"List",
"Literal",
"NestedSequence",
"Optional",
"PyCapsule",
"SupportsBufferProtocol",
"SupportsDLPack",
"Tuple",
"Union",
"Sequence",
"array",
"device",
"dtype",
"ellipsis",
"finfo_object",
"iinfo_object",
"Enum",
]

from dataclasses import dataclass
from typing import (
Any,
Expand Down Expand Up @@ -34,21 +55,25 @@
@dataclass
class finfo_object:
"""Dataclass returned by `finfo`."""

bits: int
eps: float
max: float
min: float
smallest_normal: float
dtype: dtype


@dataclass
class iinfo_object:
"""Dataclass returned by `iinfo`."""

bits: int
max: int
min: int
dtype: dtype


_T_co = TypeVar("_T_co", covariant=True)


Expand All @@ -58,25 +83,3 @@ def __getitem__(self, key: int, /) -> Union[_T_co, NestedSequence[_T_co]]:

def __len__(self, /) -> int:
...


__all__ = [
"Any",
"List",
"Literal",
"NestedSequence",
"Optional",
"PyCapsule",
"SupportsBufferProtocol",
"SupportsDLPack",
"Tuple",
"Union",
"Sequence",
"array",
"device",
"dtype",
"ellipsis",
"finfo_object",
"iinfo_object",
"Enum",
]
4 changes: 2 additions & 2 deletions src/array_api_stubs/_draft/array_object.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from __future__ import annotations

__all__ = ["array"]

from ._types import (
array,
dtype as Dtype,
Expand Down Expand Up @@ -1059,5 +1061,3 @@ def to_device(


array = _array

__all__ = ["array"]
4 changes: 2 additions & 2 deletions src/array_api_stubs/_draft/constants.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
__all__ = ["e", "inf", "nan", "newaxis", "pi"]

e = 2.718281828459045
"""
IEEE 754 floating-point representation of Euler's constant.
Expand Down Expand Up @@ -26,5 +28,3 @@

``pi = 3.1415926535897932384626433...``
"""

__all__ = ["e", "inf", "nan", "newaxis", "pi"]
40 changes: 20 additions & 20 deletions src/array_api_stubs/_draft/creation_functions.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
__all__ = [
"arange",
"asarray",
"empty",
"empty_like",
"eye",
"from_dlpack",
"full",
"full_like",
"linspace",
"meshgrid",
"ones",
"ones_like",
"tril",
"triu",
"zeros",
"zeros_like",
]


from ._types import (
List,
NestedSequence,
Expand Down Expand Up @@ -563,23 +583,3 @@ def zeros_like(
out: array
an array having the same shape as ``x`` and filled with zeros.
"""


__all__ = [
"arange",
"asarray",
"empty",
"empty_like",
"eye",
"from_dlpack",
"full",
"full_like",
"linspace",
"meshgrid",
"ones",
"ones_like",
"tril",
"triu",
"zeros",
"zeros_like",
]
6 changes: 3 additions & 3 deletions src/array_api_stubs/_draft/data_type_functions.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
__all__ = ["astype", "can_cast", "finfo", "iinfo", "isdtype", "result_type"]


from ._types import Union, Tuple, array, dtype, finfo_object, iinfo_object


Expand Down Expand Up @@ -208,6 +211,3 @@ def result_type(*arrays_and_dtypes: Union[array, dtype]) -> dtype:
out: dtype
the dtype resulting from an operation involving the input arrays and dtypes.
"""


__all__ = ["astype", "can_cast", "finfo", "iinfo", "isdtype", "result_type"]
6 changes: 3 additions & 3 deletions src/array_api_stubs/_draft/data_types.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
__all__ = ["__eq__"]


from ._types import dtype


Expand All @@ -17,6 +20,3 @@ def __eq__(self: dtype, other: dtype, /) -> bool:
out: bool
a boolean indicating whether the data type objects are equal.
"""


__all__ = ["__eq__"]
126 changes: 63 additions & 63 deletions src/array_api_stubs/_draft/elementwise_functions.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,66 @@
__all__ = [
"abs",
"acos",
"acosh",
"add",
"asin",
"asinh",
"atan",
"atan2",
"atanh",
"bitwise_and",
"bitwise_left_shift",
"bitwise_invert",
"bitwise_or",
"bitwise_right_shift",
"bitwise_xor",
"ceil",
"conj",
"cos",
"cosh",
"divide",
"equal",
"exp",
"expm1",
"floor",
"floor_divide",
"greater",
"greater_equal",
"imag",
"isfinite",
"isinf",
"isnan",
"less",
"less_equal",
"log",
"log1p",
"log2",
"log10",
"logaddexp",
"logical_and",
"logical_not",
"logical_or",
"logical_xor",
"multiply",
"negative",
"not_equal",
"positive",
"pow",
"real",
"remainder",
"round",
"sign",
"sin",
"sinh",
"square",
"sqrt",
"subtract",
"tan",
"tanh",
"trunc",
]


from ._types import array


Expand Down Expand Up @@ -2477,66 +2540,3 @@ def trunc(x: array, /) -> array:
- If ``x_i`` is ``-0``, the result is ``-0``.
- If ``x_i`` is ``NaN``, the result is ``NaN``.
"""


__all__ = [
"abs",
"acos",
"acosh",
"add",
"asin",
"asinh",
"atan",
"atan2",
"atanh",
"bitwise_and",
"bitwise_left_shift",
"bitwise_invert",
"bitwise_or",
"bitwise_right_shift",
"bitwise_xor",
"ceil",
"conj",
"cos",
"cosh",
"divide",
"equal",
"exp",
"expm1",
"floor",
"floor_divide",
"greater",
"greater_equal",
"imag",
"isfinite",
"isinf",
"isnan",
"less",
"less_equal",
"log",
"log1p",
"log2",
"log10",
"logaddexp",
"logical_and",
"logical_not",
"logical_or",
"logical_xor",
"multiply",
"negative",
"not_equal",
"positive",
"pow",
"real",
"remainder",
"round",
"sign",
"sin",
"sinh",
"square",
"sqrt",
"subtract",
"tan",
"tanh",
"trunc",
]
35 changes: 17 additions & 18 deletions src/array_api_stubs/_draft/fft.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
__all__ = [
"fft",
"ifft",
"fftn",
"ifftn",
"rfft",
"irfft",
"rfftn",
"irfftn",
"hfft",
"ihfft",
"fftfreq",
"rfftfreq",
"fftshift",
"ifftshift",
]

from ._types import Tuple, Union, Sequence, array, Optional, Literal, device


Expand Down Expand Up @@ -651,21 +668,3 @@ def ifftshift(x: array, /, *, axes: Union[int, Sequence[int]] = None) -> array:

.. versionadded:: 2022.12
"""


__all__ = [
"fft",
"ifft",
"fftn",
"ifftn",
"rfft",
"irfft",
"rfftn",
"irfftn",
"hfft",
"ihfft",
"fftfreq",
"rfftfreq",
"fftshift",
"ifftshift",
]
5 changes: 2 additions & 3 deletions src/array_api_stubs/_draft/indexing_functions.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
__all__ = ["take"]

from ._types import Union, Optional, array


Expand Down Expand Up @@ -29,6 +31,3 @@ def take(x: array, indices: array, /, *, axis: Optional[int] = None) -> array:

.. versionadded:: 2022.12
"""


__all__ = ["take"]
Loading