Overwrite the bytes at the given file offset with the given string. Return True if successful, False otherwise. It can fail if the offset is outside the file's boundaries.
(self, offset, data)
| 6952 | return self.set_bytes_at_offset(offset, data) |
| 6953 | |
| 6954 | def set_bytes_at_offset(self, offset, data): |
| 6955 | """Overwrite the bytes at the given file offset with the given string. |
| 6956 | |
| 6957 | Return True if successful, False otherwise. It can fail if the |
| 6958 | offset is outside the file's boundaries. |
| 6959 | """ |
| 6960 | |
| 6961 | if not isinstance(data, bytes): |
| 6962 | raise TypeError("data should be of type: bytes") |
| 6963 | |
| 6964 | if 0 <= offset < len(self.__data__): |
| 6965 | self.set_data_bytes(offset, data) |
| 6966 | else: |
| 6967 | return False |
| 6968 | |
| 6969 | return True |
| 6970 | |
| 6971 | def set_data_bytes(self, offset: int, data: bytes): |
| 6972 | if not isinstance(self.__data__, bytearray): |
no test coverage detected