示例#1
0
def processSourceFile(filename, manySourceFiles, args):
    try:
        source = Megamodel.loadFile(filename)
    except Exception as e:
        traceback.print_exc(e)
        cprint(str(e), 'red')
        return str(e)
    if manySourceFiles:
        cprint('#' * 30 + ' ' + filename + ' ' + '#' * 30, 'blue')
    printer_config = ModelPrinterConfig(  # ContentPrinterConfig(  # TODO: check if creating a ModelPrinterConfig is better
        #  for models
        styled=not args.bw,
        verbose=args.verbose,
        quiet=args.quiet,
        title=source.basename,
        issuesMode=args.issues,
        contentMode=args.listing,
        summaryMode=args.summary,
        # styled=True,
        # width=120,
        # baseIndent=0,
        # displayLineNos=True,
        # lineNoPadding=' ',
        # verbose=0,
        # quiet=False,
        # # ------------------------
        # title=None,
        # issuesMode='top',
        # # ------------------------
        # contentMode='self',  # self|source|model|no
        # summaryMode='top',  # top | down | no
    )
    Megamodel.displaySource(source=source, config=printer_config)
    if manySourceFiles:
        cprint('#' * 28 + ' END ' + filename + ' ' + '#' * 28 + '\n' * 2,
               'blue')
    return None
示例#2
0
def source(filename):
    return Megamodel.loadFile(filename)