From 2e1a29583d3a9d30abecba7915d2874ddaf2b3c3 Mon Sep 17 00:00:00 2001 From: Cor Zuurmond Date: Fri, 6 Oct 2023 14:44:38 +0200 Subject: [PATCH 01/10] Add author organzation to pull requests --- models/marts/fct_pull_requests.sql | 49 +++++++++++++++++++----------- 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/models/marts/fct_pull_requests.sql b/models/marts/fct_pull_requests.sql index ff50842..1a7eebf 100644 --- a/models/marts/fct_pull_requests.sql +++ b/models/marts/fct_pull_requests.sql @@ -1,18 +1,33 @@ +with authors as ( + select * + FROM (VALUES + {%- for author in var("authors") -%} + ('{{ author.name }}', '{{ author.organization }}') + {%- if not loop.last %}, {%- endif -%} + {%- endfor -%} + ) Author(name, organization) +) + select - title, - body, - user_login as author, - author_association, - owner_and_repository.full_repository_name, - owner_and_repository.owner, - owner_and_repository.repository, - state, - draft, - comments, - created_at, - updated_at, - closed_at, - pull_request_merged_at as merged_at, - reactions_total_count, - html_url as url, -from {{ ref("int_pull_requests") }} + pull_requests.title, + pull_requests.body, + pull_requests.user_login as author, + authors.organization as author_organzation, + pull_requests.author_association, + pull_requests.owner_and_repository.full_repository_name, + pull_requests.owner_and_repository.owner, + pull_requests.owner_and_repository.repository, + pull_requests.state, + pull_requests.draft, + pull_requests.comments, + pull_requests.created_at, + pull_requests.updated_at, + pull_requests.closed_at, + pull_requests.pull_request_merged_at as merged_at, + pull_requests.reactions_total_count, + pull_requests.html_url as url, +from + {{ ref("int_pull_requests") }} AS pull_requests + left join + authors + ON pull_requests.user_login = authors.name From 72863d83ef5147517c24d041b4fd3ed773860a4a Mon Sep 17 00:00:00 2001 From: Cor Zuurmond Date: Fri, 6 Oct 2023 14:57:54 +0200 Subject: [PATCH 02/10] Add organizations filter to dashboard --- webapp/src/pages/home/Home.tsx | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/webapp/src/pages/home/Home.tsx b/webapp/src/pages/home/Home.tsx index 9070bee..24c16f9 100644 --- a/webapp/src/pages/home/Home.tsx +++ b/webapp/src/pages/home/Home.tsx @@ -15,11 +15,13 @@ function Home() { const theme = useTheme(); const [allDataLoaded, setAllDataLoaded] = useState(false); const [authorFilter, setAuthorFilter] = useState(); + const [organizationFilter, setOrganizationFilter] = useState(); const [repositoryFilter, setRepositoryFilter] = useState(); const [ownerFilter, setOwnerFilter] = useState(); - const filters = [authorFilter, repositoryFilter, ownerFilter]; + const filters = [authorFilter, organizationFilter, repositoryFilter, ownerFilter]; const authorQuery = 'SELECT distinct author FROM main_marts.fct_pull_requests;'; + const organizationQuery = 'SELECT distinct author_organization AS organization FROM main_marts.fct_pull_requests ORDER BY lower(author_organzation);'; const repositoryQuery = 'SELECT distinct repository FROM main_marts.fct_pull_requests;'; const ownerQuery = 'SELECT distinct owner FROM main_marts.fct_pull_requests ORDER BY lower(owner);'; const pullRequestCountQuery = `SELECT count(*) as amount FROM main_marts.fct_pull_requests ${useQueryFilter(filters)};`; @@ -51,6 +53,7 @@ function Home() { `; const { data: authors } = useQuery<{ author: string }>(authorQuery); + const { data: organizations } = useQuery<{ organization: string }>(organizationQuery); const { data: repositories } = useQuery<{ repository: string }>(repositoryQuery); const { data: owners } = useQuery<{ owner: string }>(ownerQuery); const { data: pullRequestCount, loading: loadingPullRequests } = useQuery(pullRequestCountQuery); @@ -69,6 +72,15 @@ function Home() { return ['All']; }, [authors]); + const preparedOrganizations = useMemo(() => { + if (organizations) { + const prepData = organizations.map(item => item.organization); + prepData.unshift('All'); + return prepData; + } + return ['All']; + }, [organizations]); + const preparedRepositories = useMemo(() => { if (repositories) { const prepData = repositories.map(item => item.repository); @@ -158,6 +170,7 @@ function Home() { monthlyPullRequestCounts && pullRequestsPerRepository && authors && + organizations && repositories && owners ) { @@ -171,6 +184,7 @@ function Home() { monthlyPullRequestCounts, pullRequestsPerRepository, authors, + organizations, repositories, owners ]); @@ -195,6 +209,14 @@ function Home() { onChangeValue={(value) => onChangeSelectBox(value, setRepositoryFilter, 'repository')} /> + + onChangeSelectBox(value, setOrganizationFilter, 'organization')} + /> + Date: Fri, 6 Oct 2023 15:00:39 +0200 Subject: [PATCH 03/10] Fix typo --- models/marts/fct_pull_requests.sql | 2 +- webapp/src/pages/home/Home.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/models/marts/fct_pull_requests.sql b/models/marts/fct_pull_requests.sql index 1a7eebf..3f1bada 100644 --- a/models/marts/fct_pull_requests.sql +++ b/models/marts/fct_pull_requests.sql @@ -12,7 +12,7 @@ select pull_requests.title, pull_requests.body, pull_requests.user_login as author, - authors.organization as author_organzation, + authors.organization as author_organization, pull_requests.author_association, pull_requests.owner_and_repository.full_repository_name, pull_requests.owner_and_repository.owner, diff --git a/webapp/src/pages/home/Home.tsx b/webapp/src/pages/home/Home.tsx index 24c16f9..3e5c0a0 100644 --- a/webapp/src/pages/home/Home.tsx +++ b/webapp/src/pages/home/Home.tsx @@ -21,7 +21,7 @@ function Home() { const filters = [authorFilter, organizationFilter, repositoryFilter, ownerFilter]; const authorQuery = 'SELECT distinct author FROM main_marts.fct_pull_requests;'; - const organizationQuery = 'SELECT distinct author_organization AS organization FROM main_marts.fct_pull_requests ORDER BY lower(author_organzation);'; + const organizationQuery = 'SELECT distinct author_organization AS organization FROM main_marts.fct_pull_requests ORDER BY lower(author_organization);'; const repositoryQuery = 'SELECT distinct repository FROM main_marts.fct_pull_requests;'; const ownerQuery = 'SELECT distinct owner FROM main_marts.fct_pull_requests ORDER BY lower(owner);'; const pullRequestCountQuery = `SELECT count(*) as amount FROM main_marts.fct_pull_requests ${useQueryFilter(filters)};`; From cc728e97136faa090b2e7ea1536ed613098752ff Mon Sep 17 00:00:00 2001 From: Cor Zuurmond Date: Fri, 6 Oct 2023 15:04:05 +0200 Subject: [PATCH 04/10] Fix column --- webapp/src/pages/home/Home.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/src/pages/home/Home.tsx b/webapp/src/pages/home/Home.tsx index 3e5c0a0..3914d80 100644 --- a/webapp/src/pages/home/Home.tsx +++ b/webapp/src/pages/home/Home.tsx @@ -214,7 +214,7 @@ function Home() { label="Author organizations" initialSelection="All" items={preparedOrganizations} - onChangeValue={(value) => onChangeSelectBox(value, setOrganizationFilter, 'organization')} + onChangeValue={(value) => onChangeSelectBox(value, setOrganizationFilter, 'author_organization')} /> From 94aeb411c67e2f35198837daaccc2fda2c2a4725 Mon Sep 17 00:00:00 2001 From: Ramon Vermeulen Date: Tue, 7 Nov 2023 19:16:41 +0100 Subject: [PATCH 05/10] bring back the query + fix layout --- webapp/src/pages/home/Home.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/webapp/src/pages/home/Home.tsx b/webapp/src/pages/home/Home.tsx index d81a042..243b012 100644 --- a/webapp/src/pages/home/Home.tsx +++ b/webapp/src/pages/home/Home.tsx @@ -21,6 +21,7 @@ function Home() { const filters = [authorFilter, organizationFilter, repositoryFilter, ownerFilter]; const authorQuery = 'SELECT distinct author FROM main_marts.fct_pull_requests ORDER BY lower(author);'; + const organizationQuery = 'SELECT distinct author_organization AS organization FROM main_marts.fct_pull_requests ORDER BY lower(author_organization);'; const repositoryQuery = 'SELECT distinct repository FROM main_marts.fct_pull_requests ORDER BY lower(repository);'; const ownerQuery = 'SELECT distinct owner FROM main_marts.fct_pull_requests ORDER BY lower(owner);'; const pullRequestCountQuery = `SELECT count(*) as amount FROM main_marts.fct_pull_requests ${useQueryFilter(filters)};`; @@ -185,7 +186,7 @@ function Home() { {allDataLoaded && ( <> - + onChangeSelectBox(value, setAuthorFilter, 'author')} /> - + onChangeSelectBox(value, setRepositoryFilter, 'repository')} /> - + onChangeSelectBox(value, setOrganizationFilter, 'author_organization')} /> - + Date: Tue, 7 Nov 2023 20:02:59 +0100 Subject: [PATCH 06/10] update .gitignore --- .gitignore | 2 + .../src/github_contributions/plugin.py | 142 ------------------ 2 files changed, 2 insertions(+), 142 deletions(-) delete mode 100644 github_contributions/src/github_contributions/plugin.py diff --git a/.gitignore b/.gitignore index fe8dc34..5150942 100644 --- a/.gitignore +++ b/.gitignore @@ -79,3 +79,5 @@ dist-ssr *.sln *.sw? *.duckdb +.envrc +package-lock.yml \ No newline at end of file diff --git a/github_contributions/src/github_contributions/plugin.py b/github_contributions/src/github_contributions/plugin.py deleted file mode 100644 index decd091..0000000 --- a/github_contributions/src/github_contributions/plugin.py +++ /dev/null @@ -1,142 +0,0 @@ -import functools -import logging -import os -import sys -import time -from typing import Any - -import frozendict -import pandas as pd -import requests -from dbt.adapters.duckdb.plugins import BasePlugin -from dbt.adapters.duckdb.utils import SourceConfig - -from . import api as github_api - - -def setup_logger(info: bool = False, debug: bool = False) -> None: - """Setup the logger. - - Default log level is warning. - - Parameters - ---------- - info : bool (default : False) - Set the log level to info - debug : bool (default : False) - Set the log level to debug - """ - if debug: - log_level = logging.DEBUG - elif info: - log_level = logging.INFO - else: - log_level = logging.WARNING - - if debug: - date_format = "%Y-%m-%d %H:%M:%S" - log_format = ( - "%(asctime)s - [%(levelname)s] - %(name)s - " - "(%(filename)s).%(funcName)s(%(lineno)d) - %(message)s" - ) - else: - date_format = "%H:%M:%S" - log_format = "%(asctime)s %(message)s" - - package_name = __name__.split(".")[0] - logger = logging.getLogger(package_name) - - formatter = logging.Formatter(log_format, datefmt=date_format) - formatter.converter = time.gmtime - - handler = logging.StreamHandler(sys.stdout) - handler.setFormatter(formatter) - - logger.setLevel(log_level) - logger.addHandler(handler) - -def extract_repositories_from_pull_requests(pull_requests: pd.DataFrame) -> list[str]: - """Extract repositories from pull requests - - Parameters - ---------- - pull_requests : pd.DataFrame - The pull requests - - Returns - ------- - list[str] : - The repositories - """ - regex_pattern = "^https:\/\/github\.com\/((.+)\/(.+))\/pull\/\d+$" - repositories = pull_requests["html_url"].str.extract(regex_pattern)[0].unique() - return repositories - - -class Plugin(BasePlugin): - def initialize(self, plugin_config: dict[str, Any]) -> None: - """Initialize the plugin - - The configuration is specfied in the profile. - - Parameters - ---------- - plugin_config : dict[str, Any] - A dictionary representing the plugin configuration - """ - log_info = plugin_config.get("info", False) - log_debug = plugin_config.get("debug", False) - github_token = plugin_config.get("GITHUB_TOKEN", os.getenv("GITHUB_TOKEN")) - use_cache = plugin_config.get("cache", False) - - setup_logger(info=log_info, debug=log_debug) - - self.headers = frozendict.frozendict(github_api.create_headers(github_token)) - self.repositories = None - - self.methods = { - "pull_requests": github_api.search_author_public_pull_requests, - "repositories": github_api.get_repository, - } - if use_cache: - self.methods = { - method: functools.cache(method_function) - for method, method_function in self.methods.items() - } - - def load(self, source_config: SourceConfig) -> pd.DataFrame: - """Load the data for a source. - - Parameters - ---------- - source_config : SourceConfig - The configuration of the source - - Returns - ------- - out : pd.DataFrame - The public pull requests - - """ - resource = source_config.get("resource") - get_repositories_from_pull_requests = source_config.get( - "get_repositories_from_pull_requests", - False, - ) - - df = None - if resource == "pull_requests" or get_repositories_from_pull_requests: - authors = {author["name"] for author in source_config.get("authors", [])} - df = self.methods["pull_requests"](*authors, headers=self.headers) - self.repositories = extract_repositories_from_pull_requests(df) - if resource == "repositories": - if get_repositories_from_pull_requests: - repositories = self.repositories - else: - repositories = source_config.get("repositories", []) - df = self.methods["repositories"](*repositories, headers=self.headers) - - if df is None: - raise ValueError(f"Unrecognized resource: {resource}") - - return df From 7ccc02a7a1e68a051db9656660862a128cde6641 Mon Sep 17 00:00:00 2001 From: Ramon Vermeulen Date: Tue, 7 Nov 2023 20:08:19 +0100 Subject: [PATCH 07/10] newline --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 5150942..8c4c030 100644 --- a/.gitignore +++ b/.gitignore @@ -80,4 +80,4 @@ dist-ssr *.sw? *.duckdb .envrc -package-lock.yml \ No newline at end of file +package-lock.yml From 9230ce2a7741ba29698f444e27b6aaacde273a6b Mon Sep 17 00:00:00 2001 From: Ramon Vermeulen Date: Wed, 8 Nov 2023 20:02:16 +0100 Subject: [PATCH 08/10] Revert "update .gitignore" This reverts commit a84e95f1f5f55682e942c004c7ff63cece5b2026. Conflicts: .gitignore --- .../src/github_contributions/plugin.py | 142 ++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 github_contributions/src/github_contributions/plugin.py diff --git a/github_contributions/src/github_contributions/plugin.py b/github_contributions/src/github_contributions/plugin.py new file mode 100644 index 0000000..decd091 --- /dev/null +++ b/github_contributions/src/github_contributions/plugin.py @@ -0,0 +1,142 @@ +import functools +import logging +import os +import sys +import time +from typing import Any + +import frozendict +import pandas as pd +import requests +from dbt.adapters.duckdb.plugins import BasePlugin +from dbt.adapters.duckdb.utils import SourceConfig + +from . import api as github_api + + +def setup_logger(info: bool = False, debug: bool = False) -> None: + """Setup the logger. + + Default log level is warning. + + Parameters + ---------- + info : bool (default : False) + Set the log level to info + debug : bool (default : False) + Set the log level to debug + """ + if debug: + log_level = logging.DEBUG + elif info: + log_level = logging.INFO + else: + log_level = logging.WARNING + + if debug: + date_format = "%Y-%m-%d %H:%M:%S" + log_format = ( + "%(asctime)s - [%(levelname)s] - %(name)s - " + "(%(filename)s).%(funcName)s(%(lineno)d) - %(message)s" + ) + else: + date_format = "%H:%M:%S" + log_format = "%(asctime)s %(message)s" + + package_name = __name__.split(".")[0] + logger = logging.getLogger(package_name) + + formatter = logging.Formatter(log_format, datefmt=date_format) + formatter.converter = time.gmtime + + handler = logging.StreamHandler(sys.stdout) + handler.setFormatter(formatter) + + logger.setLevel(log_level) + logger.addHandler(handler) + +def extract_repositories_from_pull_requests(pull_requests: pd.DataFrame) -> list[str]: + """Extract repositories from pull requests + + Parameters + ---------- + pull_requests : pd.DataFrame + The pull requests + + Returns + ------- + list[str] : + The repositories + """ + regex_pattern = "^https:\/\/github\.com\/((.+)\/(.+))\/pull\/\d+$" + repositories = pull_requests["html_url"].str.extract(regex_pattern)[0].unique() + return repositories + + +class Plugin(BasePlugin): + def initialize(self, plugin_config: dict[str, Any]) -> None: + """Initialize the plugin + + The configuration is specfied in the profile. + + Parameters + ---------- + plugin_config : dict[str, Any] + A dictionary representing the plugin configuration + """ + log_info = plugin_config.get("info", False) + log_debug = plugin_config.get("debug", False) + github_token = plugin_config.get("GITHUB_TOKEN", os.getenv("GITHUB_TOKEN")) + use_cache = plugin_config.get("cache", False) + + setup_logger(info=log_info, debug=log_debug) + + self.headers = frozendict.frozendict(github_api.create_headers(github_token)) + self.repositories = None + + self.methods = { + "pull_requests": github_api.search_author_public_pull_requests, + "repositories": github_api.get_repository, + } + if use_cache: + self.methods = { + method: functools.cache(method_function) + for method, method_function in self.methods.items() + } + + def load(self, source_config: SourceConfig) -> pd.DataFrame: + """Load the data for a source. + + Parameters + ---------- + source_config : SourceConfig + The configuration of the source + + Returns + ------- + out : pd.DataFrame + The public pull requests + + """ + resource = source_config.get("resource") + get_repositories_from_pull_requests = source_config.get( + "get_repositories_from_pull_requests", + False, + ) + + df = None + if resource == "pull_requests" or get_repositories_from_pull_requests: + authors = {author["name"] for author in source_config.get("authors", [])} + df = self.methods["pull_requests"](*authors, headers=self.headers) + self.repositories = extract_repositories_from_pull_requests(df) + if resource == "repositories": + if get_repositories_from_pull_requests: + repositories = self.repositories + else: + repositories = source_config.get("repositories", []) + df = self.methods["repositories"](*repositories, headers=self.headers) + + if df is None: + raise ValueError(f"Unrecognized resource: {resource}") + + return df From 229a979ee79f92399fe07ed8919aa60fa8af2b29 Mon Sep 17 00:00:00 2001 From: Ramon Vermeulen Date: Thu, 9 Nov 2023 17:47:20 +0100 Subject: [PATCH 09/10] bring back plugin.py file --- github_contributions/plugin.py | 133 +++++++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 github_contributions/plugin.py diff --git a/github_contributions/plugin.py b/github_contributions/plugin.py new file mode 100644 index 0000000..b3d3fe7 --- /dev/null +++ b/github_contributions/plugin.py @@ -0,0 +1,133 @@ +import functools +import logging +import os +import sys +import time +from typing import Any + +import frozendict +import pandas as pd +import requests +from dbt.adapters.duckdb.plugins import BasePlugin +from dbt.adapters.duckdb.utils import SourceConfig + +from . import api as github_api + + +def setup_logger(info: bool = False, debug: bool = False) -> None: + """Setup the logger. + Default log level is warning. + Parameters + ---------- + info : bool (default : False) + Set the log level to info + debug : bool (default : False) + Set the log level to debug + """ + if debug: + log_level = logging.DEBUG + elif info: + log_level = logging.INFO + else: + log_level = logging.WARNING + + if debug: + date_format = "%Y-%m-%d %H:%M:%S" + log_format = ( + "%(asctime)s - [%(levelname)s] - %(name)s - " + "(%(filename)s).%(funcName)s(%(lineno)d) - %(message)s" + ) + else: + date_format = "%H:%M:%S" + log_format = "%(asctime)s %(message)s" + + package_name = __name__.split(".")[0] + logger = logging.getLogger(package_name) + + formatter = logging.Formatter(log_format, datefmt=date_format) + formatter.converter = time.gmtime + + handler = logging.StreamHandler(sys.stdout) + handler.setFormatter(formatter) + + logger.setLevel(log_level) + logger.addHandler(handler) + +def extract_repositories_from_pull_requests(pull_requests: pd.DataFrame) -> list[str]: + """Extract repositories from pull requests + Parameters + ---------- + pull_requests : pd.DataFrame + The pull requests + Returns + ------- + list[str] : + The repositories + """ + regex_pattern = "^https:\/\/github\.com\/((.+)\/(.+))\/pull\/\d+$" + repositories = pull_requests["html_url"].str.extract(regex_pattern)[0].unique() + return repositories + + +class Plugin(BasePlugin): + def initialize(self, plugin_config: dict[str, Any]) -> None: + """Initialize the plugin + The configuration is specfied in the profile. + Parameters + ---------- + plugin_config : dict[str, Any] + A dictionary representing the plugin configuration + """ + log_info = plugin_config.get("info", False) + log_debug = plugin_config.get("debug", False) + github_token = plugin_config.get("GITHUB_TOKEN", os.getenv("GITHUB_TOKEN")) + use_cache = plugin_config.get("cache", False) + + setup_logger(info=log_info, debug=log_debug) + + self.headers = frozendict.frozendict(github_api.create_headers(github_token)) + self.repositories = None + + self.methods = { + "pull_requests": github_api.search_author_public_pull_requests, + "repositories": github_api.get_repository, + } + if use_cache: + self.methods = { + method: functools.cache(method_function) + for method, method_function in self.methods.items() + } + + def load(self, source_config: SourceConfig) -> pd.DataFrame: + """Load the data for a source. + Parameters + ---------- + source_config : SourceConfig + The configuration of the source + Returns + ------- + out : pd.DataFrame + The public pull requests + """ + resource = source_config.get("resource") + get_repositories_from_pull_requests = source_config.get( + "get_repositories_from_pull_requests", + False, + ) + + df = None + if resource == "pull_requests" or get_repositories_from_pull_requests: + authors = {author["name"] for author in source_config.get("authors", [])} + df = self.methods["pull_requests"](*authors, headers=self.headers) + self.repositories = extract_repositories_from_pull_requests(df) + if resource == "repositories": + if get_repositories_from_pull_requests: + repositories = self.repositories + else: + repositories = source_config.get("repositories", []) + df = self.methods["repositories"](*repositories, headers=self.headers) + + if df is None: + raise ValueError(f"Unrecognized resource: {resource}") + + return df From 51bddda8632aecd32d5f95fbf0533be002c6b76b Mon Sep 17 00:00:00 2001 From: Ramon Vermeulen Date: Thu, 9 Nov 2023 17:49:32 +0100 Subject: [PATCH 10/10] Update plugin.py --- github_contributions/plugin.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/github_contributions/plugin.py b/github_contributions/plugin.py index b3d3fe7..29835eb 100644 --- a/github_contributions/plugin.py +++ b/github_contributions/plugin.py @@ -30,7 +30,7 @@ def setup_logger(info: bool = False, debug: bool = False) -> None: log_level = logging.INFO else: log_level = logging.WARNING - + if debug: date_format = "%Y-%m-%d %H:%M:%S" log_format = ( @@ -40,16 +40,16 @@ def setup_logger(info: bool = False, debug: bool = False) -> None: else: date_format = "%H:%M:%S" log_format = "%(asctime)s %(message)s" - + package_name = __name__.split(".")[0] logger = logging.getLogger(package_name) - + formatter = logging.Formatter(log_format, datefmt=date_format) formatter.converter = time.gmtime - + handler = logging.StreamHandler(sys.stdout) handler.setFormatter(formatter) - + logger.setLevel(log_level) logger.addHandler(handler) @@ -82,12 +82,12 @@ def initialize(self, plugin_config: dict[str, Any]) -> None: log_debug = plugin_config.get("debug", False) github_token = plugin_config.get("GITHUB_TOKEN", os.getenv("GITHUB_TOKEN")) use_cache = plugin_config.get("cache", False) - + setup_logger(info=log_info, debug=log_debug) - + self.headers = frozendict.frozendict(github_api.create_headers(github_token)) self.repositories = None - + self.methods = { "pull_requests": github_api.search_author_public_pull_requests, "repositories": github_api.get_repository, @@ -114,7 +114,7 @@ def load(self, source_config: SourceConfig) -> pd.DataFrame: "get_repositories_from_pull_requests", False, ) - + df = None if resource == "pull_requests" or get_repositories_from_pull_requests: authors = {author["name"] for author in source_config.get("authors", [])} @@ -129,5 +129,5 @@ def load(self, source_config: SourceConfig) -> pd.DataFrame: if df is None: raise ValueError(f"Unrecognized resource: {resource}") - + return df