MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / read

Method read

gridfs/asynchronous/grid_file.py:1685–1699  ·  view source on GitHub ↗

Read at most `size` bytes from the file (less if there isn't enough data). The bytes are returned as an instance of :class:`bytes` If `size` is negative or omitted all data is read. :param size: the number of bytes to read .. versionchanged:: 3.8

(self, size: int = -1)

Source from the content-addressed store, hash-verified

1683 return b"".join(data)
1684
1685 async def read(self, size: int = -1) -> bytes:
1686 """Read at most `size` bytes from the file (less if there
1687 isn't enough data).
1688
1689 The bytes are returned as an instance of :class:`bytes`
1690 If `size` is negative or omitted all data is read.
1691
1692 :param size: the number of bytes to read
1693
1694 .. versionchanged:: 3.8
1695 This method now only checks for extra chunks after reading the
1696 entire file. Previously, this method would check for extra chunks
1697 on every call.
1698 """
1699 return await self._read_size_or_line(size=size)
1700
1701 def tell(self) -> int:
1702 """Return the current position of this file."""

Callers 15

test_basicMethod · 0.95
test_write_file_likeMethod · 0.95
test_closedMethod · 0.95
test_multi_chunk_fileMethod · 0.95
helperMethod · 0.95
test_seekMethod · 0.95
test_tellMethod · 0.95
test_multiple_readsMethod · 0.95
test_readlineMethod · 0.95
test_readlinesMethod · 0.95

Calls 1

_read_size_or_lineMethod · 0.95

Tested by 15

test_basicMethod · 0.76
test_write_file_likeMethod · 0.76
test_closedMethod · 0.76
test_multi_chunk_fileMethod · 0.76
helperMethod · 0.76
test_seekMethod · 0.76
test_tellMethod · 0.76
test_multiple_readsMethod · 0.76
test_readlineMethod · 0.76
test_readlinesMethod · 0.76