Skip to content

Commit

Permalink
Enable disallow any generics (#233)
Browse files Browse the repository at this point in the history
Co-authored-by: DeviousStoat <[email protected]>
  • Loading branch information
DeviousStoat and DeviousStoat authored Jul 22, 2024
1 parent 63d393b commit 5152a60
Show file tree
Hide file tree
Showing 12 changed files with 222 additions and 182 deletions.
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

0 comments on commit 5152a60

Please sign in to comment.