Skip to content

Commit

Permalink
Update GitStats (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
R055A authored Jul 14, 2024
1 parent e7bc8b8 commit e685e15
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 32 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/auto_update_stat_images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ jobs:
- name: Check out code
uses: actions/checkout@v3

# Run using Python 3.11 for consistency and aiohttp
- name: Set up Python 3.11
# Run using Python 3.12 for consistency and aiohttp
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: '3.11'
python-version: '3.12'
architecture: 'x64'
cache: pip
cache-dependency-path: '**/requirements.txt'
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/non_auto_generate_stat_images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ jobs:
- name: Check out code
uses: actions/checkout@v3

# Run using Python 3.11 for consistency and aiohttp
- name: Set up Python 3.11
# Run using Python 3.12 for consistency and aiohttp
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: '3.11'
python-version: '3.12'
architecture: 'x64'
cache: pip
cache-dependency-path: '**/requirements.txt'
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pull_request_code_convention.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ jobs:
- name: Check out code
uses: actions/checkout@v3

# Run using Python 3.11 for consistency
- name: Set up Python 3.11
# Run using Python 3.12 for consistency
- name: Set up Python 3.12
uses: actions/setup-python@v3
with:
python-version: '3.11'
python-version: '3.12'
architecture: 'x64'
cache: pip
cache-dependency-path: '**/requirements.txt'
Expand Down
4 changes: 2 additions & 2 deletions src/generate_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,13 @@ async def generate_overview(self) -> None:
output = sub("{{ avg_contribution_percent }}", avg_contribution_percent, output)

num_repos = len(await self.__stats.repos)
num_owned_repos = len(await self.__stats.owned_repos)
# num_owned_repos = len(await self.__stats.owned_repos)
repos = (
num_repos
if len(str(num_repos)) < TXT_SPACER_MAX_LEN
else add_unit(num_repos)
)
repos = f"{repos:,} [{'%g' % round(num_owned_repos / num_repos * 100, 1)}%]"
repos = f"{repos:,}" # [{'%g' % round(num_owned_repos / num_repos * 100, 1)}%]"
output = sub("{{ repos }}", repos, output)

collaborators_and_contributors = f"{await self.__stats.collaborators:,}"
Expand Down
36 changes: 18 additions & 18 deletions src/github_repo_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def __init__(self, environment_vars: EnvironmentVariables, session: ClientSessio
self._languages: Optional[Dict[str, Any]] = None
self._excluded_languages: Optional[Set[str]] = None
self._repos: Optional[Set[str]] = None
self._owned_repos: Optional[Set[str]] = None
# self._owned_repos: Optional[Set[str]] = None
self._users_lines_changed: Optional[Tuple[int, int]] = None
self._avg_percent: Optional[str] = None
self._views: Optional[int] = None
Expand Down Expand Up @@ -358,23 +358,23 @@ async def repos(self) -> Set[str]:
assert self._repos is not None
return self._repos

@property
async def owned_repos(self) -> Set[str]:
"""
:return: list of names of repos owned by user
"""
if self._owned_repos is not None:
return self._owned_repos
await self.get_stats()
assert self._repos is not None
self._owned_repos = set(
[
i
for i in self._repos
if self.environment_vars.username == i.split("/")[0]
]
)
return self._owned_repos
# @property
# async def owned_repos(self) -> Set[str]:
# """
# :return: list of names of repos owned by user
# """
# if self._owned_repos is not None:
# return self._owned_repos
# await self.get_stats()
# assert self._repos is not None
# self._owned_repos = set(
# [
# i
# for i in self._repos
# if self.environment_vars.username == i.split("/")[0]
# ]
# )
# return self._owned_repos

@property
async def total_contributions(self) -> int:
Expand Down
2 changes: 1 addition & 1 deletion src/templates/languages.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/templates/overview.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e685e15

Please sign in to comment.