Skip to content
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

Enable disallow any generics #233

Merged
merged 1 commit into from
Jul 22, 2024
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: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ strict_optional = true
warn_no_return = true
warn_redundant_casts = false
warn_unused_ignores = false
disallow_any_generics = true

[tool.pytest.ini_options]
addopts = [
Expand Down
6 changes: 3 additions & 3 deletions scripts/chaining_type_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@
NumT = t.TypeVar("NumT", int, float, "Decimal")
NumT2 = t.TypeVar("NumT2", int, float, "Decimal")
NumT3 = t.TypeVar("NumT3", int, float, "Decimal")
CallableT = t.TypeVar("CallableT", bound=t.Callable)
SequenceT = t.TypeVar("SequenceT", bound=t.Sequence)
MutableSequenceT = t.TypeVar("MutableSequenceT", bound=t.MutableSequence)
CallableT = t.TypeVar("CallableT", bound=t.Callable[..., t.Any])
SequenceT = t.TypeVar("SequenceT", bound=t.Sequence[t.Any])
MutableSequenceT = t.TypeVar("MutableSequenceT", bound=t.MutableSequence[t.Any])
P = ParamSpec("P")


Expand Down
14 changes: 8 additions & 6 deletions src/pydash/arrays.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@
T3 = t.TypeVar("T3")
T4 = t.TypeVar("T4")
T5 = t.TypeVar("T5")
SequenceT = t.TypeVar("SequenceT", bound=t.Sequence)
MutableSequenceT = t.TypeVar("MutableSequenceT", bound=t.MutableSequence)
SequenceT = t.TypeVar("SequenceT", bound=t.Sequence[t.Any])
MutableSequenceT = t.TypeVar("MutableSequenceT", bound=t.MutableSequence[t.Any])


def chunk(array: t.Sequence[T], size: int = 1) -> t.List[t.Sequence[T]]:
Expand Down Expand Up @@ -664,7 +664,7 @@ def flatten(array):
return flatten_depth(array, depth=1)


def flatten_deep(array: t.Iterable) -> t.List:
def flatten_deep(array: t.Iterable[t.Any]) -> t.List[t.Any]:
"""
Flattens an array recursively.

Expand All @@ -684,7 +684,7 @@ def flatten_deep(array: t.Iterable) -> t.List:
return flatten_depth(array, depth=-1)


def flatten_depth(array: t.Iterable, depth: int = 1) -> t.List:
def flatten_depth(array: t.Iterable[t.Any], depth: int = 1) -> t.List[t.Any]:
"""
Recursively flatten `array` up to `depth` times.

Expand Down Expand Up @@ -2701,7 +2701,9 @@ def zip_object(keys, values=None):
return dict(zip(keys, values))


def zip_object_deep(keys: t.Iterable[t.Any], values: t.Union[t.List[t.Any], None] = None) -> t.Dict:
def zip_object_deep(
keys: t.Iterable[t.Any], values: t.Union[t.List[t.Any], None] = None
) -> t.Dict[t.Any, t.Any]:
"""
This method is like :func:`zip_object` except that it supports property paths.

Expand All @@ -2723,7 +2725,7 @@ def zip_object_deep(keys: t.Iterable[t.Any], values: t.Union[t.List[t.Any], None
if values is None: # pragma: no cover
keys, values = unzip(keys)

obj: t.Dict = {}
obj: t.Dict[t.Any, t.Any] = {}
for idx, key in enumerate(keys):
obj = pyd.set_(obj, key, pyd.get(values, idx))

Expand Down
Loading