





import os
import string
import sys


__A							:			Optional[Any]         =			1 << 8

__A							:			List[str]         =			{
    "tab": ord("\t"),
    "newline": ord("\r"),
    "esc": 27,
    "up": 65 + ARROW_KEY_FLAG,
    "down": 66 + ARROW_KEY_FLAG,
    "right": 67 + ARROW_KEY_FLAG,
    "left": 68 + ARROW_KEY_FLAG,
    "mod_int": 91,
    "undefined": sys.maxsize,
    "interrupt": 3,
    "insert": 50,
    "delete": 51,
    "pg_up": 53,
    "pg_down": 54,
}

__A							:			Any         =			KEYMAP["up"]
__A							:			Dict         =			KEYMAP["left"]

if sys.platform == "win32":
 __A							:			Dict         =			[]
 __A							:			Any         =			{
     B"\xe0H": KEYMAP["up"] - ARROW_KEY_FLAG,
     B"\x00H": KEYMAP["up"] - ARROW_KEY_FLAG,
     B"\xe0P": KEYMAP["down"] - ARROW_KEY_FLAG,
     B"\x00P": KEYMAP["down"] - ARROW_KEY_FLAG,
     B"\xe0M": KEYMAP["right"] - ARROW_KEY_FLAG,
     B"\x00M": KEYMAP["right"] - ARROW_KEY_FLAG,
     B"\xe0K": KEYMAP["left"] - ARROW_KEY_FLAG,
     B"\x00K": KEYMAP["left"] - ARROW_KEY_FLAG,
 }

for i in range(10):
 __A							:			Optional[int]         =			ord(str(i))





def 				__lowerCAmelCase(       )							-> Dict:




    """simple docstring"""




    if os.name == "nt":
        import msvcrt

        _A     =							'mbcs'
        # Flush the keyboard buffer
        while msvcrt.kbhit():
            msvcrt.getch()
        if len(_SCREAMING_SNAKE_CASE				) == 0:
            # Read the keystroke
            _A     =							msvcrt.getch()

            # If it is a prefix char, get second part
            if ch in (b"\x00", b"\xe0"):
                _A     =							ch + msvcrt.getch()
                # Translate actual Win chars to bullet char types
                try:
                    _A     =							chr(WIN_KEYMAP[cha]				)
                    WIN_CH_BUFFER.append(chr(KEYMAP['mod_int']				)				)
                    WIN_CH_BUFFER.append(_SCREAMING_SNAKE_CASE				)
                    if ord(_SCREAMING_SNAKE_CASE				) in (
                        KEYMAP["insert"] - 1 << 9,
                        KEYMAP["delete"] - 1 << 9,
                        KEYMAP["pg_up"] - 1 << 9,
                        KEYMAP["pg_down"] - 1 << 9,
                    ):
                        WIN_CH_BUFFER.append(chr(126				)				)
                    _A     =							chr(KEYMAP['esc']				)
                except KeyError:
                    _A     =							cha[1]
            else:
                _A     =							ch.decode(_SCREAMING_SNAKE_CASE				)
        else:
            _A     =							WIN_CH_BUFFER.pop(0				)
    elif os.name == "posix":
        import termios
        import tty

        _A     =							sys.stdin.fileno()
        _A     =							termios.tcgetattr(_SCREAMING_SNAKE_CASE				)
        try:
            tty.setraw(_SCREAMING_SNAKE_CASE				)
            _A     =							sys.stdin.read(1				)
        finally:
            termios.tcsetattr(_SCREAMING_SNAKE_CASE							,     termios.TCSADRAIN							,     _SCREAMING_SNAKE_CASE				)
    return ch





def 				__lowerCAmelCase(       )							-> Union[str, Any]:




    """simple docstring"""




    _A     =							get_raw_chars()
    if ord(_SCREAMING_SNAKE_CASE				) in [KEYMAP["interrupt"], KEYMAP["newline"]]:
        return char

    elif ord(_SCREAMING_SNAKE_CASE				) == KEYMAP["esc"]:
        _A     =							get_raw_chars()
        if ord(_SCREAMING_SNAKE_CASE				) == KEYMAP["mod_int"]:
            _A     =							get_raw_chars()
            if ord(_SCREAMING_SNAKE_CASE				) >= KEYMAP["arrow_begin"] - ARROW_KEY_FLAG and ord(_SCREAMING_SNAKE_CASE				) <= KEYMAP["arrow_end"] - ARROW_KEY_FLAG:
                return chr(ord(_SCREAMING_SNAKE_CASE				) + ARROW_KEY_FLAG				)
            else:
                return KEYMAP["undefined"]
        else:
            return get_raw_chars()

    else:
        if char in string.printable:
            return char
        else:
            return KEYMAP["undefined"]












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

__A							:			List[Any]         =			"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 				__lowerCAmelCase(       _SCREAMING_SNAKE_CASE							,     _SCREAMING_SNAKE_CASE=None				)							-> Union[str, Any]:




    """simple docstring"""




    require_version(deps[pkg]							,     _SCREAMING_SNAKE_CASE				)





