Skip to content

Instantly share code, notes, and snippets.

@cmarat
Created March 4, 2014 13:32
Show Gist options
  • Save cmarat/9346583 to your computer and use it in GitHub Desktop.
Save cmarat/9346583 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"###\u00a0Stats about Data2Semantics repositories on GitHub"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"from requests import get\n",
"from pprint import pprint\n",
"api_url = 'https://api.github.com/'\n",
"user = 'Data2Semantics'"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 88
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"all_repos = get(api_url + 'search/repositories?q=user:Data2Semantics').json()['items']\n",
"info = sorted([[r['updated_at'], r['name'], r['language']]\n",
" for r in all_repos if not r['fork']],\n",
" reverse = True)"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 77
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# List of original repos, recently updated go first\n",
"\", \".join( [i[1] for i in info])"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 78,
"text": [
"u'd2s-tools, ducktape, TabLinker, VIVO-Browser, linkitup, mustard, Workbench, plugins, PigAnalysis, GraphSampling, CensusVisualizationPrototype, nodes, PatViz, D2S4Pig, raw2ld, MockupEntityRecognizer, guideline-annotation-ontology, powerlaws, Annotator, provoviz, Platform, wur-workflow, Hubble, data2semantics.github.io, commit, eligibility-criteria, Hackathon2, STCN, prov-o-matic, commit-catalog'"
]
}
],
"prompt_number": 78
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"def authors(repo):\n",
" \"\"\"\n",
" Returns a list of contributors.\n",
" \"\"\"\n",
" response = get('{}repos/{}/{}/stats/contributors'.format(api_url, user, repo))\n",
" if response.ok:\n",
" return [a['author']['login'] for a in response.json()]\n",
" return response.content"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 84
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# Just checking the function.\n",
"authors(\"linkitup\")"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 85,
"text": [
"'{\"message\":\"API rate limit exceeded for 145.108.173.19. (But here\\'s the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)\",\"documentation_url\":\"http://developer.github.com/v3/#rate-limiting\"}'"
]
}
],
"prompt_number": 85
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# Append contributors and print info about all repos\n",
"for i in info:\n",
" i.append(authors(i[1]))\n"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 90
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"pprint(info)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"[[u'2014-03-03T16:33:04Z',\n",
" u'd2s-tools',\n",
" u'Java',\n",
" '{\"message\":\"API rate limit exceeded for 145.108.173.19. (But here\\'s the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)\",\"documentation_url\":\"http://developer.github.com/v3/#rate-limiting\"}'],\n",
" [u'2014-02-24T15:52:29Z',\n",
" u'ducktape',\n",
" u'Java',\n",
" '{\"message\":\"API rate limit exceeded for 145.108.173.19. (But here\\'s the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)\",\"documentation_url\":\"http://developer.github.com/v3/#rate-limiting\"}'],\n",
" [u'2014-02-22T18:54:15Z',\n",
" u'TabLinker',\n",
" u'Python',\n",
" '{\"message\":\"API rate limit exceeded for 145.108.173.19. (But here\\'s the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)\",\"documentation_url\":\"http://developer.github.com/v3/#rate-limiting\"}'],\n",
" [u'2014-02-17T00:41:37Z',\n",
" u'VIVO-Browser',\n",
" u'CSS',\n",
" '{\"message\":\"API rate limit exceeded for 145.108.173.19. (But here\\'s the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)\",\"documentation_url\":\"http://developer.github.com/v3/#rate-limiting\"}'],\n",
" [u'2014-02-13T15:45:59Z',\n",
" u'linkitup',\n",
" u'JavaScript',\n",
" '{\"message\":\"API rate limit exceeded for 145.108.173.19. (But here\\'s the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)\",\"documentation_url\":\"http://developer.github.com/v3/#rate-limiting\"}'],\n",
" [u'2014-02-12T12:24:35Z',\n",
" u'mustard',\n",
" u'Java',\n",
" '{\"message\":\"API rate limit exceeded for 145.108.173.19. (But here\\'s the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)\",\"documentation_url\":\"http://developer.github.com/v3/#rate-limiting\"}'],\n",
" [u'2014-02-11T10:47:47Z',\n",
" u'Workbench',\n",
" u'Java',\n",
" '{\"message\":\"API rate limit exceeded for 145.108.173.19. (But here\\'s the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)\",\"documentation_url\":\"http://developer.github.com/v3/#rate-limiting\"}'],\n",
" [u'2014-02-07T06:59:35Z',\n",
" u'plugins',\n",
" u'JavaScript',\n",
" '{\"message\":\"API rate limit exceeded for 145.108.173.19. (But here\\'s the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)\",\"documentation_url\":\"http://developer.github.com/v3/#rate-limiting\"}'],\n",
" [u'2014-02-01T20:58:41Z',\n",
" u'PigAnalysis',\n",
" u'Python',\n",
" '{\"message\":\"API rate limit exceeded for 145.108.173.19. (But here\\'s the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)\",\"documentation_url\":\"http://developer.github.com/v3/#rate-limiting\"}'],\n",
" [u'2014-02-01T20:57:07Z',\n",
" u'GraphSampling',\n",
" u'Java',\n",
" '{\"message\":\"API rate limit exceeded for 145.108.173.19. (But here\\'s the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)\",\"documentation_url\":\"http://developer.github.com/v3/#rate-limiting\"}'],\n",
" [u'2014-01-17T07:42:09Z',\n",
" u'CensusVisualizationPrototype',\n",
" u'JavaScript',\n",
" '{\"message\":\"API rate limit exceeded for 145.108.173.19. (But here\\'s the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)\",\"documentation_url\":\"http://developer.github.com/v3/#rate-limiting\"}'],\n",
" [u'2014-01-14T17:34:54Z',\n",
" u'nodes',\n",
" u'Java',\n",
" '{\"message\":\"API rate limit exceeded for 145.108.173.19. (But here\\'s the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)\",\"documentation_url\":\"http://developer.github.com/v3/#rate-limiting\"}'],\n",
" [u'2014-01-14T10:42:33Z',\n",
" u'PatViz',\n",
" u'JavaScript',\n",
" '{\"message\":\"API rate limit exceeded for 145.108.173.19. (But here\\'s the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)\",\"documentation_url\":\"http://developer.github.com/v3/#rate-limiting\"}'],\n",
" [u'2014-01-07T10:09:27Z',\n",
" u'D2S4Pig',\n",
" u'Java',\n",
" '{\"message\":\"API rate limit exceeded for 145.108.173.19. (But here\\'s the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)\",\"documentation_url\":\"http://developer.github.com/v3/#rate-limiting\"}'],\n",
" [u'2013-12-21T21:03:43Z',\n",
" u'raw2ld',\n",
" u'Python',\n",
" '{\"message\":\"API rate limit exceeded for 145.108.173.19. (But here\\'s the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)\",\"documentation_url\":\"http://developer.github.com/v3/#rate-limiting\"}'],\n",
" [u'2013-12-21T16:57:12Z',\n",
" u'MockupEntityRecognizer',\n",
" u'Java',\n",
" '{\"message\":\"API rate limit exceeded for 145.108.173.19. (But here\\'s the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)\",\"documentation_url\":\"http://developer.github.com/v3/#rate-limiting\"}'],\n",
" [u'2013-12-14T00:32:28Z',\n",
" u'guideline-annotation-ontology',\n",
" None,\n",
" '{\"message\":\"API rate limit exceeded for 145.108.173.19. (But here\\'s the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)\",\"documentation_url\":\"http://developer.github.com/v3/#rate-limiting\"}'],\n",
" [u'2013-12-11T14:38:28Z',\n",
" u'powerlaws',\n",
" u'Java',\n",
" '{\"message\":\"API rate limit exceeded for 145.108.173.19. (But here\\'s the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)\",\"documentation_url\":\"http://developer.github.com/v3/#rate-limiting\"}'],\n",
" [u'2013-12-05T09:28:14Z',\n",
" u'Annotator',\n",
" u'Java',\n",
" '{\"message\":\"API rate limit exceeded for 145.108.173.19. (But here\\'s the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)\",\"documentation_url\":\"http://developer.github.com/v3/#rate-limiting\"}'],\n",
" [u'2013-11-12T14:14:55Z',\n",
" u'provoviz',\n",
" u'JavaScript',\n",
" '{\"message\":\"API rate limit exceeded for 145.108.173.19. (But here\\'s the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)\",\"documentation_url\":\"http://developer.github.com/v3/#rate-limiting\"}'],\n",
" [u'2013-11-05T09:19:48Z',\n",
" u'Platform',\n",
" u'Java',\n",
" '{\"message\":\"API rate limit exceeded for 145.108.173.19. (But here\\'s the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)\",\"documentation_url\":\"http://developer.github.com/v3/#rate-limiting\"}'],\n",
" [u'2013-10-25T12:05:27Z',\n",
" u'wur-workflow',\n",
" u'JavaScript',\n",
" '{\"message\":\"API rate limit exceeded for 145.108.173.19. (But here\\'s the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)\",\"documentation_url\":\"http://developer.github.com/v3/#rate-limiting\"}'],\n",
" [u'2013-10-21T12:48:33Z',\n",
" u'Hubble',\n",
" u'Java',\n",
" '{\"message\":\"API rate limit exceeded for 145.108.173.19. (But here\\'s the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)\",\"documentation_url\":\"http://developer.github.com/v3/#rate-limiting\"}'],\n",
" [u'2013-10-10T11:54:57Z',\n",
" u'data2semantics.github.io',\n",
" u'CSS',\n",
" '{\"message\":\"API rate limit exceeded for 145.108.173.19. (But here\\'s the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)\",\"documentation_url\":\"http://developer.github.com/v3/#rate-limiting\"}'],\n",
" [u'2013-10-06T00:07:16Z',\n",
" u'commit',\n",
" u'JavaScript',\n",
" '{\"message\":\"API rate limit exceeded for 145.108.173.19. (But here\\'s the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)\",\"documentation_url\":\"http://developer.github.com/v3/#rate-limiting\"}'],\n",
" [u'2013-10-03T11:11:25Z',\n",
" u'eligibility-criteria',\n",
" u'JavaScript',\n",
" '{\"message\":\"API rate limit exceeded for 145.108.173.19. (But here\\'s the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)\",\"documentation_url\":\"http://developer.github.com/v3/#rate-limiting\"}'],\n",
" [u'2013-10-01T12:45:56Z',\n",
" u'Hackathon2',\n",
" u'CSS',\n",
" '{\"message\":\"API rate limit exceeded for 145.108.173.19. (But here\\'s the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)\",\"documentation_url\":\"http://developer.github.com/v3/#rate-limiting\"}'],\n",
" [u'2013-06-22T08:25:34Z',\n",
" u'STCN',\n",
" u'Python',\n",
" '{\"message\":\"API rate limit exceeded for 145.108.173.19. (But here\\'s the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)\",\"documentation_url\":\"http://developer.github.com/v3/#rate-limiting\"}'],\n",
" [u'2013-01-13T04:32:27Z',\n",
" u'prov-o-matic',\n",
" u'Python',\n",
" '{\"message\":\"API rate limit exceeded for 145.108.173.19. (But here\\'s the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)\",\"documentation_url\":\"http://developer.github.com/v3/#rate-limiting\"}'],\n",
" [u'2013-01-12T22:07:38Z',\n",
" u'commit-catalog',\n",
" u'JavaScript',\n",
" '{\"message\":\"API rate limit exceeded for 145.108.173.19. (But here\\'s the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)\",\"documentation_url\":\"http://developer.github.com/v3/#rate-limiting\"}']]\n"
]
}
],
"prompt_number": 89
},
{
"cell_type": "code",
"collapsed": false,
"input": [],
"language": "python",
"metadata": {},
"outputs": []
}
],
"metadata": {}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment