本文整理汇总了Python中scanner.Scanner.loop方法的典型用法代码示例。如果您正苦于以下问题:Python Scanner.loop方法的具体用法?Python Scanner.loop怎么用?Python Scanner.loop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scanner.Scanner
的用法示例。
在下文中一共展示了Scanner.loop方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from scanner import Scanner [as 别名]
# 或者: from scanner.Scanner import loop [as 别名]
def run(sniffer_instance=None, wait_time=0.5, clear=True, args=(), debug=False):
"""
Runs the auto tester loop. Internally, the runner instanciates the sniffer_cls and
scanner class.
``sniffer_instance`` The class to run. Usually this is set to but a subclass of scanner.
Defaults to Sniffer. Sniffer class documentation for more information.
``wait_time`` The time, in seconds, to wait between polls. This is dependent on
the underlying scanner implementation. OS-specific libraries may choose
to ignore this parameter. Defaults to 0.5 seconds.
``clear`` Boolean. Set to True to clear the terminal before running the sniffer,
(alias, the unit tests). Defaults to True.
``args`` The arguments to pass to the sniffer/test runner. Defaults to ().
``debug`` Boolean. Sets the scanner and sniffer in debug mode, printing more internal
information. Defaults to False (and should usually be False).
"""
if sniffer_instance is None:
sniffer_instance = ScentSniffer()
if debug:
scanner = Scanner(('.',), logger=sys.stdout)
else:
scanner = Scanner(('.',))
#sniffer = sniffer_cls(tuple(args), clear, debug)
sniffer_instance.set_up(tuple(args), clear, debug)
sniffer_instance.observe_scanner(scanner)
scanner.loop(wait_time)
示例2: Scanner
# 需要导入模块: from scanner import Scanner [as 别名]
# 或者: from scanner.Scanner import loop [as 别名]
import sys
from scanner import Scanner
import settings
scanner = Scanner(
camera_index=settings.CAMERA_INDEX,
fov=settings.FOV,
laser_threshold=settings.LASER_THRESHOLD,
rotation_step=settings.ROTATION_STEP,
scale=settings.SCALE,
device=sys.argv[1]
)
scanner.loop()