def getLastDiscussedDates(): data = loadLastDiscussedSOData() tags = [] LibraryData = read_json_file('../SharedFiles/LibraryData.json') for line in LibraryData: tags.append(line['SOtags']) for tag in tags: questions = so.questions(sort='creation', order='DESC', tagged=[tag, 'java']) dates_string = "" for i in range(0, 10): if questions == None or i >= len(questions): break if i > 0: dates_string += ';' dates_string += questions[i].creation_date.strftime('%m/%d/%Y') if len(dates_string) == 0: data[tag] = None else: data[tag] = dates_string saveData(data)
def getReleaseDates(username, password): data = loadReleaseFrequencyData() repositories = [] LibraryData = read_json_file('../SharedFiles/LibraryData.json') for line in LibraryData: repositories.append(line['FullRepoName']) g = Github(username, password) for repository in repositories: if repository in data: continue r = g.get_repo(repository) release_data = ReleaseData(repository) #Obtain the date of the git tag for tag in r.get_tags(): release_data.addReleaseDate(tag.commit.commit.author.date) release_data.addReleaseName(tag.name) release_data.calculateReleaseFrequency() data[repository] = release_data saveData(data)
def read_libraries(file_path): libdict = {} f = read_json_file(file_path) for line in f: libdict[line['Package']] = line['FullRepoName'] return libdict
def main(): if len(sys.argv) == 3: username = sys.argv[1] password = sys.argv[2] else: username = input("Enter Github username: "******"Enter your password: "******"../SharedFiles/LibraryData.json") getIssueDataJIRA(lib_data_json) getIssueData(username, password, lib_data_json) calculateAverageResponseTime() calculateAverageClosingTime() applyClassifiers()
def getLicenses(username, password): data = loadLicenseData() repositories = [] LibraryData = read_json_file('../SharedFiles/LibraryData.json') for line in LibraryData: repositories.append(line['FullRepoName']) g = Github(username, password) for repository in repositories: if repository in data: continue try: r = g.get_repo(repository) print(repository) data[repository] = r.get_license().license.name saveData(data) except UnknownObjectException: data[repository] = 'None' saveData(data)
def getLastModificationDates(username, password): data = loadLastModificationDateData() repositories = [] LibraryData = read_json_file('../SharedFiles/LibraryData.json') for line in LibraryData: repositories.append(line['FullRepoName']) g = Github(username, password) for repository in repositories: r = g.get_repo(repository) dates_string = "" i = 0 for c in r.get_commits(): if i == 10: break if i > 0: dates_string += ';' dates_string += c.commit.author.date.strftime('%m/%d/%Y') i += 1 data[repository] = dates_string saveData(data)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.append(BASE_DIR) os.environ['DJANGO_SETTINGS_MODULE'] = 'librarycomparison.settings' os.environ.setdefault("DJANGO_SETTINGS_MODULE", "librarycomparison.settings") import django django.setup() from librarycomparison.models import Domain, Library, Data lines = [] date = datetime.date.today() entrymonth = date.month entryyear = date.year repositories = [] lines = read_json_file("SharedFiles/LibraryData.json") for line in lines: library_name = line['LibraryName'] domain_name = line['Domain'] repository = line['FullRepoName'] tag = line['SOtags'] domain = Domain.objects.filter(name=domain_name) if not domain.exists(): domain = Domain() domain.name = domain_name domain.save() else: domain = Domain.objects.get(name=domain_name)