Skip to content

Commit 6ce8515

Browse files
committed
Run static analysis
1 parent 8eea286 commit 6ce8515

1 file changed

Lines changed: 10 additions & 16 deletions

File tree

github/github_scratcher.py

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1-
import json
1+
# Standard library
22
import os
33
import os.path
44
import sys
55
import traceback
6-
from urllib import request
76

87
sys.path.append(".")
98

9+
# Third-party
1010
import requests
11-
import quantify
12-
import pandas as pd
1311
from requests.adapters import HTTPAdapter
1412
from urllib3.util.retry import Retry
1513

14+
# First-party/Local
15+
import quantify
16+
1617
PATH_REPO_ROOT, PATH_WORK_DIR, PATH_DOTENV, DATETIME_TODAY = quantify.setup(
1718
__file__
1819
)
@@ -23,23 +24,13 @@
2324
f"{DATETIME_TODAY.year}_{DATETIME_TODAY.month}_{DATETIME_TODAY.day}.csv",
2425
)
2526

27+
2628
def set_up_data_file():
2729
"""Writes the header row of the data file."""
2830
header_title = "LICENSE_TYPE,Repository Count"
2931
with open(DATA_WRITE_FILE, "w") as f:
3032
f.write(header_title + "\n")
3133

32-
# def get_license_list():
33-
# """Provides the list of license from a Creative Commons provided tool list.
34-
# Returns:
35-
# np.array: An np array containing all license types that should be
36-
# searched via Programmable Search Engine.
37-
# """
38-
# cc_license_data = pd.read_csv(
39-
# os.path.join(PATH_WORK_DIR, "legal-tool-paths.txt"), header=None
40-
# )
41-
# license_list = cc_license_data[0].unique()
42-
# return license_list
4334

4435
def get_response_elems(license):
4536
"""Provides the metadata for query of specified parameters
@@ -69,7 +60,8 @@ def get_response_elems(license):
6960
return {"totalResults": search_data["total_count"]}
7061
except Exception as e:
7162
raise e
72-
63+
64+
7365
def record_license_data(license_type):
7466
"""Writes the row for LICENSE_TYPE to file to contain Github Query data.
7567
Args:
@@ -86,12 +78,14 @@ def record_license_data(license_type):
8678
with open(DATA_WRITE_FILE, "a") as f:
8779
f.write(f"{data_log}\n")
8880

81+
8982
def record_all_licenses():
9083
"""Records the data of all license types findable in the license list and
9184
records these data into the DATA_WRITE_FILE as specified in that constant.
9285
"""
9386
record_license_data("CC")
9487

88+
9589
def main():
9690
set_up_data_file()
9791
record_all_licenses()

0 commit comments

Comments
 (0)