MCPcopy Create free account
hub / github.com/modelscope/modelscope / seek

Method seek

modelscope/hub/commit_scheduler.py:361–370  ·  view source on GitHub ↗

Seek to a position in the file, but never beyond size_limit.

(self, __offset: int, __whence: int = SEEK_SET)

Source from the content-addressed store, hash-verified

359 return self._file.tell()
360
361 def seek(self, __offset: int, __whence: int = SEEK_SET) -> int:
362 """Seek to a position in the file, but never beyond size_limit."""
363 if __whence == SEEK_END:
364 __offset = len(self) + __offset
365 __whence = SEEK_SET
366
367 pos = self._file.seek(__offset, __whence)
368 if pos > self._size_limit:
369 return self._file.seek(self._size_limit)
370 return pos
371
372 def read(self, __size: Optional[int] = -1) -> bytes:
373 """Read at most _size bytes from the current position."""

Callers 15

get_file_sizeFunction · 0.80
get_file_hashFunction · 0.80
from_fileobjMethod · 0.80
__post_init__Method · 0.80
as_fileMethod · 0.80
__getitem__Method · 0.80
http_get_model_fileFunction · 0.80
__call__Method · 0.80
load_video_llavaFunction · 0.80
__getitem__Method · 0.80
depthreadFunction · 0.80

Calls

no outgoing calls

Tested by 2

get_contentMethod · 0.64