Skip to content

Commit

Permalink
Type fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
DeviousStoat committed Jul 21, 2024
1 parent 6851e80 commit 52b3c90
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 18 deletions.
24 changes: 15 additions & 9 deletions src/pydash/chaining/all_funcs.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2473,8 +2473,8 @@ class AllFuncs:
@t.overload
def invert(self: "Chain[t.Mapping[T, T2]]") -> "Chain[t.Dict[T2, T]]": ...
@t.overload
def invert(self: "Chain[t.Iterable[T]]") -> "Chain[t.Dict[T, int]]": ...
def invert(self) -> "Chain[t.Dict]":
def invert(self: "Chain[t.Union[t.Iterator[T], t.Sequence[T]]]") -> "Chain[t.Dict[T, int]]": ...
def invert(self):
return self._wrap(pyd.invert)()

@t.overload
Expand All @@ -2487,11 +2487,11 @@ class AllFuncs:
) -> "Chain[t.Dict[T2, t.List[T]]]": ...
@t.overload
def invert_by(
self: "Chain[t.Iterable[T]]", iteratee: t.Callable[[T], T2]
self: "Chain[t.Union[t.Iterator[T], t.Sequence[T]]]", iteratee: t.Callable[[T], T2]
) -> "Chain[t.Dict[T2, t.List[int]]]": ...
@t.overload
def invert_by(
self: "Chain[t.Iterable[T]]", iteratee: None = None
self: "Chain[t.Union[t.Iterator[T], t.Sequence[T]]]", iteratee: None = None
) -> "Chain[t.Dict[T, t.List[int]]]": ...
def invert_by(self, iteratee=None):
return self._wrap(pyd.invert_by)(iteratee)
Expand Down Expand Up @@ -2622,7 +2622,9 @@ class AllFuncs:
@t.overload
def omit(self: "Chain[t.Mapping[T, T2]]", *properties: PathT) -> "Chain[t.Dict[T, T2]]": ...
@t.overload
def omit(self: "Chain[t.Iterable[T]]", *properties: PathT) -> "Chain[t.Dict[int, T]]": ...
def omit(
self: "Chain[t.Union[t.Iterator[T], t.Sequence[T]]]", *properties: PathT
) -> "Chain[t.Dict[int, T]]": ...
@t.overload
def omit(self: "Chain[t.Any]", *properties: PathT) -> "Chain[t.Dict]": ...
def omit(self, *properties):
Expand All @@ -2640,11 +2642,11 @@ class AllFuncs:
def omit_by(self: "Chain[t.Dict[T, T2]]", iteratee: None = None) -> "Chain[t.Dict[T, T2]]": ...
@t.overload
def omit_by(
self: "Chain[t.Iterable[T]]", iteratee: t.Callable[[T, int], t.Any]
self: "Chain[t.Union[t.Iterator[T], t.Sequence[T]]]", iteratee: t.Callable[[T, int], t.Any]
) -> "Chain[t.Dict[int, T]]": ...
@t.overload
def omit_by(
self: "Chain[t.Iterable[T]]", iteratee: t.Callable[[T], t.Any]
self: "Chain[t.Union[t.Iterator[T], t.Sequence[T]]]", iteratee: t.Callable[[T], t.Any]
) -> "Chain[t.Dict[int, T]]": ...
@t.overload
def omit_by(self: "Chain[t.List[T]]", iteratee: None = None) -> "Chain[t.Dict[int, T]]": ...
Expand Down Expand Up @@ -2725,7 +2727,9 @@ class AllFuncs:
@t.overload
def to_dict(self: "Chain[t.Mapping[T, T2]]") -> "Chain[t.Dict[T, T2]]": ...
@t.overload
def to_dict(self: "Chain[t.Iterable[T]]") -> "Chain[t.Dict[int, T]]": ...
def to_dict(
self: "Chain[t.Union[t.Iterator[T], t.Sequence[T]]]",
) -> "Chain[t.Dict[int, T]]": ...
@t.overload
def to_dict(self: "Chain[t.Any]") -> "Chain[t.Dict]": ...
def to_dict(self):
Expand All @@ -2751,7 +2755,9 @@ class AllFuncs:
@t.overload
def to_pairs(self: "Chain[t.Mapping[T, T2]]") -> "Chain[t.List[t.Tuple[T, T2]]]": ...
@t.overload
def to_pairs(self: "Chain[t.Iterable[T]]") -> "Chain[t.List[t.Tuple[int, T]]]": ...
def to_pairs(
self: "Chain[t.Union[t.Iterator[T], t.Sequence[T]]]",
) -> "Chain[t.List[t.Tuple[int, T]]]": ...
@t.overload
def to_pairs(self: "Chain[t.Any]") -> "Chain[t.List]": ...
def to_pairs(self):
Expand Down
26 changes: 17 additions & 9 deletions src/pydash/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -925,10 +925,10 @@ def invert(obj: t.Mapping[T, T2]) -> t.Dict[T2, T]: ...


@t.overload
def invert(obj: t.Iterable[T]) -> t.Dict[T, int]: ...
def invert(obj: t.Union[t.Iterator[T], t.Sequence[T]]) -> t.Dict[T, int]: ...


def invert(obj) -> t.Dict:
def invert(obj):
"""
Creates an object composed of the inverted keys and values of the given object.
Expand Down Expand Up @@ -967,11 +967,15 @@ def invert_by(obj: t.Mapping[T, T2], iteratee: None = None) -> t.Dict[T2, t.List


@t.overload
def invert_by(obj: t.Iterable[T], iteratee: t.Callable[[T], T2]) -> t.Dict[T2, t.List[int]]: ...
def invert_by(
obj: t.Union[t.Iterator[T], t.Sequence[T]], iteratee: t.Callable[[T], T2]
) -> t.Dict[T2, t.List[int]]: ...


@t.overload
def invert_by(obj: t.Iterable[T], iteratee: None = None) -> t.Dict[T, t.List[int]]: ...
def invert_by(
obj: t.Union[t.Iterator[T], t.Sequence[T]], iteratee: None = None
) -> t.Dict[T, t.List[int]]: ...


def invert_by(obj, iteratee=None):
Expand Down Expand Up @@ -1510,7 +1514,7 @@ def omit(obj: t.Mapping[T, T2], *properties: PathT) -> t.Dict[T, T2]: ...


@t.overload
def omit(obj: t.Iterable[T], *properties: PathT) -> t.Dict[int, T]: ...
def omit(obj: t.Union[t.Iterator[T], t.Sequence[T]], *properties: PathT) -> t.Dict[int, T]: ...


@t.overload
Expand Down Expand Up @@ -1564,11 +1568,15 @@ def omit_by(obj: t.Dict[T, T2], iteratee: None = None) -> t.Dict[T, T2]: ...


@t.overload
def omit_by(obj: t.Iterable[T], iteratee: t.Callable[[T, int], t.Any]) -> t.Dict[int, T]: ...
def omit_by(
obj: t.Union[t.Iterator[T], t.Sequence[T]], iteratee: t.Callable[[T, int], t.Any]
) -> t.Dict[int, T]: ...


@t.overload
def omit_by(obj: t.Iterable[T], iteratee: t.Callable[[T], t.Any]) -> t.Dict[int, T]: ...
def omit_by(
obj: t.Union[t.Iterator[T], t.Sequence[T]], iteratee: t.Callable[[T], t.Any]
) -> t.Dict[int, T]: ...


@t.overload
Expand Down Expand Up @@ -1949,7 +1957,7 @@ def to_dict(obj: t.Mapping[T, T2]) -> t.Dict[T, T2]: ...


@t.overload
def to_dict(obj: t.Iterable[T]) -> t.Dict[int, T]: ...
def to_dict(obj: t.Union[t.Iterator[T], t.Sequence[T]]) -> t.Dict[int, T]: ...


@t.overload
Expand Down Expand Up @@ -2140,7 +2148,7 @@ def to_pairs(obj: t.Mapping[T, T2]) -> t.List[t.Tuple[T, T2]]: ...


@t.overload
def to_pairs(obj: t.Iterable[T]) -> t.List[t.Tuple[int, T]]: ...
def to_pairs(obj: t.Union[t.Iterator[T], t.Sequence[T]]) -> t.List[t.Tuple[int, T]]: ...


@t.overload
Expand Down

0 comments on commit 52b3c90

Please sign in to comment.