glymur/jp2box.py
def _validate(self, writing=False):
        """Verify that the box obeys the specifications."""
        # channel type and association must be specified.
        if not ((len(self.index) == len(self.channel_type))
                and (len(self.channel_type) == len(self.association))):
            msg = (
                f"The length of the index ({len(self.index)}), "
                f"channel_type ({len(self.channel_type)}), "
                f"and association ({len(self.association)}) "
                f"inputs must be the same."
            )
            self._dispatch_validation_error(msg, writing=writing)

        # channel types must be one of 0, 1, 2, 65535
        if any(x not in [0, 1, 2, 65535] for x in self.channel_type):
            msg = (
                f"channel_type specified as {self.channel_type}, but all "
                f"values must be in the set of\n\n"
                f"    0     - colour image data for associated color\n"
                f"    1     - opacity\n"
                f"    2     - premultiplied opacity\n"
                f"    65535 - unspecified\n"
            )
            self._dispatch_validation_error(msg, writing=writing)
Verify that the box obeys the specifications.
Verify that the box obeys the specifications.
Verify that the box obeys the specifications .
def _validate(self, writing=False):
        if not ((len(self.index) == len(self.channel_type))
                and (len(self.channel_type) == len(self.association))):
            msg = (
                f"The length of the index ({len(self.index)}), "
                f"channel_type ({len(self.channel_type)}), "
                f"and association ({len(self.association)}) "
                f"inputs must be the same."
            )
            self._dispatch_validation_error(msg, writing=writing)
        if any(x not in [0, 1, 2, 65535] for x in self.channel_type):
            msg = (
                f"channel_type specified as {self.channel_type}, but all "
                f"values must be in the set of\n\n"
                f"    0     - colour image data for associated color\n"
                f"    1     - opacity\n"
                f"    2     - premultiplied opacity\n"
                f"    65535 - unspecified\n"
            )
            self._dispatch_validation_error(msg, writing=writing)
def _validate ( self , writing = False ) : if not ( ( len ( self . index ) == len ( self . channel_type ) ) and ( len ( self . channel_type ) == len ( self . association ) ) ) : msg = ( f"The length of the index ({len(self.index)}), " f"channel_type ({len(self.channel_type)}), " f"and association ({len(self.association)}) " f"inputs must be the same." ) self . _dispatch_validation_error ( msg , writing = writing ) if any ( x not in [ 0 , 1 , 2 , 65535 ] for x in self . channel_type ) : msg = ( f"channel_type specified as {self.channel_type}, but all " f"values must be in the set of\n\n" f"    0     - colour image data for associated color\n" f"    1     - opacity\n" f"    2     - premultiplied opacity\n" f"    65535 - unspecified\n" ) self . _dispatch_validation_error ( msg , writing = writing )
Verify that the box obeys the specifications.
Verify that the box obeys the specifications .
"""Verify that the box obeys the specifications.""" # channel type and association must be specified. # channel types must be one of 0, 1, 2, 65535
self
writing