original_docstring: 
  		This function automatically detects the backend of the target app using a time-based approach.
  		Whichever backend detects the largest number of unique components in the same number of seconds is selected.
  		
docstring: This function automatically detects the backend of the target app using a time-based approach.
  Whichever backend detects the largest number of unique components in the same number of seconds is selected.
docstring_tokens: This function automatically detects the backend of the target app using a time - based approach . Whichever backend detects the largest number of unique components in the same number of seconds is selected .
code: def detectBackend(self):
  		"""
  		This function automatically detects the backend of the target app using a time-based approach.
  		Whichever backend detects the largest number of unique components in the same number of seconds is selected.
  		"""
  		# Let the user know we are detecting the backend
  		self.backendDetected.emit('detecting')
  
  		# Time to wait to collect components
  		waitTime = 3
  
  		# ---- UIA ---- #
  		app = Application(backend="uia")
  		app.setProcess(self._process)
  		appTimeStamp = app.getStartTime()
  		self._iteration = 0
  
  		endTime = time() + waitTime  # In waitTime seconds, stop the loop
  		while self._process.is_running():
  			if time() > endTime:
  				break
  
  			self._iteration += 1
  
  			if not self.isPlaying(): return 0
  
  			componentCount = 0
  			# work acts as a stack. Each element is a 2-tuple where the first element
  			# is a GUI component and the second element is the parent super token.
  			work = [(win, None) for win in app.windows()]
  			while len(work) > 0:
  				if time() > endTime:
  					break
  
  				if not self.isPlaying(): return 0
  
  				curComponent, parentSuperToken = work.pop()
  				if curComponent.friendly_class_name() not in Observer.ignoreTypes:
  					try:
  						token = Token.createToken(appTimeStamp, curComponent, captureImage=self.capturing)
  
  					# List boxes have a ton of children that we probably don't care about.
  					# There are probably other types like it where we just want to ignore the
  					# children. We can make this type of
  					# if token.type == "ListBox":
  					#     continue
  
  					except Token.CreationException as e:
  						continue
  
  					nextParentSuperToken = self.matchToSuperToken(token, parentSuperToken, detecting=True)
  					self._lastSuperTokenIterations[nextParentSuperToken] = self._iteration
  				else:
  					nextParentSuperToken = parentSuperToken
  
  				children = curComponent.children()
  				for child in children:
  					work.append((child, nextParentSuperToken))
  
  		uiaComps = len(self._childMapping)  # Number of unique components found
  		self._childMapping = {None: []}
  		self._lastSuperTokenIterations = {}
  
  		# ---- WIN32 ---- #
  		app = Application(backend="win32")
  		app.setProcess(self._process)
  		appTimeStamp = app.getStartTime()
  		self._iteration = 0
  
  		endTime = time() + waitTime  # In waitTime seconds, stop the loop
  		while self._process.is_running():
  			if time() > endTime:
  				break
  
  			self._iteration += 1
  
  			if not self.isPlaying(): return 0
  
  			componentCount = 0
  			# work acts as a stack. Each element is a 2-tuple where the first element
  			# is a GUI component and the second element is the parent super token.
  			work = [(win, None) for win in app.windows()]
  			while len(work) > 0:
  				if time() > endTime:
  					break
  
  				if not self.isPlaying(): return 0
  
  				curComponent, parentSuperToken = work.pop()
  				if curComponent.friendly_class_name() not in Observer.ignoreTypes:
  					try:
  						token = Token.createToken(appTimeStamp, curComponent, captureImage=self.capturing)
  
  					# List boxes have a ton of children that we probably don't care about.
  					# There are probably other types like it where we just want to ignore the
  					# children. We can make this type of
  					# if token.type == "ListBox":
  					#     continue
  
  					except Token.CreationException as e:
  						continue
  
  					nextParentSuperToken = self.matchToSuperToken(token, parentSuperToken, detecting=True)
  					self._lastSuperTokenIterations[nextParentSuperToken] = self._iteration
  				else:
  					nextParentSuperToken = parentSuperToken
  
  				children = curComponent.children()
  				for child in children:
  					work.append((child, nextParentSuperToken))
  
  		w32Comps = len(self._childMapping)
  		self._childMapping = {None: []}
  		self._lastSuperTokenIterations = {}
  
  		if uiaComps > w32Comps:
  			self._backend = 'uia'
  			self.backendDetected.emit('uia')
  		elif uiaComps < w32Comps:
  			self._backend = 'win32'
  			self.backendDetected.emit('win32')
  		else:
  			# If they detect the same amount, should probably rerun the test longer, but I doubt this will ever happen.
  			# Leaving to default as uia for now
  			self._backend = 'uia'
  			self.backendDetected.emit('uia')
code_tokens: def detectBackend ( self ) : self . backendDetected . emit ( 'detecting' ) waitTime = 3 app = Application ( backend = "uia" ) app . setProcess ( self . _process ) appTimeStamp = app . getStartTime ( ) self . _iteration = 0 endTime = time ( ) + waitTime while self . _process . is_running ( ) : if time ( ) > endTime : break self . _iteration += 1 if not self . isPlaying ( ) : return 0 componentCount = 0 work = [ ( win , None ) for win in app . windows ( ) ] while len ( work ) > 0 : if time ( ) > endTime : break if not self . isPlaying ( ) : return 0 curComponent , parentSuperToken = work . pop ( ) if curComponent . friendly_class_name ( ) not in Observer . ignoreTypes : try : token = Token . createToken ( appTimeStamp , curComponent , captureImage = self . capturing ) except Token . CreationException as e : continue nextParentSuperToken = self . matchToSuperToken ( token , parentSuperToken , detecting = True ) self . _lastSuperTokenIterations [ nextParentSuperToken ] = self . _iteration else : nextParentSuperToken = parentSuperToken children = curComponent . children ( ) for child in children : work . append ( ( child , nextParentSuperToken ) ) uiaComps = len ( self . _childMapping ) self . _childMapping = { None : [ ] } self . _lastSuperTokenIterations = { } app = Application ( backend = "win32" ) app . setProcess ( self . _process ) appTimeStamp = app . getStartTime ( ) self . _iteration = 0 endTime = time ( ) + waitTime while self . _process . is_running ( ) : if time ( ) > endTime : break self . _iteration += 1 if not self . isPlaying ( ) : return 0 componentCount = 0 work = [ ( win , None ) for win in app . windows ( ) ] while len ( work ) > 0 : if time ( ) > endTime : break if not self . isPlaying ( ) : return 0 curComponent , parentSuperToken = work . pop ( ) if curComponent . friendly_class_name ( ) not in Observer . ignoreTypes : try : token = Token . createToken ( appTimeStamp , curComponent , captureImage = self . capturing ) except Token . CreationException as e : continue nextParentSuperToken = self . matchToSuperToken ( token , parentSuperToken , detecting = True ) self . _lastSuperTokenIterations [ nextParentSuperToken ] = self . _iteration else : nextParentSuperToken = parentSuperToken children = curComponent . children ( ) for child in children : work . append ( ( child , nextParentSuperToken ) ) w32Comps = len ( self . _childMapping ) self . _childMapping = { None : [ ] } self . _lastSuperTokenIterations = { } if uiaComps > w32Comps : self . _backend = 'uia' self . backendDetected . emit ( 'uia' ) elif uiaComps < w32Comps : self . _backend = 'win32' self . backendDetected . emit ( 'win32' ) else : self . _backend = 'uia' self . backendDetected . emit ( 'uia' )
short_docstring: This function automatically detects the backend of the target app using a time-based approach.
short_docstring_tokens: This function automatically detects the backend of the target app using a time - based approach .
comment: """
  		This function automatically detects the backend of the target app using a time-based approach.
  		Whichever backend detects the largest number of unique components in the same number of seconds is selected.
  		"""$SEP$# Let the user know we are detecting the backend$SEP$# Time to wait to collect components$SEP$# ---- UIA ---- #$SEP$# In waitTime seconds, stop the loop$SEP$# work acts as a stack. Each element is a 2-tuple where the first element$SEP$# is a GUI component and the second element is the parent super token.$SEP$# List boxes have a ton of children that we probably don't care about.$SEP$# There are probably other types like it where we just want to ignore the$SEP$# children. We can make this type of$SEP$# if token.type == "ListBox":$SEP$#     continue$SEP$# Number of unique components found$SEP$# ---- WIN32 ---- #$SEP$# In waitTime seconds, stop the loop$SEP$# work acts as a stack. Each element is a 2-tuple where the first element$SEP$# is a GUI component and the second element is the parent super token.$SEP$# List boxes have a ton of children that we probably don't care about.$SEP$# There are probably other types like it where we just want to ignore the$SEP$# children. We can make this type of$SEP$# if token.type == "ListBox":$SEP$#     continue$SEP$# If they detect the same amount, should probably rerun the test longer, but I doubt this will ever happen.$SEP$# Leaving to default as uia for now