|
1 | 1 | import hashlib
|
2 | 2 | import json
|
3 |
| -import os |
4 | 3 | import re
|
5 | 4 | from collections import defaultdict
|
6 | 5 | from datetime import datetime
|
@@ -34,16 +33,16 @@ class Arca:
|
34 | 33 |
|
35 | 34 | RUNNER = Path(__file__).parent.resolve() / "_runner.py"
|
36 | 35 |
|
37 |
| - base_dir: str = LazySettingProperty(key="base_dir", default=".arca") |
38 |
| - single_pull: bool = LazySettingProperty(key="single_pull", default=False, convert=bool) |
39 |
| - ignore_cache_errors: bool = LazySettingProperty(key="ignore_cache_errors", default=False, convert=bool) |
| 36 | + base_dir: str = LazySettingProperty(default=".arca") |
| 37 | + single_pull: bool = LazySettingProperty(default=False, convert=bool) |
| 38 | + ignore_cache_errors: bool = LazySettingProperty(default=False, convert=bool) |
40 | 39 |
|
41 | 40 | def __init__(self, backend: BackendDefinitionType=NOT_SET,
|
42 | 41 | settings=None,
|
43 | 42 | single_pull=None,
|
44 | 43 | base_dir=None,
|
45 | 44 | ignore_cache_errors=None) -> None:
|
46 |
| - self.settings: Settings = self._get_settings(settings) |
| 45 | + self.settings: Settings = Settings(settings) |
47 | 46 |
|
48 | 47 | if ignore_cache_errors is not None:
|
49 | 48 | self.ignore_cache_errors = bool(ignore_cache_errors)
|
@@ -80,22 +79,6 @@ def get_backend_instance(self, backend: BackendDefinitionType) -> BaseBackend:
|
80 | 79 |
|
81 | 80 | return backend
|
82 | 81 |
|
83 |
| - def _get_settings(self, settings: Optional[Dict[str, Any]]) -> Settings: |
84 |
| - """ |
85 |
| - Returns a initialized a :class:`arca.utils.Settings` instance, |
86 |
| - from the provided dictionary and from environment variables |
87 |
| - """ |
88 |
| - if settings is not None: |
89 |
| - _settings = Settings(settings) |
90 |
| - else: |
91 |
| - _settings = Settings() |
92 |
| - |
93 |
| - for key, val in os.environ.items(): |
94 |
| - if key.startswith(Settings.PREFIX): |
95 |
| - _settings.set(key, val) |
96 |
| - |
97 |
| - return _settings |
98 |
| - |
99 | 82 | def make_region(self) -> CacheRegion:
|
100 | 83 | """
|
101 | 84 | Returns a :class:`CacheRegion <dogpile.cache.region.CacheRegion>` based on settings.
|
|
0 commit comments