def deserialize_file_header(self, fd): r"""Deserialize the header information from the file and update the serializer. Args: fd (file): File containing header. """ fd.seek(0) serialize.discover_header(fd, self, newline=self.newline, comment=self.comment, delimiter=self.delimiter)
def read_header(self): r"""Read header lines from the file and update serializer info.""" if self.header_was_read: return pos = self.record_position() self.change_position(0) serialize.discover_header(self.fd, self.serializer, newline=self.newline, comment=self.comment, delimiter=self.delimiter) self.change_position(*pos) self.header_was_read = True