diracx-client 0.0.1a10__py3-none-any.whl → 0.0.1a12__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.
@@ -1,6 +1,6 @@
1
1
  # coding=utf-8
2
2
  # --------------------------------------------------------------------------
3
- # Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.1, generator: @autorest/python@6.4.11)
3
+ # Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/python@6.13.2)
4
4
  # Changes may cause incorrect behavior and will be lost if the code is regenerated.
5
5
  # --------------------------------------------------------------------------
6
6
 
@@ -8,6 +8,7 @@ from copy import deepcopy
8
8
  from typing import Any, Awaitable
9
9
 
10
10
  from azure.core import AsyncPipelineClient
11
+ from azure.core.pipeline import policies
11
12
  from azure.core.rest import AsyncHttpResponse, HttpRequest
12
13
 
13
14
  from .. import models as _models
@@ -40,8 +41,29 @@ class Dirac: # pylint: disable=client-accepts-api-version-keyword
40
41
  self, *, endpoint: str = "", **kwargs: Any
41
42
  ) -> None:
42
43
  self._config = DiracConfiguration(**kwargs)
44
+ _policies = kwargs.pop("policies", None)
45
+ if _policies is None:
46
+ _policies = [
47
+ policies.RequestIdPolicy(**kwargs),
48
+ self._config.headers_policy,
49
+ self._config.user_agent_policy,
50
+ self._config.proxy_policy,
51
+ policies.ContentDecodePolicy(**kwargs),
52
+ self._config.redirect_policy,
53
+ self._config.retry_policy,
54
+ self._config.authentication_policy,
55
+ self._config.custom_hook_policy,
56
+ self._config.logging_policy,
57
+ policies.DistributedTracingPolicy(**kwargs),
58
+ (
59
+ policies.SensitiveHeaderCleanupPolicy(**kwargs)
60
+ if self._config.redirect_policy
61
+ else None
62
+ ),
63
+ self._config.http_logging_policy,
64
+ ]
43
65
  self._client: AsyncPipelineClient = AsyncPipelineClient(
44
- base_url=endpoint, config=self._config, **kwargs
66
+ base_url=endpoint, policies=_policies, **kwargs
45
67
  )
46
68
 
47
69
  client_models = {
@@ -53,7 +75,7 @@ class Dirac: # pylint: disable=client-accepts-api-version-keyword
53
75
  self.well_known = WellKnownOperations(
54
76
  self._client, self._config, self._serialize, self._deserialize
55
77
  )
56
- self.auth = AuthOperations( # pylint: disable=abstract-class-instantiated
78
+ self.auth = AuthOperations(
57
79
  self._client, self._config, self._serialize, self._deserialize
58
80
  )
59
81
  self.config = ConfigOperations(
@@ -64,7 +86,7 @@ class Dirac: # pylint: disable=client-accepts-api-version-keyword
64
86
  )
65
87
 
66
88
  def send_request(
67
- self, request: HttpRequest, **kwargs: Any
89
+ self, request: HttpRequest, *, stream: bool = False, **kwargs: Any
68
90
  ) -> Awaitable[AsyncHttpResponse]:
69
91
  """Runs the network request through the client's chained policies.
70
92
 
@@ -85,7 +107,7 @@ class Dirac: # pylint: disable=client-accepts-api-version-keyword
85
107
 
86
108
  request_copy = deepcopy(request)
87
109
  request_copy.url = self._client.format_url(request_copy.url)
88
- return self._client.send_request(request_copy, **kwargs)
110
+ return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
89
111
 
90
112
  async def close(self) -> None:
91
113
  await self._client.close()
@@ -1,18 +1,17 @@
1
1
  # coding=utf-8
2
2
  # --------------------------------------------------------------------------
3
- # Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.1, generator: @autorest/python@6.4.11)
3
+ # Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/python@6.13.2)
4
4
  # Changes may cause incorrect behavior and will be lost if the code is regenerated.
5
5
  # --------------------------------------------------------------------------
6
6
 
7
7
  from typing import Any
8
8
 
9
- from azure.core.configuration import Configuration
10
9
  from azure.core.pipeline import policies
11
10
 
12
11
  VERSION = "unknown"
13
12
 
14
13
 
15
- class DiracConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
14
+ class DiracConfiguration: # pylint: disable=too-many-instance-attributes
16
15
  """Configuration for Dirac.
17
16
 
18
17
  Note that all parameters used to create this instance are saved as instance
@@ -20,9 +19,9 @@ class DiracConfiguration(Configuration): # pylint: disable=too-many-instance-at
20
19
  """
21
20
 
22
21
  def __init__(self, **kwargs: Any) -> None:
23
- super(DiracConfiguration, self).__init__(**kwargs)
24
22
 
25
23
  kwargs.setdefault("sdk_moniker", "dirac/{}".format(VERSION))
24
+ self.polling_interval = kwargs.get("polling_interval", 30)
26
25
  self._configure(**kwargs)
27
26
 
28
27
  def _configure(self, **kwargs: Any) -> None:
@@ -39,13 +38,13 @@ class DiracConfiguration(Configuration): # pylint: disable=too-many-instance-at
39
38
  self.http_logging_policy = kwargs.get(
40
39
  "http_logging_policy"
41
40
  ) or policies.HttpLoggingPolicy(**kwargs)
42
- self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(
43
- **kwargs
44
- )
45
41
  self.custom_hook_policy = kwargs.get(
46
42
  "custom_hook_policy"
47
43
  ) or policies.CustomHookPolicy(**kwargs)
48
44
  self.redirect_policy = kwargs.get(
49
45
  "redirect_policy"
50
46
  ) or policies.AsyncRedirectPolicy(**kwargs)
47
+ self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(
48
+ **kwargs
49
+ )
51
50
  self.authentication_policy = kwargs.get("authentication_policy")
@@ -1,8 +1,12 @@
1
1
  # --------------------------------------------------------------------------
2
- # Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.1, generator: @autorest/python@6.4.11)
2
+ # Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/python@6.13.2)
3
3
  # Changes may cause incorrect behavior and will be lost if the code is regenerated.
4
4
  # --------------------------------------------------------------------------
5
5
 
6
+ from typing import Optional
7
+
8
+ from azure.core import MatchConditions
9
+
6
10
 
7
11
  def raise_if_not_implemented(cls, abstract_methods):
8
12
  not_implemented = [
@@ -15,3 +19,37 @@ def raise_if_not_implemented(cls, abstract_methods):
15
19
  cls.__name__, "', '".join(not_implemented)
16
20
  )
17
21
  )
22
+
23
+
24
+ def quote_etag(etag: Optional[str]) -> Optional[str]:
25
+ if not etag or etag == "*":
26
+ return etag
27
+ if etag.startswith("W/"):
28
+ return etag
29
+ if etag.startswith('"') and etag.endswith('"'):
30
+ return etag
31
+ if etag.startswith("'") and etag.endswith("'"):
32
+ return etag
33
+ return '"' + etag + '"'
34
+
35
+
36
+ def prep_if_match(
37
+ etag: Optional[str], match_condition: Optional[MatchConditions]
38
+ ) -> Optional[str]:
39
+ if match_condition == MatchConditions.IfNotModified:
40
+ if_match = quote_etag(etag) if etag else None
41
+ return if_match
42
+ if match_condition == MatchConditions.IfPresent:
43
+ return "*"
44
+ return None
45
+
46
+
47
+ def prep_if_none_match(
48
+ etag: Optional[str], match_condition: Optional[MatchConditions]
49
+ ) -> Optional[str]:
50
+ if match_condition == MatchConditions.IfModified:
51
+ if_none_match = quote_etag(etag) if etag else None
52
+ return if_none_match
53
+ if match_condition == MatchConditions.IfMissing:
54
+ return "*"
55
+ return None
@@ -1,6 +1,6 @@
1
1
  # coding=utf-8
2
2
  # --------------------------------------------------------------------------
3
- # Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.1, generator: @autorest/python@6.4.11)
3
+ # Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/python@6.13.2)
4
4
  # Changes may cause incorrect behavior and will be lost if the code is regenerated.
5
5
  # --------------------------------------------------------------------------
6
6