|
10 | 10 | from pydantic import BaseModel, ConfigDict, Field |
11 | 11 |
|
12 | 12 | 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 |
31 | 19 |
|
32 | 20 | from apify._utils import ReentrantLock, docs_group, ensure_context |
33 | 21 | from apify.log import logger |
@@ -74,40 +62,40 @@ class _RelaxedPricingMetadata(BaseModel): |
74 | 62 |
|
75 | 63 |
|
76 | 64 | @docs_group('Charging') |
77 | | -class ActorChargeEvent(_ClientActorChargeEvent): |
| 65 | +class ActorChargeEvent(ClientActorChargeEvent): |
78 | 66 | # `event_description` is required in apify-client but omitted from the env var. |
79 | 67 | event_description: Annotated[str | None, Field(alias='eventDescription')] = None |
80 | 68 |
|
81 | 69 |
|
82 | 70 | @docs_group('Charging') |
83 | | -class PricingPerEvent(_ClientPricingPerEvent): |
| 71 | +class PricingPerEvent(ClientPricingPerEvent): |
84 | 72 | actor_charge_events: Annotated[dict[str, ActorChargeEvent] | None, Field(alias='actorChargeEvents')] = None |
85 | 73 |
|
86 | 74 |
|
87 | 75 | @docs_group('Charging') |
88 | | -class FreeActorPricingInfo(_RelaxedPricingMetadata, _ClientFree): |
| 76 | +class FreeActorPricingInfo(_RelaxedPricingMetadata, ClientFree): |
89 | 77 | pass |
90 | 78 |
|
91 | 79 |
|
92 | 80 | @docs_group('Charging') |
93 | | -class FlatPricePerMonthActorPricingInfo(_RelaxedPricingMetadata, _ClientFlatPricePerMonth): |
| 81 | +class FlatPricePerMonthActorPricingInfo(_RelaxedPricingMetadata, ClientFlatPricePerMonth): |
94 | 82 | trial_minutes: Annotated[int | None, Field(alias='trialMinutes')] = None |
95 | 83 | price_per_unit_usd: Annotated[float | None, Field(alias='pricePerUnitUsd')] = None |
96 | 84 |
|
97 | 85 |
|
98 | 86 | @docs_group('Charging') |
99 | | -class PricePerDatasetItemActorPricingInfo(_RelaxedPricingMetadata, _ClientPricePerDatasetItem): |
| 87 | +class PricePerDatasetItemActorPricingInfo(_RelaxedPricingMetadata, ClientPricePerDatasetItem): |
100 | 88 | unit_name: Annotated[str | None, Field(alias='unitName')] = None |
101 | 89 | # `price_per_unit_usd` is already optional in apify-client - inherited. |
102 | 90 |
|
103 | 91 |
|
104 | 92 | @docs_group('Charging') |
105 | | -class PayPerEventActorPricingInfo(_RelaxedPricingMetadata, _ClientPayPerEvent): |
| 93 | +class PayPerEventActorPricingInfo(_RelaxedPricingMetadata, ClientPayPerEvent): |
106 | 94 | # Re-typed to the relaxed element so an omitted `eventDescription` validates; the field stays required. |
107 | 95 | pricing_per_event: Annotated[PricingPerEvent, Field(alias='pricingPerEvent')] |
108 | 96 |
|
109 | 97 |
|
110 | | -ActorPricingInfoModel = _ClientFree | _ClientFlatPricePerMonth | _ClientPricePerDatasetItem | _ClientPayPerEvent |
| 98 | +ActorPricingInfoModel = ClientFree | ClientFlatPricePerMonth | ClientPricePerDatasetItem | ClientPayPerEvent |
111 | 99 | """Common supertype of both env-var-parsed SDK subclasses and the API-returned `Run.pricing_info`.""" |
112 | 100 |
|
113 | 101 | # apify-client ships these models with deferred forward refs (`__pydantic_complete__` is False), so the |
@@ -294,7 +282,7 @@ async def __aenter__(self) -> None: |
294 | 282 |
|
295 | 283 | # Load per-event pricing information. Check against the apify-client base so both env-var-parsed |
296 | 284 | # SDK subclasses and the API-returned model match. |
297 | | - if isinstance(pricing_info, _ClientPayPerEvent): |
| 285 | + if isinstance(pricing_info, ClientPayPerEvent): |
298 | 286 | actor_charge_events = pricing_info.pricing_per_event.actor_charge_events or {} |
299 | 287 | for event_name, event_pricing in actor_charge_events.items(): |
300 | 288 | if event_pricing.event_price_usd is None: |
|
0 commit comments