Tests/scripts/hook_validations/image.py
def oversize_image(self):
        """Check if the image if over sized, bigger than IMAGE_MAX_SIZE"""
        if re.match(IMAGE_REGEX, self.file_path, re.IGNORECASE):
            if os.path.getsize(self.file_path) > self.IMAGE_MAX_SIZE:  # disable-secrets-detection
                print_error("{} has too large logo, please update the logo to be under 10kB".format(self.file_path))
                self._is_valid = False

        else:
            data_dictionary = get_yaml(self.file_path)

            if not data_dictionary:
                return

            image = data_dictionary.get('image', '')

            if ((len(image) - 22) / 4.0) * 3 > self.IMAGE_MAX_SIZE:  # disable-secrets-detection
                print_error("{} has too large logo, please update the logo to be under 10kB".format(self.file_path))
                self._is_valid = False
Check if the image if over sized, bigger than IMAGE_MAX_SIZE
Check if the image if over sized, bigger than IMAGE_MAX_SIZE
Check if the image if over sized bigger than IMAGE_MAX_SIZE
def oversize_image(self):
        if re.match(IMAGE_REGEX, self.file_path, re.IGNORECASE):
            if os.path.getsize(self.file_path) > self.IMAGE_MAX_SIZE:  
                print_error("{} has too large logo, please update the logo to be under 10kB".format(self.file_path))
                self._is_valid = False
        else:
            data_dictionary = get_yaml(self.file_path)
            if not data_dictionary:
                return
            image = data_dictionary.get('image', '')
            if ((len(image) - 22) / 4.0) * 3 > self.IMAGE_MAX_SIZE:  
                print_error("{} has too large logo, please update the logo to be under 10kB".format(self.file_path))
                self._is_valid = False
def oversize_image ( self ) : if re . match ( IMAGE_REGEX , self . file_path , re . IGNORECASE ) : if os . path . getsize ( self . file_path ) > self . IMAGE_MAX_SIZE : print_error ( "{} has too large logo, please update the logo to be under 10kB" . format ( self . file_path ) ) self . _is_valid = False else : data_dictionary = get_yaml ( self . file_path ) if not data_dictionary : return image = data_dictionary . get ( 'image' , '' ) if ( ( len ( image ) - 22 ) / 4.0 ) * 3 > self . IMAGE_MAX_SIZE : print_error ( "{} has too large logo, please update the logo to be under 10kB" . format ( self . file_path ) ) self . _is_valid = False
Check if the image if over sized, bigger than IMAGE_MAX_SIZE
Check if the image if over sized bigger than IMAGE_MAX_SIZE
"""Check if the image if over sized, bigger than IMAGE_MAX_SIZE""" # disable-secrets-detection # disable-secrets-detection
self