Skip to content

Commit

Permalink
Minor edits
Browse files Browse the repository at this point in the history
  • Loading branch information
jstrieb committed Feb 17, 2022
1 parent 659343a commit 0de78de
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ For more information on inaccuracies, see issue
`jstrieb/github-stats`) separated by commas to a new secret—created as
before—called `EXCLUDED`.
- To ignore certain languages, add them (separated by commas) to a new
secret called `EXCLUDED_LANGS`. E.g. to exclude HTML and TeX you could set
the value to `html,tex`.
secret called `EXCLUDED_LANGS`. For example, to exclude HTML and TeX you
could set the value to `html,tex`.
- To show statistics only for "owned" repositories and not forks with
contributions, add an environment variable (under the `env` header in the
[main
Expand Down
8 changes: 4 additions & 4 deletions github_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,7 @@ def __init__(
self.username = username
self._ignore_forked_repos = ignore_forked_repos
self._exclude_repos = set() if exclude_repos is None else exclude_repos
self._exclude_langs = (
set() if exclude_langs is None else {x.lower() for x in exclude_langs}
)
self._exclude_langs = set() if exclude_langs is None else exclude_langs
self.queries = Queries(username, access_token, session)

self._name: Optional[str] = None
Expand Down Expand Up @@ -306,6 +304,8 @@ async def get_stats(self) -> None:
self._languages = dict()
self._repos = set()

exclude_langs_lower = {x.lower() for x in self._exclude_langs}

next_owned = None
next_contrib = None
while True:
Expand Down Expand Up @@ -350,7 +350,7 @@ async def get_stats(self) -> None:
for lang in repo.get("languages", {}).get("edges", []):
name = lang.get("node", {}).get("name", "Other")
languages = await self.languages
if name.lower() in self._exclude_langs:
if name.lower() in exclude_langs_lower:
continue
if name in languages:
languages[name]["size"] += lang.get("size", 0)
Expand Down

0 comments on commit 0de78de

Please sign in to comment.