def _record_count(self):
self.filepath_or_buffer.seek(<NUM_LIT:0>, <NUM_LIT:2>)<EOL>total_records_length = (self.filepath_or_buffer.tell() -<EOL>self.record_start)<EOL>if total_records_length % <NUM_LIT> != <NUM_LIT:0>:<EOL><INDENT>warnings.warn("<STR_LIT>")<EOL><DEDENT>if self.record_length > <NUM_LIT>:<EOL><INDENT>self.filepath_or_buffer.seek(self.record_start)<EOL>return total_records_length // self.record_length<EOL><DEDENT>self.filepath_or_buffer.seek(-<NUM_LIT>, <NUM_LIT:2>)<EOL>last_card = self.filepath_or_buffer.read(<NUM_LIT>)<EOL>last_card = np.frombuffer(last_card, dtype=np.uint64)<EOL>ix = np.flatnonzero(last_card == <NUM_LIT>)<EOL>if len(ix) == <NUM_LIT:0>:<EOL><INDENT>tail_pad = <NUM_LIT:0><EOL><DEDENT>else:<EOL><INDENT>tail_pad = <NUM_LIT:8> * len(ix)<EOL><DEDENT>self.filepath_or_buffer.seek(self.record_start)<EOL>return (total_records_length - tail_pad) // self.record_length<EOL>
Get number of records in file.

This is maybe suboptimal because we have to seek to the end of
the file.

Side effect: returns file position to record_start.