<commit_before>import sys
from typing import Any, overload, Sequence, TYPE_CHECKING, Union

from numpy import ndarray
from ._dtype_like import DtypeLike

if sys.version_info >= (3, 8):
    from typing import Protocol
    HAVE_PROTOCOL = True
else:
    try:
        from typing_extensions import Protocol
    except ImportError:
        HAVE_PROTOCOL = False
    else:
        HAVE_PROTOCOL = True

if TYPE_CHECKING or HAVE_PROTOCOL:
    class _SupportsArray(Protocol):
        @overload
        def __array__(self, __dtype: DtypeLike = ...) -> ndarray: ...
        @overload
        def __array__(self, dtype: DtypeLike = ...) -> ndarray: ...
else:
    _SupportsArray = Any

ArrayLike = Union[bool, int, float, complex, _SupportsArray, Sequence]<commit_msg>DOC: add note about supporting buffer protocols in `ArrayLike`<commit_after>import sys
from typing import Any, overload, Sequence, TYPE_CHECKING, Union

from numpy import ndarray
from ._dtype_like import DtypeLike

if sys.version_info >= (3, 8):
    from typing import Protocol
    HAVE_PROTOCOL = True
else:
    try:
        from typing_extensions import Protocol
    except ImportError:
        HAVE_PROTOCOL = False
    else:
        HAVE_PROTOCOL = True

if TYPE_CHECKING or HAVE_PROTOCOL:
    class _SupportsArray(Protocol):
        @overload
        def __array__(self, __dtype: DtypeLike = ...) -> ndarray: ...
        @overload
        def __array__(self, dtype: DtypeLike = ...) -> ndarray: ...
else:
    _SupportsArray = Any

# TODO: support buffer protocols once
#
# https://github.com/python/typing/issues/593
#
# is resolved.
ArrayLike = Union[bool, int, float, complex, _SupportsArray, Sequence]
{'fraction_non_alphanumeric': 0.09003601440576231, 'fraction_numerical': 0.004201680672268907, 'mean_word_length': 3.146766169154229, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6409083', 'n_tokens_mistral': 502, 'n_tokens_neox': 496, 'n_words': 153}