How to use the removestar.helper.get_diff_text function in removestar

To help you get started, we’ve selected a few removestar examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github asmeurer / removestar / removestar / __main__.py View on Github external
try:
            new_code = fix_code(code, file=file, max_line_length=args.max_line_length,
                                verbose=args.verbose, quiet=args.quiet, allow_dynamic=args.allow_dynamic)
        except (RuntimeError, NotImplementedError) as e:
            if not args.quiet:
                print(f"Error with {file}: {e}", file=sys.stderr)
            continue

        if new_code != code:
            if args.in_place:
                with open(file, 'w') as f:
                    f.write(new_code)
            else:

                print(get_diff_text(io.StringIO(code).readlines(),
                    io.StringIO(new_code).readlines(), file))