From 5d7f017c9cacc122ef569a4c58ca2f2496c35e90 Mon Sep 17 00:00:00 2001 From: jesopo Date: Sun, 10 Mar 2019 13:14:15 +0000 Subject: [PATCH] Enum values shouldn't be all upper case --- modules/line_handler/__init__.py | 4 ++-- modules/line_handler/message.py | 2 +- modules/line_handler/user.py | 4 ++-- src/utils/__init__.py | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/line_handler/__init__.py b/modules/line_handler/__init__.py index 7ce361ee..a3009bf9 100644 --- a/modules/line_handler/__init__.py +++ b/modules/line_handler/__init__.py @@ -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") diff --git a/modules/line_handler/message.py b/modules/line_handler/message.py index 7bc2e27e..38fb45fc 100644 --- a/modules/line_handler/message.py +++ b/modules/line_handler/message.py @@ -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: diff --git a/modules/line_handler/user.py b/modules/line_handler/user.py index fbe136a7..4153fc1b 100644 --- a/modules/line_handler/user.py +++ b/modules/line_handler/user.py @@ -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 == "*"): diff --git a/src/utils/__init__.py b/src/utils/__init__.py index 44ba4587..3b3ab9f4 100644 --- a/src/utils/__init__.py +++ b/src/utils/__init__.py @@ -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"