Best Python code snippet using pyatom_python
sphinx.py
Source: sphinx.py
...28 mods += f"{mod}+"29 # sock_keyboard.try_send(f"{mods}{keyboardCode}")30 # logger.info(f"hold_modifiers: {hold_modifiers}")31 if not hold_modifiers:32 releaseModifiers(False)33 sendGuiState(keyboardCode)34def activateModifier(modifier):35 modifiers.add(modifier)36 logger.info(f"mods: {'+'.join(modifiers)}")37 sendGuiState(modifier)38def holdModifiers():39 global hold_modifiers40 hold_modifiers = True41 logger.info(f"hold modifiers - mods: {'+'.join(modifiers)}")42 sendGuiState("hold")43def releaseModifiers(send=True):44 global hold_modifiers45 modifiers.clear()46 hold_modifiers = False47 if send:48 sendGuiState("release")49#50def pauseEngine():51 global pause_engine52 pause_engine = True53 logger.info("pause engine")54 sendGuiState("pause")55def continueEngine():56 global pause_engine57 pause_engine = False58 logger.info("continue engine")59 sendGuiState("continue")60#61def noop(phone="noop"):62 ()63def getPermissionFor(f, infoText):64 global confirm_function65 confirm_function = f66 sendGuiState(infoText)67 switchLm("confirmation")68#69def poweroff():70 noop()71 # cmdCommand = "shutdown -h now"72 # process = subprocess.Popen(cmdCommand.split(), stdout=subprocess.PIPE)73keyCodes = {74 "A": "a",75 "B": "b",76 "C": "c",77 "D": "d",78 "E": "e",79 "F": "f",80 "G": "g",81 "J": "j",82 "H": "h",83 "I": "i",84 "K": "k",85 "L": "l",86 "M": "m",87 "N": "n",88 "O": "o",89 "P": "p",90 "Q": "q",91 "R": "r",92 "S": "s",93 "T": "t",94 "U": "u",95 "V": "v",96 "W": "w",97 "X": "x",98 "Y": "y",99 "Z": "z",100 "ZERO": "0",101 "NULL": "0",102 "1": "1",103 "2": "2",104 "3": "3",105 "4": "4",106 "5": "5",107 "6": "6",108 "7": "7",109 "8": "8",110 "9": "9",111 "ROUND_LEFT": "(",112 "ROUND_RIGHT": ")",113 "TAG_LEFT": "<",114 "TAG_RIGHT": ">",115 "SQUARE_LEFT": "[",116 "SQUARE_RIGHT": "]",117 "ESCAPE": "escape",118 "UP": "up",119 "DOWN": "down",120 "LEFT": "left",121 "RIGHT": "right",122 "PAGE_UP": "pgup",123 "PAGE_DOWN": "pgdown",124 "START": "home",125 "END": "end",126 "SPACE": "space",127 "ENTER": "enter",128 "TAB": "tab",129 "DELETE": "del",130 "BACKSPACE": "backspace",131 # "SAY <TEXT>": Text("%(text)s",132 # "F ONE": "f1",133 # "F TWO": "f2",134 # "F THREE": "f3",135 # "F FOUR": "f4",136 # "F FIVE": "f5",137 # "F SIX": "f6",138 # "F SEVEN": "f7",139 # "F EIGHT": "f8",140 # "F NINE": "f9",141 # "F TEN": "f10",142 # "F ELEVEN": "f11",143 # "F TWELVE": "f12",144 # "DEGREE": "°",145 "CARET": "^",146 "CURLY_LEFT": "{",147 "CURLY_RIGHT": "}",148 "QUESTION": "?",149 "EXCLAMATION": "!",150 "BACK_TICK": "`",151 "PIPE": "|",152 "MINUS": "minus",153 "DOT": ".",154 "COMMA": "comma",155 "BACKSLASH": "\\",156 "UNDERSCORE": "_",157 "STAR": "*",158 "COLON": "colon",159 "SEMICOLON": ";",160 "AT": "@",161 "DOUBLE_QUOTE": '"',162 "SINGLE_QUOTE": "'",163 "HASH": "hash",164 "DOLLAR": "$",165 "EURO": "euro",166 "PERCENT": "percent",167 "SLASH": "slash",168 "AMPERSAND": "&",169 "EQUAL": "=",170 "PLUS": "+",171 "COMPOSE": "menu",172}173mapping = {}174for (key, keyValue) in keyCodes.items():175 mapping[key] = lambda keyValue=keyValue: sendKeyCode(keyValue)176mapping["WIN"] = lambda: activateModifier("win")177mapping["ALT"] = lambda: activateModifier("alt")178mapping["CONTROL"] = lambda: activateModifier("ctrl")179mapping["SHIFT"] = lambda: activateModifier("shift")180mapping["CUT"] = lambda: ()181mapping["COPY"] = lambda: ()182mapping["PASTE"] = lambda: ()183mapping["HOLD"] = lambda: holdModifiers()184mapping["RELEASE"] = lambda: releaseModifiers()185mapping["PAUSE"] = lambda: pauseEngine()186mapping["CONTINUE"] = lambda: continueEngine()187#188mapping["POWEROFF"] = lambda: getPermissionFor(poweroff, "poweroff system? [Yes|No]")189# noop190mapping["YES"] = lambda: noop()191mapping["NO"] = lambda: noop()192import os, sys193# https://github.com/bambocher/pocketsphinx-python194from pocketsphinx import LiveSpeech195# modelName = 'cmusphinx-voxforge-de-5.2'196# modelName = 'an4_sphere/an4'197modelName = "own"198# modelName = 'confirmation'...
keypress_actions.py
Source: keypress_actions.py
...183 self._doRelease()184 def _doRelease(self):185 for key_val in self._keyvalId:186 if key_val.modifiers:187 self._window.releaseModifiers(key_val.modVal)188 else:189 raise LdtpServerException("Unsupported modifiers")...
kaldi.py
Source: kaldi.py
...50 51 print(f"{mods}{keyboardCode}")52 print(f"hold_modifiers: {hold_modifiers}")53 if not hold_modifiers:54 releaseModifiers(False)55 sendGuiState(keyboardCode)56def activateModifier(modifier):57 modifiers.add(modifier)58 print(f"mods: {'+'.join(modifiers)}")59 sendGuiState(modifier)60def holdModifiers():61 global hold_modifiers62 hold_modifiers = True63 print(f"hold modifiers - mods: {'+'.join(modifiers)}")64 sendGuiState("hold")65def releaseModifiers(send = True):66 global hold_modifiers67 modifiers.clear()68 hold_modifiers = False69 if send:70 sendGuiState("release")71class ExampleDictationRule(dragonfly.MappingRule):72 73 keyCodes = {74 # "dictate <text>": dragonfly.Function(lambda keyValue=keyValue: print("I heard %r!" % str(text))),75 # "duplicate <n>": release + Key("c-c, c-v"),76 77 "escape": "escape",78 "up": "up",79 "down": "down",80 "left": "left",81 "right": "right",82 "page up": "pgup",83 "page down": "pgdown",84 "start": "home",85 "end": "end",86 "space": "space",87 "enter": "enter",88 "tab": "tab",89 "delete": "del",90 "back space": "backspace",91 # "say <text>": Text("%(text)s",92 "_a": "a",93 "b": "b",94 "c": "c",95 "d": "d",96 "e": "e",97 "f": "f",98 "g": "g",99 "j": "j",100 "ha": "h",101 "i": "i",102 "k": "k",103 "la": "l",104 "om": "m",105 "nay": "n",106 "_o": "o",107 "p": "p",108 "q": "q",109 "r": "r",110 "s": "s",111 "t": "t",112 "u": "u",113 "_v": "v",114 "_w": "w",115 "x": "x",116 "y": "y",117 "z": "z",118 # "F one": "f1",119 # "F two": "f2",120 # "F three": "f3",121 # "F four": "f4",122 # "F five": "f5",123 # "F six": "f6",124 # "F seven": "f7",125 # "F eight": "f8",126 # "F nine": "f9",127 # "F ten": "f10",128 # "F eleven": "f11",129 # "F twelve": "f12",130 # "degree": "°",131 "circus": "^",132 "curly left": "{",133 "curly right": "}",134 "question": "?",135 "exclamation": "!",136 "back tick": "`",137 "(vertical bar|pipe)": "|",138 "(dash|minus|hyphen)": "minus",139 "(dot|period)": ".",140 "comma": "comma",141 "backslash": "\\",142 "underscore": "_",143 "(star|asterisk)": "*",144 "colon": "colon",145 "semicolon": ";",146 "at": "@",147 "[double] quote": "\"",148 "single quote": "'",149 "hash": "hash",150 "dollar": "$",151 "euro": "euro",152 "percent": "percent",153 "slash": "slash",154 "ampersand": "&",155 "equal": "=",156 "plus": "+",157 "zero": "0",158 "one": "1",159 "two": "2",160 "three": "3",161 "four": "4",162 "five": "5",163 "six": "6",164 "seven": "7",165 "eight": "8",166 "nine": "9",167 "para left": "(",168 "para right": ")",169 "tag left": "<",170 "tag right": ">",171 "square left": "[",172 "square right": "]",173 }174 mapping = {}175 for (key, keyValue) in keyCodes.items():176 mapping[key] = dragonfly.Function(lambda keyValue=keyValue: sendKeyCode(keyValue))177 178 mapping[f"win"] = dragonfly.Function(lambda: activateModifier(f"win"))179 mapping[f"alter"] = dragonfly.Function(lambda: activateModifier(f"alt"))180 mapping[f"control"] = dragonfly.Function(lambda: activateModifier(f"ctrl"))181 mapping[f"shift"] = dragonfly.Function(lambda: activateModifier(f"shift"))182 mapping[f"hold"] = dragonfly.Function(lambda: holdModifiers())183 mapping[f"release"] = dragonfly.Function(lambda: releaseModifiers())184 # extras = [dragonfly.Dictation("text")]185# Load engine before instantiating rules/grammars!186# Set any configuration options here as keyw187# ord arguments.188engine = dragonfly.get_engine("kaldi",189 model_dir='kaldi_model',190 # tmp_dir='kaldi_tmp', # default for temporary directory191 # vad_aggressiveness=3, # default aggressiveness of VAD192 vad_padding_start_ms=5, # default ms of required silence surrounding VAD193 vad_padding_end_ms=5,194 # input_device_index=None, # set to an int to choose a non-default microphone195 # cloud_dictation=None, # set to 'gcloud' to use cloud dictation196 )197# Call connect() now that the engine configuration is set....
Check out the latest blogs from LambdaTest on this topic:
Pair testing can help you complete your testing tasks faster and with higher quality. But who can do pair testing, and when should it be done? And what form of pair testing is best for your circumstance? Check out this blog for more information on how to conduct pair testing to optimize its benefits.
We launched LT Browser in 2020, and we were overwhelmed by the response as it was awarded as the #5 product of the day on the ProductHunt platform. Today, after 74,585 downloads and 7,000 total test runs with an average of 100 test runs each day, the LT Browser has continued to help developers build responsive web designs in a jiffy.
To understand the agile testing mindset, we first need to determine what makes a team “agile.” To me, an agile team continually focuses on becoming self-organized and cross-functional to be able to complete any challenge they may face during a project.
The QA testing career includes following an often long, winding road filled with fun, chaos, challenges, and complexity. Financially, the spectrum is broad and influenced by location, company type, company size, and the QA tester’s experience level. QA testing is a profitable, enjoyable, and thriving career choice.
Dries Buytaert, a graduate student at the University of Antwerp, came up with the idea of developing something similar to a chat room. Moreover, he modified the conventional chat rooms into a website where his friends could post their queries and reply through comments. However, for this project, he thought of creating a temporary archive of posts.
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!