cmsdials 1.6.0__tar.gz → 1.7.1__tar.gz
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.
- {cmsdials-1.6.0 → cmsdials-1.7.1}/PKG-INFO +59 -6
- {cmsdials-1.6.0 → cmsdials-1.7.1}/README.md +56 -2
- cmsdials-1.7.1/cmsdials/_version.py +1 -0
- {cmsdials-1.6.0 → cmsdials-1.7.1}/cmsdials/auth/bearer.py +8 -6
- {cmsdials-1.6.0 → cmsdials-1.7.1}/cmsdials/clients/oms_proxy/client.py +10 -4
- {cmsdials-1.6.0 → cmsdials-1.7.1}/cmsdials/utils/api_client.py +7 -7
- {cmsdials-1.6.0 → cmsdials-1.7.1}/cmsdials/utils/base_model.py +1 -1
- {cmsdials-1.6.0 → cmsdials-1.7.1}/pyproject.toml +15 -4
- cmsdials-1.6.0/cmsdials/_version.py +0 -1
- {cmsdials-1.6.0 → cmsdials-1.7.1}/LICENSE +0 -0
- {cmsdials-1.6.0 → cmsdials-1.7.1}/cmsdials/__init__.py +0 -0
- {cmsdials-1.6.0 → cmsdials-1.7.1}/cmsdials/auth/__init__.py +0 -0
- {cmsdials-1.6.0 → cmsdials-1.7.1}/cmsdials/auth/_base.py +0 -0
- {cmsdials-1.6.0 → cmsdials-1.7.1}/cmsdials/auth/client.py +0 -0
- {cmsdials-1.6.0 → cmsdials-1.7.1}/cmsdials/auth/exceptions.py +0 -0
- {cmsdials-1.6.0 → cmsdials-1.7.1}/cmsdials/auth/models.py +0 -0
- {cmsdials-1.6.0 → cmsdials-1.7.1}/cmsdials/auth/secret_key.py +0 -0
- {cmsdials-1.6.0 → cmsdials-1.7.1}/cmsdials/clients/__init__.py +0 -0
- {cmsdials-1.6.0 → cmsdials-1.7.1}/cmsdials/clients/dataset_index/__init__.py +0 -0
- {cmsdials-1.6.0 → cmsdials-1.7.1}/cmsdials/clients/dataset_index/client.py +0 -0
- {cmsdials-1.6.0 → cmsdials-1.7.1}/cmsdials/clients/dataset_index/models.py +0 -0
- {cmsdials-1.6.0 → cmsdials-1.7.1}/cmsdials/clients/file_index/__init__.py +0 -0
- {cmsdials-1.6.0 → cmsdials-1.7.1}/cmsdials/clients/file_index/client.py +0 -0
- {cmsdials-1.6.0 → cmsdials-1.7.1}/cmsdials/clients/file_index/models.py +0 -0
- {cmsdials-1.6.0 → cmsdials-1.7.1}/cmsdials/clients/h1d/__init__.py +0 -0
- {cmsdials-1.6.0 → cmsdials-1.7.1}/cmsdials/clients/h1d/client.py +0 -0
- {cmsdials-1.6.0 → cmsdials-1.7.1}/cmsdials/clients/h1d/models.py +0 -0
- {cmsdials-1.6.0 → cmsdials-1.7.1}/cmsdials/clients/h2d/__init__.py +0 -0
- {cmsdials-1.6.0 → cmsdials-1.7.1}/cmsdials/clients/h2d/client.py +0 -0
- {cmsdials-1.6.0 → cmsdials-1.7.1}/cmsdials/clients/h2d/models.py +0 -0
- {cmsdials-1.6.0 → cmsdials-1.7.1}/cmsdials/clients/lumisection/__init__.py +0 -0
- {cmsdials-1.6.0 → cmsdials-1.7.1}/cmsdials/clients/lumisection/client.py +0 -0
- {cmsdials-1.6.0 → cmsdials-1.7.1}/cmsdials/clients/lumisection/models.py +0 -0
- {cmsdials-1.6.0 → cmsdials-1.7.1}/cmsdials/clients/mes/__init__.py +0 -0
- {cmsdials-1.6.0 → cmsdials-1.7.1}/cmsdials/clients/mes/client.py +0 -0
- {cmsdials-1.6.0 → cmsdials-1.7.1}/cmsdials/clients/mes/models.py +0 -0
- {cmsdials-1.6.0 → cmsdials-1.7.1}/cmsdials/clients/ml_bad_lumisection/__init__.py +0 -0
- {cmsdials-1.6.0 → cmsdials-1.7.1}/cmsdials/clients/ml_bad_lumisection/client.py +0 -0
- {cmsdials-1.6.0 → cmsdials-1.7.1}/cmsdials/clients/ml_bad_lumisection/models.py +0 -0
- {cmsdials-1.6.0 → cmsdials-1.7.1}/cmsdials/clients/ml_models_index/__init__.py +0 -0
- {cmsdials-1.6.0 → cmsdials-1.7.1}/cmsdials/clients/ml_models_index/client.py +0 -0
- {cmsdials-1.6.0 → cmsdials-1.7.1}/cmsdials/clients/ml_models_index/models.py +0 -0
- {cmsdials-1.6.0 → cmsdials-1.7.1}/cmsdials/clients/oms_proxy/__init__.py +0 -0
- {cmsdials-1.6.0 → cmsdials-1.7.1}/cmsdials/clients/oms_proxy/models.py +0 -0
- {cmsdials-1.6.0 → cmsdials-1.7.1}/cmsdials/clients/run/__init__.py +0 -0
- {cmsdials-1.6.0 → cmsdials-1.7.1}/cmsdials/clients/run/client.py +0 -0
- {cmsdials-1.6.0 → cmsdials-1.7.1}/cmsdials/clients/run/models.py +0 -0
- {cmsdials-1.6.0 → cmsdials-1.7.1}/cmsdials/cmsdials.py +0 -0
- {cmsdials-1.6.0 → cmsdials-1.7.1}/cmsdials/filters.py +0 -0
- {cmsdials-1.6.0 → cmsdials-1.7.1}/cmsdials/utils/__init__.py +0 -0
- {cmsdials-1.6.0 → cmsdials-1.7.1}/cmsdials/utils/_json.py +0 -0
- {cmsdials-1.6.0 → cmsdials-1.7.1}/cmsdials/utils/logger.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: cmsdials
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.7.1
|
|
4
4
|
Summary: The Python api client interface to DIALS service
|
|
5
5
|
Home-page: https://github.com/cms-DQM/dials-py
|
|
6
6
|
Author: Gabriel Moreira
|
|
@@ -18,14 +18,17 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
|
18
18
|
Provides-Extra: pandas
|
|
19
19
|
Provides-Extra: tqdm
|
|
20
20
|
Requires-Dist: pandas (>=1.5.3) ; extra == "pandas"
|
|
21
|
-
Requires-Dist: pydantic (>=
|
|
21
|
+
Requires-Dist: pydantic (>=2.8.2,<3.0.0)
|
|
22
22
|
Requires-Dist: requests (>=2.31.0,<3.0.0)
|
|
23
23
|
Requires-Dist: tqdm (>=4.66.1) ; extra == "tqdm"
|
|
24
|
-
Requires-Dist:
|
|
25
|
-
Requires-Dist: urllib3 (>=2.2.3,<3.0.0)
|
|
24
|
+
Requires-Dist: urllib3 (>=1.26.16,<2.0.0)
|
|
26
25
|
Project-URL: Repository, https://github.com/cms-DQM/dials-py
|
|
27
26
|
Description-Content-Type: text/markdown
|
|
28
27
|
|
|
28
|
+

|
|
29
|
+

|
|
30
|
+
[](https://badge.fury.io/py/cmsdials)
|
|
31
|
+
|
|
29
32
|
# dials-py
|
|
30
33
|
|
|
31
34
|
The Python api client interface to DIALS service.
|
|
@@ -322,7 +325,7 @@ dials.h2d.list_all(LumisectionHistogram2DFilters(me__regex="EEOT digi occupancy
|
|
|
322
325
|
The repository has some tests written to make sure DIALS responses are compatible with pydantic metaclasses, you can use pytest to run all tests but you need to specify a secret key to authenticate non-interactively against DIALS api:
|
|
323
326
|
|
|
324
327
|
```bash
|
|
325
|
-
SECRET_KEY=... pytest tests
|
|
328
|
+
SECRET_KEY=... pytest tests --cov=cmsdials --cov-report=xml --cov-report=term --cov-report=html
|
|
326
329
|
```
|
|
327
330
|
|
|
328
331
|
The secret key is an api client enabled secret key and can be obtained from the applications portal, any api client secret key whitelisted in DIALS can be used. The interactive authentication flow should be tested manually, an example for this can be found in [this line](/tests/integration/test_auth_client.py#L33).
|
|
@@ -330,6 +333,56 @@ The secret key is an api client enabled secret key and can be obtained from the
|
|
|
330
333
|
If testing against a local version of DIALS you need to specify the BASE_URL:
|
|
331
334
|
|
|
332
335
|
```bash
|
|
333
|
-
SECRET_KEY=...
|
|
336
|
+
SECRET_KEY=... BASE_URL=http://localhost:8000 pytest tests --cov=cmsdials --cov-report=xml --cov-report=term --cov-report=html
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
### Tox
|
|
340
|
+
|
|
341
|
+
Tox is pre-configured in `pyproject.toml`, so you can run the following to test against multiple python versions locally:
|
|
342
|
+
|
|
343
|
+
```bash
|
|
344
|
+
SECRET_KEY=... poetry run tox
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
**[asdf](https://asdf-vm.com/) users**
|
|
348
|
+
|
|
349
|
+
tox requires multiple versions of Python to be installed. Using `asdf`, you have multiple versions installed, but they aren’t normally exposed to the current shell. You can use the following command to expose multiple versions of Python in the current directory:
|
|
350
|
+
|
|
351
|
+
```bash
|
|
352
|
+
asdf set python 3.12.9 3.11.10 3.10.13 3.9.19
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
This will use `3.12.9` by default (if you just run `python`), but it will also put `python3.11`, `python3.10` and `python3.9` symlinks in your path so you can run those too (which is exactly what tox is looking for).
|
|
356
|
+
|
|
357
|
+
## Releasing the package on PyPI
|
|
358
|
+
|
|
359
|
+
### Build
|
|
360
|
+
|
|
361
|
+
You can use poetry to build the package using:
|
|
362
|
+
|
|
363
|
+
```bash
|
|
364
|
+
poetry build
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
The build system requires `poetry-dynamic-versioning` plugin installed to update the package version during build time. To install this plugin simply:
|
|
368
|
+
|
|
369
|
+
```
|
|
370
|
+
poetry self add "poetry-dynamic-versioning[plugin]"
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
The build system will automatically update the package version based on the git tag of the current commit.
|
|
374
|
+
|
|
375
|
+
### Publish
|
|
376
|
+
|
|
377
|
+
To publish the package will need maintainer rights to the `cmsdials` page in PyPI and configure your poetry installation to publish with a PyPI api token. Provided you have already generate a PyPI api token in your account you can configure your poetry installation using:
|
|
378
|
+
|
|
379
|
+
```
|
|
380
|
+
poetry config pypi-token.pypi <your-api-token>
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
Then, to build and publish in one go you can do:
|
|
384
|
+
|
|
385
|
+
```bash
|
|
386
|
+
poetry publish --build
|
|
334
387
|
```
|
|
335
388
|
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+

|
|
2
|
+

|
|
3
|
+
[](https://badge.fury.io/py/cmsdials)
|
|
4
|
+
|
|
1
5
|
# dials-py
|
|
2
6
|
|
|
3
7
|
The Python api client interface to DIALS service.
|
|
@@ -294,7 +298,7 @@ dials.h2d.list_all(LumisectionHistogram2DFilters(me__regex="EEOT digi occupancy
|
|
|
294
298
|
The repository has some tests written to make sure DIALS responses are compatible with pydantic metaclasses, you can use pytest to run all tests but you need to specify a secret key to authenticate non-interactively against DIALS api:
|
|
295
299
|
|
|
296
300
|
```bash
|
|
297
|
-
SECRET_KEY=... pytest tests
|
|
301
|
+
SECRET_KEY=... pytest tests --cov=cmsdials --cov-report=xml --cov-report=term --cov-report=html
|
|
298
302
|
```
|
|
299
303
|
|
|
300
304
|
The secret key is an api client enabled secret key and can be obtained from the applications portal, any api client secret key whitelisted in DIALS can be used. The interactive authentication flow should be tested manually, an example for this can be found in [this line](/tests/integration/test_auth_client.py#L33).
|
|
@@ -302,5 +306,55 @@ The secret key is an api client enabled secret key and can be obtained from the
|
|
|
302
306
|
If testing against a local version of DIALS you need to specify the BASE_URL:
|
|
303
307
|
|
|
304
308
|
```bash
|
|
305
|
-
SECRET_KEY=...
|
|
309
|
+
SECRET_KEY=... BASE_URL=http://localhost:8000 pytest tests --cov=cmsdials --cov-report=xml --cov-report=term --cov-report=html
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
### Tox
|
|
313
|
+
|
|
314
|
+
Tox is pre-configured in `pyproject.toml`, so you can run the following to test against multiple python versions locally:
|
|
315
|
+
|
|
316
|
+
```bash
|
|
317
|
+
SECRET_KEY=... poetry run tox
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
**[asdf](https://asdf-vm.com/) users**
|
|
321
|
+
|
|
322
|
+
tox requires multiple versions of Python to be installed. Using `asdf`, you have multiple versions installed, but they aren’t normally exposed to the current shell. You can use the following command to expose multiple versions of Python in the current directory:
|
|
323
|
+
|
|
324
|
+
```bash
|
|
325
|
+
asdf set python 3.12.9 3.11.10 3.10.13 3.9.19
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
This will use `3.12.9` by default (if you just run `python`), but it will also put `python3.11`, `python3.10` and `python3.9` symlinks in your path so you can run those too (which is exactly what tox is looking for).
|
|
329
|
+
|
|
330
|
+
## Releasing the package on PyPI
|
|
331
|
+
|
|
332
|
+
### Build
|
|
333
|
+
|
|
334
|
+
You can use poetry to build the package using:
|
|
335
|
+
|
|
336
|
+
```bash
|
|
337
|
+
poetry build
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
The build system requires `poetry-dynamic-versioning` plugin installed to update the package version during build time. To install this plugin simply:
|
|
341
|
+
|
|
342
|
+
```
|
|
343
|
+
poetry self add "poetry-dynamic-versioning[plugin]"
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
The build system will automatically update the package version based on the git tag of the current commit.
|
|
347
|
+
|
|
348
|
+
### Publish
|
|
349
|
+
|
|
350
|
+
To publish the package will need maintainer rights to the `cmsdials` page in PyPI and configure your poetry installation to publish with a PyPI api token. Provided you have already generate a PyPI api token in your account you can configure your poetry installation using:
|
|
351
|
+
|
|
352
|
+
```
|
|
353
|
+
poetry config pypi-token.pypi <your-api-token>
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
Then, to build and publish in one go you can do:
|
|
357
|
+
|
|
358
|
+
```bash
|
|
359
|
+
poetry publish --build
|
|
306
360
|
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.7.1"
|
|
@@ -31,7 +31,7 @@ class Credentials(BaseCredentials):
|
|
|
31
31
|
refresh_expires_in: int,
|
|
32
32
|
refresh_token: str,
|
|
33
33
|
token_type: str,
|
|
34
|
-
cache_dir: str =
|
|
34
|
+
cache_dir: Optional[str] = None,
|
|
35
35
|
client: Optional[AuthClient] = None,
|
|
36
36
|
):
|
|
37
37
|
# Load parent class and overwrite token attributes
|
|
@@ -45,7 +45,7 @@ class Credentials(BaseCredentials):
|
|
|
45
45
|
self.token_type = token_type
|
|
46
46
|
|
|
47
47
|
# Setup dir for caching credentials and authentication client
|
|
48
|
-
self.cache_dir = cache_dir
|
|
48
|
+
self.cache_dir = cache_dir or DEFAULT_CACHE_DIR
|
|
49
49
|
self.client = client or AuthClient()
|
|
50
50
|
|
|
51
51
|
# If loaded token is expired, immediately refresh
|
|
@@ -75,7 +75,7 @@ class Credentials(BaseCredentials):
|
|
|
75
75
|
)
|
|
76
76
|
|
|
77
77
|
@staticmethod
|
|
78
|
-
def _handle_creds_filepath(cache_dir: str =
|
|
78
|
+
def _handle_creds_filepath(cache_dir: Optional[str] = None):
|
|
79
79
|
cache_dir = cache_dir or DEFAULT_CACHE_DIR
|
|
80
80
|
if os.path.isabs(cache_dir) is False:
|
|
81
81
|
cache_dir = os.path.join(os.getcwd(), cache_dir)
|
|
@@ -85,9 +85,10 @@ class Credentials(BaseCredentials):
|
|
|
85
85
|
|
|
86
86
|
@staticmethod
|
|
87
87
|
def from_authclient_token(
|
|
88
|
-
token: Token, cache_dir: str =
|
|
88
|
+
token: Token, cache_dir: Optional[str] = None, client: Optional[AuthClient] = None
|
|
89
89
|
) -> "Credentials":
|
|
90
90
|
client = client or AuthClient()
|
|
91
|
+
cache_dir = cache_dir or DEFAULT_CACHE_DIR
|
|
91
92
|
return Credentials(
|
|
92
93
|
token=token.access_token,
|
|
93
94
|
expires_in=token.expires_in,
|
|
@@ -101,8 +102,9 @@ class Credentials(BaseCredentials):
|
|
|
101
102
|
)
|
|
102
103
|
|
|
103
104
|
@staticmethod
|
|
104
|
-
def from_creds_file(cache_dir: str =
|
|
105
|
+
def from_creds_file(cache_dir: Optional[str] = None, client: Optional[AuthClient] = None) -> "Credentials":
|
|
105
106
|
client = client or AuthClient()
|
|
107
|
+
cache_dir = cache_dir or DEFAULT_CACHE_DIR
|
|
106
108
|
fpath = Credentials._handle_creds_filepath(cache_dir)
|
|
107
109
|
try:
|
|
108
110
|
with open(fpath) as filebuffer:
|
|
@@ -126,7 +128,7 @@ class Credentials(BaseCredentials):
|
|
|
126
128
|
def cache_credentials(self) -> None:
|
|
127
129
|
fpath = self._handle_creds_filepath(self.cache_dir)
|
|
128
130
|
with open(fpath, "w") as filebuffer:
|
|
129
|
-
json.dump(self._token.
|
|
131
|
+
json.dump(self._token.model_dump(), filebuffer, cls=TokenEncoder)
|
|
130
132
|
|
|
131
133
|
def refresh(self) -> None:
|
|
132
134
|
token: Token = self.client.refresh_token(self.token_type, self.token, self.refresh_token)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from typing import Optional
|
|
2
2
|
|
|
3
|
-
import requests
|
|
4
3
|
from requests.exceptions import HTTPError
|
|
4
|
+
from requests.adapters import DEFAULT_RETRIES
|
|
5
5
|
|
|
6
6
|
from ...auth._base import BaseCredentials
|
|
7
7
|
from ...utils.api_client import BaseAPIClient
|
|
@@ -24,13 +24,13 @@ class OMSProxyClient(BaseAPIClient):
|
|
|
24
24
|
|
|
25
25
|
def _build_headers(self) -> dict:
|
|
26
26
|
base = {
|
|
27
|
-
"
|
|
27
|
+
"Accept": "application/json",
|
|
28
28
|
"User-Agent": self._build_user_agent()
|
|
29
29
|
}
|
|
30
30
|
self.creds.before_request(base)
|
|
31
31
|
return base
|
|
32
32
|
|
|
33
|
-
def query(self, endpoint: str, filters: list[OMSFilter], pages: Optional[list[OMSPage]] = None):
|
|
33
|
+
def query(self, endpoint: str, filters: list[OMSFilter], pages: Optional[list[OMSPage]] = None, retries=DEFAULT_RETRIES):
|
|
34
34
|
headers = self._build_headers()
|
|
35
35
|
endpoint_url = self.api_url + self.lookup_url
|
|
36
36
|
|
|
@@ -39,7 +39,13 @@ class OMSProxyClient(BaseAPIClient):
|
|
|
39
39
|
pages = {f"page[{page.attribute_name}]": page.value for page in pages} if pages and len(pages) > 0 else {}
|
|
40
40
|
params = {"endpoint": endpoint, **filters, **pages}
|
|
41
41
|
|
|
42
|
-
response =
|
|
42
|
+
response = self._requests_get_retriable(
|
|
43
|
+
endpoint_url,
|
|
44
|
+
headers=headers,
|
|
45
|
+
params=params,
|
|
46
|
+
timeout=self.default_timeout,
|
|
47
|
+
retries=retries,
|
|
48
|
+
)
|
|
43
49
|
try:
|
|
44
50
|
response.raise_for_status()
|
|
45
51
|
except HTTPError as err:
|
|
@@ -2,10 +2,10 @@ import sys
|
|
|
2
2
|
from importlib import util as importlib_util
|
|
3
3
|
from traceback import format_exc
|
|
4
4
|
from typing import Optional
|
|
5
|
-
from urllib.parse import parse_qs, urlparse
|
|
6
5
|
from warnings import warn
|
|
7
6
|
|
|
8
7
|
import requests
|
|
8
|
+
from pydantic import AnyUrl
|
|
9
9
|
from requests import Response, Session
|
|
10
10
|
from requests.adapters import DEFAULT_RETRIES, HTTPAdapter
|
|
11
11
|
from requests.exceptions import HTTPError
|
|
@@ -85,7 +85,7 @@ class BaseAuthorizedAPIClient(BaseAPIClient):
|
|
|
85
85
|
|
|
86
86
|
def _build_headers(self) -> dict:
|
|
87
87
|
base = {
|
|
88
|
-
"
|
|
88
|
+
"Accept": "application/json",
|
|
89
89
|
"User-Agent": self._build_user_agent()
|
|
90
90
|
}
|
|
91
91
|
if self.workspace is not None:
|
|
@@ -150,13 +150,13 @@ class BaseAuthorizedAPIClient(BaseAPIClient):
|
|
|
150
150
|
keep_failed: bool = False,
|
|
151
151
|
resume_from=None,
|
|
152
152
|
):
|
|
153
|
-
next_string: Optional[
|
|
153
|
+
next_string: Optional[AnyUrl] = None
|
|
154
154
|
results = []
|
|
155
155
|
is_last_page = False
|
|
156
156
|
|
|
157
157
|
if resume_from is not None:
|
|
158
158
|
results = resume_from.results
|
|
159
|
-
next_string = resume_from.next
|
|
159
|
+
next_string: AnyUrl = resume_from.next
|
|
160
160
|
if next_string is None and len(results):
|
|
161
161
|
warn(
|
|
162
162
|
"resume_from.next is None while resume_from.result is not empty, doing nothing.",
|
|
@@ -172,8 +172,8 @@ class BaseAuthorizedAPIClient(BaseAPIClient):
|
|
|
172
172
|
progress = tqdm(desc="Progress", total=1)
|
|
173
173
|
|
|
174
174
|
while is_last_page is False:
|
|
175
|
-
next_token =
|
|
176
|
-
curr_filters = self.filter_class(**filters.
|
|
175
|
+
next_token = dict(next_string.query_params()).get("next_token") if next_string else None
|
|
176
|
+
curr_filters = self.filter_class(**filters.model_dump())
|
|
177
177
|
curr_filters.next_token = next_token
|
|
178
178
|
try:
|
|
179
179
|
response = self.list(curr_filters, retries=retries)
|
|
@@ -198,7 +198,7 @@ class BaseAuthorizedAPIClient(BaseAPIClient):
|
|
|
198
198
|
exc_formatted=exc_formatted,
|
|
199
199
|
)
|
|
200
200
|
results.extend(response.results)
|
|
201
|
-
next_string = response.next
|
|
201
|
+
next_string: AnyUrl = response.next
|
|
202
202
|
is_last_page = next_string is None
|
|
203
203
|
total_pages += 1
|
|
204
204
|
max_pages_reached = max_pages and total_pages >= max_pages
|
|
@@ -16,7 +16,7 @@ class OBaseModel(BaseModel):
|
|
|
16
16
|
def cleandict(self):
|
|
17
17
|
return {
|
|
18
18
|
key: ",".join(str(v) for v in value) if isinstance(value, (list, tuple)) else value
|
|
19
|
-
for key, value in self.
|
|
19
|
+
for key, value in self.model_dump().items()
|
|
20
20
|
if value is not None
|
|
21
21
|
}
|
|
22
22
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "cmsdials"
|
|
3
|
-
version = "1.
|
|
3
|
+
version = "1.7.1"
|
|
4
4
|
description = "The Python api client interface to DIALS service"
|
|
5
5
|
authors = ["Gabriel Moreira <gabrielmscampos@gmail.com>"]
|
|
6
6
|
readme = "README.md"
|
|
@@ -19,17 +19,18 @@ packages = [
|
|
|
19
19
|
[tool.poetry.dependencies]
|
|
20
20
|
python = "^3.9"
|
|
21
21
|
requests = "^2.31.0"
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
urllib3 = "^1.26.16"
|
|
23
|
+
pydantic = "^2.8.2"
|
|
24
24
|
pandas = {version = ">=1.5.3", optional = true}
|
|
25
25
|
tqdm = {version = ">=4.66.1", optional = true}
|
|
26
|
-
urllib3 = "^2.2.3"
|
|
27
26
|
|
|
28
27
|
[tool.poetry.group.dev.dependencies]
|
|
29
28
|
pre-commit = "^3.6.2"
|
|
30
29
|
ruff = "^0.4.2"
|
|
31
30
|
notebook = "^7.1.3"
|
|
32
31
|
pytest = "^8.2.0"
|
|
32
|
+
pytest-cov = "^6.0.0"
|
|
33
|
+
tox = "^4.24.1"
|
|
33
34
|
|
|
34
35
|
[tool.poetry.extras]
|
|
35
36
|
pandas = ["pandas"]
|
|
@@ -133,6 +134,16 @@ lines-after-imports = 2
|
|
|
133
134
|
[tool.poetry-dynamic-versioning]
|
|
134
135
|
enable = false
|
|
135
136
|
|
|
137
|
+
[tool.tox]
|
|
138
|
+
requires = ["tox>=4.24"]
|
|
139
|
+
env_list = ["py39", "py310", "py311", "py312"]
|
|
140
|
+
|
|
141
|
+
[tool.tox.env_run_base]
|
|
142
|
+
description = "Run test under {base_python}"
|
|
143
|
+
commands = [["pytest", "tests"]]
|
|
144
|
+
passenv = ["SECRET_KEY", "BASE_URL"]
|
|
145
|
+
allowlist_externals = ["pytest"]
|
|
146
|
+
|
|
136
147
|
[build-system]
|
|
137
148
|
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning>=1.0.0,<2.0.0"]
|
|
138
149
|
build-backend = "poetry_dynamic_versioning.backend"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "1.6.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|