relib 1.3.9__py3-none-any.whl → 1.3.11__py3-none-any.whl

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.
relib/iter_utils.py CHANGED
@@ -102,7 +102,7 @@ class seekable(Generic[T]):
102
102
  self.index = 0
103
103
 
104
104
  def seek(self, index: int) -> seekable[T]:
105
- remainder = index - len(self.sink)
105
+ remainder = index - self.index
106
106
  if remainder > 0:
107
107
  next(islice(self, remainder, remainder), None)
108
108
  self.index = max(0, min(index, len(self.sink)))
@@ -128,10 +128,12 @@ class seekable(Generic[T]):
128
128
  def __getitem__(self, key: slice[int | None]) -> list[T]: ...
129
129
  def __getitem__(self, key: int | slice[int | None]):
130
130
  with self.freeze():
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]
131
+ if isinstance(key, int):
132
+ return self[key:key + 1][0]
133
+ parts = (key.start, key.stop, key.step)
134
+ if not all(x is None or x >= 0 for x in parts):
135
+ raise ValueError(f"Indices for seekable() must be positive int")
136
+ return list(islice(self, *parts))
135
137
 
136
138
  def consume(self) -> Iterable[T]:
137
139
  for value in self:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: relib
3
- Version: 1.3.9
3
+ Version: 1.3.11
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,12 +1,12 @@
1
1
  relib/__init__.py,sha256=WerjUaM_sNvudjXFudLRtXB7viZWEW1RSinkDjrh4nE,163
2
2
  relib/dict_utils.py,sha256=ez8egTPvO05wVNWIyO-aJjtqaXUDYbzyw32M42q1D44,3677
3
3
  relib/io_utils.py,sha256=cUyUFhrMCUDfkINhYo32QPaVGz3chqDO3ElymSCoWEg,1086
4
- relib/iter_utils.py,sha256=l5LwIGX8QEMhV1ESTPLd6DVYNtX_EtaxMwewDkKYQM4,6193
4
+ relib/iter_utils.py,sha256=iH8fu9FrNRurOsa--GqDbTzHdrV8eJOONvumMGr2pMA,6303
5
5
  relib/processing_utils.py,sha256=kFb4izrR8vec9BFWeGSb-TXR54bbA4X3dxAfIBZItuI,1911
6
6
  relib/runtime_tools.py,sha256=6HpRXmAHHLq4bNRj6fSiaLQeHR2h3OdxFZxaB93fXhI,2979
7
7
  relib/type_utils.py,sha256=68yEhEIBCIKfsIT1u647avHVA_JjVvDYSdtLD3nCrJs,338
8
8
  relib/types.py,sha256=JzSGDl2L6tUWizGSsUpuyCKf-VKgtgfK_n21azSSMLM,288
9
- relib-1.3.9.dist-info/METADATA,sha256=PDPyPnwAoBCQnWWQcEjpkGy8R4XSe-hwApHOC8bpOao,1295
10
- relib-1.3.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
11
- relib-1.3.9.dist-info/licenses/LICENSE,sha256=9xVsdtv_-uSyY9Xl9yujwAPm4-mjcCLeVy-ljwXEWbo,1059
12
- relib-1.3.9.dist-info/RECORD,,
9
+ relib-1.3.11.dist-info/METADATA,sha256=YvXC6KVDCiYFMUUcbP8onzIcGzUzgyerJ4EBVLkDeBM,1296
10
+ relib-1.3.11.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
11
+ relib-1.3.11.dist-info/licenses/LICENSE,sha256=9xVsdtv_-uSyY9Xl9yujwAPm4-mjcCLeVy-ljwXEWbo,1059
12
+ relib-1.3.11.dist-info/RECORD,,
File without changes