-
Notifications
You must be signed in to change notification settings - Fork 0
/
_complete.py
1 lines (1 loc) · 6.8 KB
/
_complete.py
1
IyEvdXNyL2Jpbi9lbnYgcHl0aG9uMwoKZnJvbSBjb3B5IGltcG9ydCBkZWVwY29weQppbXBvcnQganNvbgoKZnJvbSBmdW5jdGlvbnMgaW1wb3J0IGdldF9kZXZpY2UsIGdldF9ydWxlcywgbG9hZF90aWNrZXRfdGVtcGxhdGUsIHBvc3RfdGlja2V0CgoKZGVmIGdldF9ydWxlX2J5X251bWJlcl9hbmRfcG9saWN5KHJ1bGVzLCBudW1iZXIsIHBvbGljeV9uYW1lKToKICAgICIiIgogICAgZmlsbCBpbiB0aGUgbG9naWMgdG8gcmV0dXJuIG9ubHkgdGhlIHJ1bGUgd2l0aCB0aGUgY29ycmVjdCBudW1iZXIsIGFuZCBwb2xpY3lfbmFtZQogICAgIiIiCiAgICAjIGxvZ2ljCiAgICAjIExvb3AgdGhyb3VnaCBhbGwgcnVsZXMgZm9yIHJ1bGUgaW4gcnVsZXM6CiAgICBmb3IgcnVsZSBpbiBydWxlczoKICAgICAgICAjIGlmIHRoZSBydWxlJ3MgcnVsZV9udW1iZXIgZG9lbnMndCBtYXRjaCwgY29udGludWUKICAgICAgICBpZiBydWxlWyJydWxlX251bWJlciJdICE9IG51bWJlcjoKICAgICAgICAgICAgY29udGludWUKICAgICAgICAjIExvb3AgdGhyb3VnaCBhbGwgdGhlIHJ1bGUgYmluZGluZ3MKICAgICAgICBmb3IgYmluZGluZyBpbiBydWxlWyJiaW5kaW5nIl06CiAgICAgICAgICAgICMgSWYgdGhlIHJ1bGUncyBiaW5kaW5nIHBvbGljeSBuYW1lIG1hdGNoZXMsIHRoaXMgaXMgdGhlIHJ1bGUgd2Ugd2FudCwgcmV0dXJuIGl0CiAgICAgICAgICAgIGlmIGJpbmRpbmdbInBvbGljeSJdWyJuYW1lIl0gPT0gcG9saWN5X25hbWU6CiAgICAgICAgICAgICAgICByZXR1cm4gcnVsZQogICAgICA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