render.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:NetOpsWorkshop 作者: ipspace 项目源码 文件源码
def getOptions():
  try:
    options, args = getopt.getopt(sys.argv[1:], "y:j:n:sw", ["yaml=", "jinja=", "notrim", "strict", "warning"])
  except getopt.GetoptError as err:
    # print help information and exit:
    print str(err)  # will print something like "option -a not recognized"
    sys.exit(2)

  global yamlfile,jinjafile,trim,undefined
  trim = True
  opts = 0

  for opt,arg in options:
    opts = opts + 1
    if opt in ("-y","-yaml"):
      yamlfile = arg
    elif opt in ("-j","-jinja"):
      jinjafile = arg
    elif opt in ("-n","-notrim"):
      trim = False
    elif opt in ("-w","-warning"):
      undefined = make_logging_undefined (base = Undefined)
    elif opt in ("-s","-strict"):
      undefined = make_logging_undefined (base = StrictUndefined)

  return opts > 0
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号