diff options
| author | 2020-10-31 05:18:21 +0000 | |
|---|---|---|
| committer | 2020-10-31 05:18:21 +0000 | |
| commit | 2b379c2f8f352caf694913c3cb298599463c87c0 (patch) | |
| tree | 681ca96b721ccc7cacc818b553bcf7c4ea2b357b | |
| parent | better no-prs message (diff) | |
Fix capitalization and grammar
For Hacktoberstats
| -rw-r--r-- | bot/exts/halloween/hacktoberstats.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/bot/exts/halloween/hacktoberstats.py b/bot/exts/halloween/hacktoberstats.py index 1640e6cf..0f6b9924 100644 --- a/bot/exts/halloween/hacktoberstats.py +++ b/bot/exts/halloween/hacktoberstats.py @@ -179,7 +179,7 @@ class HacktoberStats(commands.Cog): async with ctx.typing(): prs = await self.get_october_prs(github_username) - if prs is None: # it will be a None if user not found + if prs is None: # Will be None if the user was not found await ctx.send("GitHub user not found: " + github_username) return @@ -187,14 +187,14 @@ class HacktoberStats(commands.Cog): stats_embed = await self.build_embed(github_username, prs) await ctx.send('Here are some stats!', embed=stats_embed) else: - await ctx.send(f"No valid hacktoberfest PRs found for '{github_username}'") + await ctx.send(f"No valid Hacktoberfest PRs found for '{github_username}'") async def build_embed(self, github_username: str, prs: List[dict]) -> discord.Embed: """Return a stats embed built from github_username's PRs.""" logging.info(f"Building Hacktoberfest embed for GitHub user: '{github_username}'") in_review, accepted = await self._categorize_prs(prs) - n = len(accepted) + len(in_review) # total number of PRs + n = len(accepted) + len(in_review) # Total number of PRs if n >= PRS_FOR_SHIRT: shirtstr = f"**{github_username} is eligible for a T-shirt or a tree!**" elif n == PRS_FOR_SHIRT - 1: @@ -220,7 +220,7 @@ class HacktoberStats(commands.Cog): icon_url="https://avatars1.githubusercontent.com/u/35706162?s=200&v=4" ) - # this will handle when no PRs in_review or accepted + # This will handle when no PRs in_review or accepted review_str = self._build_prs_string(in_review, github_username) or "None" accepted_str = self._build_prs_string(accepted, github_username) or "None" stats_embed.add_field( @@ -257,7 +257,7 @@ class HacktoberStats(commands.Cog): } Otherwise, return empty list - None will be returned when github user not found + None will be returned when the GitHub user was not found """ logging.info(f"Fetching Hacktoberfest Stats for GitHub user: '{github_username}'") base_url = "https://api.github.com/search/issues?q=" @@ -288,11 +288,11 @@ class HacktoberStats(commands.Cog): return else: logging.error(f"GitHub API request for '{github_username}' failed with message: {api_message}") - return [] # not returning None here, because that should be for when user not found + return [] # No October PRs were found due to error if jsonresp["total_count"] == 0: # Short circuit if there aren't any PRs - logging.info(f"No october PRs found for GitHub user: '{github_username}'") + logging.info(f"No October PRs found for GitHub user: '{github_username}'") return [] logging.info(f"Found {len(jsonresp['items'])} Hacktoberfest PRs for GitHub user: '{github_username}'") @@ -310,7 +310,7 @@ class HacktoberStats(commands.Cog): "number": item["number"] } - # if the PR has 'invalid' or 'spam' labels, the PR must be + # If the PR has 'invalid' or 'spam' labels, the PR must be # either merged or approved for it to be included if HacktoberStats._has_label(item, ["invalid", "spam"]): if not await HacktoberStats._is_accepted(itemdict): @@ -323,17 +323,17 @@ class HacktoberStats(commands.Cog): outlist.append(itemdict) continue - # checking PR's labels for "hacktoberfest-accepted" + # Checking PR's labels for "hacktoberfest-accepted" if HacktoberStats._has_label(item, "hacktoberfest-accepted"): outlist.append(itemdict) continue - # no need to query github if repo topics are fetched before already + # No need to query GitHub if repo topics are fetched before already if shortname in hackto_topics.keys(): if hackto_topics[shortname]: outlist.append(itemdict) continue - # fetch topics for the pr repo + # Fetch topics for the pr repo topics_query_url = f"https://api.github.com/repos/{shortname}/topics" logging.debug(f"Fetching repo topics for {shortname} with url: {topics_query_url}") jsonresp2 = await HacktoberStats._fetch_url(topics_query_url, GITHUB_TOPICS_ACCEPT_HEADER) @@ -344,7 +344,7 @@ class HacktoberStats(commands.Cog): # PRs after oct 3 that doesn't have 'hacktoberfest-accepted' label # must be in repo with 'hacktoberfest' topic if "hacktoberfest" in jsonresp2["names"]: - hackto_topics[shortname] = True # cache result in the dict for later use if needed + hackto_topics[shortname] = True # Cache result in the dict for later use if needed outlist.append(itemdict) return outlist |