From 613510f8f75a71fadfad56b6aaeee5db7a56b533 Mon Sep 17 00:00:00 2001 From: Ben Date: Thu, 26 Mar 2020 22:10:58 +0000 Subject: [PATCH] Organise imports --- bootstrap.py | 4 +-- houdini/__init__.py | 11 ++++----- houdini/commands.py | 5 +--- houdini/converters.py | 15 +++++------ houdini/data/__init__.py | 3 ++- houdini/data/buddy.py | 2 +- houdini/data/dance.py | 2 +- houdini/data/igloo.py | 2 +- houdini/data/item.py | 2 +- houdini/data/mail.py | 2 +- houdini/data/moderator.py | 2 +- houdini/data/ninja.py | 2 +- houdini/data/penguin.py | 3 +-- houdini/data/permission.py | 2 +- houdini/data/pet.py | 2 +- houdini/data/room.py | 7 +----- houdini/data/stamp.py | 2 +- houdini/handlers/__init__.py | 10 ++++---- houdini/handlers/games/__init__.py | 21 ++++++++-------- houdini/handlers/games/dance.py | 15 ++++++----- houdini/handlers/games/four.py | 6 ++--- houdini/handlers/games/mancala.py | 6 ++--- houdini/handlers/games/sled.py | 6 ++--- houdini/handlers/games/treasure.py | 8 +++--- houdini/handlers/login/__init__.py | 5 ++-- houdini/handlers/login/login.py | 22 ++++++++--------- houdini/handlers/login/world.py | 16 ++++++------ houdini/handlers/play/avatar.py | 2 +- houdini/handlers/play/buddy.py | 12 ++++----- houdini/handlers/play/epf.py | 19 +++++++------- houdini/handlers/play/experience.py | 15 ++++++----- houdini/handlers/play/igloo.py | 33 +++++++++++-------------- houdini/handlers/play/ignore.py | 5 ++-- houdini/handlers/play/item.py | 11 +++++---- houdini/handlers/play/mail.py | 9 +++---- houdini/handlers/play/message.py | 6 ++--- houdini/handlers/play/moderation.py | 14 +++++------ houdini/handlers/play/music.py | 19 +++++++------- houdini/handlers/play/navigation.py | 23 +++++++++++++---- houdini/handlers/play/ninja.py | 3 +-- houdini/handlers/play/party.py | 6 ++--- houdini/handlers/play/pet.py | 25 ++++++++----------- houdini/handlers/play/player.py | 23 ++++++++--------- houdini/handlers/play/rainbow.py | 9 +++---- houdini/handlers/play/room.py | 8 +++--- houdini/handlers/play/setting.py | 3 +-- houdini/handlers/play/stampbook.py | 12 ++++----- houdini/handlers/play/toy.py | 2 +- houdini/handlers/redemption/__init__.py | 17 ++++++------- houdini/houdini.py | 11 +++------ houdini/penguin.py | 2 +- houdini/plugins/__init__.py | 4 +-- houdini/spheniscidae.py | 10 +++----- 53 files changed, 228 insertions(+), 258 deletions(-) diff --git a/bootstrap.py b/bootstrap.py index 56542e6..2826900 100644 --- a/bootstrap.py +++ b/bootstrap.py @@ -1,9 +1,9 @@ +import argparse import asyncio import logging -import argparse +from houdini.constants import ClientType, ConflictResolution, Language from houdini.houdini import Houdini -from houdini.constants import Language, ConflictResolution, ClientType if __name__ == '__main__': logger = logging.getLogger('houdini') diff --git a/houdini/__init__.py b/houdini/__init__.py index 92c5378..b1d4b90 100644 --- a/houdini/__init__.py +++ b/houdini/__init__.py @@ -1,11 +1,10 @@ +import asyncio +import importlib +import logging +import pkgutil +from abc import ABC, abstractmethod from collections import OrderedDict from types import FunctionType -from abc import abstractmethod - -import asyncio -import logging -import importlib -import pkgutil def get_package_modules(package): diff --git a/houdini/commands.py b/houdini/commands.py index 4a9f3e6..7707352 100644 --- a/houdini/commands.py +++ b/houdini/commands.py @@ -1,10 +1,7 @@ import inspect -from houdini import handlers -from houdini import plugins -from houdini import _AbstractManager +from houdini import _AbstractManager, handlers, plugins from houdini.constants import ConflictResolution - from houdini.converters import _ArgumentDeserializer, _listener diff --git a/houdini/converters.py b/houdini/converters.py index 7199c23..01996b8 100644 --- a/houdini/converters.py +++ b/houdini/converters.py @@ -1,18 +1,15 @@ -from abc import ABC -from abc import abstractmethod - import asyncio -import itertools -import inspect import collections +import inspect +import itertools +from abc import ABC, abstractmethod from houdini.cooldown import CooldownError - -from houdini.data.room import Room +from houdini.data.igloo import Flooring, Furniture, Igloo, Location from houdini.data.item import Item -from houdini.data.igloo import Igloo, Furniture, Flooring, Location +from houdini.data.pet import PenguinPuffle, Puffle +from houdini.data.room import Room from houdini.data.stamp import Stamp -from houdini.data.pet import Puffle, PenguinPuffle class ChecklistError(Exception): diff --git a/houdini/data/__init__.py b/houdini/data/__init__.py index 002e5c9..7b95108 100644 --- a/houdini/data/__init__.py +++ b/houdini/data/__init__.py @@ -1,6 +1,7 @@ -from gino import Gino from collections.abc import Mapping +from gino import Gino + db = Gino() diff --git a/houdini/data/buddy.py b/houdini/data/buddy.py index 54b2836..819f6c3 100644 --- a/houdini/data/buddy.py +++ b/houdini/data/buddy.py @@ -1,4 +1,4 @@ -from houdini.data import db, AbstractDataCollection +from houdini.data import AbstractDataCollection, db class BuddyList(db.Model): diff --git a/houdini/data/dance.py b/houdini/data/dance.py index ad14072..7e94722 100644 --- a/houdini/data/dance.py +++ b/houdini/data/dance.py @@ -1,4 +1,4 @@ -from houdini.data import db, AbstractDataCollection +from houdini.data import AbstractDataCollection, db class DanceSong(db.Model): diff --git a/houdini/data/igloo.py b/houdini/data/igloo.py index 6ddb5bb..e281336 100644 --- a/houdini/data/igloo.py +++ b/houdini/data/igloo.py @@ -1,4 +1,4 @@ -from houdini.data import db, AbstractDataCollection +from houdini.data import AbstractDataCollection, db class Flooring(db.Model): diff --git a/houdini/data/item.py b/houdini/data/item.py index feaedb0..b583911 100644 --- a/houdini/data/item.py +++ b/houdini/data/item.py @@ -1,4 +1,4 @@ -from houdini.data import db, AbstractDataCollection +from houdini.data import AbstractDataCollection, db class Item(db.Model): diff --git a/houdini/data/mail.py b/houdini/data/mail.py index e785c41..fa9242c 100644 --- a/houdini/data/mail.py +++ b/houdini/data/mail.py @@ -1,4 +1,4 @@ -from houdini.data import db, AbstractDataCollection +from houdini.data import AbstractDataCollection, db class Postcard(db.Model): diff --git a/houdini/data/moderator.py b/houdini/data/moderator.py index e5f5ade..cf9c4b8 100644 --- a/houdini/data/moderator.py +++ b/houdini/data/moderator.py @@ -1,4 +1,4 @@ -from houdini.data import db, AbstractDataCollection +from houdini.data import AbstractDataCollection, db class Ban(db.Model): diff --git a/houdini/data/ninja.py b/houdini/data/ninja.py index bb7c073..5925b82 100644 --- a/houdini/data/ninja.py +++ b/houdini/data/ninja.py @@ -1,4 +1,4 @@ -from houdini.data import db, AbstractDataCollection +from houdini.data import AbstractDataCollection, db class Card(db.Model): diff --git a/houdini/data/penguin.py b/houdini/data/penguin.py index fada88b..aed0cbd 100644 --- a/houdini/data/penguin.py +++ b/houdini/data/penguin.py @@ -1,9 +1,8 @@ from datetime import datetime +from functools import lru_cache from houdini.data import db -from functools import lru_cache - class Penguin(db.Model): __tablename__ = 'penguin' diff --git a/houdini/data/permission.py b/houdini/data/permission.py index 291098b..f31b837 100644 --- a/houdini/data/permission.py +++ b/houdini/data/permission.py @@ -1,4 +1,4 @@ -from houdini.data import db, AbstractDataCollection +from houdini.data import AbstractDataCollection, db class Permission(db.Model): diff --git a/houdini/data/pet.py b/houdini/data/pet.py index 64d715c..c50eef8 100644 --- a/houdini/data/pet.py +++ b/houdini/data/pet.py @@ -1,4 +1,4 @@ -from houdini.data import db, AbstractDataCollection +from houdini.data import AbstractDataCollection, db class Puffle(db.Model): diff --git a/houdini/data/room.py b/houdini/data/room.py index 9893cb6..07864b5 100644 --- a/houdini/data/room.py +++ b/houdini/data/room.py @@ -1,9 +1,4 @@ -from houdini.games.sled import SledRacingLogic -from houdini.games.four import ConnectFourLogic -from houdini.games.mancala import MancalaLogic -from houdini.games.treasure import TreasureHuntLogic - -from houdini.data import db, AbstractDataCollection +from houdini.data import AbstractDataCollection, db def stealth_mod_filter(stealth_mod_id): diff --git a/houdini/data/stamp.py b/houdini/data/stamp.py index 089e0e4..00147a0 100644 --- a/houdini/data/stamp.py +++ b/houdini/data/stamp.py @@ -1,4 +1,4 @@ -from houdini.data import db, AbstractDataCollection +from houdini.data import AbstractDataCollection, db class Stamp(db.Model): diff --git a/houdini/handlers/__init__.py b/houdini/handlers/__init__.py index c07dd24..b9ff3b6 100644 --- a/houdini/handlers/__init__.py +++ b/houdini/handlers/__init__.py @@ -1,12 +1,12 @@ -import inspect import enum +import inspect import itertools from types import FunctionType -from houdini.converters import _listener, _ArgumentDeserializer, get_converter, \ - do_conversion, _ConverterContext, ChecklistError -from houdini.cooldown import _Cooldown, _CooldownMapping, BucketType, CooldownError -from houdini import plugins, _AbstractManager, get_package_modules +from houdini import _AbstractManager, get_package_modules, plugins +from houdini.converters import ChecklistError, _ArgumentDeserializer, _ConverterContext, _listener, do_conversion, \ + get_converter +from houdini.cooldown import BucketType, CooldownError, _Cooldown, _CooldownMapping class AuthorityError(Exception): diff --git a/houdini/handlers/games/__init__.py b/houdini/handlers/games/__init__.py index fa37c7e..d577949 100644 --- a/houdini/handlers/games/__init__.py +++ b/houdini/handlers/games/__init__.py @@ -1,17 +1,16 @@ -from houdini import handlers -from houdini.handlers import XTPacket -from houdini.converters import OptionalConverter -from houdini.constants import ClientType -from houdini.handlers.play.navigation import handle_join_room -from houdini.handlers.play.moderation import cheat_ban -from houdini.data.room import Room -from houdini.data.game import PenguinGameData +import random +import time from sqlalchemy.dialects.postgresql import insert -import time -import random - +from houdini import handlers +from houdini.constants import ClientType +from houdini.converters import OptionalConverter +from houdini.data.game import PenguinGameData +from houdini.data.room import Room +from houdini.handlers import XTPacket +from houdini.handlers.play.moderation import cheat_ban +from houdini.handlers.play.navigation import handle_join_room default_score_games = {904, 905, 906, 912, 916, 917, 918, 919, 950, 952} diff --git a/houdini/handlers/games/dance.py b/houdini/handlers/games/dance.py index 70945da..a78a7ac 100644 --- a/houdini/handlers/games/dance.py +++ b/houdini/handlers/games/dance.py @@ -1,15 +1,14 @@ -from houdini import handlers -from houdini.handlers import XTPacket -from houdini.data.dance import DanceSongCollection -from houdini.penguin import Penguin - -import random -import time import asyncio import itertools - +import random +import time from dataclasses import dataclass +from houdini import handlers +from houdini.data.dance import DanceSongCollection +from houdini.handlers import XTPacket +from houdini.penguin import Penguin + @dataclass class Dancer: diff --git a/houdini/handlers/games/four.py b/houdini/handlers/games/four.py index 46caed1..15c1f6d 100644 --- a/houdini/handlers/games/four.py +++ b/houdini/handlers/games/four.py @@ -1,7 +1,7 @@ -from houdini import handlers +from houdini import ITable, handlers from houdini.handlers import XTPacket -from houdini.handlers.games.table import table_handler -from houdini.games.four import ConnectFourLogic + + @handlers.handler(XTPacket('gz', ext='z')) diff --git a/houdini/handlers/games/mancala.py b/houdini/handlers/games/mancala.py index ad7e251..6107deb 100644 --- a/houdini/handlers/games/mancala.py +++ b/houdini/handlers/games/mancala.py @@ -1,7 +1,7 @@ -from houdini import handlers +from houdini import ITable, handlers from houdini.handlers import XTPacket -from houdini.handlers.games.table import table_handler -from houdini.games.mancala import MancalaLogic + + @handlers.handler(XTPacket('gz', ext='z')) diff --git a/houdini/handlers/games/sled.py b/houdini/handlers/games/sled.py index 600b4eb..3bee224 100644 --- a/houdini/handlers/games/sled.py +++ b/houdini/handlers/games/sled.py @@ -1,7 +1,7 @@ -from houdini import handlers +from houdini import IWaddle, handlers from houdini.handlers import XTPacket -from houdini.handlers.games.waddle import waddle_handler -from houdini.games.sled import SledRacingLogic + + @handlers.handler(XTPacket('jz', ext='z')) diff --git a/houdini/handlers/games/treasure.py b/houdini/handlers/games/treasure.py index 4f58571..d0c476d 100644 --- a/houdini/handlers/games/treasure.py +++ b/houdini/handlers/games/treasure.py @@ -1,7 +1,9 @@ -from houdini import handlers +import random + +from houdini import ITable, handlers from houdini.handlers import XTPacket -from houdini.handlers.games.table import table_handler -from houdini.games.treasure import TreasureHuntLogic + + @handlers.handler(XTPacket('gz', ext='z')) diff --git a/houdini/handlers/login/__init__.py b/houdini/handlers/login/__init__.py index 050ae43..d8a9e94 100644 --- a/houdini/handlers/login/__init__.py +++ b/houdini/handlers/login/__init__.py @@ -1,9 +1,8 @@ from houdini import handlers -from houdini.handlers import XMLPacket -from houdini.converters import VersionChkConverter from houdini.constants import ClientType - +from houdini.converters import VersionChkConverter from houdini.data.buddy import BuddyList +from houdini.handlers import XMLPacket @handlers.handler(XMLPacket('verChk')) diff --git a/houdini/handlers/login/login.py b/houdini/handlers/login/login.py index d7fa0ae..72a23a7 100644 --- a/houdini/handlers/login/login.py +++ b/houdini/handlers/login/login.py @@ -1,18 +1,18 @@ +import asyncio +import os +from datetime import datetime, timedelta + +import bcrypt + from houdini import handlers +from houdini.constants import ClientType +from houdini.converters import Credentials +from houdini.crypto import Crypto +from houdini.data.moderator import Ban +from houdini.data.penguin import Penguin from houdini.handlers import XMLPacket from houdini.handlers.login import get_server_presence from houdini.handlers.play.navigation import get_minutes_played_today -from houdini.converters import Credentials -from houdini.data.penguin import Penguin -from houdini.data.moderator import Ban -from houdini.crypto import Crypto -from houdini.constants import ClientType - -import asyncio -import bcrypt -import os - -from datetime import datetime, timedelta @handlers.handler(XMLPacket('login')) diff --git a/houdini/handlers/login/world.py b/houdini/handlers/login/world.py index a091d07..65149bc 100644 --- a/houdini/handlers/login/world.py +++ b/houdini/handlers/login/world.py @@ -1,13 +1,13 @@ -from houdini import handlers -from houdini.handlers import XMLPacket, login -from houdini.converters import WorldCredentials, Credentials -from houdini.data.penguin import Penguin -from houdini.data.moderator import Ban -from houdini.crypto import Crypto -from houdini.constants import ClientType - from datetime import datetime +from houdini import handlers +from houdini.constants import ClientType +from houdini.converters import Credentials, WorldCredentials +from houdini.crypto import Crypto +from houdini.data.moderator import Ban +from houdini.data.penguin import Penguin +from houdini.handlers import XMLPacket, login + handle_version_check = login.handle_version_check handle_random_key = login.handle_random_key diff --git a/houdini/handlers/play/avatar.py b/houdini/handlers/play/avatar.py index 08d70f9..b59f3d6 100644 --- a/houdini/handlers/play/avatar.py +++ b/houdini/handlers/play/avatar.py @@ -1,6 +1,6 @@ from houdini import handlers -from houdini.handlers import XTPacket from houdini.constants import ClientType +from houdini.handlers import XTPacket @handlers.handler(XTPacket('pt', 'spts'), client=ClientType.Vanilla) diff --git a/houdini/handlers/play/buddy.py b/houdini/handlers/play/buddy.py index 17af66d..cb74a76 100644 --- a/houdini/handlers/play/buddy.py +++ b/houdini/handlers/play/buddy.py @@ -1,12 +1,10 @@ from houdini import handlers -from houdini.handlers import XMLPacket, XTPacket -from houdini.handlers.play.navigation import handle_join_room -from houdini.handlers import Priority - -from houdini.data.penguin import Penguin -from houdini.data.buddy import BuddyList, BuddyRequest, BuddyListCollection, \ - BuddyRequestCollection, CharacterBuddyCollection, CharacterCollection from houdini.constants import ClientType +from houdini.data.buddy import BuddyList, BuddyListCollection, BuddyRequest, BuddyRequestCollection, \ + CharacterBuddyCollection, CharacterCollection +from houdini.data.penguin import Penguin +from houdini.handlers import Priority, XMLPacket, XTPacket +from houdini.handlers.play.navigation import handle_join_room async def update_player_presence(p): diff --git a/houdini/handlers/play/epf.py b/houdini/handlers/play/epf.py index e2150a4..069a06d 100644 --- a/houdini/handlers/play/epf.py +++ b/houdini/handlers/play/epf.py @@ -1,17 +1,16 @@ -from houdini import handlers -from houdini.handlers import XTPacket -from houdini.handlers.play.mail import handle_start_mail_engine +import datetime +import random +import time +from aiocache import cached + +from houdini import handlers +from houdini.constants import ClientType from houdini.data.item import Item from houdini.data.mail import PenguinPostcard from houdini.data.penguin import EpfComMessage -from houdini.constants import ClientType - -import datetime -import time -import random - -from aiocache import cached +from houdini.handlers import XTPacket +from houdini.handlers.play.mail import handle_start_mail_engine @cached(alias='default', key='com_messages') diff --git a/houdini/handlers/play/experience.py b/houdini/handlers/play/experience.py index 17754aa..1b060a4 100644 --- a/houdini/handlers/play/experience.py +++ b/houdini/handlers/play/experience.py @@ -1,14 +1,13 @@ -from houdini import handlers -from houdini.handlers import XTPacket -from houdini.handlers.play.navigation import handle_join_server, handle_join_room, handle_join_player_room - -from houdini.data import db -from houdini.data.quest import Quest, QuestAwardItem, QuestAwardFurniture, QuestAwardPuffleItem, QuestTask -from houdini.data.quest import PenguinQuestTask - import ujson from aiocache import cached +from houdini import handlers +from houdini.data import db +from houdini.data.quest import PenguinQuestTask, Quest, QuestAwardFurniture, QuestAwardItem, QuestAwardPuffleItem, \ + QuestTask +from houdini.handlers import XTPacket +from houdini.handlers.play.navigation import handle_join_player_room, handle_join_room, handle_join_server + def get_status_key(_, p): return f'quest.status.{p.id}' diff --git a/houdini/handlers/play/igloo.py b/houdini/handlers/play/igloo.py index 8d6cb47..9c1a79c 100644 --- a/houdini/handlers/play/igloo.py +++ b/houdini/handlers/play/igloo.py @@ -1,28 +1,23 @@ import itertools -import ujson import time from datetime import datetime, timedelta -from houdini import handlers -from houdini.handlers import XMLPacket, XTPacket, Priority -from houdini.converters import SeparatorConverter -from houdini.constants import ClientType, StatusField -from houdini.handlers.play.navigation import handle_join_server - -from houdini.data import db -from houdini.data.penguin import Penguin -from houdini.data.room import PenguinIglooRoom -from houdini.data.igloo import IglooFurniture, IglooLike, Igloo, Furniture, Flooring, Location, \ - IglooCollection, FurnitureCollection, \ - FlooringCollection, LocationCollection,\ - PenguinIglooCollection, PenguinFurnitureCollection, \ - PenguinFlooringCollection, PenguinLocationCollection -from houdini.data.room import PenguinIglooRoomCollection -from houdini.data.game import PenguinGameData - +import ujson +from aiocache import cached from sqlalchemy.dialects.postgresql import insert -from aiocache import cached +from houdini import handlers +from houdini.constants import ClientType, StatusField +from houdini.converters import SeparatorConverter +from houdini.data import db +from houdini.data.game import PenguinGameData +from houdini.data.igloo import Flooring, FlooringCollection, Furniture, FurnitureCollection, Igloo, IglooCollection, \ + IglooFurniture, IglooLike, Location, LocationCollection, PenguinFlooringCollection, PenguinFurnitureCollection, \ + PenguinIglooCollection, PenguinLocationCollection +from houdini.data.penguin import Penguin +from houdini.data.room import PenguinIglooRoom, PenguinIglooRoomCollection +from houdini.handlers import Priority, XMLPacket, XTPacket +from houdini.handlers.play.navigation import handle_join_server def get_layout_furniture_key(_, p, igloo_id): diff --git a/houdini/handlers/play/ignore.py b/houdini/handlers/play/ignore.py index cd59b3e..b040e79 100644 --- a/houdini/handlers/play/ignore.py +++ b/houdini/handlers/play/ignore.py @@ -1,8 +1,7 @@ from houdini import handlers -from houdini.handlers import XMLPacket, XTPacket, Priority - -from houdini.data.penguin import Penguin from houdini.data.buddy import IgnoreList, IgnoreListCollection +from houdini.data.penguin import Penguin +from houdini.handlers import Priority, XMLPacket, XTPacket @handlers.handler(XMLPacket('login'), priority=Priority.Low) diff --git a/houdini/handlers/play/item.py b/houdini/handlers/play/item.py index 849d7b3..f697d68 100644 --- a/houdini/handlers/play/item.py +++ b/houdini/handlers/play/item.py @@ -1,11 +1,12 @@ +import operator +import time + +from aiocache import cached + from houdini import handlers -from houdini.handlers import XMLPacket, XTPacket, Priority from houdini.data.item import Item, ItemCollection, PenguinItemCollection from houdini.data.permission import PenguinPermissionCollection - -import time -from aiocache import cached -import operator +from houdini.handlers import Priority, XMLPacket, XTPacket def get_pin_string_key(_, p, player_id): diff --git a/houdini/handlers/play/mail.py b/houdini/handlers/play/mail.py index 3bb78c1..5a6f631 100644 --- a/houdini/handlers/play/mail.py +++ b/houdini/handlers/play/mail.py @@ -1,12 +1,11 @@ -from houdini import handlers -from houdini.handlers import XTPacket +import time +from houdini import handlers from houdini.data import db -from houdini.data.penguin import Penguin from houdini.data.buddy import IgnoreList from houdini.data.mail import PenguinPostcard, PostcardCollection - -import time +from houdini.data.penguin import Penguin +from houdini.handlers import XTPacket @handlers.boot diff --git a/houdini/handlers/play/message.py b/houdini/handlers/play/message.py index a51f6a7..cbd64ec 100644 --- a/houdini/handlers/play/message.py +++ b/houdini/handlers/play/message.py @@ -1,11 +1,9 @@ from houdini import handlers +from houdini.commands import has_command_prefix, invoke_command_string +from houdini.data.moderator import ChatFilterRuleCollection from houdini.handlers import XTPacket from houdini.handlers.play.moderation import moderator_ban -from houdini.commands import invoke_command_string, has_command_prefix - -from houdini.data.moderator import ChatFilterRuleCollection - @handlers.boot async def filter_load(server): diff --git a/houdini/handlers/play/moderation.py b/houdini/handlers/play/moderation.py index 87d0289..1bac2a5 100644 --- a/houdini/handlers/play/moderation.py +++ b/houdini/handlers/play/moderation.py @@ -1,12 +1,12 @@ -from houdini import handlers -from houdini.data import db -from houdini.handlers import XTPacket -from houdini.data.moderator import Ban, Warning, Report -from houdini.data.penguin import Penguin -from houdini.constants import ClientType - import datetime +from houdini import handlers +from houdini.constants import ClientType +from houdini.data import db +from houdini.data.moderator import Ban, Report, Warning +from houdini.data.penguin import Penguin +from houdini.handlers import XTPacket + @handlers.handler(XTPacket('o', 'k')) async def handle_kick_player(p, penguin_id: int): diff --git a/houdini/handlers/play/music.py b/houdini/handlers/play/music.py index d7bdef7..d3a519f 100644 --- a/houdini/handlers/play/music.py +++ b/houdini/handlers/play/music.py @@ -1,16 +1,15 @@ -from houdini import handlers -from houdini.handlers import XTPacket - -from houdini.data import db -from houdini.data.music import PenguinTrack, TrackLike -from houdini.constants import ClientType -from houdini.crypto import Crypto +import asyncio +import re +from datetime import date, datetime from gino.loader import ColumnLoader -from datetime import datetime, date -import asyncio -import re +from houdini import handlers +from houdini.constants import ClientType +from houdini.crypto import Crypto +from houdini.data import db +from houdini.data.music import PenguinTrack, TrackLike +from houdini.handlers import XTPacket class SoundStudio: diff --git a/houdini/handlers/play/navigation.py b/houdini/handlers/play/navigation.py index 2a13ebb..a0bf043 100644 --- a/houdini/handlers/play/navigation.py +++ b/houdini/handlers/play/navigation.py @@ -1,10 +1,23 @@ +import hashlib +import random +import time +from datetime import date, datetime + +import pytz + from houdini import handlers -from houdini.handlers import XTPacket -from houdini.data import db -from houdini.data.room import Room -from houdini.data.penguin import Penguin, Login -from houdini.data.room import PenguinIglooRoom, PenguinBackyardRoom, RoomCollection from houdini.constants import ClientType, StatusField +from houdini.data import db +from houdini.data.penguin import Login, Penguin +from houdini.data.room import PenguinBackyardRoom, PenguinIglooRoom, Room, RoomCollection, RoomTable, RoomWaddle +from houdini.handlers import XTPacket +from houdini.handlers.games.four import ConnectFourLogic +from houdini.handlers.games.mancala import MancalaLogic +from houdini.handlers.games.ninja.card import CardJitsuLogic, SenseiLogic +from houdini.handlers.games.ninja.fire import CardJitsuFireLogic, FireSenseiLogic +from houdini.handlers.games.ninja.water import CardJitsuWaterLogic, WaterSenseiLogic +from houdini.handlers.games.sled import SledRacingLogic +from houdini.handlers.games.treasure import TreasureHuntLogic import random import time diff --git a/houdini/handlers/play/ninja.py b/houdini/handlers/play/ninja.py index 439ecac..162c6dc 100644 --- a/houdini/handlers/play/ninja.py +++ b/houdini/handlers/play/ninja.py @@ -1,6 +1,5 @@ from houdini import handlers -from houdini.handlers import XMLPacket, XTPacket, Priority -from houdini.data.ninja import PenguinCardCollection, CardCollection +from houdini.handlers import XTPacket @handlers.boot diff --git a/houdini/handlers/play/party.py b/houdini/handlers/play/party.py index fbb812b..80f8701 100644 --- a/houdini/handlers/play/party.py +++ b/houdini/handlers/play/party.py @@ -1,9 +1,7 @@ -from houdini import handlers -from houdini.handlers import XTPacket - - import ujson +from houdini import handlers +from houdini.handlers import XTPacket DefaultPartyCookie = { 'msgViewedArray': [0] * 10, diff --git a/houdini/handlers/play/pet.py b/houdini/handlers/play/pet.py index 6aba114..39fca0e 100644 --- a/houdini/handlers/play/pet.py +++ b/houdini/handlers/play/pet.py @@ -1,21 +1,16 @@ -from houdini import handlers -from houdini.handlers import XMLPacket, XTPacket, Priority -from houdini.constants import ClientType, StatusField - -from houdini.data.pet import PenguinPuffleCollection, PenguinPuffleItemCollection, PenguinPuffle, \ - PuffleCollection, PuffleItemCollection, \ - PuffleTreasureFurniture, PuffleTreasureItem, \ - PuffleTreasurePuffleItem -from houdini.data.room import PenguinBackyardRoom, PenguinIglooRoom -from houdini.data.mail import PenguinPostcard - -from datetime import datetime, timedelta - -import time -import random import asyncio import operator +import random +import time +from datetime import datetime, timedelta +from houdini import handlers +from houdini.constants import ClientType, StatusField +from houdini.data.mail import PenguinPostcard +from houdini.data.pet import PenguinPuffle, PenguinPuffleCollection, PenguinPuffleItemCollection, PuffleCollection, \ + PuffleItemCollection, PuffleTreasureFurniture, PuffleTreasureItem, PuffleTreasurePuffleItem +from houdini.data.room import PenguinBackyardRoom, PenguinIglooRoom +from houdini.handlers import Priority, XMLPacket, XTPacket PuffleKillerInterval = 600 LegacyPuffleIds = [0, 1, 2, 3, 4, 5, 6, 7, 8] diff --git a/houdini/handlers/play/player.py b/houdini/handlers/play/player.py index 61f65e4..a33c3c9 100644 --- a/houdini/handlers/play/player.py +++ b/houdini/handlers/play/player.py @@ -1,16 +1,17 @@ -from houdini import handlers -from houdini.converters import SeparatorConverter -from houdini.handlers import XTPacket, XMLPacket, Priority -from houdini.data import db -from houdini.data.penguin import Penguin, PenguinMembership -from houdini.data.mail import PenguinPostcard -from houdini.constants import ClientType +import asyncio +import random +import time +from datetime import datetime, timedelta from aiocache import cached -from datetime import datetime, timedelta -import random -import asyncio -import time + +from houdini import handlers +from houdini.constants import ClientType +from houdini.converters import SeparatorConverter +from houdini.data import db +from houdini.data.mail import PenguinPostcard +from houdini.data.penguin import Penguin, PenguinMembership +from houdini.handlers import Priority, XMLPacket, XTPacket def get_player_string_key(_, p, player_id): diff --git a/houdini/handlers/play/rainbow.py b/houdini/handlers/play/rainbow.py index 8b4ad94..732e2bb 100644 --- a/houdini/handlers/play/rainbow.py +++ b/houdini/handlers/play/rainbow.py @@ -1,12 +1,11 @@ -from houdini import handlers -from houdini.handlers import XTPacket -from houdini.constants import ClientType - +import time from datetime import datetime, timedelta import ujson -import time +from houdini import handlers +from houdini.constants import ClientType +from houdini.handlers import XTPacket RainbowQuestRewards = [6158, 4809, 1560, 3159] RainbowBonusReward = 5220 diff --git a/houdini/handlers/play/room.py b/houdini/handlers/play/room.py index ca83701..2912eb8 100644 --- a/houdini/handlers/play/room.py +++ b/houdini/handlers/play/room.py @@ -1,9 +1,9 @@ -from houdini import handlers -from houdini.handlers import XTPacket -from houdini.data.penguin import Penguin - import random +from houdini import handlers +from houdini.data.penguin import Penguin +from houdini.handlers import XTPacket + @handlers.handler(XTPacket('r', 'cdu')) @handlers.cooldown(1) diff --git a/houdini/handlers/play/setting.py b/houdini/handlers/play/setting.py index 9cfac6c..01cfcb5 100644 --- a/houdini/handlers/play/setting.py +++ b/houdini/handlers/play/setting.py @@ -1,7 +1,6 @@ from houdini import handlers -from houdini.handlers import XTPacket - from houdini.data.item import Item +from houdini.handlers import XTPacket @handlers.handler(XTPacket('s', 'upc')) diff --git a/houdini/handlers/play/stampbook.py b/houdini/handlers/play/stampbook.py index 559609a..9f04bc5 100644 --- a/houdini/handlers/play/stampbook.py +++ b/houdini/handlers/play/stampbook.py @@ -1,11 +1,11 @@ -from houdini import handlers -from houdini.handlers import XMLPacket, XTPacket, Priority -from houdini.handlers.play.navigation import handle_join_server, handle_join_room -from houdini.data.stamp import Stamp, CoverStamp, CoverItem, PenguinStampCollection, StampCollection -from houdini.data.penguin import Penguin - from aiocache import cached +from houdini import handlers +from houdini.data.penguin import Penguin +from houdini.data.stamp import CoverItem, CoverStamp, PenguinStampCollection, Stamp, StampCollection +from houdini.handlers import Priority, XMLPacket, XTPacket +from houdini.handlers.play.navigation import handle_join_room, handle_join_server + def get_book_cover_key(_, p, player_id): return f'book.{player_id}' diff --git a/houdini/handlers/play/toy.py b/houdini/handlers/play/toy.py index 4dd710b..ef223db 100644 --- a/houdini/handlers/play/toy.py +++ b/houdini/handlers/play/toy.py @@ -1,6 +1,6 @@ from houdini import handlers -from houdini.handlers import XTPacket from houdini.constants import ClientType +from houdini.handlers import XTPacket @handlers.handler(XTPacket('t', 'at')) diff --git a/houdini/handlers/redemption/__init__.py b/houdini/handlers/redemption/__init__.py index b791e72..df433c0 100644 --- a/houdini/handlers/redemption/__init__.py +++ b/houdini/handlers/redemption/__init__.py @@ -1,14 +1,13 @@ -from houdini import handlers -from houdini.handlers import XTPacket -from houdini.constants import ClientType - -from houdini.data import db -from houdini.data.redemption import RedemptionCode, RedemptionAwardCard, RedemptionAwardFlooring, \ - RedemptionAwardFurniture, RedemptionAwardIgloo, RedemptionAwardItem, RedemptionAwardLocation,\ - RedemptionAwardPuffle, RedemptionAwardPuffleItem, PenguinRedemptionBook, PenguinRedemptionCode - from datetime import datetime +from houdini import handlers +from houdini.constants import ClientType +from houdini.data import db +from houdini.data.redemption import PenguinRedemptionBook, PenguinRedemptionCode, RedemptionAwardCard, \ + RedemptionAwardFlooring, RedemptionAwardFurniture, RedemptionAwardIgloo, RedemptionAwardItem, \ + RedemptionAwardLocation, RedemptionAwardPuffle, RedemptionAwardPuffleItem, RedemptionCode +from houdini.handlers import XTPacket + @handlers.handler(XTPacket('rjs', ext='red'), pre_login=True, client=ClientType.Vanilla) @handlers.allow_once diff --git a/houdini/houdini.py b/houdini/houdini.py index 86a1624..6b7ca37 100644 --- a/houdini/houdini.py +++ b/houdini/houdini.py @@ -1,19 +1,17 @@ import asyncio +import logging import os import sys - -from houdini.spheniscidae import Spheniscidae -from houdini.penguin import Penguin -from houdini import PenguinStringCompiler - -import logging from logging.handlers import RotatingFileHandler import aioredis from aiocache import SimpleMemoryCache, caches +from houdini import PenguinStringCompiler from houdini.data import db from houdini.data.permission import PermissionCollection +from houdini.penguin import Penguin +from houdini.spheniscidae import Spheniscidae try: import uvloop @@ -32,7 +30,6 @@ from houdini.handlers.play.player import server_heartbeat, server_egg_timer from houdini.handlers.play.pet import decrease_stats from houdini.handlers.play.music import SoundStudio -from houdini.handlers.games.dance import DanceFloor class Houdini: diff --git a/houdini/penguin.py b/houdini/penguin.py index cb74e12..c7f5df0 100644 --- a/houdini/penguin.py +++ b/houdini/penguin.py @@ -1,9 +1,9 @@ import time -from houdini.spheniscidae import Spheniscidae from houdini.data import penguin from houdini.data.mail import PenguinPostcard from houdini.handlers.play.pet import get_my_player_walking_puffle +from houdini.spheniscidae import Spheniscidae class Penguin(Spheniscidae, penguin.Penguin): diff --git a/houdini/plugins/__init__.py b/houdini/plugins/__init__.py index 8b7c4ea..de5f81e 100644 --- a/houdini/plugins/__init__.py +++ b/houdini/plugins/__init__.py @@ -1,7 +1,5 @@ -from abc import ABC -from abc import abstractmethod - import inspect +from abc import ABC, abstractmethod from houdini import _AbstractManager, get_package_modules diff --git a/houdini/spheniscidae.py b/houdini/spheniscidae.py index d88dd70..0c8f7e1 100644 --- a/houdini/spheniscidae.py +++ b/houdini/spheniscidae.py @@ -1,12 +1,10 @@ -from houdini.handlers import XMLPacket, XTPacket - -from asyncio import IncompleteReadError, CancelledError - -import defusedxml.cElementTree as Et +from asyncio import CancelledError, IncompleteReadError from xml.etree.cElementTree import Element, SubElement, tostring +import defusedxml.cElementTree as Et + from houdini.constants import ClientType -from houdini.handlers import AuthorityError +from houdini.handlers import AuthorityError, XMLPacket, XTPacket class Spheniscidae: