Rename all modules to comply with PEP8

Lowercase with underscores
This commit is contained in:
Ben 2019-05-16 16:34:16 +01:00
parent 5a77c09ac7
commit 75c05604d9
59 changed files with 116 additions and 100 deletions

View File

@ -1,6 +1,6 @@
import asyncio import asyncio
import sys import sys
from Houdini.HoudiniFactory import HoudiniFactory from houdini.houdini import HoudiniFactory
if __name__ == '__main__': if __name__ == '__main__':
if sys.platform == 'win32': if sys.platform == 'win32':

View File

@ -2,11 +2,11 @@ import inspect
import config import config
from Houdini import Handlers from houdini import handlers
from Houdini import Plugins from houdini import plugins
from Houdini import ConflictResolution from houdini import ConflictResolution
from Houdini.Converters import _ArgumentDeserializer, _listener from houdini.converters import _ArgumentDeserializer, _listener
class UnknownCommandException(Exception): class UnknownCommandException(Exception):
@ -55,12 +55,12 @@ def group(name=None, **kwargs):
string_separator=' ', **kwargs) string_separator=' ', **kwargs)
cooldown = Handlers.cooldown cooldown = handlers.cooldown
check = Handlers.check check = handlers.check
player_attribute = Handlers.player_attribute player_attribute = handlers.player_attribute
player_data_attribute = Handlers.player_data_attribute player_data_attribute = handlers.player_data_attribute
player_in_room = Handlers.player_in_room player_in_room = handlers.player_in_room
def is_command(command_object): def is_command(command_object):
@ -69,7 +69,7 @@ def is_command(command_object):
def commands_from_plugin(commands, plugin): def commands_from_plugin(commands, plugin):
command_objects = inspect.getmembers(plugin, is_command) command_objects = inspect.getmembers(plugin, is_command)
if not isinstance(plugin, Plugins.IPlugin): if not isinstance(plugin, plugins.IPlugin):
raise TypeError('Commands can only be loaded from plugins') raise TypeError('Commands can only be loaded from plugins')
for command_name, command_object in command_objects: for command_name, command_object in command_objects:

View File

@ -6,7 +6,7 @@ import itertools
import inspect import inspect
from Houdini.Cooldown import CooldownError from houdini.cooldown import CooldownError
class ChecklistError(Exception): class ChecklistError(Exception):
@ -213,7 +213,7 @@ class ConnectedIglooConverter(IConverter):
class RoomConverter(IConverter): class RoomConverter(IConverter):
description = """Converts a room ID into a Houdini.Data.Room instance""" description = """Converts a room ID into a houdini.data.Room instance"""
async def convert(self, ctx): async def convert(self, ctx):
room_id = int(ctx.argument) room_id = int(ctx.argument)
@ -224,7 +224,7 @@ class RoomConverter(IConverter):
class ItemConverter(IConverter): class ItemConverter(IConverter):
description = """Converts an item ID into a Houdini.Data.Item instance""" description = """Converts an item ID into a houdini.data.Item instance"""
async def convert(self, ctx): async def convert(self, ctx):
item_id = int(ctx.argument) item_id = int(ctx.argument)
@ -235,7 +235,7 @@ class ItemConverter(IConverter):
class IglooConverter(IConverter): class IglooConverter(IConverter):
description = """Converts an igloo ID into a Houdini.Data.Igloo instance""" description = """Converts an igloo ID into a houdini.data.Igloo instance"""
async def convert(self, ctx): async def convert(self, ctx):
igloo_id = int(ctx.argument) igloo_id = int(ctx.argument)
@ -246,7 +246,7 @@ class IglooConverter(IConverter):
class FurnitureConverter(IConverter): class FurnitureConverter(IConverter):
description = """Converts a furniture ID into a Houdini.Data.Furniture instance""" description = """Converts a furniture ID into a houdini.data.Furniture instance"""
async def convert(self, ctx): async def convert(self, ctx):
furniture_id = int(ctx.argument) furniture_id = int(ctx.argument)
@ -257,7 +257,7 @@ class FurnitureConverter(IConverter):
class FlooringConverter(IConverter): class FlooringConverter(IConverter):
description = """Converts a flooring ID into a Houdini.Data.Flooring instance""" description = """Converts a flooring ID into a houdini.data.Flooring instance"""
async def convert(self, ctx): async def convert(self, ctx):
flooring_id = int(ctx.argument) flooring_id = int(ctx.argument)
@ -268,7 +268,7 @@ class FlooringConverter(IConverter):
class StampConverter(IConverter): class StampConverter(IConverter):
description = """Converts a stamp ID into a Houdini.Data.Stamp instance""" description = """Converts a stamp ID into a houdini.data.Stamp instance"""
async def convert(self, ctx): async def convert(self, ctx):
stamp_id = int(ctx.argument) stamp_id = int(ctx.argument)

View File

@ -1,4 +1,4 @@
from Houdini.Data import db from houdini.data import db
class BuddyList(db.Model): class BuddyList(db.Model):

View File

@ -1,4 +1,4 @@
from Houdini.Data import db from houdini.data import db
class DanceSong(db.Model): class DanceSong(db.Model):

View File

@ -1,5 +1,5 @@
from Houdini.Data import db, BaseCrumbsCollection from houdini.data import db, BaseCrumbsCollection
from Houdini.Data.Penguin import PenguinIgloo, PenguinLocation, PenguinFurniture from houdini.data.penguin import PenguinIgloo, PenguinLocation, PenguinFurniture
class Flooring(db.Model): class Flooring(db.Model):

View File

@ -1,5 +1,5 @@
from Houdini.Data import db, BaseCrumbsCollection from houdini.data import db, BaseCrumbsCollection
from Houdini.Data.Penguin import PenguinItem from houdini.data.penguin import PenguinItem
class Item(db.Model): class Item(db.Model):
@ -19,6 +19,6 @@ class Item(db.Model):
class ItemCrumbsCollection(BaseCrumbsCollection): class ItemCrumbsCollection(BaseCrumbsCollection):
def __init__(self, model=Item, key='ID', inventory_model=PenguinItem, inventory_id=None): def __init__(self, inventory_id=None):
super().__init__(model=model, key=key, inventory_model=inventory_model, super().__init__(model=Item, key='ID', inventory_model=PenguinItem,
inventory_id=inventory_id) inventory_id=inventory_id)

View File

@ -1,5 +1,5 @@
from Houdini.Data import db, BaseCrumbsCollection from houdini.data import db, BaseCrumbsCollection
from Houdini.Data.Penguin import PenguinPostcard from houdini.data.penguin import PenguinPostcard
class Postcard(db.Model): class Postcard(db.Model):

View File

@ -1,4 +1,4 @@
from Houdini.Data import db from houdini.data import db
class Ban(db.Model): class Ban(db.Model):

View File

@ -1,4 +1,4 @@
from Houdini.Data import db from houdini.data import db
class PenguinTrack(db.Model): class PenguinTrack(db.Model):

View File

@ -1,5 +1,5 @@
from Houdini.Data import db, BaseCrumbsCollection from houdini.data import db, BaseCrumbsCollection
from Houdini.Data.Penguin import PenguinCard from houdini.data.penguin import PenguinCard
class Card(db.Model): class Card(db.Model):

View File

@ -1,4 +1,4 @@
from Houdini.Data import db from houdini.data import db
class Penguin(db.Model): class Penguin(db.Model):
@ -71,6 +71,11 @@ class Penguin(db.Model):
return int('{}{}0{}{}{}{}'.format(self.ApprovalRu * 1, self.ApprovalDe * 1, self.ApprovalEs * 1, return int('{}{}0{}{}{}{}'.format(self.ApprovalRu * 1, self.ApprovalDe * 1, self.ApprovalEs * 1,
self.ApprovalFr * 1, self.ApprovalPt * 1, self.ApprovalEn * 1), 2) self.ApprovalFr * 1, self.ApprovalPt * 1, self.ApprovalEn * 1), 2)
@property
def rejection(self):
return int('{}{}0{}{}{}{}'.format(self.RejectionRu * 1, self.RejectionDe * 1, self.RejectionEs * 1,
self.RejectionFr * 1, self.RejectionPt * 1, self.RejectionEn * 1), 2)
class ActivationKey(db.Model): class ActivationKey(db.Model):
__tablename__ = 'activation_key' __tablename__ = 'activation_key'
@ -233,6 +238,13 @@ class PenguinPuffleItem(db.Model):
Quantity = db.Column(db.SmallInteger, nullable=False) Quantity = db.Column(db.SmallInteger, nullable=False)
class PenguinPermission(db.Model):
__tablename__ = 'penguin_permission'
PenguinID = db.Column(db.ForeignKey(u'penguin.ID', ondelete=u'CASCADE', onupdate=u'CASCADE'), primary_key=True)
PermissionID = db.Column(db.ForeignKey(u'permission.ID', ondelete=u'CASCADE', onupdate=u'CASCADE'), nullable=False)
class Login(db.Model): class Login(db.Model):
__tablename__ = 'login' __tablename__ = 'login'

View File

@ -1,5 +1,5 @@
from Houdini.Data import db, BaseCrumbsCollection from houdini.data import db, BaseCrumbsCollection
from Houdini.Data.Penguin import PenguinPuffle, PenguinPuffleItem from houdini.data.penguin import PenguinPuffle, PenguinPuffleItem
class Puffle(db.Model): class Puffle(db.Model):

View File

@ -1,4 +1,4 @@
from Houdini.Data import db from houdini.data import db
class RedemptionBook(db.Model): class RedemptionBook(db.Model):

View File

@ -1,4 +1,4 @@
from Houdini.Data import db, BaseCrumbsCollection from houdini.data import db, BaseCrumbsCollection
class Room(db.Model): class Room(db.Model):

View File

@ -1,5 +1,5 @@
from Houdini.Data import db, BaseCrumbsCollection from houdini.data import db, BaseCrumbsCollection
from Houdini.Data.Penguin import PenguinStamp from houdini.data.penguin import PenguinStamp
class Stamp(db.Model): class Stamp(db.Model):

View File

@ -3,8 +3,8 @@ import importlib
import copy import copy
from watchdog.events import FileSystemEventHandler from watchdog.events import FileSystemEventHandler
from Houdini.Handlers import listeners_from_module, remove_handlers_by_module from houdini.handlers import listeners_from_module, remove_handlers_by_module
from Houdini.Events import evaluate_handler_file_event from houdini.events import evaluate_handler_file_event
class HandlerFileEventHandler(FileSystemEventHandler): class HandlerFileEventHandler(FileSystemEventHandler):

View File

@ -5,7 +5,7 @@ import copy
import asyncio import asyncio
from watchdog.events import FileSystemEventHandler from watchdog.events import FileSystemEventHandler
from Houdini.Events import evaluate_handler_file_event from houdini.events import evaluate_handler_file_event
class PluginFileEventHandler(FileSystemEventHandler): class PluginFileEventHandler(FileSystemEventHandler):

View File

@ -4,10 +4,10 @@ import os
import itertools import itertools
from types import FunctionType from types import FunctionType
from Houdini.Converters import _listener, _ArgumentDeserializer, get_converter, do_conversion, _ConverterContext from houdini.converters import _listener, _ArgumentDeserializer, get_converter, do_conversion, _ConverterContext
from Houdini.Cooldown import _Cooldown, _CooldownMapping, BucketType from houdini.cooldown import _Cooldown, _CooldownMapping, BucketType
from Houdini import Plugins from houdini import plugins
class AuthorityError(Exception): class AuthorityError(Exception):
@ -132,7 +132,7 @@ def is_listener(listener):
def listeners_from_module(xt_listeners, xml_listeners, module): def listeners_from_module(xt_listeners, xml_listeners, module):
listener_objects = inspect.getmembers(module, is_listener) listener_objects = inspect.getmembers(module, is_listener)
for listener_name, listener_object in listener_objects: for listener_name, listener_object in listener_objects:
if isinstance(module, Plugins.IPlugin): if isinstance(module, plugins.IPlugin):
listener_object.instance = module listener_object.instance = module
listener_collection = xt_listeners if type(listener_object) == _XTListener else xml_listeners listener_collection = xt_listeners if type(listener_object) == _XTListener else xml_listeners

View File

@ -1,10 +1,10 @@
from Houdini import Handlers from houdini import handlers
from Houdini.Handlers import XMLPacket from houdini.handlers import XMLPacket
from Houdini.Converters import VersionChkConverter from houdini.converters import VersionChkConverter
@Handlers.handler(XMLPacket('verChk')) @handlers.handler(XMLPacket('verChk'))
@Handlers.allow_once() @handlers.allow_once()
async def handle_version_check(p, version: VersionChkConverter): async def handle_version_check(p, version: VersionChkConverter):
if not version == 153: if not version == 153:
await p.send_xml({'body': {'action': 'apiKO', 'r': '0'}}) await p.send_xml({'body': {'action': 'apiKO', 'r': '0'}})
@ -13,7 +13,7 @@ async def handle_version_check(p, version: VersionChkConverter):
await p.send_xml({'body': {'action': 'apiOK', 'r': '0'}}) await p.send_xml({'body': {'action': 'apiOK', 'r': '0'}})
@Handlers.handler(XMLPacket('rndK')) @handlers.handler(XMLPacket('rndK'))
@Handlers.allow_once() @handlers.allow_once()
async def handle_random_key(p, data): async def handle_random_key(p, data):
await p.send_xml({'body': {'action': 'rndK', 'r': '-1'}, 'k': 'houdini'}) await p.send_xml({'body': {'action': 'rndK', 'r': '-1'}, 'k': 'houdini'})

View File

@ -1,10 +1,10 @@
from Houdini import Handlers from houdini import handlers
from Houdini.Handlers import XMLPacket, Login from houdini.handlers import XMLPacket, login
from Houdini.Converters import CredentialsConverter from houdini.converters import CredentialsConverter
from Houdini.Data.Penguin import Penguin from houdini.data.penguin import Penguin
from Houdini.Data.Buddy import BuddyList from houdini.data.buddy import BuddyList
from Houdini.Data.Moderator import Ban from houdini.data.moderator import Ban
from Houdini.Crypto import Crypto from houdini.crypto import Crypto
import asyncio import asyncio
import bcrypt import bcrypt
@ -15,8 +15,8 @@ import config
from datetime import datetime from datetime import datetime
@Handlers.handler(XMLPacket('login')) @handlers.handler(XMLPacket('login'))
@Handlers.allow_once() @handlers.allow_once()
async def handle_login(p, credentials: CredentialsConverter): async def handle_login(p, credentials: CredentialsConverter):
loop = asyncio.get_event_loop() loop = asyncio.get_event_loop()
@ -97,7 +97,8 @@ async def handle_login(p, credentials: CredentialsConverter):
for server_name, server_config in servers_config.items(): for server_name, server_config in servers_config.items():
if server_config['World']: if server_config['World']:
server_population = await p.server.redis.get('{}.population'.format(server_name)) server_population = await p.server.redis.get('{}.population'.format(server_name))
server_population = int(server_population) / (server_config['Capacity'] / 6) if server_population else 0 server_population = (7 if int(server_population) == server_config['Capacity'] \
else int(server_population) / (server_config['Capacity'] / 6)) if server_population else 0
server_players = await p.server.redis.smembers('{}.players'.format(server_name)) server_players = await p.server.redis.smembers('{}.players'.format(server_name))
@ -113,8 +114,9 @@ async def handle_login(p, credentials: CredentialsConverter):
buddy_worlds.append(server_config['Id']) buddy_worlds.append(server_config['Id'])
break break
raw_login_data = '|'.join([str(data.ID), str(data.ID), data.Username, login_key, str(data.approval), '1']) raw_login_data = '|'.join([str(data.ID), str(data.ID), data.Username, login_key, str(data.approval),
await p.send_xt('l', raw_login_data, confirmation_hash, 'friendsKey', '|'.join(world_populations), data.Email) str(data.rejection)])
await p.send_xt('l', raw_login_data, confirmation_hash, '', '|'.join(world_populations), '|'.join(buddy_worlds), data.Email)
handle_version_check = Login.handle_version_check handle_version_check = login.handle_version_check
handle_random_key = Login.handle_random_key handle_random_key = login.handle_random_key

View File

@ -4,9 +4,9 @@ import sys
import pkgutil import pkgutil
import importlib import importlib
from Houdini.Spheniscidae import Spheniscidae from houdini.spheniscidae import Spheniscidae
from Houdini.Penguin import Penguin from houdini.penguin import Penguin
from Houdini import PenguinStringCompiler from houdini import PenguinStringCompiler
import config import config
from aiologger import Logger from aiologger import Logger
@ -20,15 +20,17 @@ import aioredis
from aiocache import SimpleMemoryCache from aiocache import SimpleMemoryCache
from watchdog.observers import Observer from watchdog.observers import Observer
from Houdini.Data import db from houdini.data import db
from Houdini.Data.Item import ItemCrumbsCollection from houdini.data.item import ItemCrumbsCollection
from Houdini.Data.Igloo import IglooCrumbsCollection, FurnitureCrumbsCollection, \ from houdini.data.igloo import IglooCrumbsCollection, FurnitureCrumbsCollection, \
LocationCrumbsCollection, FlooringCrumbsCollection LocationCrumbsCollection, FlooringCrumbsCollection
from Houdini.Data.Room import RoomCrumbsCollection from houdini.data.room import RoomCrumbsCollection
from Houdini.Data.Stamp import StampCrumbsCollection from houdini.data.stamp import StampCrumbsCollection
from Houdini.Data.Ninja import CardCrumbsCollection from houdini.data.ninja import CardCrumbsCollection
from Houdini.Data.Mail import PostcardCrumbsCollection from houdini.data.mail import PostcardCrumbsCollection
from Houdini.Data.Pet import PuffleCrumbsCollection, PuffleItemCrumbsCollection from houdini.data.pet import PuffleCrumbsCollection, PuffleItemCrumbsCollection
from houdini.data.permission import PermissionCrumbsCollection
try: try:
import uvloop import uvloop
@ -36,14 +38,14 @@ try:
except ImportError: except ImportError:
uvloop = None uvloop = None
import Houdini.Handlers import houdini.handlers
from Houdini.Handlers import listeners_from_module, remove_handlers_by_module from houdini.handlers import listeners_from_module, remove_handlers_by_module
from Houdini.Events.HandlerFileEvent import HandlerFileEventHandler from houdini.events.handler_file_event import HandlerFileEventHandler
from Houdini.Events.PluginFileEvent import PluginFileEventHandler from houdini.events.plugin_file_event import PluginFileEventHandler
from Houdini.Commands import commands_from_plugin from houdini.commands import commands_from_plugin
import Houdini.Plugins as Plugins import houdini.plugins as plugins
class HoudiniFactory: class HoudiniFactory:
@ -103,7 +105,7 @@ class HoudiniFactory:
os.mkdir(errors_log_directory) os.mkdir(errors_log_directory)
if sys.platform != 'win32': if sys.platform != 'win32':
self.logger = Logger(name='Houdini') self.logger = Logger(name='houdini')
universal_handler = AsyncTimedRotatingFileHandler( universal_handler = AsyncTimedRotatingFileHandler(
filename=self.server_config['Logging']['General'], filename=self.server_config['Logging']['General'],
backup_count=3, backup_count=3,
@ -112,7 +114,7 @@ class HoudiniFactory:
error_handler = AsyncFileHandler(filename=self.server_config['Logging']['Errors']) error_handler = AsyncFileHandler(filename=self.server_config['Logging']['Errors'])
console_handler = AsyncStreamHandler(stream=sys.stdout) console_handler = AsyncStreamHandler(stream=sys.stdout)
else: else:
self.logger = logging.getLogger('Houdini') self.logger = logging.getLogger('houdini')
universal_handler = RotatingFileHandler(self.server_config['Logging']['General'], universal_handler = RotatingFileHandler(self.server_config['Logging']['General'],
maxBytes=2097152, backupCount=3, encoding='utf-8') maxBytes=2097152, backupCount=3, encoding='utf-8')
@ -142,7 +144,7 @@ class HoudiniFactory:
self.config.database['Address'], self.config.database['Address'],
self.config.database['Name'])) self.config.database['Name']))
self.logger.info('Houdini module instantiated') self.logger.info('houdini module instantiated')
self.redis = await aioredis.create_redis_pool('redis://{}:{}'.format( self.redis = await aioredis.create_redis_pool('redis://{}:{}'.format(
self.config.redis['Address'], self.config.redis['Port']), self.config.redis['Address'], self.config.redis['Port']),
@ -161,10 +163,10 @@ class HoudiniFactory:
PenguinStringCompiler.setup_default_builder(self.penguin_string_compiler) PenguinStringCompiler.setup_default_builder(self.penguin_string_compiler)
PenguinStringCompiler.setup_anonymous_default_builder(self.anonymous_penguin_string_compiler) PenguinStringCompiler.setup_anonymous_default_builder(self.anonymous_penguin_string_compiler)
self.load_handler_modules(exclude_load='Houdini.Handlers.Login.Login') self.load_handler_modules(exclude_load='houdini.Handlers.Login.Login')
self.logger.info('World server started') self.logger.info('World server started')
else: else:
self.load_handler_modules('Houdini.Handlers.Login.Login') self.load_handler_modules('houdini.Handlers.Login.Login')
self.logger.info('Login server started') self.logger.info('Login server started')
self.items = await ItemCrumbsCollection.get_collection() self.items = await ItemCrumbsCollection.get_collection()
@ -203,8 +205,8 @@ class HoudiniFactory:
self.puffle_items = await PuffleItemCrumbsCollection.get_collection() self.puffle_items = await PuffleItemCrumbsCollection.get_collection()
self.logger.info('Loaded {} puffle care items'.format(len(self.puffle_items))) self.logger.info('Loaded {} puffle care items'.format(len(self.puffle_items)))
handlers_path = './Houdini{}Handlers'.format(os.path.sep) handlers_path = './houdini{}handlers'.format(os.path.sep)
plugins_path = './Houdini{}Plugins'.format(os.path.sep) plugins_path = './houdini{}plugins'.format(os.path.sep)
self.configure_observers([handlers_path, HandlerFileEventHandler], self.configure_observers([handlers_path, HandlerFileEventHandler],
[plugins_path, PluginFileEventHandler]) [plugins_path, PluginFileEventHandler])
@ -216,7 +218,7 @@ class HoudiniFactory:
await self.server.serve_forever() await self.server.serve_forever()
async def load_plugins(self): async def load_plugins(self):
for plugin_package in self.get_package_modules(Plugins): for plugin_package in self.get_package_modules(plugins):
await self.load_plugin(plugin_package) await self.load_plugin(plugin_package)
async def load_plugin(self, plugin): async def load_plugin(self, plugin):
@ -227,7 +229,7 @@ class HoudiniFactory:
plugin_object = getattr(plugin_module, plugin_class)(self) plugin_object = getattr(plugin_module, plugin_class)(self)
if isinstance(plugin_object, Plugins.IPlugin): if isinstance(plugin_object, plugins.IPlugin):
self.plugins[plugin_class] = plugin_object self.plugins[plugin_class] = plugin_object
listeners_from_module(self.xt_listeners, self.xml_listeners, plugin_object) listeners_from_module(self.xt_listeners, self.xml_listeners, plugin_object)
@ -251,7 +253,7 @@ class HoudiniFactory:
await client_object.run() await client_object.run()
def load_handler_modules(self, strict_load=None, exclude_load=None): def load_handler_modules(self, strict_load=None, exclude_load=None):
for handler_module in self.get_package_modules(Houdini.Handlers): for handler_module in self.get_package_modules(houdini.handlers):
if not (strict_load and handler_module not in strict_load or exclude_load and handler_module in exclude_load): if not (strict_load and handler_module not in strict_load or exclude_load and handler_module in exclude_load):
if handler_module not in sys.modules.keys(): if handler_module not in sys.modules.keys():
module = importlib.import_module(handler_module) module = importlib.import_module(handler_module)
@ -269,7 +271,7 @@ class HoudiniFactory:
subpackage_object = importlib.import_module(full_module_name, package=package.__path__) subpackage_object = importlib.import_module(full_module_name, package=package.__path__)
subpackage_object_directory = dir(subpackage_object) subpackage_object_directory = dir(subpackage_object)
if Plugins.IPlugin.__name__ in subpackage_object_directory: if plugins.IPlugin.__name__ in subpackage_object_directory:
package_modules.append((subpackage_object, module_name)) package_modules.append((subpackage_object, module_name))
continue continue

View File

@ -1,4 +1,4 @@
from Houdini.Spheniscidae import Spheniscidae from houdini.spheniscidae import Spheniscidae
class Penguin(Spheniscidae): class Penguin(Spheniscidae):

View File

@ -1,5 +1,5 @@
from Houdini import Handlers from houdini import handlers
from Houdini.Handlers import XMLPacket, XTPacket from houdini.handlers import XMLPacket, XTPacket
from asyncio import IncompleteReadError from asyncio import IncompleteReadError
@ -85,7 +85,7 @@ class Spheniscidae:
packet_id = parsed_data[2] packet_id = parsed_data[2]
packet = XTPacket(packet_id) packet = XTPacket(packet_id)
if Handlers.listener_exists(self.server.xt_listeners, self.server.xml_listeners, packet): if handlers.listener_exists(self.server.xt_listeners, self.server.xml_listeners, packet):
xt_listeners = self.server.xt_listeners[packet] xt_listeners = self.server.xt_listeners[packet]
packet_data = parsed_data[4:] packet_data = parsed_data[4:]
@ -111,7 +111,7 @@ class Spheniscidae:
action = body_tag.get('action') action = body_tag.get('action')
packet = XMLPacket(action) packet = XMLPacket(action)
if Handlers.listener_exists(self.server.xt_listeners, self.server.xml_listeners, packet): if handlers.listener_exists(self.server.xt_listeners, self.server.xml_listeners, packet):
xml_listeners = self.server.xml_listeners[packet] xml_listeners = self.server.xml_listeners[packet]
for listener in xml_listeners: for listener in xml_listeners: