Skip to content

Commit

Permalink
chore: run formatter and fix flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
BeatsuDev committed Jan 6, 2025
1 parent 5bc058c commit 3c93b44
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
38 changes: 38 additions & 0 deletions tibber/types/subscription_price_connection.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
from __future__ import annotations

"""A class representing the SubscriptionPriceConnection type from the GraphQL Tibber API."""
from typing import TYPE_CHECKING

from tibber.types.price import Price
from tibber.types.subscription_price_connection_page_info import \
SubscriptionPriceConnectionPageInfo
from tibber.types.subscription_price_edge import SubscriptionPriceEdge

if TYPE_CHECKING:
from tibber.account import Account


class SubscriptionPriceConnection:
"""A class to get subscription price connection."""

def __init__(self, data: dict, tibber_client: "Account"):
self.cache: dict = data or {}
self.tibber_client: "Account" = tibber_client

@property
def edges(self) -> list[SubscriptionPriceEdge]:
return [
SubscriptionPriceEdge(edge, self.tibber_client)
for edge in self.cache.get("edges", [])
]

@property
def pageInfo(self) -> SubscriptionPriceConnectionPageInfo:
return SubscriptionPriceConnectionPageInfo(
self.cache.get("pageInfo"), self.tibber_client
)

@property
def nodes(self) -> list[Price]:
"""List of Price objects from the executed range query."""
return [Price(node, self.tibber_client) for node in self.cache.get("nodes", [])]
3 changes: 3 additions & 0 deletions tibber/types/subscription_price_connection_page_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"""A class representing the SubscriptionPriceConnectionPageInfo type from the GraphQL Tibber API."""
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from tibber.account import Account


class SubscriptionPriceConnectionPageInfo:
def __init__(self, data: dict, tibber_client: "Account"):
Expand Down
3 changes: 3 additions & 0 deletions tibber/types/subscription_price_edge.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

from tibber.types.price import Price

if TYPE_CHECKING:
from tibber.account import Account


class SubscriptionPriceEdge:
def __init__(self, data: dict, tibber_client: "Account"):
Expand Down

0 comments on commit 3c93b44

Please sign in to comment.