本文整理汇总了Python中LogStream.logDiag方法的典型用法代码示例。如果您正苦于以下问题:Python LogStream.logDiag方法的具体用法?Python LogStream.logDiag怎么用?Python LogStream.logDiag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LogStream
的用法示例。
在下文中一共展示了LogStream.logDiag方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createAreaDictionary
# 需要导入模块: import LogStream [as 别名]
# 或者: from LogStream import logDiag [as 别名]
def createAreaDictionary(outputDir, mapDict):
LogStream.logEvent("Generating AreaDictionary")
areadict = {}
mapIter = mapDict.entrySet().iterator()
while mapIter.hasNext():
entry = mapIter.next()
ean = str(entry.getKey())
att = entry.getValue()
if len(ean):
try:
d = {}
if att.containsKey('zone') and att.containsKey('state'):
d['ugcCode'] = str(att.get('state')) + "Z" + str(att.get('zone'))
elif att.containsKey('id'):
d['ugcCode'] = str(att.get('id'))
elif att.containsKey('fips') and att.containsKey('state') and \
att.containsKey('countyname'):
d['ugcCode'] = str(att.get('state')) + "C" + str(att.get('fips'))[-3:]
d['ugcName'] = string.strip(str(att.get('countyname')))
else:
continue
if att.containsKey('state'):
d["stateAbbr"] = str(att.get('state'))
if att.containsKey('name'):
d["ugcName"] = string.strip(str(att.get('name')))
if att.containsKey('time_zone'):
tzvalue = getRealTimeZone(str(att.get('time_zone')))
if tzvalue is not None:
d["ugcTimeZone"] = tzvalue
if zonedata.has_key(d['ugcCode']):
cityDict = zonedata[d['ugcCode']]
elif fipsdata.has_key(d['ugcCode']):
cityDict = fipsdata[d['ugcCode']]
else:
cityDict = None
if cityDict:
cityString = makeCityString(cityDict)
if cityString is not None:
cityString, locs = cityString
if len(cityString):
d["ugcCityString"] = cityString
CityLocationDict[ean] = locs
# partOfState codes
if zonedata.has_key(d['ugcCode']):
if zonedata[d['ugcCode']].has_key('partOfState'):
d["partOfState"] = \
zonedata[d['ugcCode']]['partOfState']
elif fipsdata.has_key(d['ugcCode']):
if fipsdata[d['ugcCode']].has_key('partOfState'):
d["partOfState"] = \
fipsdata[d['ugcCode']]['partOfState']
# full state name
if zonedata.has_key(d['ugcCode']):
if zonedata[d['ugcCode']].has_key('fullStateName'):
d["fullStateName"] = \
zonedata[d['ugcCode']]['fullStateName']
elif fipsdata.has_key(d['ugcCode']):
if fipsdata[d['ugcCode']].has_key('fullStateName'):
d["fullStateName"] = \
fipsdata[d['ugcCode']]['fullStateName']
else:
marineState = checkMarineState(d['ugcCode'])
if marineState is not None:
d['fullStateName'] = marineState
if areadict.has_key(ean) and d != areadict[ean]:
LogStream.logDiag("Mismatch of definitions in " +\
"AreaDictionary creation. EditAreaName=", ean,
"AreaDict=\n", areadict[ean], "\nIgnored=\n", d)
else:
areadict[ean] = d
except:
LogStream.logProblem("Problem with ", ean, LogStream.exc())
s = """
# ----------------------------------------------------------------------------
# This software is in the public domain, furnished "as is", without technical
# support, and with no warranty, express or implied, as to its usefulness for
# any purpose.
#
# AreaDictionary
# AreaDictionary file
#
# Author: GFE Installation Script
# ----------------------------------------------------------------------------
# Format:
# AreaDictionary = {
# "editArea" : {
# "ugcCode": "STZxxx",
# "ugcName": "EditAreaName",
# "ugcCityString": "...CITY1...CITY2",
#.........这里部分代码省略.........