Skip to content
This repository was archived by the owner on Sep 19, 2024. It is now read-only.

Commit 6e8a803

Browse files
authored
Merge pull request #20 from aswinshenoy/master
Django App
2 parents 5c85ccb + 52bcc61 commit 6e8a803

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+2157
-0
lines changed

.idea/gitlit.iml

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

algorithms/languages.txt

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
C++
2+
Python
3+
Java
4+
JavaScript
5+
HTML
6+
CSS
7+
Shell
8+
Haskell
9+
Scala
10+
Ruby
11+
C#
12+
Erlang
13+
Go
14+
Lua
15+
PHP
16+
Swift
17+
Dart
18+
Jupyter Notebook
19+
CoffeeScript
20+
Batchfile

graphql/README.MD

Whitespace-only changes.

portal/__init__.py

Whitespace-only changes.

portal/db.sqlite3

320 KB
Binary file not shown.

portal/repo/__init__.py

Whitespace-only changes.

portal/repo/admin.py

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from django.contrib import admin
2+
from .models import *
3+
from django.contrib.auth.models import User
4+
from django.db.models.signals import post_save
5+
6+
admin.site.register(Repository)
7+
admin.site.register(Topic)

portal/repo/apps.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from django.apps import AppConfig
2+
3+
4+
class RepoConfig(AppConfig):
5+
name = 'repo'
+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Generated by Django 2.1.4 on 2018-12-16 05:24
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
initial = True
9+
10+
dependencies = [
11+
]
12+
13+
operations = [
14+
migrations.CreateModel(
15+
name='Repository',
16+
fields=[
17+
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
18+
('reponame', models.CharField(help_text='slug', max_length=70, unique=True)),
19+
('name', models.SlugField()),
20+
('owner', models.SlugField()),
21+
('hasTopicTag', models.BooleanField(default=None)),
22+
('hasDocumentation', models.BooleanField(default=None)),
23+
('hasDescription', models.BooleanField(default=None)),
24+
('hasLicense', models.BooleanField(default=None)),
25+
('hasContributingGuidelines', models.BooleanField(default=None)),
26+
('commitCount', models.IntegerField(blank=True, null=True)),
27+
('prCount', models.IntegerField(blank=True, null=True)),
28+
('prMergedCount', models.IntegerField(blank=True, null=True)),
29+
('issueCount', models.IntegerField(blank=True, null=True)),
30+
('branchCount', models.IntegerField(blank=True, null=True)),
31+
('maintainersCount', models.IntegerField(blank=True, null=True)),
32+
('avgIssueResolutionTime', models.DurationField(blank=True, null=True)),
33+
('avgPRmergeTime', models.DurationField(blank=True, null=True)),
34+
('avgFirstResponseTime', models.DurationField(blank=True, null=True)),
35+
('weeklyContributorsCount', models.IntegerField(blank=True, null=True)),
36+
('firstTimeContributorsThisWeek', models.IntegerField(blank=True, null=True)),
37+
('weeklyContributorsChange', models.IntegerField(blank=True, null=True)),
38+
('contributorsList', models.TextField(blank=True, null=True)),
39+
('contributorsThisWeekList', models.TextField(blank=True, null=True)),
40+
('score', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)),
41+
('baseScore', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)),
42+
('activityScore', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)),
43+
('popularityScore', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)),
44+
('inclusivityScore', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)),
45+
('meritScore', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)),
46+
],
47+
options={
48+
'verbose_name': 'Repository',
49+
'verbose_name_plural': 'Repositories',
50+
},
51+
),
52+
migrations.CreateModel(
53+
name='Topic',
54+
fields=[
55+
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
56+
('name', models.SlugField(help_text='slug', unique=True)),
57+
('full_name', models.CharField(blank=True, max_length=50)),
58+
('icon', models.URLField(blank=True)),
59+
('short_description', models.CharField(blank=True, max_length=200)),
60+
('related', models.CharField(blank=True, max_length=100)),
61+
('description', models.TextField(blank=True, max_length=500)),
62+
('url', models.URLField(blank=True)),
63+
('wikipedia_url', models.URLField(blank=True)),
64+
],
65+
options={
66+
'verbose_name': 'Topics',
67+
'verbose_name_plural': 'Topic',
68+
},
69+
),
70+
migrations.AddField(
71+
model_name='repository',
72+
name='topics',
73+
field=models.ManyToManyField(related_name='repo_name', to='repo.Topic'),
74+
),
75+
]

portal/repo/migrations/__init__.py

Whitespace-only changes.

portal/repo/models.py

+105
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
from django.db import models
2+
from django.db.models.signals import post_save
3+
from django.dispatch import receiver
4+
import requests
5+
from ruamel.yaml import YAML
6+
import re
7+
8+
class Topic(models.Model):
9+
name = models.SlugField(help_text='slug', unique=True)
10+
full_name = models.CharField(max_length=50, blank=True)
11+
icon = models.URLField(blank=True)
12+
short_description = models.CharField(blank=True, max_length=200)
13+
related = models.CharField(max_length=100, blank=True)
14+
description = models.TextField(max_length=500, blank=True)
15+
url = models.URLField(blank=True)
16+
wikipedia_url = models.URLField(blank=True)
17+
18+
class Meta:
19+
verbose_name_plural = "Topic"
20+
verbose_name = "Topics"
21+
22+
def __str__(self):
23+
return self.full_name
24+
25+
def save(self, force_insert=False, force_update=False, using=None):
26+
full_name = self.full_name
27+
if not Topic.objects.filter(full_name=full_name).exists():
28+
url = 'https://raw.githubusercontent.com/github/explore/master/topics/' + self.name + '/index.md'
29+
response = requests.get(url=url)
30+
if(response.status_code!=404):
31+
yaml = YAML()
32+
flag = 0
33+
str = ''
34+
desc = ''
35+
for i in range(3, len(response.text)):
36+
if (flag == 0):
37+
if (response.text[i] == response.text[i + 1] == response.text[i + 2] == '-'):
38+
flag = i
39+
else:
40+
str = str + response.text[i]
41+
42+
for i in range(flag+4, len(response.text)):
43+
desc = desc + response.text[i]
44+
45+
data = yaml.load(str)
46+
self.name = data['topic']
47+
self.full_name = data['display_name']
48+
self.short_description = data['short_description']
49+
self.description = desc
50+
if 'related' in data:
51+
self.related = data['related']
52+
if 'logo' in data:
53+
self.icon = 'https://raw.githubusercontent.com/github/explore/master/topics/' + data['topic'] + '/' + data['logo']
54+
if 'url' in data:
55+
self.url = data['url']
56+
if 'wikipedia_url' in data:
57+
self.wikipedia_url = data['wikipedia_url']
58+
super(Topic, self).save()
59+
60+
61+
class Repository(models.Model):
62+
reponame = models.CharField(max_length=70,help_text='slug', unique=True)
63+
name = models.SlugField()
64+
owner = models.SlugField()
65+
66+
topics = models.ManyToManyField(Topic, related_name='repo_name')
67+
68+
hasTopicTag = models.BooleanField(default=None)
69+
hasDocumentation = models.BooleanField(default=None)
70+
hasDescription = models.BooleanField(default=None)
71+
hasLicense = models.BooleanField(default=None)
72+
hasContributingGuidelines = models.BooleanField(default=None)
73+
74+
commitCount = models.IntegerField(null=True, blank=True)
75+
prCount = models.IntegerField(null=True, blank=True)
76+
prMergedCount = models.IntegerField(null=True, blank=True)
77+
issueCount = models.IntegerField(null=True, blank=True)
78+
branchCount = models.IntegerField(null=True, blank=True)
79+
maintainersCount = models.IntegerField(null=True, blank=True)
80+
81+
avgIssueResolutionTime = models.DurationField(null=True, blank=True)
82+
avgPRmergeTime = models.DurationField(null=True, blank=True)
83+
avgFirstResponseTime = models.DurationField(null=True, blank=True)
84+
85+
weeklyContributorsCount = models.IntegerField(null=True, blank=True)
86+
firstTimeContributorsThisWeek = models.IntegerField(null=True, blank=True)
87+
weeklyContributorsChange = models.IntegerField(null=True, blank=True)
88+
89+
contributorsList = models.TextField(null=True, blank=True)
90+
contributorsThisWeekList = models.TextField(null=True, blank=True)
91+
92+
score = models.DecimalField(decimal_places=2, max_digits=10, null=True, blank=True)
93+
baseScore = models.DecimalField(decimal_places=2, max_digits=10, null=True, blank=True)
94+
activityScore = models.DecimalField(decimal_places=2, max_digits=10, null=True, blank=True)
95+
popularityScore = models.DecimalField(decimal_places=2, max_digits=10, null=True, blank=True)
96+
inclusivityScore = models.DecimalField(decimal_places=2, max_digits=10, null=True, blank=True)
97+
meritScore = models.DecimalField(decimal_places=2, max_digits=10, null=True, blank=True)
98+
99+
class Meta:
100+
verbose_name_plural = "Repositories"
101+
verbose_name = "Repository"
102+
103+
def __str__(self):
104+
return self.reponame
105+

portal/repo/static/repo/sass/bootstrap.min.css

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

portal/repo/static/repo/sass/font-awesome.min.css

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)