Example #1
0
def _process_file(patterns, text_file):
    log.info('undebting {}'.format(text_file))

    text = _load_text(text_file)

    try:
        result_text = process(patterns, text)
    except Exception:
        log.exception(traceback.format_exc())
        return False
    else:
        _write_result_text(result_text, text_file)
        return True
Example #2
0
def process(patterns, text_file, dry_run):
    log.info('undebting {}'.format(text_file))

    text = _load_text(text_file)

    try:
        result_text = logic.process(patterns, text)
    except Exception:
        log.exception(traceback.format_exc())
        return False
    else:
        if result_text != text:
            _write_result_text(result_text, text_file, dry_run)
        return True
Example #3
0
 def try_except(*args, **kwargs):
     try:
         return func(*args, **kwargs)
     except Exception as err:
         log.exception(str(err))
         sys.exit(1)