Skip to content

Commit

Permalink
clean up imports using ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
Galarzaa90 committed Oct 2, 2024
1 parent e876fa0 commit 6421be6
Show file tree
Hide file tree
Showing 38 changed files with 519 additions and 141 deletions.
67 changes: 53 additions & 14 deletions server.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,65 @@
import datetime
import logging
from contextlib import asynccontextmanager
from typing import Optional, TypeVar
from typing import Annotated, Optional, TypeVar

import uvicorn
from fastapi import Depends, FastAPI, Path, Query, Response
from starlette import status
from typing import Annotated

import tibiapy
from tibiapy.enums import (AuctionBattlEyeFilter, AuctionOrderBy, AuctionOrderDirection, AuctionSearchType,
AuctionSkillFilter, AuctionVocationFilter, HighscoresBattlEyeType, HighscoresCategory,
HighscoresProfession, HouseOrder, HouseStatus, HouseType, NewsCategory, NewsType,
PvpTypeFilter,
SpellGroup, SpellSorting, SpellType, SpellVocationFilter)
from tibiapy.models import (Auction, AuctionFilters, BoostableBosses, BossEntry, Character, CharacterBazaar, Creature,
CreatureEntry, CreaturesSection, EventSchedule, FansitesSection, ForumBoard, ForumSection,
ForumThread,
Guild, GuildWars,
GuildsSection, Highscores, House, HousesSection, KillStatistics, Leaderboard, News,
NewsArchive, Spell,
SpellsSection, TibiaResponse, World, WorldOverview)
from tibiapy.enums import (
AuctionBattlEyeFilter,
AuctionOrderBy,
AuctionOrderDirection,
AuctionSearchType,
AuctionSkillFilter,
AuctionVocationFilter,
HighscoresBattlEyeType,
HighscoresCategory,
HighscoresProfession,
HouseOrder,
HouseStatus,
HouseType,
NewsCategory,
NewsType,
PvpTypeFilter,
SpellGroup,
SpellSorting,
SpellType,
SpellVocationFilter,
)
from tibiapy.models import (
Auction,
AuctionFilters,
BoostableBosses,
BossEntry,
Character,
CharacterBazaar,
Creature,
CreatureEntry,
CreaturesSection,
EventSchedule,
FansitesSection,
ForumBoard,
ForumSection,
ForumThread,
Guild,
GuildsSection,
GuildWars,
Highscores,
House,
HousesSection,
KillStatistics,
Leaderboard,
News,
NewsArchive,
Spell,
SpellsSection,
TibiaResponse,
World,
WorldOverview,
)

logging_formatter = logging.Formatter("[%(asctime)s][%(levelname)s] %(message)s")
console_handler = logging.StreamHandler()
Expand Down
24 changes: 19 additions & 5 deletions tibiapy/builders/bazaar.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,31 @@
from __future__ import annotations


from typing import Optional, TYPE_CHECKING
from typing import TYPE_CHECKING, Optional

from tibiapy.models import Auction, CharacterBazaar
from tibiapy.models.bazaar import AuctionDetails, RevealedGem

if TYPE_CHECKING:
import datetime

from typing_extensions import Self
from tibiapy.enums import BazaarType, Vocation, Sex, BidType, AuctionStatus
from tibiapy.models import (AuctionFilters, OutfitImage, ItemEntry, SalesArgument, SkillEntry, ItemSummary, Mounts,
Outfits, Familiars, BlessingEntry, CharmEntry, AchievementEntry, BestiaryEntry)

from tibiapy.enums import AuctionStatus, BazaarType, BidType, Sex, Vocation
from tibiapy.models import (
AchievementEntry,
AuctionFilters,
BestiaryEntry,
BlessingEntry,
CharmEntry,
Familiars,
ItemEntry,
ItemSummary,
Mounts,
OutfitImage,
Outfits,
SalesArgument,
SkillEntry,
)


class CharacterBazaarBuilder:
Expand Down
15 changes: 12 additions & 3 deletions tibiapy/builders/character.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
from __future__ import annotations

from typing import Optional, TYPE_CHECKING
from typing import TYPE_CHECKING, Optional

from tibiapy.models import Character

if TYPE_CHECKING:
import datetime

from typing_extensions import Self

from tibiapy.enums import Sex, Vocation
from tibiapy.models import (CharacterHouse, GuildMembership, AccountBadge, Achievement, Death, AccountInformation,
OtherCharacter)
from tibiapy.models import (
AccountBadge,
AccountInformation,
Achievement,
CharacterHouse,
Death,
GuildMembership,
OtherCharacter,
)


class CharacterBuilder:
Expand Down
1 change: 1 addition & 0 deletions tibiapy/builders/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

if TYPE_CHECKING:
from typing_extensions import Self

from tibiapy.models.event import EventEntry


Expand Down
10 changes: 8 additions & 2 deletions tibiapy/builders/forum.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
from __future__ import annotations

import datetime
from typing import Optional, TYPE_CHECKING
from typing import TYPE_CHECKING, Optional

from tibiapy.models import AnnouncementEntry, ForumAuthor, ForumPost, ThreadEntry
from tibiapy.models.forum import CMPostArchive, CMPost, ForumAnnouncement, ForumBoard, ForumThread
from tibiapy.models.forum import (
CMPost,
CMPostArchive,
ForumAnnouncement,
ForumBoard,
ForumThread,
)

if TYPE_CHECKING:
from typing_extensions import Self
Expand Down
8 changes: 5 additions & 3 deletions tibiapy/builders/guild.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
from __future__ import annotations

from typing import Optional, TYPE_CHECKING
from typing import TYPE_CHECKING, Optional

from tibiapy.models import GuildEntry, Guild, GuildWars, GuildWarEntry
from tibiapy.models import Guild, GuildEntry, GuildWarEntry, GuildWars

if TYPE_CHECKING:
import datetime

from typing_extensions import Self
from tibiapy.models import GuildHouse, GuildMember, GuildInvite

from tibiapy.models import GuildHouse, GuildInvite, GuildMember


class _BaseGuildBuilder:
Expand Down
9 changes: 8 additions & 1 deletion tibiapy/builders/highscores.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,15 @@

if TYPE_CHECKING:
import datetime

from typing_extensions import Self
from tibiapy.enums import HighscoresCategory, HighscoresProfession, HighscoresBattlEyeType, PvpTypeFilter

from tibiapy.enums import (
HighscoresBattlEyeType,
HighscoresCategory,
HighscoresProfession,
PvpTypeFilter,
)
from tibiapy.models import HighscoresEntry


Expand Down
6 changes: 3 additions & 3 deletions tibiapy/builders/house.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
from __future__ import annotations


from typing import TYPE_CHECKING, Optional

from typing_extensions import Self

from tibiapy.models.house import HouseEntry, HousesSection, House
from tibiapy.models.house import House, HouseEntry, HousesSection

if TYPE_CHECKING:
import datetime
from tibiapy.enums import HouseStatus, HouseType, HouseOrder, Sex

from tibiapy.enums import HouseOrder, HouseStatus, HouseType, Sex


class HousesSectionBuilder:
Expand Down
1 change: 1 addition & 0 deletions tibiapy/builders/kill_statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

if TYPE_CHECKING:
from typing_extensions import Self

from tibiapy.models import RaceEntry


Expand Down
6 changes: 4 additions & 2 deletions tibiapy/builders/leaderboard.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
from __future__ import annotations

from typing import Optional, TYPE_CHECKING
from typing import TYPE_CHECKING, Optional

from tibiapy.models.leaderboard import LeaderboardEntry, Leaderboard
from tibiapy.models.leaderboard import Leaderboard, LeaderboardEntry

if TYPE_CHECKING:
import datetime

from typing_extensions import Self

from tibiapy.models.leaderboard import LeaderboardRotation


Expand Down
8 changes: 5 additions & 3 deletions tibiapy/builders/news.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
from __future__ import annotations

from typing import Optional, TYPE_CHECKING
from collections.abc import Collection
from typing import TYPE_CHECKING, Optional

from tibiapy.models import NewsEntry, NewsArchive, News
from tibiapy.models import News, NewsArchive, NewsEntry

if TYPE_CHECKING:
import datetime

from typing_extensions import Self
from tibiapy.enums import NewsType, NewsCategory

from tibiapy.enums import NewsCategory, NewsType


class NewsArchiveBuilder:
Expand Down
7 changes: 4 additions & 3 deletions tibiapy/builders/spell.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
from __future__ import annotations

from typing import Optional, TYPE_CHECKING
from typing import TYPE_CHECKING, Optional

from tibiapy.models import SpellEntry, SpellsSection, Spell, Rune
from tibiapy.models import Rune, Spell, SpellEntry, SpellsSection

if TYPE_CHECKING:
from typing_extensions import Self
from tibiapy.enums import SpellVocationFilter, SpellGroup, SpellSorting, SpellType

from tibiapy.enums import SpellGroup, SpellSorting, SpellType, SpellVocationFilter


class SpellSectionBuilder:
Expand Down
12 changes: 7 additions & 5 deletions tibiapy/builders/world.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
from __future__ import annotations

from typing import Optional, TYPE_CHECKING
from typing import TYPE_CHECKING, Optional

from tibiapy.enums import TransferType, BattlEyeType
from tibiapy.enums import BattlEyeType, TransferType
from tibiapy.models import World, WorldEntry, WorldOverview

if TYPE_CHECKING:
from tibiapy.models import OnlineCharacter
from tibiapy.enums import WorldLocation, PvpType
from typing_extensions import Self
import datetime

from typing_extensions import Self

from tibiapy.enums import PvpType, WorldLocation
from tibiapy.models import OnlineCharacter

__all__ = (
"WorldBuilder",
"WorldEntryBuilder",
Expand Down
Loading

0 comments on commit 6421be6

Please sign in to comment.