clear-skies 2.0.5__py3-none-any.whl → 2.0.6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of clear-skies might be problematic. Click here for more details.

Files changed (252) hide show
  1. {clear_skies-2.0.5.dist-info → clear_skies-2.0.6.dist-info}/METADATA +1 -1
  2. clear_skies-2.0.6.dist-info/RECORD +251 -0
  3. clearskies/__init__.py +61 -0
  4. clearskies/action.py +7 -0
  5. clearskies/authentication/__init__.py +15 -0
  6. clearskies/authentication/authentication.py +46 -0
  7. clearskies/authentication/authorization.py +16 -0
  8. clearskies/authentication/authorization_pass_through.py +20 -0
  9. clearskies/authentication/jwks.py +163 -0
  10. clearskies/authentication/public.py +5 -0
  11. clearskies/authentication/secret_bearer.py +553 -0
  12. clearskies/autodoc/__init__.py +8 -0
  13. clearskies/autodoc/formats/__init__.py +5 -0
  14. clearskies/autodoc/formats/oai3_json/__init__.py +7 -0
  15. clearskies/autodoc/formats/oai3_json/oai3_json.py +87 -0
  16. clearskies/autodoc/formats/oai3_json/oai3_schema_resolver.py +15 -0
  17. clearskies/autodoc/formats/oai3_json/parameter.py +35 -0
  18. clearskies/autodoc/formats/oai3_json/request.py +68 -0
  19. clearskies/autodoc/formats/oai3_json/response.py +28 -0
  20. clearskies/autodoc/formats/oai3_json/schema/__init__.py +11 -0
  21. clearskies/autodoc/formats/oai3_json/schema/array.py +9 -0
  22. clearskies/autodoc/formats/oai3_json/schema/default.py +13 -0
  23. clearskies/autodoc/formats/oai3_json/schema/enum.py +7 -0
  24. clearskies/autodoc/formats/oai3_json/schema/object.py +35 -0
  25. clearskies/autodoc/formats/oai3_json/test.json +1985 -0
  26. clearskies/autodoc/py.typed +0 -0
  27. clearskies/autodoc/request/__init__.py +15 -0
  28. clearskies/autodoc/request/header.py +6 -0
  29. clearskies/autodoc/request/json_body.py +6 -0
  30. clearskies/autodoc/request/parameter.py +8 -0
  31. clearskies/autodoc/request/request.py +47 -0
  32. clearskies/autodoc/request/url_parameter.py +6 -0
  33. clearskies/autodoc/request/url_path.py +6 -0
  34. clearskies/autodoc/response/__init__.py +5 -0
  35. clearskies/autodoc/response/response.py +9 -0
  36. clearskies/autodoc/schema/__init__.py +31 -0
  37. clearskies/autodoc/schema/array.py +10 -0
  38. clearskies/autodoc/schema/base64.py +8 -0
  39. clearskies/autodoc/schema/boolean.py +5 -0
  40. clearskies/autodoc/schema/date.py +5 -0
  41. clearskies/autodoc/schema/datetime.py +5 -0
  42. clearskies/autodoc/schema/double.py +5 -0
  43. clearskies/autodoc/schema/enum.py +17 -0
  44. clearskies/autodoc/schema/integer.py +6 -0
  45. clearskies/autodoc/schema/long.py +5 -0
  46. clearskies/autodoc/schema/number.py +6 -0
  47. clearskies/autodoc/schema/object.py +13 -0
  48. clearskies/autodoc/schema/password.py +5 -0
  49. clearskies/autodoc/schema/schema.py +11 -0
  50. clearskies/autodoc/schema/string.py +5 -0
  51. clearskies/backends/__init__.py +65 -0
  52. clearskies/backends/api_backend.py +1178 -0
  53. clearskies/backends/backend.py +136 -0
  54. clearskies/backends/cursor_backend.py +335 -0
  55. clearskies/backends/memory_backend.py +797 -0
  56. clearskies/backends/secrets_backend.py +106 -0
  57. clearskies/column.py +1233 -0
  58. clearskies/columns/__init__.py +71 -0
  59. clearskies/columns/audit.py +206 -0
  60. clearskies/columns/belongs_to_id.py +483 -0
  61. clearskies/columns/belongs_to_model.py +132 -0
  62. clearskies/columns/belongs_to_self.py +105 -0
  63. clearskies/columns/boolean.py +113 -0
  64. clearskies/columns/category_tree.py +275 -0
  65. clearskies/columns/category_tree_ancestors.py +51 -0
  66. clearskies/columns/category_tree_children.py +127 -0
  67. clearskies/columns/category_tree_descendants.py +48 -0
  68. clearskies/columns/created.py +95 -0
  69. clearskies/columns/created_by_authorization_data.py +116 -0
  70. clearskies/columns/created_by_header.py +99 -0
  71. clearskies/columns/created_by_ip.py +92 -0
  72. clearskies/columns/created_by_routing_data.py +97 -0
  73. clearskies/columns/created_by_user_agent.py +92 -0
  74. clearskies/columns/date.py +234 -0
  75. clearskies/columns/datetime.py +282 -0
  76. clearskies/columns/email.py +76 -0
  77. clearskies/columns/float.py +153 -0
  78. clearskies/columns/has_many.py +505 -0
  79. clearskies/columns/has_many_self.py +56 -0
  80. clearskies/columns/has_one.py +14 -0
  81. clearskies/columns/integer.py +160 -0
  82. clearskies/columns/json.py +128 -0
  83. clearskies/columns/many_to_many_ids.py +337 -0
  84. clearskies/columns/many_to_many_ids_with_data.py +274 -0
  85. clearskies/columns/many_to_many_models.py +158 -0
  86. clearskies/columns/many_to_many_pivots.py +134 -0
  87. clearskies/columns/phone.py +159 -0
  88. clearskies/columns/select.py +92 -0
  89. clearskies/columns/string.py +102 -0
  90. clearskies/columns/timestamp.py +164 -0
  91. clearskies/columns/updated.py +110 -0
  92. clearskies/columns/uuid.py +86 -0
  93. clearskies/configs/README.md +105 -0
  94. clearskies/configs/__init__.py +162 -0
  95. clearskies/configs/actions.py +43 -0
  96. clearskies/configs/any.py +13 -0
  97. clearskies/configs/any_dict.py +22 -0
  98. clearskies/configs/any_dict_or_callable.py +23 -0
  99. clearskies/configs/authentication.py +23 -0
  100. clearskies/configs/authorization.py +23 -0
  101. clearskies/configs/boolean.py +16 -0
  102. clearskies/configs/boolean_or_callable.py +18 -0
  103. clearskies/configs/callable_config.py +18 -0
  104. clearskies/configs/columns.py +34 -0
  105. clearskies/configs/conditions.py +30 -0
  106. clearskies/configs/config.py +24 -0
  107. clearskies/configs/datetime.py +18 -0
  108. clearskies/configs/datetime_or_callable.py +19 -0
  109. clearskies/configs/endpoint.py +23 -0
  110. clearskies/configs/endpoint_list.py +29 -0
  111. clearskies/configs/float.py +16 -0
  112. clearskies/configs/float_or_callable.py +18 -0
  113. clearskies/configs/integer.py +16 -0
  114. clearskies/configs/integer_or_callable.py +18 -0
  115. clearskies/configs/joins.py +30 -0
  116. clearskies/configs/list_any_dict.py +30 -0
  117. clearskies/configs/list_any_dict_or_callable.py +31 -0
  118. clearskies/configs/model_class.py +35 -0
  119. clearskies/configs/model_column.py +65 -0
  120. clearskies/configs/model_columns.py +56 -0
  121. clearskies/configs/model_destination_name.py +25 -0
  122. clearskies/configs/model_to_id_column.py +43 -0
  123. clearskies/configs/readable_model_column.py +9 -0
  124. clearskies/configs/readable_model_columns.py +9 -0
  125. clearskies/configs/schema.py +23 -0
  126. clearskies/configs/searchable_model_columns.py +9 -0
  127. clearskies/configs/security_headers.py +39 -0
  128. clearskies/configs/select.py +26 -0
  129. clearskies/configs/select_list.py +47 -0
  130. clearskies/configs/string.py +29 -0
  131. clearskies/configs/string_dict.py +32 -0
  132. clearskies/configs/string_list.py +32 -0
  133. clearskies/configs/string_list_or_callable.py +35 -0
  134. clearskies/configs/string_or_callable.py +18 -0
  135. clearskies/configs/timedelta.py +18 -0
  136. clearskies/configs/timezone.py +18 -0
  137. clearskies/configs/url.py +23 -0
  138. clearskies/configs/validators.py +45 -0
  139. clearskies/configs/writeable_model_column.py +9 -0
  140. clearskies/configs/writeable_model_columns.py +9 -0
  141. clearskies/configurable.py +76 -0
  142. clearskies/contexts/__init__.py +11 -0
  143. clearskies/contexts/cli.py +117 -0
  144. clearskies/contexts/context.py +98 -0
  145. clearskies/contexts/wsgi.py +76 -0
  146. clearskies/contexts/wsgi_ref.py +82 -0
  147. clearskies/decorators.py +33 -0
  148. clearskies/di/__init__.py +14 -0
  149. clearskies/di/additional_config.py +130 -0
  150. clearskies/di/additional_config_auto_import.py +17 -0
  151. clearskies/di/di.py +973 -0
  152. clearskies/di/inject/__init__.py +23 -0
  153. clearskies/di/inject/by_class.py +21 -0
  154. clearskies/di/inject/by_name.py +18 -0
  155. clearskies/di/inject/di.py +13 -0
  156. clearskies/di/inject/environment.py +14 -0
  157. clearskies/di/inject/input_output.py +20 -0
  158. clearskies/di/inject/now.py +13 -0
  159. clearskies/di/inject/requests.py +13 -0
  160. clearskies/di/inject/secrets.py +14 -0
  161. clearskies/di/inject/utcnow.py +13 -0
  162. clearskies/di/inject/uuid.py +15 -0
  163. clearskies/di/injectable.py +29 -0
  164. clearskies/di/injectable_properties.py +131 -0
  165. clearskies/di/test_module/__init__.py +6 -0
  166. clearskies/di/test_module/another_module/__init__.py +2 -0
  167. clearskies/di/test_module/module_class.py +5 -0
  168. clearskies/end.py +183 -0
  169. clearskies/endpoint.py +1314 -0
  170. clearskies/endpoint_group.py +336 -0
  171. clearskies/endpoints/__init__.py +25 -0
  172. clearskies/endpoints/advanced_search.py +526 -0
  173. clearskies/endpoints/callable.py +388 -0
  174. clearskies/endpoints/create.py +205 -0
  175. clearskies/endpoints/delete.py +139 -0
  176. clearskies/endpoints/get.py +271 -0
  177. clearskies/endpoints/health_check.py +183 -0
  178. clearskies/endpoints/list.py +574 -0
  179. clearskies/endpoints/restful_api.py +427 -0
  180. clearskies/endpoints/schema.py +189 -0
  181. clearskies/endpoints/simple_search.py +286 -0
  182. clearskies/endpoints/update.py +193 -0
  183. clearskies/environment.py +104 -0
  184. clearskies/exceptions/__init__.py +19 -0
  185. clearskies/exceptions/authentication.py +2 -0
  186. clearskies/exceptions/authorization.py +2 -0
  187. clearskies/exceptions/client_error.py +2 -0
  188. clearskies/exceptions/input_errors.py +4 -0
  189. clearskies/exceptions/missing_dependency.py +2 -0
  190. clearskies/exceptions/moved_permanently.py +3 -0
  191. clearskies/exceptions/moved_temporarily.py +3 -0
  192. clearskies/exceptions/not_found.py +2 -0
  193. clearskies/functional/__init__.py +7 -0
  194. clearskies/functional/routing.py +92 -0
  195. clearskies/functional/string.py +112 -0
  196. clearskies/functional/validations.py +76 -0
  197. clearskies/input_outputs/__init__.py +13 -0
  198. clearskies/input_outputs/cli.py +171 -0
  199. clearskies/input_outputs/exceptions/__init__.py +2 -0
  200. clearskies/input_outputs/exceptions/cli_input_error.py +2 -0
  201. clearskies/input_outputs/exceptions/cli_not_found.py +2 -0
  202. clearskies/input_outputs/headers.py +45 -0
  203. clearskies/input_outputs/input_output.py +138 -0
  204. clearskies/input_outputs/programmatic.py +69 -0
  205. clearskies/input_outputs/py.typed +0 -0
  206. clearskies/input_outputs/wsgi.py +77 -0
  207. clearskies/model.py +1922 -0
  208. clearskies/py.typed +0 -0
  209. clearskies/query/__init__.py +12 -0
  210. clearskies/query/condition.py +223 -0
  211. clearskies/query/join.py +136 -0
  212. clearskies/query/query.py +196 -0
  213. clearskies/query/sort.py +27 -0
  214. clearskies/schema.py +82 -0
  215. clearskies/secrets/__init__.py +6 -0
  216. clearskies/secrets/additional_configs/__init__.py +32 -0
  217. clearskies/secrets/additional_configs/mysql_connection_dynamic_producer.py +61 -0
  218. clearskies/secrets/additional_configs/mysql_connection_dynamic_producer_via_ssh_cert_bastion.py +160 -0
  219. clearskies/secrets/akeyless.py +182 -0
  220. clearskies/secrets/exceptions/__init__.py +1 -0
  221. clearskies/secrets/exceptions/not_found.py +2 -0
  222. clearskies/secrets/secrets.py +38 -0
  223. clearskies/security_header.py +15 -0
  224. clearskies/security_headers/__init__.py +11 -0
  225. clearskies/security_headers/cache_control.py +67 -0
  226. clearskies/security_headers/cors.py +50 -0
  227. clearskies/security_headers/csp.py +94 -0
  228. clearskies/security_headers/hsts.py +22 -0
  229. clearskies/security_headers/x_content_type_options.py +0 -0
  230. clearskies/security_headers/x_frame_options.py +0 -0
  231. clearskies/test_base.py +8 -0
  232. clearskies/typing.py +11 -0
  233. clearskies/validator.py +37 -0
  234. clearskies/validators/__init__.py +33 -0
  235. clearskies/validators/after_column.py +62 -0
  236. clearskies/validators/before_column.py +13 -0
  237. clearskies/validators/in_the_future.py +32 -0
  238. clearskies/validators/in_the_future_at_least.py +11 -0
  239. clearskies/validators/in_the_future_at_most.py +10 -0
  240. clearskies/validators/in_the_past.py +32 -0
  241. clearskies/validators/in_the_past_at_least.py +10 -0
  242. clearskies/validators/in_the_past_at_most.py +10 -0
  243. clearskies/validators/maximum_length.py +26 -0
  244. clearskies/validators/maximum_value.py +29 -0
  245. clearskies/validators/minimum_length.py +26 -0
  246. clearskies/validators/minimum_value.py +29 -0
  247. clearskies/validators/required.py +34 -0
  248. clearskies/validators/timedelta.py +59 -0
  249. clearskies/validators/unique.py +30 -0
  250. clear_skies-2.0.5.dist-info/RECORD +0 -4
  251. {clear_skies-2.0.5.dist-info → clear_skies-2.0.6.dist-info}/WHEEL +0 -0
  252. {clear_skies-2.0.5.dist-info → clear_skies-2.0.6.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,82 @@
1
+ import datetime
2
+ from types import ModuleType
3
+ from typing import Any, Callable
4
+ from wsgiref.simple_server import make_server
5
+ from wsgiref.util import setup_testing_defaults
6
+
7
+ import clearskies.endpoint
8
+ import clearskies.endpoint_group
9
+ from clearskies.contexts.context import Context
10
+ from clearskies.di import AdditionalConfig
11
+ from clearskies.input_outputs import Wsgi as WsgiInputOutput
12
+
13
+
14
+ class WsgiRef(Context):
15
+ """
16
+ Use a built in WSGI server (for development purposes only).
17
+
18
+ This context will launch a built-in HTTP server for you, so you can run applications locally
19
+ without having to install extra dependencies. Note that this server is not intended for production
20
+ usage, so this is best used for simple tests/demonstration purposes. Unlike the WSGI context, where
21
+ you define the application handler and invoke the context from inside of it (passing along the
22
+ environment and start_response variables), in this case you simply directly invoke the context to
23
+ launch the server. The default port is 8080:
24
+
25
+ ```
26
+ #!/usr/bin/env python
27
+ import clearskies
28
+
29
+ def hello_world(name):
30
+ return f"Hello {name}!"
31
+
32
+ wsgi = clearskies.contexts.WsgiRef(
33
+ clearskies.endpoints.Callable(
34
+ hello_world,
35
+ url="/hello/:name",
36
+ )
37
+ )
38
+ wsgi()
39
+ ```
40
+
41
+ And to invoke it:
42
+
43
+ ```
44
+ curl 'http://localhost:8080/hello/Friend'
45
+ ```
46
+ """
47
+
48
+ port: int = 8080
49
+
50
+ def __init__(
51
+ self,
52
+ application: Callable | clearskies.endpoint.Endpoint | clearskies.endpoint_group.EndpointGroup,
53
+ port: int = 8080,
54
+ classes: type | list[type] = [],
55
+ modules: ModuleType | list[ModuleType] = [],
56
+ bindings: dict[str, Any] = {},
57
+ additional_configs: AdditionalConfig | list[AdditionalConfig] = [],
58
+ class_overrides: dict[type, type] = {},
59
+ overrides: dict[str, type] = {},
60
+ now: datetime.datetime | None = None,
61
+ utcnow: datetime.datetime | None = None,
62
+ ):
63
+ super().__init__(
64
+ application,
65
+ classes=classes,
66
+ modules=modules,
67
+ bindings=bindings,
68
+ additional_configs=additional_configs,
69
+ class_overrides=class_overrides,
70
+ overrides=overrides,
71
+ now=now,
72
+ utcnow=utcnow,
73
+ )
74
+ self.port = port
75
+
76
+ def __call__(self): # type: ignore
77
+ with make_server("", self.port, self.handler) as httpd:
78
+ print(f"Starting WSGI server on port {self.port}. This is NOT intended for production usage.")
79
+ httpd.serve_forever()
80
+
81
+ def handler(self, environment, start_response):
82
+ return self.execute_application(WsgiInputOutput(environment, start_response))
@@ -0,0 +1,33 @@
1
+ from __future__ import annotations
2
+
3
+ import inspect
4
+
5
+ import wrapt # type: ignore
6
+
7
+
8
+ @wrapt.decorator
9
+ def parameters_to_properties(wrapped, instance, args, kwargs):
10
+ if not instance:
11
+ raise ValueError(
12
+ "The parameters_to_properties decorator only works for methods in classes, not plain functions"
13
+ )
14
+
15
+ if args:
16
+ wrapped_args = inspect.getfullargspec(wrapped)
17
+ for key, value in zip(wrapped_args.args[1:], args):
18
+ # if it's a dictionary or a list then copy it to avoid linking data
19
+ if isinstance(value, dict):
20
+ value = {**value}
21
+ if isinstance(value, list):
22
+ value = [*value]
23
+ setattr(instance, key, value)
24
+
25
+ for key, value in kwargs.items():
26
+ # if it's a dictionary or a list then copy it to avoid linking data
27
+ if isinstance(value, dict):
28
+ value = {**value}
29
+ if isinstance(value, list):
30
+ value = [*value]
31
+ setattr(instance, key, value)
32
+
33
+ wrapped(*args, **kwargs)
@@ -0,0 +1,14 @@
1
+ import clearskies.di.inject as inject
2
+ from clearskies.di.additional_config import AdditionalConfig
3
+ from clearskies.di.additional_config_auto_import import AdditionalConfigAutoImport
4
+ from clearskies.di.di import Di
5
+ from clearskies.di.injectable import Injectable
6
+ from clearskies.di.injectable_properties import InjectableProperties
7
+
8
+ __all__ = [
9
+ "AdditionalConfig",
10
+ "AdditionalConfigAutoImport",
11
+ "Di",
12
+ "InjectableProperties",
13
+ "injectInjectable",
14
+ ]
@@ -0,0 +1,130 @@
1
+ from typing import Any
2
+
3
+
4
+ class AdditionalConfig:
5
+ """
6
+ This class allows you to add additional names to the Di container.
7
+
8
+ The idea here is that you extend the AdditonalConfig class and attach as many
9
+ `provide_*` methods to the class as you want. This allows the developer to declare a number of
10
+ dependencies and easily attach them to the Di container in one go - helpful for modules that
11
+ come with a variety of things that they want to make available to developers.
12
+
13
+ When an AdditionalConfig instance is attached to the Di container, the container (in essence) finds all the
14
+ `provide_*` methods in the class and registers the corresponding name in the Di container - e.g. if you have
15
+ a method called `provide_widget` then when a class or function requests an argument named `widget`
16
+ from the Di container, the container will call the `provide_widget` method on your instance and pass along
17
+ the return value to the thing that requested a `widget`. The `provide_*` methods can declare their own
18
+ dependencies, including ones declared in the same `AdditionalConfig` class (they just can't be circular, of course).
19
+
20
+ As always, keep in mind the priority of dependency injection names (see the `clearskies.di.Di` class for full
21
+ details). If two `AdditionalConfig` objects declare a `provide_*` method with the same name, then the Di
22
+ system will call the method for the `AdditionalConfig` object that was added last.
23
+
24
+ By default the Di system caches all values. If you have a dependency that shouldn't be cached, you can
25
+ extend the `can_cache` method and have it return True/False depending on the name and context.
26
+
27
+ Example:
28
+ ```python
29
+ from clearskies.di import Di, AdditionalConfig
30
+
31
+
32
+ class MyAdditionalConfig(AdditionalConfig):
33
+ def provide_inner_dependency(self):
34
+ return 5
35
+
36
+ def provide_important_thing(self, inner_dependency):
37
+ return inner_dependency * 10
38
+
39
+
40
+ class AnotherAdditionalConfig(AdditionalConfig):
41
+ def provide_inner_dependency(self):
42
+ return 10
43
+
44
+
45
+ di = Di(additional_configs=[MyAdditionalConfig(), AnotherAdditionalConfig()])
46
+ # Equivalent:
47
+ # di = Di()
48
+ # di.add_addtional_configs([MyAdditionalConfig(), AnotherAdditionalConfig()])
49
+
50
+
51
+ def my_function(important_thing):
52
+ print(important_thing) # prints 100
53
+ ```
54
+ """
55
+
56
+ def can_cache(self, name: str, di, context: str) -> bool:
57
+ """
58
+ Cache control.
59
+
60
+ The Di container caches values by default, but this method allows you to override that.
61
+ After fetching an object from the AdditionalConfig class, the Di container will call this method to
62
+ determine whether or not to cache it. `name` will be the name of the Di value that was built, and
63
+ context will be the name of the class that the value was built for. You then return True/False.
64
+
65
+ Note that this controls whether or not to cache the returned value, not whether or not to check the
66
+ cache for a value. The importance is that, once there is a value in the cache, that will be reused
67
+ for all future requests for that name. Example:
68
+
69
+ ```python
70
+ from clearskies.di import Di, AdditionalConfig
71
+ import secrets
72
+
73
+
74
+ class MyAdditionalConfig(AdditionalConfig):
75
+ def provide_random_number_not_cached(self):
76
+ return secrets.randbelow(100)
77
+
78
+ def provide_random_number_cached(self):
79
+ return secrets.randbelow(100)
80
+
81
+ def can_cache(self, name, context=None):
82
+ return name == "random_number_not_cached"
83
+
84
+
85
+ di = Di(additional_configs=MyAdditionalConfig())
86
+
87
+
88
+ def my_function(random_number_cached, random_number_not_cached):
89
+ print(random_number_cached)
90
+ print(random_number_not_cached)
91
+
92
+
93
+ di.call_function(my_function)
94
+ di.call_function(my_function)
95
+ di.call_function(my_function)
96
+ di.call_function(my_function)
97
+
98
+ # This prints something like:
99
+ # 58
100
+ # 12
101
+ # 58
102
+ # 14
103
+ # 58
104
+ # 41
105
+ ```
106
+ """
107
+ return True
108
+
109
+ def can_build(self, name):
110
+ return hasattr(self, f"provide_{name}")
111
+
112
+ def build(self, name, di, context=None):
113
+ if not hasattr(self, f"provide_{name}"):
114
+ raise KeyError(
115
+ f"AdditionalConfig class '{self.__class__.__name__}' cannot build requested dependency, '{name}'"
116
+ )
117
+
118
+ return di.call_function(getattr(self, f"provide_{name}"))
119
+
120
+ def can_build_class(self, class_to_check: type) -> bool:
121
+ """Return True/False to denote if this AdditionalConfig class can provide a given class."""
122
+ return False
123
+
124
+ def build_class(self, class_to_provide: type, argument_name: str, di, context: str = "") -> Any:
125
+ """Return the desired instance of a given class."""
126
+ pass
127
+
128
+ def can_cache_class(self, class_to_build: type, di, context: str) -> bool:
129
+ """Control whether or not the Di container caches the instance after building a class."""
130
+ return False
@@ -0,0 +1,17 @@
1
+ from .additional_config import AdditionalConfig
2
+
3
+
4
+ class AdditionalConfigAutoImport(AdditionalConfig):
5
+ """
6
+ AdditionalConfig, but now with auto import.
7
+
8
+ This works exactly like the AdditionalConfig class, but will be automatically imported into the Di
9
+ container if found in a module being imported into the Di container. This just provides a way for
10
+ modules to easily inject names into the Di system. In order to be found, an imported module
11
+ just needs to make sure that it imports the class that extends the AdditionalConfigAutoImport class.
12
+
13
+ Note that automatically-imported AdditionalConfig classes automatically have lower priority than
14
+ any AdditionalConfig classes added explicitly to the Di container.
15
+ """
16
+
17
+ pass