本文整理汇总了Python中Search.parse方法的典型用法代码示例。如果您正苦于以下问题:Python Search.parse方法的具体用法?Python Search.parse怎么用?Python Search.parse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Search
的用法示例。
在下文中一共展示了Search.parse方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: write
# 需要导入模块: import Search [as 别名]
# 或者: from Search import parse [as 别名]
def write():
#first finger scan
setBaud()
data = genImg.getHeader()
ser.write(bytearray(data));
time.sleep(1)
s = ser.read(ser.inWaiting())
print([hex(ord(c)) for c in s])
genImg.parse(s)
# generate character file of the finger image.
setBaud()
data = Img2Tz.getHeader(0x01)
ser.write(bytearray(data));
time.sleep(1)
s = ser.read(ser.inWaiting())
print([hex(ord(c)) for c in s])
Img2Tz.parse(s)
setBaud()
data = Search.getHeader(0x01, 0x0000, 0x0064)
ser.write(bytearray(data));
time.sleep(1)
s = ser.read(ser.inWaiting())
print([hex(ord(c)) for c in s])
print Search.parse(s)
示例2: countyMapperMenu
# 需要导入模块: import Search [as 别名]
# 或者: from Search import parse [as 别名]
def countyMapperMenu(caches):
#Filters caches given by BC, then tries to assign them to a regional district of BC.
#Menu to choose province
print "Will search BC Caches and try to assign counties"
#get caches in BC currently without a county
(options, args, search) = Search.parse('-s "British Columbia" -O C', False)
cacheList = Search.parseOptions(caches, options)
#write these caches to a file
filename = writeCountyMapper(cacheList)
BCPolygons = ['BC/Alberni-Clayoquot.arc', 'BC/Bulkley-Nechako.arc', 'BC/Capital.arc',
'BC/Cariboo.arc', 'BC/Central Coast.arc', 'BC/Central Kootenay.arc',
'BC/Central Okanagan.arc', 'BC/Columbia-Shuswap.arc', 'BC/Comox Valley.arc',
'BC/Cowichan Valley.arc', 'BC/East Kootenay.arc', 'BC/Fraser Valley.arc',
'BC/Fraser-Fort George.arc', 'BC/Greater Vancouver.arc', 'BC/Kitimat-Stikine.arc',
'BC/Kootenay Boundary.arc', 'BC/Mount Waddington.arc', 'BC/Nanaimo.arc',
'BC/North Okanagan.arc', 'BC/Northern Rockies.arc', 'BC/Okanagan-Similkameen.arc',
'BC/Peace River.arc', 'BC/Powell River.arc', 'BC/Skeena-Queen Charlotte.arc',
'BC/Squamish-Lillooet.arc', 'BC/Stikine.arc', 'BC/Strathcona.arc',
'BC/Sunshine Coast.arc', 'BC/Thompson-Nicola.arc']
#call GPSBabel to filter these caches through each polygon, then remove temp files
gcids = {}
for polygonName in BCPolygons:
callPolygonFilter(filename, polygonName, "test.out")
gcids.update(readCountyMapper(os.path.join(os.getcwd(), 'test.out'), polygonName[3:-4]))
os.remove("test.out")
if len(gcids) > 0:
log.info("%s has caches" %(polygonName[3:]))
else:
log.info("%s does not have caches" %(polygonName[3:]))
os.remove(filename)
#save county name to caches
for cache in cacheList:
if cache.gcid in gcids.keys():
cache.county = gcids[cache.gcid]
else:
log.error("%s was not found in a BC Regional District despite being in BC" %cache.gcid)
return