relib 1.3.8__tar.gz → 1.3.9__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: relib
3
- Version: 1.3.8
3
+ Version: 1.3.9
4
4
  Project-URL: Repository, https://github.com/Reddan/relib.git
5
5
  Author: Hampus Hallman
6
6
  License: Copyright 2018-2025 Hampus Hallman
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "relib"
3
- version = "1.3.8"
3
+ version = "1.3.9"
4
4
  requires-python = ">=3.10"
5
5
  dependencies = []
6
6
  authors = [
@@ -95,7 +95,7 @@ class seekable(Generic[T]):
95
95
  return item
96
96
 
97
97
  def __bool__(self):
98
- return bool(self.lookahead(1))
98
+ return bool(self[:1])
99
99
 
100
100
  def clear(self):
101
101
  self.sink[:self.index] = []
@@ -122,11 +122,18 @@ class seekable(Generic[T]):
122
122
  finally:
123
123
  self.seek(initial_index)
124
124
 
125
- def lookahead(self, count: int) -> list[T]:
125
+ @overload
126
+ def __getitem__(self, key: int) -> T: ...
127
+ @overload
128
+ def __getitem__(self, key: slice[int | None]) -> list[T]: ...
129
+ def __getitem__(self, key: int | slice[int | None]):
126
130
  with self.freeze():
127
- return list(islice(self, count))
131
+ if isinstance(key, slice):
132
+ return list(islice(self, key.start, key.stop, key.step))
133
+ elif isinstance(key, int):
134
+ return self[:key][key - 1]
128
135
 
129
- def forgetful(self) -> Iterable[T]:
136
+ def consume(self) -> Iterable[T]:
130
137
  for value in self:
131
138
  self.clear()
132
139
  yield value
@@ -161,7 +161,7 @@ wheels = [
161
161
 
162
162
  [[package]]
163
163
  name = "relib"
164
- version = "1.3.8"
164
+ version = "1.3.9"
165
165
  source = { editable = "." }
166
166
 
167
167
  [package.dev-dependencies]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes