aboutsummaryrefslogtreecommitdiffstats
path: root/bot/cogs/codeblock/parsing.py
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2020-05-07 16:26:17 -0700
committerGravatar MarkKoz <[email protected]>2020-06-13 11:21:07 -0700
commit7468aff92bc6cd658b334d89e7049c98b8ae0439 (patch)
tree91312af4b91ef4f7d47e4465e3985b2f99a853b2 /bot/cogs/codeblock/parsing.py
parentCode block: refactor `send_guide_embed` (diff)
Code block: rename some things to be "private"
Diffstat (limited to '')
-rw-r--r--bot/cogs/codeblock/parsing.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/bot/cogs/codeblock/parsing.py b/bot/cogs/codeblock/parsing.py
index 055c21118..a49ecc8f7 100644
--- a/bot/cogs/codeblock/parsing.py
+++ b/bot/cogs/codeblock/parsing.py
@@ -6,7 +6,7 @@ from typing import NamedTuple, Optional, Sequence
log = logging.getLogger(__name__)
BACKTICK = "`"
-TICKS = {
+_TICKS = {
BACKTICK,
"'",
'"',
@@ -19,10 +19,10 @@ TICKS = {
"\u2033", # DOUBLE PRIME
"\u3003", # VERTICAL KANA REPEAT MARK UPPER HALF
}
-RE_CODE_BLOCK = re.compile(
+_RE_CODE_BLOCK = re.compile(
fr"""
(?P<ticks>
- (?P<tick>[{''.join(TICKS)}]) # Put all ticks into a character class within a group.
+ (?P<tick>[{''.join(_TICKS)}]) # Put all ticks into a character class within a group.
\2{{2}} # Match previous group 2 more times to ensure the same char.
)
(?P<lang>[^\W_]+\n)? # Optionally match a language specifier followed by a newline.
@@ -54,7 +54,7 @@ def find_code_blocks(message: str) -> Optional[Sequence[CodeBlock]]:
log.trace("Finding all code blocks in a message.")
code_blocks = []
- for match in RE_CODE_BLOCK.finditer(message):
+ for match in _RE_CODE_BLOCK.finditer(message):
# Used to ensure non-matched groups have an empty string as the default value.
groups = match.groupdict("")
language = groups["lang"].strip() # Strip the newline cause it's included in the group.