Skip to content

Commit

Permalink
do linter things
Browse files Browse the repository at this point in the history
Signed-off-by: Isaac Milarsky <[email protected]>
  • Loading branch information
Isaac Milarsky committed Nov 2, 2023
1 parent 06bed34 commit 54f0d80
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 49 deletions.
4 changes: 1 addition & 3 deletions scripts/clear_old_metrics.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import datetime
import json
import os
import shutil

from metricsLib.constants import BASE_PATH, PATH_TO_METRICS_DATA
from metricsLib.constants import PATH_TO_METRICS_DATA


def clear_json_data():
Expand Down
44 changes: 12 additions & 32 deletions scripts/fetch_public_metrics.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
import datetime

import json
import os
import requests

from metricsLib.constants import *
from metricsLib.constants import SIMPLE_METRICS, ORG_METRICS
from metricsLib.repos import Repository
from metricsLib.orgs import GithubOrg
import re

"""This method serves to iterate through previously collected metric
data that is associated with a repo and derive the cumulative metric data
for the whole organization instead of the repository.

This is mainly to avoid using more api calls than we have to.
Arguments:
repo_list: List of all repos with metrics
org: The github org to add metrics to
"""
def add_info_to_org_from_list_of_repos(repo_list, org):

"""
This method serves to iterate through previously collected metric
data that is associated with a repo and derive the cumulative metric data
for the whole organization instead of the repository.
This is mainly to avoid using more api calls than we have to.
Arguments:
repo_list: List of all repos with metrics
org: The github org to add metrics to
"""
#Define counts to update based on tracked repositories.
org_counts = {"commits_count": 0,
"issues_count": 0,
Expand Down Expand Up @@ -48,20 +42,6 @@ def add_info_to_org_from_list_of_repos(repo_list, org):
org.store_metrics(org_counts)


"""
Purpose: repo_data_to_json will convert data from string to json format such that we can
access the counts for the desired metrics in a repo
Input: Requires a repository name defined from graphql_queries
Returns: json dict of repo data
"""
repos = {}

def repo_data_to_json(repositories):
for repo in repositories:
repo_json = json.loads(repo)
repos[repo] = repo_json


def get_all_parsed_data(org_name_list, repo_name_list):

all_orgs = []
Expand Down
3 changes: 0 additions & 3 deletions scripts/metricsLib/constants.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import datetime
import json
import os
from pathlib import Path
from metricsLib import repos
from metricsLib import orgs
from metricsLib.metrics import GraphqlMetric, RangeMetric

BASE_PATH = os.path.dirname(os.path.abspath(__file__))
Expand Down
24 changes: 13 additions & 11 deletions scripts/metricsLib/repos.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
import os
import re
import json
import requests
import datetime
import re

"""This class serves to manage the parameter and metric data of a Repository.
It stores parameter and metric data in two seperate dictionaries for easy JSON
conversion.

Repository's main purpose as a real python class is to encapsulate the mapping
of the db ids in augur to the repos we are trying to gather metrics for.

Arguments:
repo_git_url: Github url
"""
class Repository:
"""
This class serves to manage the parameter and metric data of a Repository.
It stores parameter and metric data in two seperate dictionaries for easy JSON
conversion.
Repository's main purpose as a real python class is to encapsulate the mapping
of the db ids in augur to the repos we are trying to gather metrics for.
Arguments:
repo_git_url: Github url
"""
def __init__(self, repo_git_url):

self.url = repo_git_url
Expand Down

0 comments on commit 54f0d80

Please sign in to comment.