Skip to content

Commit f766df7

Browse files
authored
[Monitor] Regen packages (Azure#38695)
This should resolve next pyright issues. Signed-off-by: Paul Van Eck <[email protected]>
1 parent 5d2c6bb commit f766df7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+2475
-3033
lines changed

sdk/monitor/azure-monitor-ingestion/azure/monitor/ingestion/__init__.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,25 @@
55
# Code generated by Microsoft (R) AutoRest Code Generator.
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
8+
# pylint: disable=wrong-import-position
89

9-
from ._patch import LogsIngestionClient
10+
from typing import TYPE_CHECKING
1011

12+
if TYPE_CHECKING:
13+
from ._patch import * # pylint: disable=unused-wildcard-import
1114

12-
from ._patch import LogsUploadError
15+
from ._client import LogsIngestionClient # type: ignore
16+
17+
try:
18+
from ._patch import __all__ as _patch_all
19+
from ._patch import *
20+
except ImportError:
21+
_patch_all = []
1322
from ._patch import patch_sdk as _patch_sdk
1423

1524
__all__ = [
16-
"LogsUploadError",
1725
"LogsIngestionClient",
1826
]
19-
27+
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
2028

2129
_patch_sdk()

sdk/monitor/azure-monitor-ingestion/azure/monitor/ingestion/_client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
from copy import deepcopy
1010
from typing import Any, TYPE_CHECKING
11+
from typing_extensions import Self
1112

1213
from azure.core import PipelineClient
1314
from azure.core.pipeline import policies
@@ -18,11 +19,10 @@
1819
from ._serialization import Deserializer, Serializer
1920

2021
if TYPE_CHECKING:
21-
# pylint: disable=unused-import,ungrouped-imports
2222
from azure.core.credentials import TokenCredential
2323

2424

25-
class LogsIngestionClient(LogsIngestionClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword
25+
class LogsIngestionClient(LogsIngestionClientOperationsMixin):
2626
"""Azure Monitor Data Collection Python Client.
2727
2828
:param endpoint: The Data Collection Endpoint for the Data Collection Rule, for example
@@ -90,7 +90,7 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:
9090
def close(self) -> None:
9191
self._client.close()
9292

93-
def __enter__(self) -> "LogsIngestionClient":
93+
def __enter__(self) -> Self:
9494
self._client.__enter__()
9595
return self
9696

sdk/monitor/azure-monitor-ingestion/azure/monitor/ingestion/_configuration.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,12 @@
1111
from azure.core.pipeline import policies
1212

1313
if TYPE_CHECKING:
14-
# pylint: disable=unused-import,ungrouped-imports
1514
from azure.core.credentials import TokenCredential
1615

1716
VERSION = "unknown"
1817

1918

20-
class LogsIngestionClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
19+
class LogsIngestionClientConfiguration: # pylint: disable=too-many-instance-attributes
2120
"""Configuration for LogsIngestionClient.
2221
2322
Note that all parameters used to create this instance are saved as instance

sdk/monitor/azure-monitor-ingestion/azure/monitor/ingestion/_operations/__init__.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,21 @@
55
# Code generated by Microsoft (R) AutoRest Code Generator.
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
8+
# pylint: disable=wrong-import-position
89

9-
from ._patch import LogsIngestionClientOperationsMixin
10+
from typing import TYPE_CHECKING
1011

12+
if TYPE_CHECKING:
13+
from ._patch import * # pylint: disable=unused-wildcard-import
1114

15+
from ._operations import LogsIngestionClientOperationsMixin # type: ignore
16+
17+
from ._patch import __all__ as _patch_all
18+
from ._patch import *
1219
from ._patch import patch_sdk as _patch_sdk
1320

1421
__all__ = [
1522
"LogsIngestionClientOperationsMixin",
1623
]
17-
24+
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
1825
_patch_sdk()

sdk/monitor/azure-monitor-ingestion/azure/monitor/ingestion/_operations/_operations.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# pylint: disable=too-many-lines,too-many-statements
21
# coding=utf-8
32
# --------------------------------------------------------------------------
43
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8,7 +7,7 @@
87
# --------------------------------------------------------------------------
98
from io import IOBase
109
import sys
11-
from typing import Any, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, overload
10+
from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload
1211

1312
from azure.core.exceptions import (
1413
ClientAuthenticationError,
@@ -29,7 +28,7 @@
2928
if sys.version_info >= (3, 9):
3029
from collections.abc import MutableMapping
3130
else:
32-
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
31+
from typing import MutableMapping # type: ignore
3332
JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object
3433
T = TypeVar("T")
3534
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
@@ -71,8 +70,9 @@ def build_logs_ingestion_upload_request(
7170

7271

7372
class LogsIngestionClientOperationsMixin(LogsIngestionClientMixinABC):
73+
7474
@overload
75-
def _upload( # pylint: disable=inconsistent-return-statements
75+
def _upload(
7676
self,
7777
rule_id: str,
7878
stream: str,
@@ -82,9 +82,8 @@ def _upload( # pylint: disable=inconsistent-return-statements
8282
content_type: str = "application/json",
8383
**kwargs: Any
8484
) -> None: ...
85-
8685
@overload
87-
def _upload( # pylint: disable=inconsistent-return-statements
86+
def _upload(
8887
self,
8988
rule_id: str,
9089
stream: str,
@@ -122,7 +121,7 @@ def _upload( # pylint: disable=inconsistent-return-statements
122121
:rtype: None
123122
:raises ~azure.core.exceptions.HttpResponseError:
124123
"""
125-
error_map: MutableMapping[int, Type[HttpResponseError]] = {
124+
error_map: MutableMapping = {
126125
401: ClientAuthenticationError,
127126
404: ResourceNotFoundError,
128127
409: ResourceExistsError,
@@ -168,8 +167,6 @@ def _upload( # pylint: disable=inconsistent-return-statements
168167
response = pipeline_response.http_response
169168

170169
if response.status_code not in [204]:
171-
if _stream:
172-
response.read() # Load the body in memory and close the socket
173170
map_error(status_code=response.status_code, response=response, error_map=error_map)
174171
raise HttpResponseError(response=response)
175172

0 commit comments

Comments
 (0)