



'''simple docstring'''




from .imports import is_tqdm_available


if is_tqdm_available():
						from tqdm.auto import tqdm as _tqdm

from ..state import PartialState


def        lowerCAmelCase_     (			_lowerCamelCase:     bool = True ,   *_lowerCamelCase:     Optional[int] ,   **_lowerCamelCase:     Optional[Any]      ):
		if not is_tqdm_available():
				raise ImportError("""Accelerate's `tqdm` module requires `tqdm` to be installed. Please run `pip install tqdm`."""      )
		__SCREAMING_SNAKE_CASE :	Any					 =	False
		if main_process_only:
				__SCREAMING_SNAKE_CASE :	Optional[int]					 =	PartialState().local_process_index == 0
		return _tqdm(*_lowerCamelCase ,   **_lowerCamelCase ,   disable=_lowerCamelCase      )




'''simple docstring'''




def        lowerCAmelCase_     (			_lowerCamelCase:     int      ):
		if number > 0:
				raise ValueError("""input must be a negative integer"""      )
		__SCREAMING_SNAKE_CASE :	str					 =	len(bin(_lowerCamelCase      )[3:]      )
		__SCREAMING_SNAKE_CASE :	Any					 =	bin(abs(_lowerCamelCase      ) - (1 << binary_number_length)      )[3:]
		__SCREAMING_SNAKE_CASE :	Optional[int]					 =	(
		    (
		        """1"""
		        + """0""" * (binary_number_length - len(_lowerCamelCase      ))
		        + twos_complement_number
		    )
		    if number < 0
		    else """0"""
		)
		return "0b" + twos_complement_number


if __name__ == "__main__":
						import doctest

						doctest.testmod()