From 94d6772266e8420b9314ac72f93c9beb4037fd8d Mon Sep 17 00:00:00 2001 From: Nicolas F Date: Thu, 16 Mar 2017 18:25:55 +0100 Subject: [PATCH] rcon: code style fixes --- overviewer_core/rcon.py | 42 ++++++++++------------------------------- 1 file changed, 10 insertions(+), 32 deletions(-) diff --git a/overviewer_core/rcon.py b/overviewer_core/rcon.py index d815b8e..bd6b90c 100644 --- a/overviewer_core/rcon.py +++ b/overviewer_core/rcon.py @@ -14,10 +14,10 @@ # with the Overviewer. If not, see . import socket -#from enum import Enum import struct import select + class RConException(Exception): def __init__(self, request_id, reason): self.request_id = request_id @@ -27,24 +27,6 @@ class RConException(Exception): return ("Failed RCon request with request ID %d, reason %s" % (self.request_id, self.reason)) -# In D, enums are just that, enums. They're a group of named constants, -# sometimes with a tag, sometimes anonymous. -# In Python, Enums use the same syntax as class objects that derive from -# the "Enum" base class, even though they are not normal python classes -# and work as singletons anyway, but instead of using a different syntax, -# Python instead decided to have a chapter in their docs about how Enums -# are different from regular classes while looking exactly the same. -# You can look at said document of failure right here: -# https://docs.python.org/3/library/enum.html#how-are-enums-different -# -# "D has too much shit going on for me" -- agrif, 2014 -# -# Fortunately, we're not allowed to use Enums in Python 2. - -#class RConType(Enum): -# command = 2 -# login = 3 - class RConConnection(): rid = 0 @@ -56,13 +38,11 @@ class RConConnection(): def send(self, t, payload): self.rid = self.rid + 1 header = struct.pack("