def extract_and_compare(self, base_url, name): input_review, xtrd_ref = load_change(name) rf = review.ReviewesFetcher(base_url, None) xtrd: List[Union[Change, Event]] = rf.extract_objects([input_review], None) ddiff = DeepDiff( xtrd_ref, [change_or_event_to_dict(x) for x in xtrd], ignore_order=True, ) if ddiff: raise DiffException(ddiff)
def extract_and_compare(self, name: str) -> None: input_pr, xtrd_ref = load_change(name) pr_fetcher = pullrequest.PRsFetcher(None, "https://github.com", None, None) xtrd: List[Union[Change, Event]] = pr_fetcher.extract_objects([input_pr], None) ddiff = DeepDiff( xtrd_ref, [change_or_event_to_dict(x) for x in xtrd], ignore_order=True, ) if ddiff: raise DiffException(ddiff)
def _dumper(raw, prefix=None): pprint(raw) rf = ReviewesFetcher( args.base_url, args.repository, args.insecure, idents_config=[], login=args.login, password=args.password, prefix=args.prefix, ) review = rf.get("2020-01-01 00:00:00", args.id) objs = rf.extract_objects(review, _dumper) if not args.output_dir: pprint([review[0], objs]) else: basename = "%s-%s-%s" % ( utils.strip_url(args.base_url).replace("/", ("_")).replace(":", ""), args.repository.replace("/", "_"), args.id, ) basepath = os.path.join(args.output_dir, basename) json.dump(review[0], open(basepath + "_raw.json", "w"), indent=2) json.dump( [change_or_event_to_dict(o) for o in objs], open(basepath + "_extracted.json", "w"), indent=2, )
prf = PRsFetcher( graphql.GithubGraphQLQuery(token_getter=tg), "https://github.com", args.org, idents_config=[], repository=args.repository, ) if args.crawler: if not args.updated_since: print("please provide --update-since arg") sys.exit(1) prs = prf.get(args.updated_since) pprint(prs) else: if not args.id: print("please provide --id arg") sys.exit(1) data = prf.get_one(args.org, args.repository, args.id) if not args.output_dir: pprint(data) else: basename = "github.com-%s-%s-%s" % (args.org, args.repository, args.id) basepath = os.path.join(args.output_dir, basename) json.dump(data[0], open(basepath + "_raw.json", "w"), indent=2) json.dump( [change_or_event_to_dict(o) for o in data[1]], open(basepath + "_extracted.json", "w"), indent=2, )