pybiolib 1.2.111__py3-none-any.whl → 1.2.115.dev1__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.
@@ -1,9 +1,10 @@
1
- from abc import ABC, abstractmethod
2
1
  import io
3
2
  import math
4
- from typing import Optional, Callable
5
- from biolib.typing_utils import Iterator
3
+ from abc import ABC, abstractmethod
4
+ from typing import Callable, Optional
5
+
6
6
  from biolib._internal.http_client import HttpClient
7
+ from biolib.typing_utils import Iterator
7
8
 
8
9
 
9
10
  class RemoteEndpoint(ABC):
@@ -13,7 +14,6 @@ class RemoteEndpoint(ABC):
13
14
 
14
15
 
15
16
  class IndexableBuffer(ABC):
16
-
17
17
  def __init__(self):
18
18
  self.pointer = 0
19
19
 
@@ -44,7 +44,6 @@ class IndexableBuffer(ABC):
44
44
 
45
45
 
46
46
  class LocalFileIndexableBuffer(IndexableBuffer):
47
-
48
47
  def __init__(self, filename: str):
49
48
  super().__init__()
50
49
  self._filehandle = open(filename, 'rb')
@@ -66,7 +65,6 @@ class LocalFileIndexableBuffer(IndexableBuffer):
66
65
 
67
66
 
68
67
  class RemoteIndexableBuffer(IndexableBuffer):
69
-
70
68
  def __init__(self, endpoint: RemoteEndpoint):
71
69
  super().__init__()
72
70
  self._endpoint = endpoint
@@ -92,7 +90,6 @@ class RemoteIndexableBuffer(IndexableBuffer):
92
90
 
93
91
 
94
92
  class InMemoryIndexableBuffer(IndexableBuffer):
95
-
96
93
  def __init__(self, data: bytes):
97
94
  super().__init__()
98
95
  self._buffer = data
@@ -107,14 +104,13 @@ class InMemoryIndexableBuffer(IndexableBuffer):
107
104
 
108
105
 
109
106
  class LazyLoadedFile:
110
-
111
107
  def __init__(
112
- self,
113
- path: str,
114
- buffer: IndexableBuffer,
115
- start: Optional[int],
116
- length: int,
117
- start_func: Optional[Callable[[], int]] = None,
108
+ self,
109
+ path: str,
110
+ buffer: IndexableBuffer,
111
+ start: Optional[int],
112
+ length: int,
113
+ start_func: Optional[Callable[[], int]] = None,
118
114
  ):
119
115
  self._path = path
120
116
  self._buffer = buffer
@@ -152,10 +148,7 @@ class LazyLoadedFile:
152
148
  start_offset = start + self.start
153
149
  # make sure length doesn't go outside file boundaries
154
150
  length_to_end_of_file = max(self._length - start, 0)
155
- if length is None:
156
- length_to_request = length_to_end_of_file
157
- else:
158
- length_to_request = min(length, length_to_end_of_file)
151
+ length_to_request = length_to_end_of_file if length is None else min(length, length_to_end_of_file)
159
152
  return self._buffer.get_data(start=start_offset, length=length_to_request)
160
153
 
161
154
  def get_data_iterator(self) -> Iterator[bytes]:
@@ -165,7 +158,9 @@ class LazyLoadedFile:
165
158
  chunk_size = 10_000_000
166
159
  chunks_to_yield = math.ceil(self._length / chunk_size)
167
160
  for chunk_idx in range(chunks_to_yield - 1):
168
- yield self._buffer.get_data(start=self.start+chunk_idx*chunk_size, length=chunk_size)
169
- data_already_yielded = (chunks_to_yield - 1)*chunk_size
170
- yield self._buffer.get_data(start=self.start+data_already_yielded,
171
- length=self._length - data_already_yielded)
161
+ yield self._buffer.get_data(start=self.start + chunk_idx * chunk_size, length=chunk_size)
162
+
163
+ data_already_yielded = (chunks_to_yield - 1) * chunk_size
164
+ yield self._buffer.get_data(
165
+ start=self.start + data_already_yielded, length=self._length - data_already_yielded
166
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pybiolib
3
- Version: 1.2.111
3
+ Version: 1.2.115.dev1
4
4
  Summary: BioLib Python Client
5
5
  Home-page: https://github.com/biolib
6
6
  License: MIT
@@ -53,7 +53,7 @@ biolib/biolib_binary_format/saved_job.py,sha256=nFHVFRNTNcAFGODLSiBntCtMk55QKwre
53
53
  biolib/biolib_binary_format/stdout_and_stderr.py,sha256=WfUUJFFCBrtfXjuWIaRPiWCpuBLxfko68oxoTKhrwx8,1023
54
54
  biolib/biolib_binary_format/system_exception.py,sha256=T3iL4_cSHAHim3RSDPS8Xyb1mfteaJBZonSXuRltc28,853
55
55
  biolib/biolib_binary_format/system_status_update.py,sha256=aOELuQ0k-GtpaZTUxYd0GFomP_OInmrK585y6fuQuKE,1191
56
- biolib/biolib_binary_format/utils.py,sha256=ra_plrh_Z10u98O2gW9uW2qzscQZCfq91SOznmDTY64,5170
56
+ biolib/biolib_binary_format/utils.py,sha256=JflE3m2QTJtXf9AhsHl-UagjHH6Yl6QWGkabyTGlQ3U,5087
57
57
  biolib/biolib_docker_client/__init__.py,sha256=aBfA6mtWSI5dBEfNNMD6bIZzCPloW4ghKm0wqQiljdo,1481
58
58
  biolib/biolib_download_container.py,sha256=8TmBV8iv3bCvkNlHa1SSsc4zl0wX_eaxhfnW5rvFIh8,1779
59
59
  biolib/biolib_errors.py,sha256=5m4lK2l39DafpoXBImEBD4EPH3ayXBX0JgtPzmGClow,689
@@ -119,8 +119,8 @@ biolib/utils/cache_state.py,sha256=u256F37QSRIVwqKlbnCyzAX4EMI-kl6Dwu6qwj-Qmag,3
119
119
  biolib/utils/multipart_uploader.py,sha256=XvGP1I8tQuKhAH-QugPRoEsCi9qvbRk-DVBs5PNwwJo,8452
120
120
  biolib/utils/seq_util.py,sha256=WJnU9vZdwY8RHXvzATyV80OXzyJ7w9EkG33Tna9Nr6A,5698
121
121
  biolib/utils/zip/remote_zip.py,sha256=0wErYlxir5921agfFeV1xVjf29l9VNgGQvNlWOlj2Yc,23232
122
- pybiolib-1.2.111.dist-info/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
123
- pybiolib-1.2.111.dist-info/METADATA,sha256=aeFveQ_z6KQLLlNL25APEVxJ3bvLiZnQin9kh-zQgi0,1507
124
- pybiolib-1.2.111.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
125
- pybiolib-1.2.111.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
126
- pybiolib-1.2.111.dist-info/RECORD,,
122
+ pybiolib-1.2.115.dev1.dist-info/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
123
+ pybiolib-1.2.115.dev1.dist-info/METADATA,sha256=2LcF9GxcTuCfCBqfo1E6sFlueJyfdBRTTlezjjHoGTo,1512
124
+ pybiolib-1.2.115.dev1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
125
+ pybiolib-1.2.115.dev1.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
126
+ pybiolib-1.2.115.dev1.dist-info/RECORD,,