diracx-client 0.0.1a18__py3-none-any.whl → 0.0.1a19__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- diracx/client/__init__.py +4 -18
- diracx/client/aio.py +1 -0
- diracx/client/extensions.py +90 -0
- diracx/client/{aio → generated}/__init__.py +2 -2
- diracx/client/{_client.py → generated/_client.py} +7 -6
- diracx/client/{_configuration.py → generated/_configuration.py} +1 -1
- diracx/client/generated/_patch.py +47 -0
- diracx/client/{_serialization.py → generated/_serialization.py} +301 -151
- diracx/client/{_vendor.py → generated/_vendor.py} +1 -1
- diracx/client/generated/aio/__init__.py +21 -0
- diracx/client/{aio → generated/aio}/_client.py +7 -6
- diracx/client/{aio → generated/aio}/_configuration.py +1 -1
- diracx/client/generated/aio/_patch.py +23 -0
- diracx/client/{aio → generated/aio}/_vendor.py +1 -1
- diracx/client/{aio → generated/aio}/operations/__init__.py +1 -1
- diracx/client/{aio → generated/aio}/operations/_operations.py +402 -385
- diracx/client/{models → generated/models}/__init__.py +3 -1
- diracx/client/{models → generated/models}/_enums.py +2 -2
- diracx/client/{models → generated/models}/_models.py +84 -43
- diracx/client/{operations → generated/operations}/__init__.py +1 -1
- diracx/client/{operations → generated/operations}/_operations.py +402 -385
- diracx/client/generated/py.typed +1 -0
- diracx/client/models.py +5 -0
- diracx/client/patches/__init__.py +19 -0
- diracx/client/patches/aio/__init__.py +18 -0
- diracx/client/{aio/_patch.py → patches/aio/utils.py} +10 -19
- diracx/client/{_patch.py → patches/utils.py} +98 -121
- {diracx_client-0.0.1a18.dist-info → diracx_client-0.0.1a19.dist-info}/METADATA +1 -1
- diracx_client-0.0.1a19.dist-info/RECORD +36 -0
- diracx_client-0.0.1a19.dist-info/entry_points.txt +3 -0
- diracx_client-0.0.1a18.dist-info/RECORD +0 -26
- /diracx/client/{aio → generated/aio}/operations/_patch.py +0 -0
- /diracx/client/{models → generated/models}/_patch.py +0 -0
- /diracx/client/{operations → generated/operations}/_patch.py +0 -0
- {diracx_client-0.0.1a18.dist-info → diracx_client-0.0.1a19.dist-info}/WHEEL +0 -0
- {diracx_client-0.0.1a18.dist-info → diracx_client-0.0.1a19.dist-info}/top_level.txt +0 -0
diracx/client/__init__.py
CHANGED
@@ -1,21 +1,7 @@
|
|
1
|
-
|
2
|
-
# --------------------------------------------------------------------------
|
3
|
-
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/python@6.13.19)
|
4
|
-
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
5
|
-
# --------------------------------------------------------------------------
|
1
|
+
from .extensions import initialize_client
|
6
2
|
|
7
|
-
|
3
|
+
initialize_client()
|
8
4
|
|
9
|
-
try:
|
10
|
-
from ._patch import __all__ as _patch_all
|
11
|
-
from ._patch import * # pylint: disable=unused-wildcard-import
|
12
|
-
except ImportError:
|
13
|
-
_patch_all = []
|
14
|
-
from ._patch import patch_sdk as _patch_sdk
|
15
5
|
|
16
|
-
|
17
|
-
|
18
|
-
]
|
19
|
-
__all__.extend([p for p in _patch_all if p not in __all__])
|
20
|
-
|
21
|
-
_patch_sdk()
|
6
|
+
from .generated import * # pylint: disable=unused-wildcard-import
|
7
|
+
from .patches import DiracClient
|
diracx/client/aio.py
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
from .patches.aio import DiracClient
|
@@ -0,0 +1,90 @@
|
|
1
|
+
import os
|
2
|
+
import sys
|
3
|
+
import importlib
|
4
|
+
|
5
|
+
from importlib.abc import MetaPathFinder
|
6
|
+
from importlib.machinery import SourceFileLoader, ModuleSpec
|
7
|
+
|
8
|
+
|
9
|
+
class DiracxLoader(SourceFileLoader):
|
10
|
+
|
11
|
+
def create_module(self, spec):
|
12
|
+
if spec.name in sys.modules:
|
13
|
+
return sys.modules[spec.name]
|
14
|
+
|
15
|
+
def exec_module(self, module): ...
|
16
|
+
|
17
|
+
|
18
|
+
class DiracxPathFinder(MetaPathFinder):
|
19
|
+
"""
|
20
|
+
This MetaPathFinder modifies the import such that the patches
|
21
|
+
from vanila diracx are looked at first.
|
22
|
+
"""
|
23
|
+
|
24
|
+
diracx_extensions = os.environ.get("DIRACX_EXTENSIONS", "diracx").split(",")
|
25
|
+
|
26
|
+
@classmethod
|
27
|
+
def find_spec(cls, fullname, path, target=None):
|
28
|
+
for i, extension in enumerate(cls.diracx_extensions, start=1):
|
29
|
+
# If we are trying to load the patch from an extension
|
30
|
+
# make sure it does not exist in the lower levels first
|
31
|
+
if any(
|
32
|
+
[
|
33
|
+
fullname.startswith(prefix)
|
34
|
+
for prefix in [
|
35
|
+
f"{extension}.client.generated.operations._patch",
|
36
|
+
f"{extension}.client.generated.models._patch",
|
37
|
+
f"{extension}.client.generated.aio.operations._patch",
|
38
|
+
]
|
39
|
+
]
|
40
|
+
):
|
41
|
+
for lower_extension in cls.diracx_extensions[i:][::-1]:
|
42
|
+
try:
|
43
|
+
patched_name = fullname.replace(extension, lower_extension)
|
44
|
+
overwritten = importlib.util.find_spec(patched_name)
|
45
|
+
|
46
|
+
spec = ModuleSpec(
|
47
|
+
patched_name, DiracxLoader(patched_name, path)
|
48
|
+
)
|
49
|
+
return spec
|
50
|
+
if patched_name in sys.modules:
|
51
|
+
return sys.modules[patched_name].__spec__
|
52
|
+
|
53
|
+
overwritten = importlib.util.find_spec(patched_name)
|
54
|
+
|
55
|
+
# overwritten = spec_from_loader(patched_name, DiracxLoader(filepath))
|
56
|
+
return overwritten
|
57
|
+
except Exception as e:
|
58
|
+
pass
|
59
|
+
|
60
|
+
return None
|
61
|
+
|
62
|
+
|
63
|
+
def initialize_client():
|
64
|
+
|
65
|
+
# insert a DiracxPathFinder instance at the start of the meta_path list
|
66
|
+
if not isinstance(sys.meta_path[0], DiracxPathFinder):
|
67
|
+
|
68
|
+
sys.meta_path.insert(0, DiracxPathFinder())
|
69
|
+
|
70
|
+
# Reload all the client module that could potentially have been
|
71
|
+
# already loaded
|
72
|
+
# This was needed when the generated code was at the top
|
73
|
+
# level of the module.
|
74
|
+
# In principle, this is not needed anymore so I comment it out,
|
75
|
+
# but in case it ends up being needed, I keep it there, as it is rather
|
76
|
+
# tricky
|
77
|
+
# importlib.invalidate_caches()
|
78
|
+
# diracx_extensions = os.environ.get("DIRACX_EXTENSIONS", "diracx").split(",")
|
79
|
+
# for top_module in diracx_extensions:
|
80
|
+
# for module_name, module in sys.modules.copy().items():
|
81
|
+
# if (
|
82
|
+
# (f"{top_module}.client" in module_name)
|
83
|
+
# and module_name
|
84
|
+
# not in (
|
85
|
+
# f"{top_module}.client.generated",
|
86
|
+
# f"{top_module}.client.generated._patch",
|
87
|
+
# )
|
88
|
+
# and "_patch" in module_name
|
89
|
+
# ):
|
90
|
+
# importlib.reload(module)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# coding=utf-8
|
2
2
|
# --------------------------------------------------------------------------
|
3
|
-
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.
|
3
|
+
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.0, generator: @autorest/python@6.23.0)
|
4
4
|
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
5
5
|
# --------------------------------------------------------------------------
|
6
6
|
|
@@ -9,7 +9,7 @@ from ._client import Dirac
|
|
9
9
|
try:
|
10
10
|
from ._patch import __all__ as _patch_all
|
11
11
|
from ._patch import * # pylint: disable=unused-wildcard-import
|
12
|
-
except
|
12
|
+
except ValueError:
|
13
13
|
_patch_all = []
|
14
14
|
from ._patch import patch_sdk as _patch_sdk
|
15
15
|
|
@@ -1,11 +1,12 @@
|
|
1
1
|
# coding=utf-8
|
2
2
|
# --------------------------------------------------------------------------
|
3
|
-
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.
|
3
|
+
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.0, generator: @autorest/python@6.23.0)
|
4
4
|
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
5
5
|
# --------------------------------------------------------------------------
|
6
6
|
|
7
7
|
from copy import deepcopy
|
8
8
|
from typing import Any
|
9
|
+
from typing_extensions import Self
|
9
10
|
|
10
11
|
from azure.core import PipelineClient
|
11
12
|
from azure.core.pipeline import policies
|
@@ -26,13 +27,13 @@ class Dirac: # pylint: disable=client-accepts-api-version-keyword
|
|
26
27
|
"""Dirac.
|
27
28
|
|
28
29
|
:ivar well_known: WellKnownOperations operations
|
29
|
-
:vartype well_known:
|
30
|
+
:vartype well_known: generated.operations.WellKnownOperations
|
30
31
|
:ivar auth: AuthOperations operations
|
31
|
-
:vartype auth:
|
32
|
+
:vartype auth: generated.operations.AuthOperations
|
32
33
|
:ivar config: ConfigOperations operations
|
33
|
-
:vartype config:
|
34
|
+
:vartype config: generated.operations.ConfigOperations
|
34
35
|
:ivar jobs: JobsOperations operations
|
35
|
-
:vartype jobs:
|
36
|
+
:vartype jobs: generated.operations.JobsOperations
|
36
37
|
:keyword endpoint: Service URL. Required. Default value is "".
|
37
38
|
:paramtype endpoint: str
|
38
39
|
"""
|
@@ -112,7 +113,7 @@ class Dirac: # pylint: disable=client-accepts-api-version-keyword
|
|
112
113
|
def close(self) -> None:
|
113
114
|
self._client.close()
|
114
115
|
|
115
|
-
def __enter__(self) ->
|
116
|
+
def __enter__(self) -> Self:
|
116
117
|
self._client.__enter__()
|
117
118
|
return self
|
118
119
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# coding=utf-8
|
2
2
|
# --------------------------------------------------------------------------
|
3
|
-
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.
|
3
|
+
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.0, generator: @autorest/python@6.23.0)
|
4
4
|
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
5
5
|
# --------------------------------------------------------------------------
|
6
6
|
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# ------------------------------------
|
2
|
+
# Copyright (c) Microsoft Corporation.
|
3
|
+
# Licensed under the MIT License.
|
4
|
+
# ------------------------------------
|
5
|
+
"""Customize generated code here.
|
6
|
+
|
7
|
+
Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
|
8
|
+
"""
|
9
|
+
from __future__ import annotations
|
10
|
+
|
11
|
+
import os
|
12
|
+
from datetime import datetime, timezone
|
13
|
+
import importlib.util
|
14
|
+
import json
|
15
|
+
import jwt
|
16
|
+
import requests
|
17
|
+
|
18
|
+
from pathlib import Path
|
19
|
+
from typing import Any, Dict, List, Optional, cast
|
20
|
+
from urllib import parse
|
21
|
+
from azure.core.credentials import AccessToken
|
22
|
+
from azure.core.credentials import TokenCredential
|
23
|
+
from azure.core.pipeline import PipelineRequest
|
24
|
+
from azure.core.pipeline.policies import BearerTokenCredentialPolicy
|
25
|
+
|
26
|
+
from diracx.core.preferences import DiracxPreferences, get_diracx_preferences
|
27
|
+
|
28
|
+
|
29
|
+
import sys
|
30
|
+
import importlib
|
31
|
+
from importlib.abc import MetaPathFinder, Loader
|
32
|
+
|
33
|
+
__all__: List[str] = [
|
34
|
+
"DiracClient",
|
35
|
+
] # Add all objects you want publicly available to users at this package level
|
36
|
+
|
37
|
+
|
38
|
+
def patch_sdk():
|
39
|
+
"""Do not remove from this file.
|
40
|
+
|
41
|
+
`patch_sdk` is a last resort escape hatch that allows you to do customizations
|
42
|
+
you can't accomplish using the techniques described in
|
43
|
+
https://aka.ms/azsdk/python/dpcodegen/python/customize
|
44
|
+
"""
|
45
|
+
|
46
|
+
|
47
|
+
from ..patches import DiracClient
|