# Path: pycdlib/pycdlibexception.py
# class PyCdlibException(Exception):
# class PyCdlibInternalError(PyCdlibException):
# class PyCdlibInvalidInput(PyCdlibException):
# class PyCdlibInvalidISO(PyCdlibException):
#     def __init__(self, msg):
#     def __init__(self, msg):
#     def __init__(self, msg):
#     def __init__(self, msg):
# 
# Path: pycdlib/utils.py
# def swab_32bit(x):
# def swab_16bit(x):
# def ceiling_div(numer, denom):
# def copy_data(data_length, blocksize, infp, outfp):
# def encode_space_pad(instr, length, encoding):
# def normpath(path):
# def gmtoffset_from_tm(tm, local):
# def zero_pad(fp, data_size, pad_size):
# def starts_with_slash(path):
# def split_path(iso_path):
# def file_object_supports_binary(fp):
# def truncate_basename(basename, iso_level, is_dir):
# def mangle_file_for_iso9660(orig, iso_level):
# def mangle_dir_for_iso9660(orig, iso_level):
#     def __init__(self, target):
#     def __enter__(self):
#     def __exit__(self, *_, **__):
#     def __len__(self):
#     def dispose(self):
#     def get_target(self):
#     def get_handle(self):
#     def get_geometry(self):
#     def tell(self):
#     def _tell(self):
#     def seek(self, offset, whence=os.SEEK_SET):
#     def read(self, size=-1):
#     def align(self, size, to=None):
# class Win32RawDevice:


import os
import struct
from pycdlib import pycdlibexception
from pycdlib import utils
    from typing import List, Union  # NOQA pylint: disable=unused-import
    from pycdlib import dr  # NOQA pylint: disable=unused-import
    from pycdlib import headervd  # NOQA pylint: disable=unused-import
    from pycdlib import inode    # NOQA pylint: disable=unused-import
    from pycdlib import udf as udfmod  # NOQA pylint: disable=unused-import
            adder = short
            if short & (1 << 15):
                adder |= 0xffff0000
            csum += adder
        return (-csum) & 0xffff

    def parse(self, valstr):
        # type: (bytes) -> None
        """
        Parse an El Torito Validation Entry out of a string.

        Parameters:
         valstr - The string to parse the El Torito Validation Entry out of.
        Returns:
         Nothing.
        """
        if self._initialized:
            raise pycdlibexception.PyCdlibInternalError('El Torito Validation Entry already initialized')

        (header_id, self.platform_id, reserved_unused, self.id_string,
         self.checksum, keybyte1,
         keybyte2) = struct.unpack_from(self.FMT, valstr, 0)

        if header_id != 1:
            raise pycdlibexception.PyCdlibInvalidISO('El Torito Validation entry header ID not 1')

        if self.platform_id not in (0, 1, 2, 0xef):
            raise pycdlibexception.PyCdlibInvalidISO('El Torito Validation entry platform ID not valid')

        if keybyte1 != 0x55:

# Path: pycdlib/pycdlibexception.py
# class PyCdlibException(Exception):
# class PyCdlibInternalError(PyCdlibException):
# class PyCdlibInvalidInput(PyCdlibException):
# class PyCdlibInvalidISO(PyCdlibException):
#     def __init__(self, msg):
#     def __init__(self, msg):
#     def __init__(self, msg):
#     def __init__(self, msg):
# 
# Path: pycdlib/utils.py
# def swab_32bit(x):
# def swab_16bit(x):
# def ceiling_div(numer, denom):
# def copy_data(data_length, blocksize, infp, outfp):
# def encode_space_pad(instr, length, encoding):
# def normpath(path):
# def gmtoffset_from_tm(tm, local):
# def zero_pad(fp, data_size, pad_size):
# def starts_with_slash(path):
# def split_path(iso_path):
# def file_object_supports_binary(fp):
# def truncate_basename(basename, iso_level, is_dir):
# def mangle_file_for_iso9660(orig, iso_level):
# def mangle_dir_for_iso9660(orig, iso_level):
#     def __init__(self, target):
#     def __enter__(self):
#     def __exit__(self, *_, **__):
#     def __len__(self):
#     def dispose(self):
#     def get_target(self):
#     def get_handle(self):
#     def get_geometry(self):
#     def tell(self):
#     def _tell(self):
#     def seek(self, offset, whence=os.SEEK_SET):
#     def read(self, size=-1):
#     def align(self, size, to=None):
# class Win32RawDevice:


# Path: pycdlib/eltorito.py
import os
import struct
from pycdlib import pycdlibexception
from pycdlib import utils
    from typing import List, Union  # NOQA pylint: disable=unused-import
    from pycdlib import dr  # NOQA pylint: disable=unused-import
    from pycdlib import headervd  # NOQA pylint: disable=unused-import
    from pycdlib import inode    # NOQA pylint: disable=unused-import
    from pycdlib import udf as udfmod  # NOQA pylint: disable=unused-import

            adder = short
            if short & (1 << 15):
                adder |= 0xffff0000
            csum += adder
        return (-csum) & 0xffff

    def parse(self, valstr):
        # type: (bytes) -> None
        """
        Parse an El Torito Validation Entry out of a string.

        Parameters:
         valstr - The string to parse the El Torito Validation Entry out of.
        Returns:
         Nothing.
        """
        if self._initialized:
            raise pycdlibexception.PyCdlibInternalError('El Torito Validation Entry already initialized')

        (header_id, self.platform_id, reserved_unused, self.id_string,
         self.checksum, keybyte1,
         keybyte2) = struct.unpack_from(self.FMT, valstr, 0)

        if header_id != 1:
            raise pycdlibexception.PyCdlibInvalidISO('El Torito Validation entry header ID not 1')

        if self.platform_id not in (0, 1, 2, 0xef):
            raise pycdlibexception.PyCdlibInvalidISO('El Torito Validation entry platform ID not valid')

        if keybyte1 != 0x55:

            raise pycdlibexception.PyCdlibInvalidISO('El Torito Validation entry first keybyte not 0x55')