|
8 | 8 |
|
9 | 9 | from cognite.client._version import __api_subversion__ |
10 | 10 | from cognite.client.credentials import CredentialProvider |
11 | | -from cognite.client.utils._auxiliary import is_finite, is_positive, load_resource_to_dict |
| 11 | +from cognite.client.utils._auxiliary import is_non_negative_int, is_positive_int, load_resource_to_dict |
12 | 12 | from cognite.client.utils._concurrency import ConcurrencySettings |
13 | 13 | from cognite.client.utils._importing import local_import |
14 | 14 |
|
@@ -78,21 +78,21 @@ def __init__(self) -> None: |
78 | 78 | self.file_upload_chunk_size: int | None = None |
79 | 79 | self.silence_feature_preview_warnings: bool = False |
80 | 80 |
|
81 | | - def __setattr__(self, name: str, value: Any) -> None: |
| 81 | + def __setattr__(self, name: str, val: Any) -> None: |
82 | 82 | # Why __setattr__ instead of just more use of @property? It is to avoid breaking a bunch of existing |
83 | 83 | # inspection code (which would then need special handling). Setting global config options is a rare |
84 | 84 | # one-off type event, so overhead is no issue. |
85 | 85 | match name: |
86 | | - case "max_retries" | "max_retries_connect" | "max_retry_backoff" if not is_finite(value): |
87 | | - raise ValueError(f"{name} must be a non-negative integer, got {value!r}") |
| 86 | + case "max_retries" | "max_retries_connect" | "max_retry_backoff" if not is_non_negative_int(val): |
| 87 | + raise ValueError(f"{name} must be a non-negative integer, got {val!r}") |
88 | 88 |
|
89 | | - case "max_connection_pool_size" if not is_positive(value): |
90 | | - raise ValueError(f"max_connection_pool_size must be a positive integer, got {value!r}") |
| 89 | + case "max_connection_pool_size" if not is_positive_int(val): |
| 90 | + raise ValueError(f"max_connection_pool_size must be a positive integer, got {val!r}") |
91 | 91 |
|
92 | | - case "file_download_chunk_size" | "file_upload_chunk_size" if value is not None and not is_positive(value): |
93 | | - raise ValueError(f"{name} must be a positive integer or None, got {value!r}") |
| 92 | + case "file_download_chunk_size" | "file_upload_chunk_size" if val is not None and not is_positive_int(val): |
| 93 | + raise ValueError(f"{name} must be a positive integer or None, got {val!r}") |
94 | 94 |
|
95 | | - super().__setattr__(name, value) |
| 95 | + super().__setattr__(name, val) |
96 | 96 |
|
97 | 97 | @property |
98 | 98 | def max_workers(self) -> int: |
@@ -219,7 +219,9 @@ def __init__( |
219 | 219 | self.timeout = timeout or 60 |
220 | 220 | self.file_transfer_timeout = file_transfer_timeout or 600 |
221 | 221 | if debug: |
222 | | - self.debug = True |
| 222 | + from cognite.client.utils._logging import _configure_logger_for_debug_mode |
| 223 | + |
| 224 | + _configure_logger_for_debug_mode() |
223 | 225 | self._validate_config() |
224 | 226 |
|
225 | 227 | if not global_config.disable_pypi_version_check: |
|
0 commit comments