





def 		A_    (					_lowerCAmelCase					)						->			list:

 # bit count represents no. of bits in the gray code
 if bit_count < 0:
  raise ValueError("The given input must be positive"					)

 # get the generated string sequence
 UpperCamelCase     : Dict	     =       gray_code_sequence_string(_lowerCAmelCase					)
 #
 # convert them to integers
 for i in range(len(_lowerCAmelCase					)					):
  UpperCamelCase     : str	     =       int(sequence[i]							,       2					)

 return sequence



def 		A_    (					_lowerCAmelCase					)						->			list:

 # The approach is a recursive one
 # Base case achieved when either n = 0 or n=1
 if bit_count == 0:
  return ["0"]

 if bit_count == 1:
  return ["0", "1"]

 UpperCamelCase     : Dict	     =       1 << bit_count  # defines the length of the sequence
 # 1<< n is equivalent to 2^n

 # recursive answer will generate answer for n-1 bits
 UpperCamelCase     : Any	     =       gray_code_sequence_string(bit_count - 1					)

 UpperCamelCase     : Dict	     =       []

 # append 0 to first half of the smaller sequence generated
 for i in range(seq_len // 2					):
  UpperCamelCase     : int	     =       "0" + smaller_sequence[i]
  sequence.append(_lowerCAmelCase					)

 # append 1 to second half ... start from the end of the list
 for i in reversed(range(seq_len // 2					)					):
  UpperCamelCase     : Tuple	     =       "1" + smaller_sequence[i]
  sequence.append(_lowerCAmelCase					)

 return sequence


if __name__ == "__main__":
    import doctest

    doctest.testmod()







import sys

from .dependency_versions_table import deps
from .utils.versions import require_version, require_version_core


# define which module versions we always want to check at run time
# (usually the ones defined in `install_requires` in setup.py)
#
# order specific notes:
# - tqdm must be checked before tokenizers

__lowerCamelCase	:					Optional[int]			  =					"""python tqdm regex requests packaging filelock numpy tokenizers""".split()
if sys.version_info < (3, 7):
    pkgs_to_check_at_runtime.append("""dataclasses""")
if sys.version_info < (3, 8):
    pkgs_to_check_at_runtime.append("""importlib_metadata""")

for pkg in pkgs_to_check_at_runtime:
    if pkg in deps:
        if pkg == "tokenizers":
            # must be loaded here, or else tqdm check may fail
            from .utils import is_tokenizers_available

            if not is_tokenizers_available():
                continue  # not required, check version only if installed

        require_version_core(deps[pkg])
    else:
        raise ValueError(f"""can't find {pkg} in {deps.keys()}, check dependency_versions_table.py""")



def 		A_    (					_lowerCAmelCase							,       _lowerCAmelCase=None					)						->			Optional[Any]:
 require_version(deps[pkg]							,       _lowerCAmelCase					)
