本文整理汇总了Python中Avn.getTafPath方法的典型用法代码示例。如果您正苦于以下问题:Python Avn.getTafPath方法的具体用法?Python Avn.getTafPath怎么用?Python Avn.getTafPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Avn
的用法示例。
在下文中一共展示了Avn.getTafPath方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getActiveRules
# 需要导入模块: import Avn [as 别名]
# 或者: from Avn import getTafPath [as 别名]
def getActiveRules(id_, namespace, source):
rules = []
# file containing rule definitions
fname = Avn.getTafPath(id_, source + '.cfg')
cp = ConfigParser.SafeConfigParser()
cp.read(fname)
try:
activeRules = cp.get('rules', 'active')
except Exception :
raise Avn.AvnError('No active rules in "%s"' % fname)
active = ['rule_'+x.strip() for x in cp.get('rules', 'active').split(',')]
if activeRules:
while 'rule_' in active:
active.remove('rule_')
if not activeRules or len(activeRules) == 0 :
raise Avn.AvnError('No active rules in "%s"' % fname)
for s in active:
try:
name = cp.get(s, 'method')
rule = namespace[name]()
except (ConfigParser.NoOptionError, ConfigParser.NoSectionError), ex:
_Logger.error(' %s - in file %s' % (str(ex), fname))
continue
except KeyError:
_Logger.error('Invalid method: %s, for rule: %s - in file %s' % (name, s, fname))
continue
示例2: _readPrbConf
# 需要导入模块: import Avn [as 别名]
# 或者: from Avn import getTafPath [as 别名]
def _readPrbConf():
conf=ConfigParser.ConfigParser()
conf.read(Avn.getTafPath('XXXX', 'grid_prob.cfg'))
prb_conf={'before9hr': {},'after9hr': {}}
wxkeys = ['S', 'IS', 'WS', 'SC', 'NM', 'O', 'C', 'D', 'WP', 'L']
for wx in wxkeys:
prb_conf['before9hr'][wx] = conf.getint('before9hr',wx)
prb_conf['after9hr'][wx] = conf.getint('after9hr',wx)
return prb_conf
示例3: _getCriteria
# 需要导入模块: import Avn [as 别名]
# 或者: from Avn import getTafPath [as 别名]
def _getCriteria(ident):
fname = Avn.getTafPath(ident, 'impact.cfg')
cp = ConfigParser.SafeConfigParser()
cp.read(fname)
clist = AvnParser.split(cp.get('conditions', 'items'))
criteria = [dict(cp.items(c)) for c in clist]
for d in criteria:
d['level'] = int(d['level'])
return criteria
示例4: getClimQCConfig
# 需要导入模块: import Avn [as 别名]
# 或者: from Avn import getTafPath [as 别名]
def getClimQCConfig(ident):
# file containing category definitions: thresholds
# fname = os.path.join('etc', 'tafs', ident, 'climqc.cfg')
# if not os.path.isfile(fname):
# fname = os.path.join('etc', 'tafs', 'XXXX', 'climqc.cfg')
fname = Avn.getTafPath(ident, 'climqc.cfg')
cp = ConfigParser.SafeConfigParser()
cp.read(fname)
d = dict([(t, [_guess(x) for x in cp.get('thresholds', t).split(',')]) \
for t in ['vsby', 'cig', 'ff', 'dd']])
opts = dict(cp.items('args'))
for k in opts:
opts[k] = _guess(opts[k])
d.update(opts)
return d