Esempio n. 1
0
 def descriptors(self):
     try:
         return [
             self.descriptor_table[code] for code in self.descriptor_codes
         ]
     except KeyError as e:
         raise KeyError("No descriptor for code " + int2fxy(e.args[0]))
Esempio n. 2
0
def _decode_descriptors_table(length, stream, descriptor_table):
    # length is remaining length of descriptor field in bytes
    n_read = 0
    codes = []
    while n_read + 2 <= length:
        codes.append(stream.readint(2))
        n_read += 2

    descriptors = []
    for code in codes:
        try:
            descriptors.append(descriptor_table[code])
        except KeyError as e:
            raise KeyError("Missing definition for descriptor " + int2fxy(code))

    # read final byte, since length of the section should be even and
    # descriptors start at odd offset
    stream.readbytes(length-n_read)
    return descriptors
Esempio n. 3
0
def _decode_descriptors_table(length, stream, descriptor_table):
    # length is remaining length of descriptor field in bytes
    n_read = 0
    codes = []
    while n_read + 2 <= length:
        codes.append(stream.readint(2))
        n_read += 2

    descriptors = []
    for code in codes:
        try:
            descriptors.append(descriptor_table[code])
        except KeyError as e:
            raise KeyError("Missing definition for descriptor " +
                           int2fxy(code))

    # read final byte, since length of the section should be even and
    # descriptors start at odd offset
    stream.readbytes(length - n_read)
    return descriptors
Esempio n. 4
0
 def descriptors(self):
     try:
         return [self.descriptor_table[code] for code in self.descriptor_codes]
     except KeyError as e:
         raise KeyError("No descriptor for code " + int2fxy(e.args[0]))