|
6 | 6 | from datetime import timedelta |
7 | 7 | from typing import TYPE_CHECKING, Any, Callable, TypeVar, cast |
8 | 8 |
|
| 9 | +from lazy_object_proxy import Proxy |
9 | 10 | from pydantic import AliasChoices |
10 | 11 | from typing_extensions import Self |
11 | | -from werkzeug.local import LocalProxy |
12 | 12 |
|
13 | 13 | from apify._crypto import decrypt_input_secrets, load_private_key |
14 | 14 | from apify._utils import get_system_info, is_running_in_ipython |
@@ -103,7 +103,7 @@ async def __aexit__( |
103 | 103 | await self.exit() |
104 | 104 |
|
105 | 105 | def __repr__(self) -> str: |
106 | | - if self is _default_instance: |
| 106 | + if self is cast(Proxy, Actor).__wrapped__: |
107 | 107 | return '<apify.Actor>' |
108 | 108 |
|
109 | 109 | return super().__repr__() |
@@ -933,17 +933,5 @@ async def create_proxy_configuration( |
933 | 933 | return proxy_configuration |
934 | 934 |
|
935 | 935 |
|
936 | | -_default_instance: _ActorType | None = None |
937 | | - |
938 | | - |
939 | | -def _get_default_instance() -> _ActorType: |
940 | | - global _default_instance # noqa: PLW0603 |
941 | | - |
942 | | - if not _default_instance: |
943 | | - _default_instance = _ActorType() |
944 | | - |
945 | | - return _default_instance |
946 | | - |
947 | | - |
948 | | -Actor = cast(_ActorType, LocalProxy(_get_default_instance)) |
| 936 | +Actor = cast(_ActorType, Proxy(_ActorType)) |
949 | 937 | """The entry point of the SDK, through which all the Actor operations should be done.""" |
0 commit comments