Reformat project
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
from twisted.internet.protocol import Protocol, Factory, ClientFactory
|
||||
from twisted.internet.protocol import Protocol, Factory
|
||||
from json import dumps, loads
|
||||
from copy import deepcopy
|
||||
|
||||
import main
|
||||
from utils.logging.log import *
|
||||
from utils.logging.log import log, warn
|
||||
|
||||
validTypes = [
|
||||
"msg",
|
||||
@@ -47,10 +45,10 @@ class Relay(Protocol):
|
||||
data = data.decode("utf-8", "replace")
|
||||
try:
|
||||
parsed = loads(data)
|
||||
except:
|
||||
except: # noqa: E722
|
||||
self.sendErr("MALFORMED")
|
||||
return
|
||||
if not "type" in parsed.keys():
|
||||
if "type" not in parsed.keys():
|
||||
self.sendErr("NOTYPE")
|
||||
return
|
||||
if parsed["type"] == "hello":
|
||||
@@ -87,7 +85,7 @@ class Relay(Protocol):
|
||||
self.sendErr("NOTLIST")
|
||||
return
|
||||
for i in lst:
|
||||
if not i in validTypes:
|
||||
if i not in validTypes:
|
||||
self.sendErr("NONEXISTANT")
|
||||
return
|
||||
if i in self.subscriptions:
|
||||
@@ -102,10 +100,10 @@ class Relay(Protocol):
|
||||
self.sendErr("NOTLIST")
|
||||
return
|
||||
for i in lst:
|
||||
if not i in validTypes:
|
||||
if i not in validTypes:
|
||||
self.sendErr("NONEXISTANT")
|
||||
return
|
||||
if not i in self.subscriptions:
|
||||
if i not in self.subscriptions:
|
||||
self.sendErr("NOTSUBSCRIBED")
|
||||
return
|
||||
del self.subscriptions[i]
|
||||
|
||||
Reference in New Issue
Block a user