Skip to content

Commit 3f389f8

Browse files
committed
polish
1 parent 15bf6df commit 3f389f8

1 file changed

Lines changed: 14 additions & 26 deletions

File tree

src/apify/_charging.py

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,12 @@
1010
from pydantic import BaseModel, ConfigDict, Field
1111

1212
import apify_client._models as _client_models
13-
from apify_client._models import (
14-
ActorChargeEvent as _ClientActorChargeEvent,
15-
)
16-
from apify_client._models import (
17-
FlatPricePerMonthActorPricingInfo as _ClientFlatPricePerMonth,
18-
)
19-
from apify_client._models import (
20-
FreeActorPricingInfo as _ClientFree,
21-
)
22-
from apify_client._models import (
23-
PayPerEventActorPricingInfo as _ClientPayPerEvent,
24-
)
25-
from apify_client._models import (
26-
PricePerDatasetItemActorPricingInfo as _ClientPricePerDatasetItem,
27-
)
28-
from apify_client._models import (
29-
PricingPerEvent as _ClientPricingPerEvent,
30-
)
13+
from apify_client._models import ActorChargeEvent as ClientActorChargeEvent
14+
from apify_client._models import FlatPricePerMonthActorPricingInfo as ClientFlatPricePerMonth
15+
from apify_client._models import FreeActorPricingInfo as ClientFree
16+
from apify_client._models import PayPerEventActorPricingInfo as ClientPayPerEvent
17+
from apify_client._models import PricePerDatasetItemActorPricingInfo as ClientPricePerDatasetItem
18+
from apify_client._models import PricingPerEvent as ClientPricingPerEvent
3119

3220
from apify._utils import ReentrantLock, docs_group, ensure_context
3321
from apify.log import logger
@@ -74,40 +62,40 @@ class _RelaxedPricingMetadata(BaseModel):
7462

7563

7664
@docs_group('Charging')
77-
class ActorChargeEvent(_ClientActorChargeEvent):
65+
class ActorChargeEvent(ClientActorChargeEvent):
7866
# `event_description` is required in apify-client but omitted from the env var.
7967
event_description: Annotated[str | None, Field(alias='eventDescription')] = None
8068

8169

8270
@docs_group('Charging')
83-
class PricingPerEvent(_ClientPricingPerEvent):
71+
class PricingPerEvent(ClientPricingPerEvent):
8472
actor_charge_events: Annotated[dict[str, ActorChargeEvent] | None, Field(alias='actorChargeEvents')] = None
8573

8674

8775
@docs_group('Charging')
88-
class FreeActorPricingInfo(_RelaxedPricingMetadata, _ClientFree):
76+
class FreeActorPricingInfo(_RelaxedPricingMetadata, ClientFree):
8977
pass
9078

9179

9280
@docs_group('Charging')
93-
class FlatPricePerMonthActorPricingInfo(_RelaxedPricingMetadata, _ClientFlatPricePerMonth):
81+
class FlatPricePerMonthActorPricingInfo(_RelaxedPricingMetadata, ClientFlatPricePerMonth):
9482
trial_minutes: Annotated[int | None, Field(alias='trialMinutes')] = None
9583
price_per_unit_usd: Annotated[float | None, Field(alias='pricePerUnitUsd')] = None
9684

9785

9886
@docs_group('Charging')
99-
class PricePerDatasetItemActorPricingInfo(_RelaxedPricingMetadata, _ClientPricePerDatasetItem):
87+
class PricePerDatasetItemActorPricingInfo(_RelaxedPricingMetadata, ClientPricePerDatasetItem):
10088
unit_name: Annotated[str | None, Field(alias='unitName')] = None
10189
# `price_per_unit_usd` is already optional in apify-client - inherited.
10290

10391

10492
@docs_group('Charging')
105-
class PayPerEventActorPricingInfo(_RelaxedPricingMetadata, _ClientPayPerEvent):
93+
class PayPerEventActorPricingInfo(_RelaxedPricingMetadata, ClientPayPerEvent):
10694
# Re-typed to the relaxed element so an omitted `eventDescription` validates; the field stays required.
10795
pricing_per_event: Annotated[PricingPerEvent, Field(alias='pricingPerEvent')]
10896

10997

110-
ActorPricingInfoModel = _ClientFree | _ClientFlatPricePerMonth | _ClientPricePerDatasetItem | _ClientPayPerEvent
98+
ActorPricingInfoModel = ClientFree | ClientFlatPricePerMonth | ClientPricePerDatasetItem | ClientPayPerEvent
11199
"""Common supertype of both env-var-parsed SDK subclasses and the API-returned `Run.pricing_info`."""
112100

113101
# apify-client ships these models with deferred forward refs (`__pydantic_complete__` is False), so the
@@ -294,7 +282,7 @@ async def __aenter__(self) -> None:
294282

295283
# Load per-event pricing information. Check against the apify-client base so both env-var-parsed
296284
# SDK subclasses and the API-returned model match.
297-
if isinstance(pricing_info, _ClientPayPerEvent):
285+
if isinstance(pricing_info, ClientPayPerEvent):
298286
actor_charge_events = pricing_info.pricing_per_event.actor_charge_events or {}
299287
for event_name, event_pricing in actor_charge_events.items():
300288
if event_pricing.event_price_usd is None:

0 commit comments

Comments
 (0)