
"""simple docstring"""
import unittest

from diffusers.pipelines.pipeline_utils import is_safetensors_compatible
class       lowerCAmelCase_		(				unittest.TestCase ):



							'''simple docstring'''





							def    A__						( self				)       ->  Any:
													__lowerCAmelCase     =  [
													    """safety_checker/pytorch_model.bin""",
													    """safety_checker/model.safetensors""",
													    """vae/diffusion_pytorch_model.bin""",
													    """vae/diffusion_pytorch_model.safetensors""",
													    """text_encoder/pytorch_model.bin""",
													    """text_encoder/model.safetensors""",
													    """unet/diffusion_pytorch_model.bin""",
													    """unet/diffusion_pytorch_model.safetensors""",
													]
													self.assertTrue(is_safetensors_compatible(__UpperCamelCase				)				)




							def    A__						( self				)       ->  List[Any]:
													__lowerCAmelCase     =  [
													    """unet/diffusion_pytorch_model.bin""",
													    """unet/diffusion_pytorch_model.safetensors""",
													]
													self.assertTrue(is_safetensors_compatible(__UpperCamelCase				)				)




							def    A__						( self				)       ->  Tuple:
													__lowerCAmelCase     =  [
													    """safety_checker/pytorch_model.bin""",
													    """safety_checker/model.safetensors""",
													    """vae/diffusion_pytorch_model.bin""",
													    """vae/diffusion_pytorch_model.safetensors""",
													    """text_encoder/pytorch_model.bin""",
													    """text_encoder/model.safetensors""",
													    """unet/diffusion_pytorch_model.bin""",
													    # Removed: 'unet/diffusion_pytorch_model.safetensors',
													]
													self.assertFalse(is_safetensors_compatible(__UpperCamelCase				)				)




							def    A__						( self				)       ->  Any:
													__lowerCAmelCase     =  [
													    """text_encoder/pytorch_model.bin""",
													    """text_encoder/model.safetensors""",
													]
													self.assertTrue(is_safetensors_compatible(__UpperCamelCase				)				)




							def    A__						( self				)       ->  List[str]:
													__lowerCAmelCase     =  [
													    """safety_checker/pytorch_model.bin""",
													    """safety_checker/model.safetensors""",
													    """vae/diffusion_pytorch_model.bin""",
													    """vae/diffusion_pytorch_model.safetensors""",
													    """text_encoder/pytorch_model.bin""",
													    # Removed: 'text_encoder/model.safetensors',
													    """unet/diffusion_pytorch_model.bin""",
													    """unet/diffusion_pytorch_model.safetensors""",
													]
													self.assertFalse(is_safetensors_compatible(__UpperCamelCase				)				)




							def    A__						( self				)       ->  List[str]:
													__lowerCAmelCase     =  [
													    """safety_checker/pytorch_model.fp16.bin""",
													    """safety_checker/model.fp16.safetensors""",
													    """vae/diffusion_pytorch_model.fp16.bin""",
													    """vae/diffusion_pytorch_model.fp16.safetensors""",
													    """text_encoder/pytorch_model.fp16.bin""",
													    """text_encoder/model.fp16.safetensors""",
													    """unet/diffusion_pytorch_model.fp16.bin""",
													    """unet/diffusion_pytorch_model.fp16.safetensors""",
													]
													__lowerCAmelCase     =  """fp16"""
													self.assertTrue(is_safetensors_compatible(__UpperCamelCase    ,				variant=__UpperCamelCase				)				)




							def    A__						( self				)       ->  Optional[Any]:
													__lowerCAmelCase     =  [
													    """unet/diffusion_pytorch_model.fp16.bin""",
													    """unet/diffusion_pytorch_model.fp16.safetensors""",
													]
													__lowerCAmelCase     =  """fp16"""
													self.assertTrue(is_safetensors_compatible(__UpperCamelCase    ,				variant=__UpperCamelCase				)				)




							def    A__						( self				)       ->  Optional[int]:
													# pass variant but use the non-variant filenames
													__lowerCAmelCase     =  [
													    """unet/diffusion_pytorch_model.bin""",
													    """unet/diffusion_pytorch_model.safetensors""",
													]
													__lowerCAmelCase     =  """fp16"""
													self.assertTrue(is_safetensors_compatible(__UpperCamelCase    ,				variant=__UpperCamelCase				)				)




							def    A__						( self				)       ->  List[str]:
													__lowerCAmelCase     =  [
													    """safety_checker/pytorch_model.fp16.bin""",
													    """safety_checker/model.fp16.safetensors""",
													    """vae/diffusion_pytorch_model.fp16.bin""",
													    """vae/diffusion_pytorch_model.fp16.safetensors""",
													    """text_encoder/pytorch_model.fp16.bin""",
													    """text_encoder/model.fp16.safetensors""",
													    """unet/diffusion_pytorch_model.fp16.bin""",
													    # Removed: 'unet/diffusion_pytorch_model.fp16.safetensors',
													]
													__lowerCAmelCase     =  """fp16"""
													self.assertFalse(is_safetensors_compatible(__UpperCamelCase    ,				variant=__UpperCamelCase				)				)




							def    A__						( self				)       ->  Optional[int]:
													__lowerCAmelCase     =  [
													    """text_encoder/pytorch_model.fp16.bin""",
													    """text_encoder/model.fp16.safetensors""",
													]
													__lowerCAmelCase     =  """fp16"""
													self.assertTrue(is_safetensors_compatible(__UpperCamelCase    ,				variant=__UpperCamelCase				)				)




							def    A__						( self				)       ->  int:
													# pass variant but use the non-variant filenames
													__lowerCAmelCase     =  [
													    """text_encoder/pytorch_model.bin""",
													    """text_encoder/model.safetensors""",
													]
													__lowerCAmelCase     =  """fp16"""
													self.assertTrue(is_safetensors_compatible(__UpperCamelCase    ,				variant=__UpperCamelCase				)				)




							def    A__						( self				)       ->  Optional[Any]:
													__lowerCAmelCase     =  [
													    """safety_checker/pytorch_model.fp16.bin""",
													    """safety_checker/model.fp16.safetensors""",
													    """vae/diffusion_pytorch_model.fp16.bin""",
													    """vae/diffusion_pytorch_model.fp16.safetensors""",
													    """text_encoder/pytorch_model.fp16.bin""",
													    # 'text_encoder/model.fp16.safetensors',
													    """unet/diffusion_pytorch_model.fp16.bin""",
													    """unet/diffusion_pytorch_model.fp16.safetensors""",
													]
													__lowerCAmelCase     =  """fp16"""
													self.assertFalse(is_safetensors_compatible(__UpperCamelCase    ,				variant=__UpperCamelCase				)				)





import math
import sys






def  lowerCamelCase_	(      lowerCAmelCase__	:	str				)       ->							str:

							'''simple docstring'''






							A      						=    ''
							try:
														with open(lowerCAmelCase__			,	'rb'				) as binary_file:
																					A      						=    binary_file.read()
														for dat in data:
																					A      						=    F'''{dat:08b}'''
																					result += curr_byte
														return result
							except OSError:
														print('File not accessible'				)
														sys.exit()






def  lowerCamelCase_	(      lowerCAmelCase__	:	str				)       ->							str:

							'''simple docstring'''






							A      						=    {'0': '0', '1': '1'}
							A						,   A      						=    '', ''
							A      						=    len(lowerCAmelCase__				)

							for i in range(len(lowerCAmelCase__				)				):
														curr_string += data_bits[i]
														if curr_string not in lexicon:
																					continue

														A      						=    lexicon[curr_string]
														result += last_match_id
														A      						=    last_match_id + '0'

														if math.loga(lowerCAmelCase__				).is_integer():
																					A      						=    {}
																					for curr_key in list(lowerCAmelCase__				):
																												A      						=    lexicon.pop(lowerCAmelCase__				)
																					A      						=    new_lex

														A      						=    last_match_id + '1'
														index += 1
														A      						=    ''
							return result






def  lowerCamelCase_	(      lowerCAmelCase__	:	str			,	lowerCAmelCase__	:	str				)       ->							None:

							'''simple docstring'''






							A      						=    8
							try:
														with open(lowerCAmelCase__			,	'wb'				) as opened_file:
																					A      						=    [
																					    to_write[i : i + byte_length]
																					    for i in range(0			,	len(lowerCAmelCase__				)			,	lowerCAmelCase__				)
																					]

																					if len(result_byte_array[-1]				) % byte_length == 0:
																												result_byte_array.append('10000000'				)
																					else:
																												result_byte_array[-1] += "1" + "0" * (
																												    byte_length - len(result_byte_array[-1]				) - 1
																												)

																					for elem in result_byte_array[:-1]:
																												opened_file.write(int(lowerCAmelCase__			,	2				).to_bytes(1			,	byteorder='big'				)				)
							except OSError:
														print('File not accessible'				)
														sys.exit()






def  lowerCamelCase_	(      lowerCAmelCase__	:	str				)       ->							str:

							'''simple docstring'''






							A      						=    0
							for letter in data_bits:
														if letter == "1":
																					break
														counter += 1

							A      						=    data_bits[counter:]
							A      						=    data_bits[counter + 1 :]
							return data_bits






def  lowerCamelCase_	(      lowerCAmelCase__	:	str			,	lowerCAmelCase__	:	str				)       ->							None:

							'''simple docstring'''






							A      						=    read_file_binary(lowerCAmelCase__				)
							A      						=    remove_prefix(lowerCAmelCase__				)
							A      						=    decompress_data(lowerCAmelCase__				)
							write_file_binary(lowerCAmelCase__			,	lowerCAmelCase__				)


if __name__ == "__main__":
				compress(sys.argv[1], sys.argv[2])