File size: 5,292 Bytes
c7f4bd0
 
1
2
3
{"nwo":"AdguardTeam\/AdguardBrowserExtension","sha":"3304ba0ad4fe2f1c887f29bb580b801ea6b5363e","path":"changelog.py","language":"python","identifier":"get_args","parameters":"()","argument_list":"","return_statement":"return args","docstring":"Parses, validates and returns arguments, passed to the script","docstring_summary":"Parses, validates and returns arguments, passed to the script","docstring_tokens":["Parses","validates","and","returns","arguments","passed","to","the","script"],"function":"def get_args():\n    \"\"\"Parses, validates and returns arguments, passed to the script\"\"\"\n    parser = argparse.ArgumentParser()\n    parser.add_argument('--repo', dest='repo', action='store')\n    parser.add_argument('--after_date', dest='after_date', action='store')\n    parser.add_argument('--output', dest='output', action='store')\n    parser.add_argument('--token', dest='token', action='store')\n    args = parser.parse_args()\n    if not args.repo:\n        print 'Repo is not specified'\n        sys.exit(1)\n\n    if not args.after_date:\n        print 'After date is not specified'\n        sys.exit(1)\n\n    if not args.output:\n        print 'Output path is not specified'\n        sys.exit(1)\n\n    if not args.token:\n        print 'Github token is not specified'\n        sys.exit(1)\n\n    print 'Args are: %s' %args\n    return args","function_tokens":["def","get_args","(",")",":","parser","=","argparse",".","ArgumentParser","(",")","parser",".","add_argument","(","'--repo'",",","dest","=","'repo'",",","action","=","'store'",")","parser",".","add_argument","(","'--after_date'",",","dest","=","'after_date'",",","action","=","'store'",")","parser",".","add_argument","(","'--output'",",","dest","=","'output'",",","action","=","'store'",")","parser",".","add_argument","(","'--token'",",","dest","=","'token'",",","action","=","'store'",")","args","=","parser",".","parse_args","(",")","if","not","args",".","repo",":","print","'Repo is not specified'","sys",".","exit","(","1",")","if","not","args",".","after_date",":","print","'After date is not specified'","sys",".","exit","(","1",")","if","not","args",".","output",":","print","'Output path is not specified'","sys",".","exit","(","1",")","if","not","args",".","token",":","print","'Github token is not specified'","sys",".","exit","(","1",")","print","'Args are: %s'","%","args","return","args"],"url":"https:\/\/github.com\/AdguardTeam\/AdguardBrowserExtension\/blob\/3304ba0ad4fe2f1c887f29bb580b801ea6b5363e\/changelog.py#L21-L46"}
{"nwo":"AdguardTeam\/AdguardBrowserExtension","sha":"3304ba0ad4fe2f1c887f29bb580b801ea6b5363e","path":"changelog.py","language":"python","identifier":"get_gh_issue_summary","parameters":"(branch_name_parts, repo, token)","argument_list":"","return_statement":"return text","docstring":"Gets short summary for the specified branch_id, which is related to the github issue from the specified repo","docstring_summary":"Gets short summary for the specified branch_id, which is related to the github issue from the specified repo","docstring_tokens":["Gets","short","summary","for","the","specified","branch_id","which","is","related","to","the","github","issue","from","the","specified","repo"],"function":"def get_gh_issue_summary(branch_name_parts, repo, token):\n    \"\"\"Gets short summary for the specified branch_id, which is related to the github issue from the specified repo\"\"\"\n    issue_url = BASE_URL + repo + \"\/issues\/\" + branch_name_parts.group(3)\n    req = urllib2.Request(\n            url=issue_url,\n            headers={\n                'User-Agent' : \"Mozilla\/5.0 (Windows NT 10.0) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/56.0.2924.87 Safari\/537.36\",\n                'Authorization' : 'token ' + token\n            }\n        )\n    response = urllib2.urlopen(req)\n    issue = json.loads(response.read())\n    issue_type = ISSUE_TYPES.get(branch_name_parts.group(1), 'Fix')\n    patch_name = branch_name_parts.group(4)\n\n    text = '* [%s%s] %s: #%s\\r\\n' %(\n        issue_type,\n        '(regression)' if patch_name != '' else '',\n        issue[\"title\"],\n        issue[\"number\"]\n    )\n    return text","function_tokens":["def","get_gh_issue_summary","(","branch_name_parts",",","repo",",","token",")",":","issue_url","=","BASE_URL","+","repo","+","\"\/issues\/\"","+","branch_name_parts",".","group","(","3",")","req","=","urllib2",".","Request","(","url","=","issue_url",",","headers","=","{","'User-Agent'",":","\"Mozilla\/5.0 (Windows NT 10.0) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/56.0.2924.87 Safari\/537.36\"",",","'Authorization'",":","'token '","+","token","}",")","response","=","urllib2",".","urlopen","(","req",")","issue","=","json",".","loads","(","response",".","read","(",")",")","issue_type","=","ISSUE_TYPES",".","get","(","branch_name_parts",".","group","(","1",")",",","'Fix'",")","patch_name","=","branch_name_parts",".","group","(","4",")","text","=","'* [%s%s] %s: #%s\\r\\n'","%","(","issue_type",",","'(regression)'","if","patch_name","!=","''","else","''",",","issue","[","\"title\"","]",",","issue","[","\"number\"","]",")","return","text"],"url":"https:\/\/github.com\/AdguardTeam\/AdguardBrowserExtension\/blob\/3304ba0ad4fe2f1c887f29bb580b801ea6b5363e\/changelog.py#L48-L69"}