/usr/lib/python3/dist-packages/jsondiff/cli.py is in python3-jsondiff 1.1.1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | import argparse
import jsondiff
import json
import sys
def main():
parser = argparse.ArgumentParser()
parser.add_argument("first")
parser.add_argument("second")
parser.add_argument("-p", "--patch", action="store_true", default=False)
parser.add_argument("-s", "--syntax", action="store", type=str, default="compact")
parser.add_argument("-i", "--indent", action="store", type=int, default=None)
args = parser.parse_args()
with open(args.first, "r") as f:
with open(args.second, "r") as g:
jf = json.load(f)
jg = json.load(g)
if args.patch:
x = jsondiff.patch(
jf,
jg,
marshal=True,
syntax=args.syntax
)
else:
x = jsondiff.diff(
jf,
jg,
marshal=True,
syntax=args.syntax
)
json.dump(x, sys.stdout, indent=args.indent)
if __name__ == '__main__':
main()
|