From 5b35619b7c02598ec7612a1b1b1d41437bd862bc Mon Sep 17 00:00:00 2001 From: 201st-Luka Date: Mon, 21 Aug 2023 20:39:50 +0200 Subject: [PATCH] refactor: fixed imports (optimized) --- pyclasher/__init__.py | 13 +++++++++++++ pyclasher/api/__init__.py | 3 +++ pyclasher/api/bulk_requests/BulkPlayer.py | 8 ++++---- pyclasher/api/bulk_requests/BulkPlayer.pyi | 3 ++- pyclasher/api/bulk_requests/BulkRequestModel.py | 2 -- pyclasher/api/models/BaseModels.py | 2 +- pyclasher/api/models/BaseModels.pyi | 2 +- pyclasher/api/models/Clan.pyi | 4 ++-- pyclasher/api/models/ClanCapitalRaidSeasons.pyi | 2 +- pyclasher/api/models/ClanMember.pyi | 2 +- pyclasher/api/models/Enums.py | 2 +- pyclasher/api/models/Enums.pyi | 2 +- pyclasher/api/models/GoldPassSeason.py | 2 +- pyclasher/api/models/GoldPassSeason.pyi | 2 +- pyclasher/api/models/Labels.py | 2 +- pyclasher/api/models/Labels.pyi | 2 +- pyclasher/api/models/Location.pyi | 2 +- pyclasher/api/models/Player.pyi | 2 +- .../api/models/PlayerBuilderBaseRankingList.pyi | 2 +- pyclasher/api/models/PlayerRankingList.pyi | 2 +- pyclasher/api/models/Season.py | 2 +- pyclasher/api/models/__init__.py | 2 +- pyclasher/api/models/misc/Api.pyi | 2 +- pyclasher/api/requests/BuilderBaseLeague.py | 2 +- pyclasher/api/requests/BuilderBaseLeagues.py | 2 +- pyclasher/api/requests/CapitalLeague.py | 2 +- pyclasher/api/requests/CapitalLeagueSeasons.py | 2 +- pyclasher/api/requests/Clan.py | 2 +- pyclasher/api/requests/ClanBuilderBaseRankings.py | 2 +- pyclasher/api/requests/ClanCapitalRaidSeasons.py | 2 +- pyclasher/api/requests/ClanCurrentWar.py | 2 +- pyclasher/api/requests/ClanLabels.py | 2 +- pyclasher/api/requests/ClanMembers.py | 2 +- pyclasher/api/requests/ClanRankings.py | 2 +- pyclasher/api/requests/ClanSearch.py | 2 +- pyclasher/api/requests/ClanWarLog.py | 2 +- pyclasher/api/requests/GoldPass.py | 2 +- pyclasher/api/requests/League.py | 2 +- pyclasher/api/requests/LeagueSeason.py | 2 +- pyclasher/api/requests/Leagues.py | 2 +- pyclasher/api/requests/Location.py | 2 +- pyclasher/api/requests/Locations.py | 2 +- pyclasher/api/requests/Player.py | 5 +++-- pyclasher/api/requests/PlayerBuilderBaseRankings.py | 2 +- pyclasher/api/requests/PlayerLabels.py | 2 +- pyclasher/api/requests/PlayerRankings.py | 2 +- pyclasher/api/requests/RequestModels.py | 6 +++--- pyclasher/api/requests/RequestModels.pyi | 6 +++--- pyclasher/api/requests/WarLeague.py | 2 +- pyclasher/api/requests/WarLeagues.py | 2 +- pyclasher/client.py | 6 +++--- pyclasher/client.pyi | 4 ++-- pyclasher/utils/ExecTimer.py | 2 +- pyclasher/utils/ExecTimer.pyi | 3 --- tests/requests/async_tests/test_clan.py | 11 ++++++----- tests/requests/async_tests/test_goldpass.py | 2 +- tests/requests/async_tests/test_labels.py | 2 +- tests/requests/async_tests/test_locations.py | 2 +- tests/requests/async_tests/test_player.py | 4 ++-- 59 files changed, 91 insertions(+), 77 deletions(-) diff --git a/pyclasher/__init__.py b/pyclasher/__init__.py index c38c72e..d7150c8 100644 --- a/pyclasher/__init__.py +++ b/pyclasher/__init__.py @@ -11,3 +11,16 @@ __version__ = '1.0.0-alpha1' +# api +from .api import * + +# utils +from .utils import * + +# client.py +from .client import RequestMethods, Status, Auth, Developer, Login, RequestQueue, Consumer, PyClasherClient + +# exceptions.py +from .exceptions import (Missing, MISSING, PyClasherException, ApiCode, RequestNotDone, NoneToken, InvalidLoginData, + InvalidType, LoginNotDone, ClientIsRunning, ClientIsNotRunning, ClientAlreadyInitialised, + NoClient, InvalidTimeFormat, ClientRunningOverwrite, InvalidSeasonFormat, RequestTimeout) diff --git a/pyclasher/api/__init__.py b/pyclasher/api/__init__.py index e69de29..ce0dd00 100644 --- a/pyclasher/api/__init__.py +++ b/pyclasher/api/__init__.py @@ -0,0 +1,3 @@ +from .bulk_requests import * +from .models import * +from .requests import * diff --git a/pyclasher/api/bulk_requests/BulkPlayer.py b/pyclasher/api/bulk_requests/BulkPlayer.py index abb49d7..622730f 100644 --- a/pyclasher/api/bulk_requests/BulkPlayer.py +++ b/pyclasher/api/bulk_requests/BulkPlayer.py @@ -1,10 +1,10 @@ from asyncio import get_running_loop, run -from Exceptions import MISSING -from api.models import Clan from .BulkRequestModel import BulkRequestModel -from api.models import BaseClan -from api.requests import PlayerRequest, ClanMembersRequest +from ..models import BaseClan +from ..models import Clan +from ..requests import PlayerRequest, ClanMembersRequest +from ...exceptions import MISSING class PlayerBulkRequest(BulkRequestModel): diff --git a/pyclasher/api/bulk_requests/BulkPlayer.pyi b/pyclasher/api/bulk_requests/BulkPlayer.pyi index 7cbe4b0..4ea935d 100644 --- a/pyclasher/api/bulk_requests/BulkPlayer.pyi +++ b/pyclasher/api/bulk_requests/BulkPlayer.pyi @@ -1,7 +1,8 @@ from typing import Iterable, Coroutine, Any, Iterator from .BulkRequestModel import BulkRequestModel -from ..models import BaseClan, ClanMemberList, ClanWarMemberList, ClanWarLeagueClanMemberList, ClanCapitalRaidSeasonMemberList +from ..models import BaseClan, ClanMemberList, ClanWarMemberList, ClanWarLeagueClanMemberList, \ + ClanCapitalRaidSeasonMemberList from ..requests import PlayerRequest, ClanMembersRequest diff --git a/pyclasher/api/bulk_requests/BulkRequestModel.py b/pyclasher/api/bulk_requests/BulkRequestModel.py index a79ab8c..817a315 100644 --- a/pyclasher/api/bulk_requests/BulkRequestModel.py +++ b/pyclasher/api/bulk_requests/BulkRequestModel.py @@ -1,7 +1,5 @@ from asyncio import gather, get_running_loop, run -from Exceptions import RequestNotDone - class BulkRequestModel: _request_model = ... diff --git a/pyclasher/api/models/BaseModels.py b/pyclasher/api/models/BaseModels.py index 17e18e9..871cb44 100644 --- a/pyclasher/api/models/BaseModels.py +++ b/pyclasher/api/models/BaseModels.py @@ -1,7 +1,7 @@ from datetime import datetime from typing import Any -from Exceptions import RequestNotDone, InvalidTimeFormat, MISSING +from ...exceptions import RequestNotDone, InvalidTimeFormat, MISSING class BaseModel: diff --git a/pyclasher/api/models/BaseModels.pyi b/pyclasher/api/models/BaseModels.pyi index c3a319a..bdf10a4 100644 --- a/pyclasher/api/models/BaseModels.pyi +++ b/pyclasher/api/models/BaseModels.pyi @@ -4,7 +4,7 @@ base models for this API wrapper client from typing import Any, Iterator, Generator -from ..Exceptions import MISSING, Missing +from ...exceptions import MISSING, Missing class BaseModel: diff --git a/pyclasher/api/models/Clan.pyi b/pyclasher/api/models/Clan.pyi index fe0f034..fccfb80 100644 --- a/pyclasher/api/models/Clan.pyi +++ b/pyclasher/api/models/Clan.pyi @@ -9,8 +9,8 @@ from .Enums import WarFrequency, ClanType from .Labels import LabelList from .Leagues import WarLeague, CapitalLeague from .Location import Location -from api.models.misc import Language -from ..Exceptions import Missing +from .misc import Language +from ...exceptions import Missing class ClanDistrictData(BaseModel): diff --git a/pyclasher/api/models/ClanCapitalRaidSeasons.pyi b/pyclasher/api/models/ClanCapitalRaidSeasons.pyi index 1961b0f..c0d4077 100644 --- a/pyclasher/api/models/ClanCapitalRaidSeasons.pyi +++ b/pyclasher/api/models/ClanCapitalRaidSeasons.pyi @@ -1,7 +1,7 @@ from typing import Iterator -from ..Exceptions import Missing from .BaseModels import BaseModel, IterBaseModel, BaseClanMember, BaseClan, Time +from ...exceptions import Missing class ClanCapitalRaidSeasonClanInfo(BaseClan): diff --git a/pyclasher/api/models/ClanMember.pyi b/pyclasher/api/models/ClanMember.pyi index 529abfe..7b376d7 100644 --- a/pyclasher/api/models/ClanMember.pyi +++ b/pyclasher/api/models/ClanMember.pyi @@ -1,8 +1,8 @@ -from ..Exceptions import Missing from .BaseModels import BaseClanMember from .Enums import ClanRole from .Leagues import League, BuilderBaseLeague from .PlayerHouse import PlayerHouse +from ...exceptions import Missing class ClanMember(BaseClanMember): diff --git a/pyclasher/api/models/Enums.py b/pyclasher/api/models/Enums.py index be88494..d878795 100644 --- a/pyclasher/api/models/Enums.py +++ b/pyclasher/api/models/Enums.py @@ -3,7 +3,7 @@ from .Labels import Label from .Leagues import League, CapitalLeague, BuilderBaseLeague, WarLeague from .Location import Location -from Exceptions import ApiCode +from ...exceptions import ApiCode class ApiCodes(Enum): diff --git a/pyclasher/api/models/Enums.pyi b/pyclasher/api/models/Enums.pyi index 6016b9b..4ffef3f 100644 --- a/pyclasher/api/models/Enums.pyi +++ b/pyclasher/api/models/Enums.pyi @@ -3,7 +3,7 @@ from enum import Enum from .Labels import Label from .Leagues import League, CapitalLeague, BuilderBaseLeague, WarLeague from .Location import Location -from ..Exceptions import ApiCode +from ...exceptions import ApiCode class ApiCodes(Enum): diff --git a/pyclasher/api/models/GoldPassSeason.py b/pyclasher/api/models/GoldPassSeason.py index df59203..8608dd0 100644 --- a/pyclasher/api/models/GoldPassSeason.py +++ b/pyclasher/api/models/GoldPassSeason.py @@ -1,4 +1,4 @@ -from api.models import Time, BaseModel +from .BaseModels import Time, BaseModel class GoldPassSeason(BaseModel): diff --git a/pyclasher/api/models/GoldPassSeason.pyi b/pyclasher/api/models/GoldPassSeason.pyi index 8f4a7e6..16a80b0 100644 --- a/pyclasher/api/models/GoldPassSeason.pyi +++ b/pyclasher/api/models/GoldPassSeason.pyi @@ -1,4 +1,4 @@ -from api.models import Time, BaseModel +from .BaseModels import Time, BaseModel class GoldPassSeason(BaseModel): diff --git a/pyclasher/api/models/Labels.py b/pyclasher/api/models/Labels.py index 9407883..672dd7e 100644 --- a/pyclasher/api/models/Labels.py +++ b/pyclasher/api/models/Labels.py @@ -1,4 +1,4 @@ -from api.models import BaseModel, IterBaseModel, IconUrls +from .BaseModels import BaseModel, IterBaseModel, IconUrls class Label(BaseModel): diff --git a/pyclasher/api/models/Labels.pyi b/pyclasher/api/models/Labels.pyi index c27b9e3..9480d31 100644 --- a/pyclasher/api/models/Labels.pyi +++ b/pyclasher/api/models/Labels.pyi @@ -1,6 +1,6 @@ from typing import Iterator -from api.models import BaseModel, IterBaseModel, IconUrls +from .BaseModels import BaseModel, IterBaseModel, IconUrls class Label(BaseModel): diff --git a/pyclasher/api/models/Location.pyi b/pyclasher/api/models/Location.pyi index eab5504..7a5dd0c 100644 --- a/pyclasher/api/models/Location.pyi +++ b/pyclasher/api/models/Location.pyi @@ -4,7 +4,7 @@ models concerning the location from typing import Iterator from .BaseModels import IterBaseModel, BaseModel -from ..Exceptions import Missing +from ...exceptions import Missing class Location(BaseModel): diff --git a/pyclasher/api/models/Player.pyi b/pyclasher/api/models/Player.pyi index 0530def..560d7d2 100644 --- a/pyclasher/api/models/Player.pyi +++ b/pyclasher/api/models/Player.pyi @@ -1,11 +1,11 @@ from typing import Iterator -from ..Exceptions import Missing from .BaseModels import BaseModel, IterBaseModel, BaseClan from .Enums import ClanRole, WarPreference, Village from .Labels import LabelList from .Leagues import League, BuilderBaseLeague from .PlayerHouse import PlayerHouse +from ...exceptions import Missing class PlayerClan(BaseClan): diff --git a/pyclasher/api/models/PlayerBuilderBaseRankingList.pyi b/pyclasher/api/models/PlayerBuilderBaseRankingList.pyi index 2159797..b33ef4a 100644 --- a/pyclasher/api/models/PlayerBuilderBaseRankingList.pyi +++ b/pyclasher/api/models/PlayerBuilderBaseRankingList.pyi @@ -2,7 +2,7 @@ from typing import Iterator from .BaseModels import BaseModel, IterBaseModel from .Leagues import BuilderBaseLeague -from api.models.PlayerRankingClan import PlayerRankingClan +from .PlayerRankingClan import PlayerRankingClan class PlayerBuilderBaseRanking(BaseModel): diff --git a/pyclasher/api/models/PlayerRankingList.pyi b/pyclasher/api/models/PlayerRankingList.pyi index 6781a29..c7dc5d4 100644 --- a/pyclasher/api/models/PlayerRankingList.pyi +++ b/pyclasher/api/models/PlayerRankingList.pyi @@ -2,7 +2,7 @@ from typing import Iterator from .BaseModels import BaseModel, IterBaseModel from .Leagues import League -from api.models.PlayerRankingClan import PlayerRankingClan +from .PlayerRankingClan import PlayerRankingClan class PlayerRanking(BaseModel): diff --git a/pyclasher/api/models/Season.py b/pyclasher/api/models/Season.py index 02a541c..5900616 100644 --- a/pyclasher/api/models/Season.py +++ b/pyclasher/api/models/Season.py @@ -1,4 +1,4 @@ -from Exceptions import InvalidSeasonFormat +from ...exceptions import InvalidSeasonFormat class Season: diff --git a/pyclasher/api/models/__init__.py b/pyclasher/api/models/__init__.py index 4f3fb42..ad09f78 100644 --- a/pyclasher/api/models/__init__.py +++ b/pyclasher/api/models/__init__.py @@ -7,7 +7,6 @@ Cursor, Paging, BadgeUrl, BadgeUrls, Time, BaseClanMember, BaseClan, BaseLeague # clan models from .Clan import ClanDistrictData, ClanDistrictDataList, ClanCapital, Clan -from .ClanList import ClanList from .ClanBuilderBaseRankingList import ClanBuilderBaseRanking, ClanBuilderBaseRankingList from .ClanCapitalRaidSeasons import ClanCapitalRaidSeasonClanInfo, ClanCapitalRaidSeasonAttacker, \ ClanCapitalRaidSeasonAttack, ClanCapitalRaidSeasonAttackList, ClanCapitalRaidSeasonDistrict, \ @@ -15,6 +14,7 @@ ClanCapitalRaidSeasonDefenseLogList, ClanCapitalRaidSeasonAttackLogList, ClanCapitalRaidSeasonMember, \ ClanCapitalRaidSeasonMemberList, ClanCapitalRaidSeason, ClanCapitalRaidSeasons from .ClanCapitalRankingList import ClanCapitalRanking, ClanCapitalRankingList +from .ClanList import ClanList from .ClanMember import ClanMember from .ClanMemberList import ClanMemberList from .ClanRankingList import ClanRanking, ClanRankingList diff --git a/pyclasher/api/models/misc/Api.pyi b/pyclasher/api/models/misc/Api.pyi index eae7c14..cff6ab8 100644 --- a/pyclasher/api/models/misc/Api.pyi +++ b/pyclasher/api/models/misc/Api.pyi @@ -3,7 +3,7 @@ models concerning the ClashOfClans API responses """ from ..BaseModels import BaseModel -from ...Exceptions import Missing +from ....exceptions import Missing class ClientError(BaseModel): diff --git a/pyclasher/api/requests/BuilderBaseLeague.py b/pyclasher/api/requests/BuilderBaseLeague.py index 07b6f16..a57a35a 100644 --- a/pyclasher/api/requests/BuilderBaseLeague.py +++ b/pyclasher/api/requests/BuilderBaseLeague.py @@ -1,5 +1,5 @@ from .RequestModels import RequestModel -from api.models import BuilderBaseLeague +from ..models import BuilderBaseLeague class BuilderBaseLeagueRequest(RequestModel, BuilderBaseLeague): diff --git a/pyclasher/api/requests/BuilderBaseLeagues.py b/pyclasher/api/requests/BuilderBaseLeagues.py index 9247c95..81ce5dc 100644 --- a/pyclasher/api/requests/BuilderBaseLeagues.py +++ b/pyclasher/api/requests/BuilderBaseLeagues.py @@ -1,5 +1,5 @@ from .RequestModels import IterRequestModel -from api.models import BuilderBaseLeagueList, BuilderBaseLeague +from ..models import BuilderBaseLeagueList, BuilderBaseLeague class BuilderBaseLeaguesRequest(IterRequestModel): diff --git a/pyclasher/api/requests/CapitalLeague.py b/pyclasher/api/requests/CapitalLeague.py index 0f26d73..b3f5dbe 100644 --- a/pyclasher/api/requests/CapitalLeague.py +++ b/pyclasher/api/requests/CapitalLeague.py @@ -1,5 +1,5 @@ from .RequestModels import RequestModel -from api.models import CapitalLeague +from ..models import CapitalLeague class CapitalLeagueRequest(RequestModel, CapitalLeague): diff --git a/pyclasher/api/requests/CapitalLeagueSeasons.py b/pyclasher/api/requests/CapitalLeagueSeasons.py index e86edbc..be71abe 100644 --- a/pyclasher/api/requests/CapitalLeagueSeasons.py +++ b/pyclasher/api/requests/CapitalLeagueSeasons.py @@ -1,5 +1,5 @@ from .RequestModels import IterRequestModel -from api.models import CapitalLeagueList, CapitalLeague +from ..models import CapitalLeagueList, CapitalLeague class CapitalLeaguesRequest(IterRequestModel): diff --git a/pyclasher/api/requests/Clan.py b/pyclasher/api/requests/Clan.py index 63f89f0..9c82deb 100644 --- a/pyclasher/api/requests/Clan.py +++ b/pyclasher/api/requests/Clan.py @@ -1,7 +1,7 @@ from asyncio import get_running_loop, run from .RequestModels import RequestModel -from api.models import Clan, BaseClan +from ..models import Clan, BaseClan class ClanRequest(RequestModel, Clan): diff --git a/pyclasher/api/requests/ClanBuilderBaseRankings.py b/pyclasher/api/requests/ClanBuilderBaseRankings.py index a1e0555..cb2879b 100644 --- a/pyclasher/api/requests/ClanBuilderBaseRankings.py +++ b/pyclasher/api/requests/ClanBuilderBaseRankings.py @@ -1,5 +1,5 @@ from .RequestModels import IterRequestModel -from api.models import ClanBuilderBaseRanking, ClanBuilderBaseRankingList +from ..models import ClanBuilderBaseRanking, ClanBuilderBaseRankingList class ClanBuilderBaseRankingsRequest(IterRequestModel): diff --git a/pyclasher/api/requests/ClanCapitalRaidSeasons.py b/pyclasher/api/requests/ClanCapitalRaidSeasons.py index e86723c..21fc3d9 100644 --- a/pyclasher/api/requests/ClanCapitalRaidSeasons.py +++ b/pyclasher/api/requests/ClanCapitalRaidSeasons.py @@ -1,5 +1,5 @@ from .RequestModels import IterRequestModel -from api.models import ClanCapitalRaidSeasons, ClanCapitalRaidSeason +from ..models import ClanCapitalRaidSeasons, ClanCapitalRaidSeason class ClanCapitalRaidSeasonsRequest(IterRequestModel): diff --git a/pyclasher/api/requests/ClanCurrentWar.py b/pyclasher/api/requests/ClanCurrentWar.py index 1a6f420..1f21285 100644 --- a/pyclasher/api/requests/ClanCurrentWar.py +++ b/pyclasher/api/requests/ClanCurrentWar.py @@ -1,7 +1,7 @@ from asyncio import get_running_loop, run from .RequestModels import RequestModel -from api.models import ClanWar, BaseClan +from ..models import ClanWar, BaseClan class ClanCurrentWarRequest(RequestModel, ClanWar): diff --git a/pyclasher/api/requests/ClanLabels.py b/pyclasher/api/requests/ClanLabels.py index 591d3d2..80e0d36 100644 --- a/pyclasher/api/requests/ClanLabels.py +++ b/pyclasher/api/requests/ClanLabels.py @@ -1,5 +1,5 @@ from .RequestModels import IterRequestModel -from api.models import LabelList, Label +from ..models import LabelList, Label class ClanLabelsRequest(IterRequestModel): diff --git a/pyclasher/api/requests/ClanMembers.py b/pyclasher/api/requests/ClanMembers.py index 75e24c1..6add44e 100644 --- a/pyclasher/api/requests/ClanMembers.py +++ b/pyclasher/api/requests/ClanMembers.py @@ -1,5 +1,5 @@ from .RequestModels import IterRequestModel -from api.models import ClanMember, ClanMemberList +from ..models import ClanMember, ClanMemberList class ClanMembersRequest(IterRequestModel): diff --git a/pyclasher/api/requests/ClanRankings.py b/pyclasher/api/requests/ClanRankings.py index ca1928d..ced1940 100644 --- a/pyclasher/api/requests/ClanRankings.py +++ b/pyclasher/api/requests/ClanRankings.py @@ -1,5 +1,5 @@ from .RequestModels import IterRequestModel -from api.models import ClanRanking, ClanRankingList +from ..models import ClanRanking, ClanRankingList class ClanRankingsRequest(IterRequestModel): diff --git a/pyclasher/api/requests/ClanSearch.py b/pyclasher/api/requests/ClanSearch.py index c707da8..b6890ef 100644 --- a/pyclasher/api/requests/ClanSearch.py +++ b/pyclasher/api/requests/ClanSearch.py @@ -1,5 +1,5 @@ from .RequestModels import IterRequestModel -from api.models import ClanList, WarFrequency, Locations, Labels, Clan +from ..models import ClanList, WarFrequency, Locations, Labels, Clan class ClanSearchRequest(IterRequestModel): diff --git a/pyclasher/api/requests/ClanWarLog.py b/pyclasher/api/requests/ClanWarLog.py index 46f43c5..9f6f0b5 100644 --- a/pyclasher/api/requests/ClanWarLog.py +++ b/pyclasher/api/requests/ClanWarLog.py @@ -1,5 +1,5 @@ from .RequestModels import IterRequestModel -from api.models import ClanWarLog, ClanWarLogEntry +from ..models import ClanWarLog, ClanWarLogEntry class ClanWarLogRequest(IterRequestModel): diff --git a/pyclasher/api/requests/GoldPass.py b/pyclasher/api/requests/GoldPass.py index 8ad47d5..5835c5e 100644 --- a/pyclasher/api/requests/GoldPass.py +++ b/pyclasher/api/requests/GoldPass.py @@ -1,5 +1,5 @@ from .RequestModels import RequestModel -from api.models import GoldPassSeason +from ..models import GoldPassSeason class GoldPassRequest(RequestModel, GoldPassSeason): diff --git a/pyclasher/api/requests/League.py b/pyclasher/api/requests/League.py index aaa9835..8a437ab 100644 --- a/pyclasher/api/requests/League.py +++ b/pyclasher/api/requests/League.py @@ -1,5 +1,5 @@ from .RequestModels import RequestModel -from api.models import League +from ..models import League class LeagueRequest(RequestModel, League): diff --git a/pyclasher/api/requests/LeagueSeason.py b/pyclasher/api/requests/LeagueSeason.py index 455f1a5..2171566 100644 --- a/pyclasher/api/requests/LeagueSeason.py +++ b/pyclasher/api/requests/LeagueSeason.py @@ -1,5 +1,5 @@ from .RequestModels import IterRequestModel -from api.models import PlayerRanking, PlayerRankingList, Season +from ..models import PlayerRanking, PlayerRankingList, Season class LeagueSeasonRequest(IterRequestModel): diff --git a/pyclasher/api/requests/Leagues.py b/pyclasher/api/requests/Leagues.py index 3d2365e..da82399 100644 --- a/pyclasher/api/requests/Leagues.py +++ b/pyclasher/api/requests/Leagues.py @@ -1,5 +1,5 @@ from .RequestModels import IterRequestModel -from api.models import LeagueList, League +from ..models import LeagueList, League class LeaguesRequest(IterRequestModel): diff --git a/pyclasher/api/requests/Location.py b/pyclasher/api/requests/Location.py index b9d14bd..a634596 100644 --- a/pyclasher/api/requests/Location.py +++ b/pyclasher/api/requests/Location.py @@ -1,5 +1,5 @@ from .RequestModels import RequestModel -from api.models import Location +from ..models import Location class LocationRequest(RequestModel, Location): diff --git a/pyclasher/api/requests/Locations.py b/pyclasher/api/requests/Locations.py index db40712..eabacae 100644 --- a/pyclasher/api/requests/Locations.py +++ b/pyclasher/api/requests/Locations.py @@ -1,5 +1,5 @@ from .RequestModels import IterRequestModel -from api.models import Location, LocationList +from ..models import Location, LocationList class LocationsRequest(IterRequestModel): diff --git a/pyclasher/api/requests/Player.py b/pyclasher/api/requests/Player.py index e484cfd..395db79 100644 --- a/pyclasher/api/requests/Player.py +++ b/pyclasher/api/requests/Player.py @@ -2,8 +2,9 @@ from urllib.parse import quote from .RequestModels import RequestModel -from pyclasher import ClientIsNotRunning, RequestMethods, ApiCode -from api.models import Player, VerifyTokenRequest, VerifyTokenResponse +from ..models import Player, VerifyTokenRequest, VerifyTokenResponse +from ...client import RequestMethods +from ...exceptions import ClientIsNotRunning, ApiCode class PlayerRequest(RequestModel, Player): diff --git a/pyclasher/api/requests/PlayerBuilderBaseRankings.py b/pyclasher/api/requests/PlayerBuilderBaseRankings.py index c6f136e..5840aba 100644 --- a/pyclasher/api/requests/PlayerBuilderBaseRankings.py +++ b/pyclasher/api/requests/PlayerBuilderBaseRankings.py @@ -1,5 +1,5 @@ from .RequestModels import IterRequestModel -from api.models import PlayerBuilderBaseRanking, PlayerBuilderBaseRankingList +from ..models import PlayerBuilderBaseRanking, PlayerBuilderBaseRankingList class PlayerBuilderBaseRankingsRequest(IterRequestModel): diff --git a/pyclasher/api/requests/PlayerLabels.py b/pyclasher/api/requests/PlayerLabels.py index 35cb169..dc10334 100644 --- a/pyclasher/api/requests/PlayerLabels.py +++ b/pyclasher/api/requests/PlayerLabels.py @@ -1,5 +1,5 @@ from .RequestModels import IterRequestModel -from api.models import LabelList, Label +from ..models import LabelList, Label class PlayerLabelsRequest(IterRequestModel): diff --git a/pyclasher/api/requests/PlayerRankings.py b/pyclasher/api/requests/PlayerRankings.py index 7b001f8..57ed459 100644 --- a/pyclasher/api/requests/PlayerRankings.py +++ b/pyclasher/api/requests/PlayerRankings.py @@ -1,5 +1,5 @@ from .RequestModels import IterRequestModel -from api.models import PlayerRanking, PlayerRankingList +from ..models import PlayerRanking, PlayerRankingList class PlayerRankingsRequest(IterRequestModel): diff --git a/pyclasher/api/requests/RequestModels.py b/pyclasher/api/requests/RequestModels.py index 27dad1f..2370ed7 100644 --- a/pyclasher/api/requests/RequestModels.py +++ b/pyclasher/api/requests/RequestModels.py @@ -2,9 +2,9 @@ from typing import Any from urllib.parse import quote, urlencode -from Exceptions import NoClient, ClientIsNotRunning, RequestNotDone, MISSING -from client import PyClasherClient, RequestMethods -from api.models import Paging +from ..models import Paging +from ...client import PyClasherClient, RequestMethods +from ...exceptions import NoClient, ClientIsNotRunning, RequestNotDone, MISSING request_id = 0 diff --git a/pyclasher/api/requests/RequestModels.pyi b/pyclasher/api/requests/RequestModels.pyi index 8d7ccc7..3da530f 100644 --- a/pyclasher/api/requests/RequestModels.pyi +++ b/pyclasher/api/requests/RequestModels.pyi @@ -1,8 +1,8 @@ -from typing import Any, Self, Coroutine, Iterator, Generator +from typing import Any, Coroutine, Iterator, Generator -from ..Exceptions import MISSING, Missing -from ..client import PyClasherClient, RequestMethods from ..models import Paging +from ...client import PyClasherClient, RequestMethods +from ...exceptions import MISSING, Missing request_id: int = 0 diff --git a/pyclasher/api/requests/WarLeague.py b/pyclasher/api/requests/WarLeague.py index d578f68..c184024 100644 --- a/pyclasher/api/requests/WarLeague.py +++ b/pyclasher/api/requests/WarLeague.py @@ -1,5 +1,5 @@ from .RequestModels import RequestModel -from api.models import WarLeague +from ..models import WarLeague class WarLeagueRequest(RequestModel, WarLeague): diff --git a/pyclasher/api/requests/WarLeagues.py b/pyclasher/api/requests/WarLeagues.py index 0decdf8..9cbdfac 100644 --- a/pyclasher/api/requests/WarLeagues.py +++ b/pyclasher/api/requests/WarLeagues.py @@ -1,5 +1,5 @@ from .RequestModels import IterRequestModel -from api.models import WarLeagueList, WarLeague +from ..models import WarLeagueList, WarLeague class WarLeaguesRequest(IterRequestModel): diff --git a/pyclasher/client.py b/pyclasher/client.py index 32bf20b..3e2cbb4 100644 --- a/pyclasher/client.py +++ b/pyclasher/client.py @@ -6,10 +6,10 @@ from aiohttp import ClientSession, request -from .Exceptions import InvalidLoginData, InvalidType, LoginNotDone, ClientIsRunning, ClientIsNotRunning, \ +from .api.models import ApiCodes +from .api.models import BaseModel +from .exceptions import InvalidLoginData, InvalidType, LoginNotDone, ClientIsRunning, ClientIsNotRunning, \ NoneToken, MISSING -from api.models import ApiCodes -from api.models import BaseModel from .utils import ExecutionTimer diff --git a/pyclasher/client.pyi b/pyclasher/client.pyi index 943675e..3d0ce9e 100644 --- a/pyclasher/client.pyi +++ b/pyclasher/client.pyi @@ -5,8 +5,8 @@ from typing import Iterable, Coroutine, Any from aiohttp import ClientSession -from .Exceptions import MISSING -from api.models import BaseModel +from .api.models import BaseModel +from .exceptions import MISSING class RequestMethods(Enum): diff --git a/pyclasher/utils/ExecTimer.py b/pyclasher/utils/ExecTimer.py index f67b39c..2daf760 100644 --- a/pyclasher/utils/ExecTimer.py +++ b/pyclasher/utils/ExecTimer.py @@ -1,5 +1,5 @@ -from time import perf_counter from asyncio import sleep +from time import perf_counter class ExecutionTimer: diff --git a/pyclasher/utils/ExecTimer.pyi b/pyclasher/utils/ExecTimer.pyi index 73a642e..7d14c03 100644 --- a/pyclasher/utils/ExecTimer.pyi +++ b/pyclasher/utils/ExecTimer.pyi @@ -1,6 +1,3 @@ -from asyncio import Task - - class ExecutionTimer: def __init__(self, min_time: float = 0) -> None: self._min_time = min_time diff --git a/tests/requests/async_tests/test_clan.py b/tests/requests/async_tests/test_clan.py index 5375295..fde41b4 100644 --- a/tests/requests/async_tests/test_clan.py +++ b/tests/requests/async_tests/test_clan.py @@ -2,11 +2,12 @@ from pyclasher import (ClanRequest, ClanMembersRequest, Missing, ClanCurrentWarRequest, ClanWarLogRequest, ClanSearchRequest, ClanCapitalRaidSeasonsRequest) -from api.models import (ClanType, WarFrequency, BadgeUrls, WarLeague, CapitalLeague, Language, ClanCapital, - LabelList, Location, ClanMemberList, Paging, BuilderBaseLeague, League, PlayerHouse, - ClanRole, ClanMember, ClanWarState, WarClan, Time, ClanWarLog, ClanWarResult, ClanList, - ClanCapitalRaidSeasons, ClanCapitalRaidSeasonMemberList, - ClanCapitalRaidSeasonAttackLogList, ClanCapitalRaidSeasonDefenseLogList) +from pyclasher.api.models import (ClanType, WarFrequency, BadgeUrls, WarLeague, CapitalLeague, Language, ClanCapital, + LabelList, Location, ClanMemberList, Paging, BuilderBaseLeague, League, PlayerHouse, + ClanRole, ClanMember, ClanWarState, WarClan, Time, ClanWarLog, ClanWarResult, + ClanList, + ClanCapitalRaidSeasons, ClanCapitalRaidSeasonMemberList, + ClanCapitalRaidSeasonAttackLogList, ClanCapitalRaidSeasonDefenseLogList) from ...constants import TEST_CLAN_TAG, TEST_CLAN_NAME diff --git a/tests/requests/async_tests/test_goldpass.py b/tests/requests/async_tests/test_goldpass.py index 68e9b71..a07a85b 100644 --- a/tests/requests/async_tests/test_goldpass.py +++ b/tests/requests/async_tests/test_goldpass.py @@ -1,7 +1,7 @@ import pytest from pyclasher import GoldPassRequest -from api.models import Time +from pyclasher.api.models import Time @pytest.mark.asyncio diff --git a/tests/requests/async_tests/test_labels.py b/tests/requests/async_tests/test_labels.py index 84272c5..107f617 100644 --- a/tests/requests/async_tests/test_labels.py +++ b/tests/requests/async_tests/test_labels.py @@ -1,7 +1,7 @@ import pytest from pyclasher import ClanLabelsRequest, PlayerLabelsRequest -from api.models import LabelList, Paging, IconUrls +from pyclasher.api.models import LabelList, Paging, IconUrls @pytest.mark.asyncio diff --git a/tests/requests/async_tests/test_locations.py b/tests/requests/async_tests/test_locations.py index e932811..ae8c4cf 100644 --- a/tests/requests/async_tests/test_locations.py +++ b/tests/requests/async_tests/test_locations.py @@ -1,7 +1,7 @@ import pytest from pyclasher import LocationsRequest -from api.models import LocationList, Paging +from pyclasher.api.models import LocationList, Paging @pytest.mark.asyncio diff --git a/tests/requests/async_tests/test_player.py b/tests/requests/async_tests/test_player.py index f6270b9..add732d 100644 --- a/tests/requests/async_tests/test_player.py +++ b/tests/requests/async_tests/test_player.py @@ -1,8 +1,8 @@ import pytest from pyclasher import PlayerRequest, Missing -from api.models import (ClanRole, PlayerHouse, PlayerClan, PlayerAchievementProgressList, BuilderBaseLeague, - PlayerItemLevelList, LabelList, League, PlayerLegendStatistics, WarPreference) +from pyclasher.api.models import (ClanRole, PlayerHouse, PlayerClan, PlayerAchievementProgressList, BuilderBaseLeague, + PlayerItemLevelList, LabelList, League, PlayerLegendStatistics, WarPreference) from ...constants import TEST_PLAYER_TAG