

'''simple docstring'''



import platform
from argparse import ArgumentParser

import huggingface_hub

from .. import __version__ as version
from ..utils import is_accelerate_available, is_torch_available, is_transformers_available, is_xformers_available
from . import BaseDiffusersCLICommand







def    a__       (  a__						):




     """simple docstring"""


     return EnvironmentCommand()







class 						lowerCAmelCase__   (      __UpperCAmelCase					):



 """simple docstring"""



 @staticmethod
 def       UpperCAmelCase__		(		__SCREAMING_SNAKE_CASE					:       ArgumentParser			)  -> Dict:


      """simple docstring"""




      __SCREAMING_SNAKE_CASE     =      parser.add_parser("""env"""			)
      download_parser.set_defaults(func=lowerCamelCase__			)
 def       UpperCAmelCase__		(		self					:       Optional[int]			)  -> Dict:


      """simple docstring"""




      __SCREAMING_SNAKE_CASE     =      huggingface_hub.__version__

      __SCREAMING_SNAKE_CASE     =      """not installed"""
      __SCREAMING_SNAKE_CASE     =      """NA"""
      if is_torch_available():
           import torch

           __SCREAMING_SNAKE_CASE     =      torch.__version__
           __SCREAMING_SNAKE_CASE     =      torch.cuda.is_available()

      __SCREAMING_SNAKE_CASE     =      """not installed"""
      if is_transformers_available():
           import transformers

           __SCREAMING_SNAKE_CASE     =      transformers.__version__

      __SCREAMING_SNAKE_CASE     =      """not installed"""
      if is_accelerate_available():
           import accelerate

           __SCREAMING_SNAKE_CASE     =      accelerate.__version__

      __SCREAMING_SNAKE_CASE     =      """not installed"""
      if is_xformers_available():
           import xformers

           __SCREAMING_SNAKE_CASE     =      xformers.__version__

      __SCREAMING_SNAKE_CASE     =      {
          """`diffusers` version""": version,
          """Platform""": platform.platform(),
          """Python version""": platform.python_version(),
          """PyTorch version (GPU?)""": f'{pt_version} ({pt_cuda_available})',
          """Huggingface_hub version""": hub_version,
          """Transformers version""": transformers_version,
          """Accelerate version""": accelerate_version,
          """xFormers version""": xformers_version,
          """Using GPU in script?""": """<fill in>""",
          """Using distributed or parallel set-up in script?""": """<fill in>""",
      }

      print("""\nCopy-and-paste the text below in your GitHub issue and FILL OUT the two last points.\n"""			)
      print(self.format_dict(lowerCamelCase__			)			)

      return info


 @staticmethod
 def       UpperCAmelCase__		(		__SCREAMING_SNAKE_CASE					:       Any			)  -> Any:


      """simple docstring"""




      return "\n".join([f'- {prop}: {val}' for prop, val in d.items()]			) + "\n"







"""simple docstring"""






def   a_						(					lowerCamelCase					,			lowerCamelCase       ):
				if a < 0 or b < 0:
								raise ValueError('the value of both inputs must be positive'       )

				UpperCAmelCase__             =							str(bin(lowerCamelCase       )       )[2:]  # remove the leading "0b"
				UpperCAmelCase__             =							str(bin(lowerCamelCase       )       )[2:]  # remove the leading "0b"

				UpperCAmelCase__             =							max(len(lowerCamelCase       )					,			len(lowerCamelCase       )       )

				return "0b" + "".join(
				    str(int(char_a == '1' and char_b == '1'       )       )
				    for char_a, char_b in zip(a_binary.zfill(lowerCamelCase       )					,			b_binary.zfill(lowerCamelCase       )       )       )


if __name__ == "__main__":
						import doctest

						doctest.testmod()



