310 lines
38 KiB
Text
310 lines
38 KiB
Text
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 1,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"import requests\n",
|
||
|
"from requests_oauthlib import OAuth2Session\n",
|
||
|
"import os\n",
|
||
|
"import json\n",
|
||
|
"import pandas as pd\n",
|
||
|
"import time\n",
|
||
|
"from datetime import datetime"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 2,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"MAXTIME = 365\n",
|
||
|
"RESULT_FOLDER = \"results\"\n",
|
||
|
"CLIENTID = \"hoernschen\"\n",
|
||
|
"TOKEN = \"8f8f5c00e15f7ae7dc6dcbc38b01015c1c1a51d9\"\n",
|
||
|
"FILE = \"decentral_communication_protocols.csv\""
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 3,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"def getGithubOAuthSession():\n",
|
||
|
" token = {\n",
|
||
|
" 'access_token': TOKEN\n",
|
||
|
" }\n",
|
||
|
" return OAuth2Session(CLIENTID, token=token) "
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 4,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"def createCSV(pathToFile, list):\n",
|
||
|
" df = pd.DataFrame(list)\n",
|
||
|
" df.to_csv(pathToFile)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 16,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"def getCommits(repoName, oAuthSession):\n",
|
||
|
" commitList = []\n",
|
||
|
" devList = []\n",
|
||
|
" headers = {'Accept': 'application/vnd.github.mercy-preview+json'}\n",
|
||
|
" commitsResponseJson = None\n",
|
||
|
" i = 0\n",
|
||
|
" commitsTooOld = False\n",
|
||
|
" while commitsResponseJson is None or len(commitsResponseJson) > 0:\n",
|
||
|
" commitsResponse = oAuthSession.get('https://api.github.com/repos/' + repoName + '/commits?page=' + str(i), headers=headers)\n",
|
||
|
" if commitsResponse.status_code == 200:\n",
|
||
|
" commitsResponseJson = commitsResponse.json()\n",
|
||
|
" i = i + 1\n",
|
||
|
" for commit in commitsResponseJson:\n",
|
||
|
" if MAXTIME is not None and (datetime.now() - datetime.strptime(commit['commit']['author']['date'], '%Y-%m-%dT%H:%M:%SZ')).days > MAXTIME:\n",
|
||
|
" commitsTooOld = True\n",
|
||
|
" break\n",
|
||
|
" committer = commit['committer']\n",
|
||
|
" if committer is not None and \"login\" in committer.keys() and committer['login'] not in devList:\n",
|
||
|
" devList.append(committer['login'])\n",
|
||
|
" commitList.append(commit)\n",
|
||
|
" if commitsTooOld:\n",
|
||
|
" break\n",
|
||
|
" elif commitsResponse.status_code == 409: # empty repo\n",
|
||
|
" break\n",
|
||
|
" else:\n",
|
||
|
" time.sleep(3600)\n",
|
||
|
" print(\"Error in Http Request (commitsRequest):\", commitsResponse.status_code, commitsResponse.text)\n",
|
||
|
" return commitList, devList"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 17,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"def getIssues(repoName, oAuthSession):\n",
|
||
|
" issueList = []\n",
|
||
|
" devList = []\n",
|
||
|
" headers = {'Accept': 'application/vnd.github.mercy-preview+json'}\n",
|
||
|
" issuesResponseJson = None\n",
|
||
|
" i = 0\n",
|
||
|
" issuesTooOld = False\n",
|
||
|
" while issuesResponseJson is None or len(issuesResponseJson) > 0:\n",
|
||
|
" issuesResponse = oAuthSession.get('https://api.github.com/repos/' + repoName + '/issues?state=all&page=' + str(i), headers=headers)\n",
|
||
|
" if issuesResponse.status_code == 200:\n",
|
||
|
" i = i + 1\n",
|
||
|
" issuesResponseJson = issuesResponse.json()\n",
|
||
|
" for issue in issuesResponseJson:\n",
|
||
|
" if MAXTIME is not None and (datetime.now() - datetime.strptime(issue['created_at'], '%Y-%m-%dT%H:%M:%SZ')).days > MAXTIME:\n",
|
||
|
" issuesTooOld = True\n",
|
||
|
" break\n",
|
||
|
" assignee = issue['assignee']\n",
|
||
|
" assignees = issue['assignees']\n",
|
||
|
" if assignee is not None and 'login' in assignee.keys() and assignee['login'] not in devList:\n",
|
||
|
" devList.append(assignee['login'])\n",
|
||
|
" for assignee in assignees:\n",
|
||
|
" if 'login' in assignee.keys() and assignee['login'] not in devList:\n",
|
||
|
" devList.append(assignee['login'])\n",
|
||
|
" issueList.append(issue)\n",
|
||
|
" if issuesTooOld:\n",
|
||
|
" break\n",
|
||
|
" elif issuesResponse.status_code == 409: # empty repo\n",
|
||
|
" break\n",
|
||
|
" else:\n",
|
||
|
" print(\"Error in Http Request (issuesRequest):\", issuesResponse.status_code, issuesResponse.text)\n",
|
||
|
" time.sleep(3600)\n",
|
||
|
" return issueList, devList"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 18,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"def getRepoFacts(repoName, oAuthSession):\n",
|
||
|
" devList = []\n",
|
||
|
" issueList = []\n",
|
||
|
" commitList = []\n",
|
||
|
" issueList, devListIssues = getIssues(repoName, oAuthSession)\n",
|
||
|
" commitList, devListCommits = getCommits(repoName, oAuthSession)\n",
|
||
|
" devList.append(devListIssues)\n",
|
||
|
" for dev in devListCommits:\n",
|
||
|
" if dev not in devList:\n",
|
||
|
" devList.append(dev)\n",
|
||
|
" return issueList, commitList, devList"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 19,
|
||
|
"metadata": {
|
||
|
"tags": []
|
||
|
},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"def getTopicFacts(topicName):\n",
|
||
|
" amountRepos = 0\n",
|
||
|
" amountStars = 0\n",
|
||
|
" amountIssues = 0\n",
|
||
|
" amountCommits = 0\n",
|
||
|
" amountDeveloper = 0\n",
|
||
|
"\n",
|
||
|
" repoNameList = []\n",
|
||
|
" repoList = []\n",
|
||
|
" issueList = []\n",
|
||
|
" commitList = []\n",
|
||
|
" devList = []\n",
|
||
|
"\n",
|
||
|
" oAuthSession = getGithubOAuthSession()\n",
|
||
|
" headers = {'Accept': 'application/vnd.github.mercy-preview+json'}\n",
|
||
|
" topicResponse = oAuthSession.get('https://api.github.com/search/repositories?q=topic:' + topicName, headers=headers)\n",
|
||
|
"\n",
|
||
|
" if topicResponse.status_code == 200:\n",
|
||
|
" topicResponseJson = topicResponse.json()\n",
|
||
|
" i = 0\n",
|
||
|
" while \"items\" in topicResponseJson.keys() and len(topicResponseJson['items']) > 0:\n",
|
||
|
" i = i + 1\n",
|
||
|
" for repo in topicResponseJson['items']:\n",
|
||
|
" print(repo['full_name'])\n",
|
||
|
" if repo['full_name'] not in repoNameList:\n",
|
||
|
" issueListRepo, commitListRepo, devListRepo = getRepoFacts(repo['full_name'], oAuthSession)\n",
|
||
|
" for issue in issueListRepo:\n",
|
||
|
" issueList.append(issue)\n",
|
||
|
" for commit in commitListRepo:\n",
|
||
|
" commitList.append(commit)\n",
|
||
|
" for dev in devListRepo:\n",
|
||
|
" if dev not in devList:\n",
|
||
|
" devList.append(dev)\n",
|
||
|
" amountStars = amountStars + int(repo['stargazers_count'])\n",
|
||
|
" repoNameList.append(repo['full_name'])\n",
|
||
|
" repoList.append(repo)\n",
|
||
|
" topicResponseJson = oAuthSession.get('https://api.github.com/search/repositories?q=topic:' + topicName + '&page=' + str(i), headers=headers).json()\n",
|
||
|
" \n",
|
||
|
" createCSV(topicName + \"_repos.csv\", repoList)\n",
|
||
|
" createCSV(topicName + \"_issues.csv\", issueList)\n",
|
||
|
" createCSV(topicName + \"_commits.csv\", commitList)\n",
|
||
|
"\n",
|
||
|
" amountRepos = len(repoList)\n",
|
||
|
" amountDevs = len(devList)\n",
|
||
|
" amountIssues = len(issueList)\n",
|
||
|
" amountCommits = len(commitList)\n",
|
||
|
" print(\"Amount Repos:\", str(amountRepos))\n",
|
||
|
" print(\"Amount Stars:\", str(amountStars))\n",
|
||
|
" print(\"Amount Issues:\", str(amountIssues))\n",
|
||
|
" print(\"Amount Commits:\", str(amountCommits))\n",
|
||
|
" print(\"Amount Devs:\", str(amountDevs))\n",
|
||
|
" else:\n",
|
||
|
" print(\"Error in Http Request (topicRequest):\", topicResponse.status_code, topicResponse.text)\n",
|
||
|
" return amountRepos, amountStars, amountIssues, amountCommits, amountDevs"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 15,
|
||
|
"metadata": {
|
||
|
"tags": [
|
||
|
"outputPrepend"
|
||
|
]
|
||
|
},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"output_type": "stream",
|
||
|
"name": "stdout",
|
||
|
"text": "TheKinrar/mastodon-instances\nArkanosis/microstatus\njaywink/federation\nGargron/cobalt\ntootsuite/mastodon\nChocobozzz/PeerTube\nLemmyNet/lemmy\npixelfed/pixelfed\nwriteas/writefreely\nPlume-org/Plume\nsyuilo/misskey\nforgefed/forgefed\ntsileo/microblog.pub\nrustodon/rustodon\nAardwolf-Social/aardwolf\ngo-fed/activity\nBasixKOR/awesome-activitypub\ndariusk/rss-to-activitypub\nmouse-reeve/bookwyrm\njaywink/socialhome\nnextcloud/social\nandstatus/andstatus\nanforaProject/anfora\nsyuilo/dolphin\nreel2bits/reel2bits\nframasoft/mobilizon\npfefferle/wordpress-activitypub\njoyeusenoelle/GuideToMastodon\nmariusor/go-littr\nwriteas/Read.as\nTheKinrar/mastodon-instances\nArkanosis/microstatus\njaywink/federation\nGargron/cobalt\ndsblank/activitypub\nthefederationinfo/the-federation.info\nlandrok/activitypub\npubcast/pubcast\nrowanlupton/pylodon\ntsileo/little-boxes\ntOkeshu/activitypub-example\nautogestion/pubgate\npeerpx/peerpx\nlambdadog/fontina\nshleeable/Big-List-of-ActivityPub\naaronpk/Nautilus\ngrishka/Smithereen\nyukimochi/Activity-Relay\ngo-fed/apcore\np2panda/beep-beep\nbrooksn/serverless-activitypub\nactivitypubguide/guide\nToromino/kibou\ngo-ap/activitypub\nemilebosch/awesome-fediverse\nargrath/activitypub\nYuigaWada/MisskeyKit-for-iOS\nwmurphyrd/activitypub-express\nDeadSuperHero/postmodern\ngo-ap/fedbox\ngazpachoteam/hanatachi\nwriteas/pherephone\nbotwiki/glitch-fediverse-bot\nlesion/gancio\njfmcbrayer/cl-activitypub\nweathermen/soundstorm\neniehack/Learn-ActivityPub\npfefferle/wordpress-nodeinfo\nwakin-/simple_ap\nautogestion/pubgate-telegram\nXeltica/actorscafe\nScarly-Crow/lamia\npauljohncleary/activitypub.js\npfefferle/wordpress-webfinger\npixelfedLabs/delta\nDavidLibeau/FediBlog\ngo-fed/presentations\nYuzuRyo61/CrossPlan\ngamebin/decen_social\nrzr/mastodon-lite\nTGNThump/Pantheon\nswentel/activitypub\nmoodle/moodlenet\nmerveilles/merveilles-town\nredaktor/ActivityPubSchema\neniehack/asteroidgazer\nMatejLach/astreams\nfedimos/server\nevan-duncan/activitypub-php\nreel2bits/reel2bits.org\nexlibris-fed/exlibris\norigamium/Tempest-Client\ncomm-network/mastodon\nbrooksn/activitypub-web\nFlaque/metapod\nlukehoersten/activitypub\nautogestion/pubgate-rssbot\ntoddsundsted/ktistec\nyukimochi/mastodon_pub-relay\nmediaformat/fediembedi\nwriteas/activityserve\nufosc/TheIsolator\ncommune-project/rbq\nfoozmeat/tusk.rocks\nfediverse/wordpress\nreconnexion/colibris.social\nautogestion/vkfed\nh3poteto/pleroma.io\njapaslu/History-TwitChain\nrzr/fediverse-action\nreconnexion/activitypub-mailer\nassemblee-virtuelle/ActivityPubBundle\nakihikodaki/activity-intent\nmikekasprzak/hacktivity-pub\nreconnexion/admin.colibris.social\nmarrus-sh/so-what\nchinianwang/mawa\nd0p1s4m4/Minna\npk400/bonfire-server\npH7Software/pH7Decentralized\nWellFactored/clovis\nfujitastyle/clione-bottlepy\nchrisjdavis/habariActivityPub\ncommonspub/CommonsPub-Client-React\nHasHooves/mastodon-backup\nfedimos/ios\ntimmot/activity-pub-tutorial\nXeltica/groundpolis-lite\nacid-chicken/dogpark\nfiatjaf/litepub\nautogestion/pubgate-steemit\n153/twtoo\ninnereq/pleroma-soapbox-builder\nSamR1/activity-pub-test\nwalkaway-project/sora\nargrath/kroeg-vagrant\n153/fedichan\nsentriz/honk-docker\nbashrc2/epicyon\nGopiandcode/simple-pleroma-comments\nlqdev/APFS\nAmount Repos: 137\nAmount Stars: 47118\nAmount Issues: 10755\nAmount Commits: 25837\nAmount Devs: 204\nProtocol: matrix-org\nmatrix-org/synapse\nmatrix-org/dendrite\nspantaleev/matrix-docker-ansible-deploy\ntulir/mautrix-telegram\ntulir/gomuks\ntulir/mautrix-whatsapp\nSwellRT/swellrt\nmatrix-construct/construct\nmaubot/maubot\nmaelstrom-rs/maelstrom\nAwesome-Technologies/synapse-admin\ntulir/mautrix-facebook\nmatrix-org/matrix-rust-sdk\ntulir/mautrix-go\npoljar/weechat-matrix-rs\nZerataX/matrix-registration\naaronraimist/element-themes\nfinogeeks/Ligase\ngary-kim/riotchat\ndevture/matrix-corporal\nsignaller-matrix/signaller\nKB1RD/matrix-notepad\n4nd3r/tiny-matrix-bot\nmatrix-org/rust-synapse-compress-state\ndaydream-mx/Daydream\ndylhack/matrix-appservice-minecraft\nnilsding/AgentSmith\ntulir/mautrix-python\
|
||
|
},
|
||
|
{
|
||
|
"output_type": "error",
|
||
|
"ename": "NameError",
|
||
|
"evalue": "name 'issuesResponse' is not defined",
|
||
|
"traceback": [
|
||
|
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
||
|
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
|
||
|
"\u001b[0;32m<ipython-input-15-555ea80995f6>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 27\u001b[0m })\n\u001b[1;32m 28\u001b[0m \u001b[0mprotocols\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mto_csv\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"new.csv\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 29\u001b[0;31m \u001b[0mmain\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
|
||
|
"\u001b[0;32m<ipython-input-15-555ea80995f6>\u001b[0m in \u001b[0;36mmain\u001b[0;34m()\u001b[0m\n\u001b[1;32m 11\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mi\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mrange\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mprotocols\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 12\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Protocol:\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mprotocols\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"Github Tag\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mi\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 13\u001b[0;31m \u001b[0mamountRepos\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mamountStars\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mamountIssues\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mamountCommits\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mamountDevs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mgetTopicFacts\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mprotocols\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"Github Tag\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mi\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 14\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 15\u001b[0m \u001b[0mamountReposList\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mappend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mamountRepos\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
|
||
|
"\u001b[0;32m<ipython-input-14-b37d7d3c46ed>\u001b[0m in \u001b[0;36mgetTopicFacts\u001b[0;34m(topicName)\u001b[0m\n\u001b[1;32m 24\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mrepo\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'full_name'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 25\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mrepo\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'full_name'\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mrepoNameList\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 26\u001b[0;31m \u001b[0missueListRepo\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcommitListRepo\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdevListRepo\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mgetRepoFacts\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mrepo\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'full_name'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moAuthSession\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 27\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0missue\u001b[0m \u001b[0;32min\u001b[0m \u001b[0missueListRepo\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 28\u001b[0m \u001b[0missueList\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mappend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0missue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
|
||
|
"\u001b[0;32m<ipython-input-13-c762a0387c81>\u001b[0m in \u001b[0;36mgetRepoFacts\u001b[0;34m(repoName, oAuthSession)\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0mcommitList\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0missueList\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdevListIssues\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mgetIssues\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mrepoName\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moAuthSession\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 6\u001b[0;31m \u001b[0mcommitList\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdevListCommits\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mgetCommits\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mrepoName\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moAuthSession\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 7\u001b[0m \u001b[0mdevList\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mappend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdevListIssues\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mdev\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mdevListCommits\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
|
||
|
"\u001b[0;32m<ipython-input-11-8e555f5bb044>\u001b[0m in \u001b[0;36mgetCommits\u001b[0;34m(repoName, oAuthSession)\u001b[0m\n\u001b[1;32m 21\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mcommitsTooOld\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 22\u001b[0m \u001b[0;32mbreak\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 23\u001b[0;31m \u001b[0;32melif\u001b[0m \u001b[0missuesResponse\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstatus_code\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;36m409\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;31m# empty repo\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 24\u001b[0m \u001b[0;32mbreak\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 25\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
|
||
|
"\u001b[0;31mNameError\u001b[0m: name 'issuesResponse' is not defined"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"def main():\n",
|
||
|
" amountReposList = []\n",
|
||
|
" amountStarsList = []\n",
|
||
|
" amountIssuesList = []\n",
|
||
|
" amountCommitsList = []\n",
|
||
|
" amountDevsList = []\n",
|
||
|
" #result_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), RESULT_FOLDER)\n",
|
||
|
" #if not os.path.exists(result_path):\n",
|
||
|
" # os.makedirs(result_path)\n",
|
||
|
" protocols = pd.read_csv(FILE)\n",
|
||
|
" for i in range(len(protocols)):\n",
|
||
|
" print(\"Protocol:\", protocols[\"Github Tag\"][i])\n",
|
||
|
" amountRepos, amountStars, amountIssues, amountCommits, amountDevs = getTopicFacts(protocols[\"Github Tag\"][i])\n",
|
||
|
"\n",
|
||
|
" amountReposList.append(amountRepos)\n",
|
||
|
" amountStarsList.append(amountStars)\n",
|
||
|
" amountIssuesList.append(amountIssues)\n",
|
||
|
" amountCommitsList.append(amountCommits)\n",
|
||
|
" amountDevsList.append(amountDevs)\n",
|
||
|
"\n",
|
||
|
" protocols.assign(**{\n",
|
||
|
" 'amountRepos':amountReposList,\n",
|
||
|
" 'amountStars':amountStarsList,\n",
|
||
|
" 'amountIssues':amountIssuesList,\n",
|
||
|
" 'amountCommits':amountCommitsList,\n",
|
||
|
" 'amountDevs':amountDevsList\n",
|
||
|
" })\n",
|
||
|
" protocols.to_csv(\"new.csv\")\n",
|
||
|
"main()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"if __name__ == \"__main__\":\n",
|
||
|
" print(\"Start\")\n",
|
||
|
" main()\n",
|
||
|
" print(\"End\")"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"metadata": {
|
||
|
"kernelspec": {
|
||
|
"display_name": "Python 3.7.5 64-bit",
|
||
|
"language": "python",
|
||
|
"name": "python_defaultSpec_1599206669290"
|
||
|
},
|
||
|
"language_info": {
|
||
|
"codemirror_mode": {
|
||
|
"name": "ipython",
|
||
|
"version": 3
|
||
|
},
|
||
|
"file_extension": ".py",
|
||
|
"mimetype": "text/x-python",
|
||
|
"name": "python",
|
||
|
"nbconvert_exporter": "python",
|
||
|
"pygments_lexer": "ipython3",
|
||
|
"version": "3.7.5-final"
|
||
|
}
|
||
|
},
|
||
|
"nbformat": 4,
|
||
|
"nbformat_minor": 4
|
||
|
}
|