



'''simple docstring'''





import os
import string
import sys


SCREAMING_SNAKE_CASE__												=     1 << 8

SCREAMING_SNAKE_CASE__												=     {
    "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,
}

SCREAMING_SNAKE_CASE__												=     KEYMAP["up"]
SCREAMING_SNAKE_CASE__												=     KEYMAP["left"]

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




def        lowerCamelCase  (				):





    '''simple docstring'''


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

        lowercase__		       =						"""mbcs"""
        # Flush the keyboard buffer
        while msvcrt.kbhit():
            msvcrt.getch()
        if len(_snake_case       ) == 0:
            # Read the keystroke
            lowercase__		       =						msvcrt.getch()

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

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




def        lowerCamelCase  (				):





    '''simple docstring'''


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

    elif ord(_snake_case       ) == KEYMAP["esc"]:
        lowercase__		       =						get_raw_chars()
        if ord(_snake_case       ) == KEYMAP["mod_int"]:
            lowercase__		       =						get_raw_chars()
            if ord(_snake_case       ) >= KEYMAP["arrow_begin"] - ARROW_KEY_FLAG and ord(_snake_case       ) <= KEYMAP["arrow_end"] - ARROW_KEY_FLAG:
                return chr(ord(_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"]









'''simple docstring'''





import unittest

from transformers import load_tool

from .test_tools_common import ToolTesterMixin


class 				snake_case (unittest.TestCase		,      UpperCamelCase   ):



       def 							_a      (				self      )  ->							List[str]:
           lowercase__		       =						load_tool("text-classification"      )
           self.tool.setup()
           lowercase__		       =						load_tool("text-classification"     ,remote=UpperCAmelCase_      )



       def 							_a      (				self      )  ->							Any:
           lowercase__		       =						self.tool("That's quite cool"     ,["positive", "negative"]      )
           self.assertEqual(UpperCAmelCase_     ,"positive"      )



       def 							_a      (				self      )  ->							Optional[int]:
           lowercase__		       =						self.remote_tool("That's quite cool"     ,["positive", "negative"]      )
           self.assertEqual(UpperCAmelCase_     ,"positive"      )



       def 							_a      (				self      )  ->							List[Any]:
           lowercase__		       =						self.tool(text="That's quite cool"     ,labels=["positive", "negative"]      )
           self.assertEqual(UpperCAmelCase_     ,"positive"      )







       def 							_a      (				self      )  ->							List[Any]:
           lowercase__		       =						self.remote_tool(text="That's quite cool"     ,labels=["positive", "negative"]      )
           self.assertEqual(UpperCAmelCase_     ,"positive"      )




