1
1
from __future__ import annotations
2
2
3
+ from lazy_object_proxy import Proxy as LazyObjectProxy
4
+
3
5
from crawlee ._utils .docs import docs_group
4
6
from crawlee .base_storage_client ._base_storage_client import BaseStorageClient
5
7
from crawlee .configuration import Configuration
@@ -91,7 +93,8 @@ def storage_client_was_set(self) -> bool:
91
93
@docs_group ('Functions' )
92
94
def get_configuration () -> Configuration :
93
95
"""Get the configuration."""
94
- return _service_locator .configuration
96
+ proxy_config : Configuration = LazyObjectProxy (lambda : _service_locator .configuration )
97
+ return proxy_config
95
98
96
99
97
100
@docs_group ('Functions' )
@@ -113,7 +116,8 @@ def set_configuration(configuration: Configuration) -> None:
113
116
@docs_group ('Functions' )
114
117
def get_event_manager () -> EventManager :
115
118
"""Get the event manager."""
116
- return _service_locator .event_manager
119
+ proxy_event_manager : EventManager = LazyObjectProxy (lambda : _service_locator .event_manager )
120
+ return proxy_event_manager
117
121
118
122
119
123
@docs_group ('Functions' )
@@ -135,7 +139,8 @@ def set_event_manager(event_manager: EventManager) -> None:
135
139
@docs_group ('Functions' )
136
140
def get_storage_client () -> BaseStorageClient :
137
141
"""Get the storage client."""
138
- return _service_locator .storage_client
142
+ proxy_storage_client : BaseStorageClient = LazyObjectProxy (lambda : _service_locator .storage_client )
143
+ return proxy_storage_client
139
144
140
145
141
146
@docs_group ('Functions' )
0 commit comments