Enum values shouldn't be all upper case

This commit is contained in:
jesopo 2019-03-10 13:14:15 +00:00
parent 2dc290951a
commit 5d7f017c9c
4 changed files with 7 additions and 7 deletions

View file

@ -16,7 +16,7 @@ class Module(ModuleManager.BaseModule):
default_event = any(default_events)
kwargs = {"args": line.args, "tags": line.tags, "server": server,
"prefix": line.prefix, "direction": utils.Direction.RECV}
"prefix": line.prefix, "direction": utils.Direction.Recv}
self.events.on("raw.received").on(line.command).call_unsafe(**kwargs)
if default_event or not hooks:
@ -35,7 +35,7 @@ class Module(ModuleManager.BaseModule):
def handle_send(self, event):
self.events.on("raw.send").on(event["line"].command).call_unsafe(
args=event["line"].args, tags=event["line"].tags,
server=event["server"], direction=utils.Direction.SEND)
server=event["server"], direction=utils.Direction.Send)
# ping from the server
@utils.hook("raw.received.ping")

View file

@ -1,7 +1,7 @@
from src import utils
def _from_self(server, direction, prefix):
if direction == utils.Direction.SEND:
if direction == utils.Direction.Send:
if server.has_capability("echo-message"):
return None
else:

View file

@ -18,11 +18,11 @@ def handle_311(event):
def quit(events, event):
nickname = None
if event["direction"] == utils.Direction.RECV:
if event["direction"] == utils.Direction.Recv:
nickname = event["prefix"].nickname
reason = event["args"].get(0)
if event["direction"] == utils.Direction.RECV:
if event["direction"] == utils.Direction.Recv:
nickname = event["prefix"].nickname
if (not event["server"].is_own_nickname(nickname) and
not event["prefix"].hostmask == "*"):

View file

@ -2,8 +2,8 @@ import datetime, decimal, enum, io, ipaddress, re, threading, typing
from src.utils import cli, consts, irc, http, parse, security
class Direction(enum.Enum):
SEND = 0
RECV = 1
Send = 0
Recv = 1
ISO8601_PARSE = "%Y-%m-%dT%H:%M:%S%z"