MCPcopy Create free account
hub / github.com/PyMySQL/PyMySQL / read

Method read

pymysql/protocol.py:61–74  ·  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

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

Callers 1

Calls 1

dumpMethod · 0.95

Tested by

no test coverage detected