aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar jesopo2018-11-08 10:36:40 +0000
committerGravatar jesopo2018-11-08 10:36:40 +0000
commit3d00a1e15a533a71c35175d3bf62f51910e6e859 (patch)
tree3784568a5876129de21d02cc17941d35f4f414f6
parentWe don't need to expliticly print issue/pr numbers; they're shown in the urls (diff)
signature
Explicitly denote when an :arbitrary arg is present in an IRCLine
-rw-r--r--src/utils/irc.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/utils/irc.py b/src/utils/irc.py
index a7604b4b..821a46d9 100644
--- a/src/utils/irc.py
+++ b/src/utils/irc.py
@@ -71,11 +71,12 @@ class IRCArgs(object):
class IRCLine(object):
def __init__(self, tags: dict, prefix: typing.Optional[str], command: str,
- args: IRCArgs):
+ args: IRCArgs, has_arbitrary: bool):
self.tags = tags
self.prefix = prefix
self.command = command
self.args = args
+ self.has_arbitrary = has_arbitrary
def parse_line(line: str) -> IRCLine:
tags = {}
@@ -94,8 +95,11 @@ def parse_line(line: str) -> IRCLine:
else:
tags[tag] = None
- line, _, arbitrary_split = line.partition(" :")
- arbitrary = arbitrary_split or None
+ line, arb_sep, arbitrary_split = line.partition(" :")
+ has_arbitrary = bool(arb_sep)
+ arbitrary = None # type: typing.Optional[str]
+ if has_arbitrary:
+ arbitrary = arbitrary_split
if line[0] == ":":
prefix_str, line = line[1:].split(" ", 1)
@@ -109,7 +113,7 @@ def parse_line(line: str) -> IRCLine:
if arbitrary:
args.append(arbitrary)
- return IRCLine(tags, prefix, command, IRCArgs(args))
+ return IRCLine(tags, prefix, command, IRCArgs(args), has_arbitrary)
COLOR_WHITE, COLOR_BLACK, COLOR_BLUE, COLOR_GREEN = 0, 1, 2, 3
COLOR_RED, COLOR_BROWN, COLOR_PURPLE, COLOR_ORANGE = 4, 5, 6, 7