def _read_pnm_header(self, data):
bpm = data[<NUM_LIT:1>:<NUM_LIT:2>] in b"<STR_LIT>"<EOL>regroups = re.search(b"<STR_LIT>".join((<EOL>b"<STR_LIT>",<EOL>b"<STR_LIT>",<EOL>b"<STR_LIT>" * (not bpm),<EOL>b"<STR_LIT>")), data).groups() + (<NUM_LIT:1>, ) * bpm<EOL>self.header = regroups[<NUM_LIT:0>]<EOL>self.magicnum = regroups[<NUM_LIT:1>]<EOL>self.width = int(regroups[<NUM_LIT:2>])<EOL>self.height = int(regroups[<NUM_LIT:3>])<EOL>self.maxval = int(regroups[<NUM_LIT:4>])<EOL>self.depth = <NUM_LIT:3> if self.magicnum in b"<STR_LIT>" else <NUM_LIT:1><EOL>self.tupltypes = [self._types[self.magicnum]]<EOL>
Read PNM header and initialize instance.