MCPcopy
hub / github.com/PyMySQL/PyMySQL / read

Method read

pymysql/protocol.py:62–75  ·  view source on GitHub ↗

Read the first 'size' bytes in packet and advance cursor past them.

(self, size)

Source from the content-addressed store, hash-verified

60 return self._data
61
62 def read(self, size):
63 """Read the first 'size' bytes in packet and advance cursor past them."""
64 result = self._data[self._position : (self._position + size)]
65 if len(result) != size:
66 error = (
67 "Result length not requested length:\n"
68 f"Expected={size}. Actual={len(result)}. Position: {self._position}. Data Length: {len(self._data)}"
69 )
70 if DEBUG:
71 print(error)
72 self.dump()
73 raise AssertionError(error)
74 self._position += size
75 return result
76
77 def read_all(self):
78 """Read all remaining data in the packet.

Callers 1

Calls 1

dumpMethod · 0.95

Tested by

no test coverage detected