Best Python code snippet using fMBT_python
fmbtuinput.py
Source:fmbtuinput.py
...1008# Once the lock is released, the thread will quit without writing1009# anything to the eventQueue anymore.1010_g_recQL = {}1011_g_unfetchedEvents = []1012def queueEventsFromFiles(listOfFilenames, filterOpts):1013 global _g_recQL1014 for filename in listOfFilenames:1015 q = Queue.Queue()1016 l = thread.allocate_lock()1017 l.acquire()1018 if filename in _g_recQL:1019 # previous reader thread should quit1020 _g_recQL[filename][1].release()1021 thread.start_new_thread(1022 queueEventsFromFile, (filename, q, l, filterOpts))1023 _g_recQL[filename] = (q, l)1024def startQueueingEvents(filterOpts):1025 refreshDeviceInfo()1026 if len(_g_recQL) > 0:1027 # already queueing, restart1028 stopQueueingEvents()1029 if "device" in filterOpts:1030 deviceFiles = []1031 for n in filterOpts["device"]:1032 if n in _g_deviceNames:1033 deviceFiles.append(_g_deviceNames[n])1034 elif os.access(n, os.R_OK):1035 deviceFiles.append(n)1036 del filterOpts["device"]1037 else:1038 deviceFiles = glob.glob("/dev/input/event[0-9]*")1039 queueEventsFromFiles(deviceFiles, filterOpts)1040def stopQueueingEvents():1041 global _g_recQL1042 global _g_unfetchedEvents1043 for filename in _g_recQL:1044 _g_recQL[filename][1].release()1045 _g_unfetchedEvents = fetchQueuedEvents()1046 _g_recQL = {}1047def fetchQueuedEvents():1048 global _g_unfetchedEvents1049 if len(_g_recQL) == 0: # no active recording1050 rv = _g_unfetchedEvents1051 _g_unfetchedEvents = []1052 return rv1053 else: # events are being recorded...
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!!