Skip to content
This repository has been archived by the owner on Jul 21, 2022. It is now read-only.

Commit

Permalink
Merge pull request #65 from iblancasa/testing
Browse files Browse the repository at this point in the history
New version
  • Loading branch information
iblancasa committed Dec 26, 2015
2 parents c393901 + d87c686 commit 3fa7eed
Show file tree
Hide file tree
Showing 13 changed files with 579 additions and 153 deletions.
File renamed without changes.
289 changes: 246 additions & 43 deletions GitHubCity.py → githubcity/GitHubCity.py

Large diffs are not rendered by default.

89 changes: 88 additions & 1 deletion GitHubUser.py → githubcity/GitHubUser.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,14 @@ class GitHubUser:
_name (str): Name of the user (private).
_contributions (int): total contributions of a user in the last year (private).
_followers (int): total number of followers of an user (private).
_gists (int): total number of gists of an user (private).
_longestStreak (int): maximum number of consecutive days with activity (private).
_numRepos (int): number of repositories of an user (private).
_stars (int): number of total stars given to the user (private).
_organizations (int): number of public organizations where the user is (private).
_join (str): when the user joined to GitHub. Format: %Y-%M-%DT%H:%i:%sZ (private).
_avatar (str): URL where the user's avatar is (private).
_language (str): language most user by the user (private).
_currentStreak (int): actual number of consecutive days making contributions (private).
"""

def __init__(self, name):
Expand All @@ -56,40 +61,122 @@ def __init__(self, name):
"""
self._name = name

def export(self):
"""Export all attributes of the user to a dict
Returns:
dict with all attributes of the user
"""
data = {}
data["name"] = self.getName()
data["contributions"] = self.getContributions()
data["longestStreak"] = self.getLongestStreak()
data["currentStreak"] = self.getCurrentStreak()
data["language"] = self.getLanguage()
data["avatar"] = self.getAvatar()
data["followers"] = self.getFollowers()
data["join"] = self.getJoin()
data["organizations"] = self.getOrganizations()
data["repositories"] = self.getNumberOfRepositories()
data["stars"] = self.getStars()
return data


def getName(self):
"""Get the name of the user
Returns:
str with the name of the user
"""
return self._name

def getContributions(self):
"""Get the number of public contributions of the user
Returns:
int with the number of public contributions of the user
"""

return self._contributions

def getLongestStreak(self):
"""Get the longest streak of the user
Returns:
int with the longest streak of the user
"""
return self._longestStreak

def getCurrentStreak(self):
"""Get the current streak of the user
Returns:
int with the current streak of the user
"""
return self._currentStreak

def getLanguage(self):
"""Get the most used language by the user
Returns:
str with the language most used
"""
return self._language

def getAvatar(self):
"""Get the URL where the avatar is
Returns:
str with an URL where the avatar is
"""
return self._avatar

def getFollowers(self):
"""Get the number of followers of this user
Returns:
int with the number of followers
"""
return self._followers

def getLocation(self):
"""Get the location of the user
Returns:
str with location of the user
"""
return self._location

def getJoin(self):
"""Get when an user joined to GitHub
Returns:
a str with this time format %Y-%M-%DT%H:%i:%sZ
"""

return self._join

def getOrganizations(self):
"""Get the number of public organizations where the user is
Returns:
int with the number of organizations
"""
return self._organizations

def getNumberOfRepositories(self):
"""Get the number of repositories of this user
Returns:
int with the number of repositories
"""
return self._numRepos

def getStars(self):
"""Get number of stars given from GitHub users to repositories created by this user
Returns:
int with the number of stars
"""
return self._stars


Expand Down
2 changes: 2 additions & 0 deletions githubcity/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from GitHubCity import GitHubCity
from GitHubUser import GitHubUser
21 changes: 21 additions & 0 deletions githubcity/cityconfschema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"description": "Configuration of a city",
"type": "object",
"properties": {
"excludedLocations": {
"type": "array"
},
"excludedUsers": {
"type": "array"
},
"locations": {
"type": "array"
},
"name": {
"type": "string"
},
"intervals": {
"type": "array"
}
}
}
16 changes: 0 additions & 16 deletions schemaExcluded.json

This file was deleted.

2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[metadata]
description-file = README.md
42 changes: 42 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""This module is used to install githubcity package
Author: Israel Blancas @iblancasa
License:
The MIT License (MIT)
Copyright (c) 2015 Israel Blancas @iblancasa (http://iblancasa.com/)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the “Software”), to deal in the Software without
restriction, including without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom
the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
"""

from distutils.core import setup
setup(
name = 'githubcity',
packages = ['githubcity'],
version = '0.01',
description = 'GitHub city ranking creator',
author = 'Israel Blancas @iblancasa',
author_email = '[email protected]',
url='https://github.com/iblancasa/GitHubCity',
download_url = 'https://github.com/iblancasa/GitHubCity/0.01',
keywords = ['github', 'ranking', 'data', 'api'], # arbitrary keywords
classifiers = [],
)
19 changes: 19 additions & 0 deletions testConfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"excludedLocations": [
"Granada"
],
"excludedUsers": [
"vrivas"
],
"intervals": [
[
"2008-01-01",
"2015-12-24"
]
],
"last_date": "2015-12-24",
"locations": [
"Jaén"
],
"name": "Jaen"
}
14 changes: 0 additions & 14 deletions testExclude.json

This file was deleted.

Loading

0 comments on commit 3fa7eed

Please sign in to comment.