
'''simple docstring'''

import os
import string
import sys


__snake_case:  List[str]								=			1 << 8

__snake_case:  List[Any]								=			{
    "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,
}

__snake_case:  int								=			KEYMAP["up"]
__snake_case:  List[Any]								=			KEYMAP["left"]

if sys.platform == "win32":
    __snake_case:  str								=			[]
    __snake_case:  List[str]								=			{
        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):
    __snake_case:  str								=			ord(str(i))






def 	_snake_case						(      ):
  """simple docstring"""







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

    a_      :	Optional[Any]      =							"""mbcs"""
    # Flush the keyboard buffer
    while msvcrt.kbhit():
      msvcrt.getch()
    if len(A_   ) == 0:
      # Read the keystroke
      a_      :	Dict      =							msvcrt.getch()

      # If it is a prefix char, get second part
      if ch in (b"\x00", b"\xe0"):
        a_      :	Tuple      =							ch + msvcrt.getch()
        # Translate actual Win chars to bullet char types
        try:
          a_      :	Optional[Any]      =							chr(WIN_KEYMAP[cha]   )
          WIN_CH_BUFFER.append(chr(KEYMAP["""mod_int"""]   )   )
          WIN_CH_BUFFER.append(A_   )
          if ord(A_   ) 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_      :	Optional[int]      =							chr(KEYMAP["""esc"""]   )
        except KeyError:
          a_      :	List[Any]      =							cha[1]
      else:
        a_      :	int      =							ch.decode(A_   )
    else:
      a_      :	Any      =							WIN_CH_BUFFER.pop(0   )
  elif os.name == "posix":
    import termios
    import tty

    a_      :	Union[str, Any]      =							sys.stdin.fileno()
    a_      :	int      =							termios.tcgetattr(A_   )
    try:
      tty.setraw(A_   )
      a_      :	str      =							sys.stdin.read(1   )
    finally:
      termios.tcsetattr(A_     ,		termios.TCSADRAIN     ,		A_   )
  return ch






def 	_snake_case						(      ):
  """simple docstring"""







  a_      :	Dict      =							get_raw_chars()
  if ord(A_   ) in [KEYMAP["interrupt"], KEYMAP["newline"]]:
    return char

  elif ord(A_   ) == KEYMAP["esc"]:
    a_      :	int      =							get_raw_chars()
    if ord(A_   ) == KEYMAP["mod_int"]:
      a_      :	List[Any]      =							get_raw_chars()
      if ord(A_   ) >= KEYMAP["arrow_begin"] - ARROW_KEY_FLAG and ord(A_   ) <= KEYMAP["arrow_end"] - ARROW_KEY_FLAG:
        return chr(ord(A_   ) + ARROW_KEY_FLAG   )
      else:
        return KEYMAP["undefined"]
    else:
      return get_raw_chars()

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




'''simple docstring'''

import copy
from dataclasses import dataclass, field
from typing import ClassVar, Dict

from ..features import Audio, Features, Value
from .base import TaskTemplate


@dataclass(frozen=lowerCAmelCase__    )
class  _UpperCAmelCase ( lowerCAmelCase__    ):

     """simple docstring"""

     a_    	=					field(default="automatic-speech-recognition"	,metadata={"include_in_asdict_even_if_is_default": True}    )
     a_    	=					Features({"audio": Audio()}    )
     a_    	=					Features({"transcription": Value("string"    )}    )
     a_    	=					"audio"
     a_    	=					"transcription"


     def 							_lowerCAmelCase  (      self							,		lowerCAmelCase_ ):

       '''simple docstring'''

       if self.audio_column not in features:
         raise ValueError(f'''Column {self.audio_column} is not present in features.''' )
       if not isinstance(features[self.audio_column]							,		lowerCAmelCase_ ):
         raise ValueError(f'''Column {self.audio_column} is not an Audio type.''' )
       a_      :	int      =							copy.deepcopy(self )
       a_      :	Optional[int]      =							self.input_schema.copy()
       a_      :	Any      =							features[self.audio_column]
       a_      :	Any      =							input_schema
       return task_template






     @property
     def 							_lowerCAmelCase  (      self ):

       '''simple docstring'''

       return {self.audio_column: "audio", self.transcription_column: "transcription"}


