Skip to content

Commit 07cee61

Browse files
committed
Migrate to the latest version of the wraps library.
1 parent db9cba8 commit 07cee61

File tree

12 files changed

+43
-34
lines changed

12 files changed

+43
-34
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
<!-- changelogging: start -->
44

5+
## 0.18.0 (2024-04-23)
6+
7+
### Changes
8+
9+
- Migrated to the latest version of the `wraps` library.
10+
511
## 0.17.0 (2024-03-23)
612

713
### Features

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Or by directly specifying it in the configuration like so:
4848

4949
```toml
5050
[tool.poetry.dependencies]
51-
iters = "^0.17.0"
51+
iters = "^0.18.0"
5252
```
5353

5454
Alternatively, you can add it directly from the source:

iters/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
__title__ = "iters"
1212
__author__ = "nekitdev"
1313
__license__ = "MIT"
14-
__version__ = "0.17.0"
14+
__version__ = "0.18.0"
1515

1616
from iters.async_iters import (
1717
AsyncIter,

iters/async_iters.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@
6060
Validate,
6161
)
6262
from typing_extensions import Never, ParamSpec
63-
from wraps.early import early_option_await
64-
from wraps.option import Option, Some
65-
from wraps.result import Result
66-
from wraps.wraps import wrap_future, wrap_future_option, wrap_future_result
63+
from wraps.early.decorators import early_option_await
64+
from wraps.primitives.option import Option, Some
65+
from wraps.primitives.result import Result
66+
from wraps.wraps.futures import wrap_future, wrap_future_option, wrap_future_result
6767

6868
from iters.async_utils import (
6969
async_accumulate_fold,

iters/async_wraps.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from typing import AsyncIterator, TypeVar
22

33
from typing_aliases import AnyIterable, AsyncBinary, AsyncUnary, Binary, Unary
4-
from wraps.option import NULL, Option, Some
5-
from wraps.result import Error, Ok, Result
4+
from wraps.primitives.option import NULL, Option, Some
5+
from wraps.primitives.result import Error, Ok, Result
66

77
from iters.async_utils import async_chain, async_iter, async_next_unchecked
88
from iters.types import is_marker, marker

iters/iters.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@
4848
Unary,
4949
)
5050
from typing_extensions import Never, ParamSpec
51-
from wraps.early import early_option
52-
from wraps.option import Option, Some
53-
from wraps.result import Result
51+
from wraps.early.decorators import early_option
52+
from wraps.primitives.option import Option, Some
53+
from wraps.primitives.result import Result
5454

5555
from iters.constants import DEFAULT_START, DEFAULT_STEP, EMPTY_BYTES, EMPTY_STRING
5656
from iters.ordered_set import OrderedSet, ordered_set

iters/mapping_view.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
from attrs import frozen
44
from typing_extensions import Self
5-
from wraps.wraps import WrapOption
5+
from wraps.wraps.option import wrap_option_on
66

77
__all__ = ("MappingView", "mapping_view")
88

99
K = TypeVar("K")
1010
V = TypeVar("V")
1111

12-
wrap_key_error = WrapOption(KeyError)
12+
wrap_key_error = wrap_option_on(KeyError)
1313

1414

1515
@final

iters/ordered_set.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from named import get_type_name
2020
from typing_aliases import AnySet, is_instance, is_sized, is_slice
2121
from typing_extensions import TypeIs
22-
from wraps.wraps import wrap_option
22+
from wraps.wraps.option import wrap_option_on
2323

2424
__all__ = ("OrderedSet", "ordered_set", "ordered_set_unchecked")
2525

@@ -49,6 +49,9 @@ def is_any_set(iterable: Iterable[T]) -> TypeIs[AnySet[T]]:
4949
return is_instance(iterable, AnySet)
5050

5151

52+
wrap_index_error = wrap_option_on(IndexError)
53+
54+
5255
class OrderedSet(MutableSet[Q], Sequence[Q]):
5356
"""Represents ordered sets, i.e. mutable hash sets that preserve insertion order.
5457
@@ -350,7 +353,7 @@ def index(self, item: Q, start: Optional[int] = None, stop: Optional[int] = None
350353

351354
return index
352355

353-
get_index = wrap_option(index)
356+
get_index = wrap_index_error(index)
354357
"""An alias of [`index`][iters.ordered_set.OrderedSet.index] wrapped to return
355358
[`Option[int]`][wraps.option.Option] instead of erroring.
356359
"""
@@ -405,7 +408,7 @@ def pop(self, index: int = LAST) -> Q:
405408

406409
return item
407410

408-
get_pop = wrap_option(pop)
411+
get_pop = wrap_index_error(pop)
409412
"""An alias of [`pop`][iters.ordered_set.OrderedSet.pop] wrapped to return
410413
[`Option[Q]`][wraps.option.Option] instead of erroring.
411414
"""

iters/sequence_view.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44

55
from attrs import frozen
66
from typing_aliases import is_slice
7-
from wraps.wraps import WrapOption
7+
from wraps.wraps.option import wrap_option_on
88

99
__all__ = ("SequenceView", "sequence_view")
1010

1111
T = TypeVar("T")
1212

13-
wrap_index_error = WrapOption(IndexError)
13+
wrap_index_error = wrap_option_on(IndexError)
1414

1515

1616
@final

iters/types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from solus import Singleton
66
from typing_extensions import TypeIs
7-
from wraps.option import NULL, Option, Some
7+
from wraps.primitives.option import NULL, Option, Some
88

99
T = TypeVar("T")
1010

0 commit comments

Comments
 (0)