Skip to content

Commit 10dde0f

Browse files
[Storage] Update typing for azure-storage-queue (Azure#29045)
* [Storage] Update typing for `queue_service_client` (Queue) (Azure#28949) * qsc done sync&async * Remove #type ignore, fix dict() * Fix indents * Fix indent again :D * [Storage] Update typing for `queue_client` (Queue) (Azure#28952) * sync 80% done need *, logic * First attempt at *, * Async + unify sync spacing * Fix CI * Revert recordings * PR feedback * Revert recording, fix indents * indent, again :D * Fix content docstring * [Storage] Update typing for miscellaneous files (queue) (Azure#29173) * [Storage] `_queue_client.py` mypy fixes (Azure#29736) * First draft MyPy * Mypy config fix + just Config Mypy left * Fully done w/ custom StorageConfiguration * Pylint * Double import * Fix cast * PR feedback * Unused imports * Pylint * Configuration errors in async BE GONE * Fix tests that assert against _config * [Storage] _queue_client_async.py mypy fixes (Azure#29824) * Init done for _queue_client * Fix async calling into sync * Back to the drawing board * Finished __init__ * Fix failing tests * queue_client done and decoupled * Queue specific files done * Shared, some base_client leftovers, some model leftovers * 3 _model 1 response_handlers * Mypy congrats, time to fight pylint & CI :D * unused import asyncio * New PyLint rules fixes * Pylint 2 * Fix failing test cases * Be gone test failures * Finally found root cause of infinite loop * All encryption tests passing locally, 32 pylint errors remaining * All tests passing locally, mypy green locally * Pylint * Encryption feedback done * Shared, sample, and lint output left * More comments addressed, need bc_async, policies, and samples + output * Just samples, added more helpers * More feedback * More fixes * Lint * Feedback 2 * CI * Fix weird invisible unicode char * No mypy errors hopefully no CI * Pylint and CI, but now hinting issues * Fix Lint which should fix CI * Attempted overload * Just hanging encryption and message_encoding Qs, fix import ordering * Addressed encryption feedback * Feedback, need base client decouple, need CI passing * Fixing CI * CI * CI * Ignores :( * More fixes * CI * Pylint again * Adjust typehint * Try SO workaround 41207128 * Reimport Pylint * First round of feedback * Fix CorsRule to_generated method * Fix PyLint & test failures * Feedback * Revert moving out sas token helper, causes circular dependency * Pylint * Typing feedback * Fix CI * Use QueueMessage ctor * Pylint * Privatize CorsRule method * Disable for protected access * Flip on mypy * Missed configuration value parsing * Double-spaced * Typo * Last minute nits * Extra newline in encryption
1 parent 625a526 commit 10dde0f

34 files changed

+2082
-1123
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: str
1+
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: str
1+
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore

sdk/storage/azure-storage-queue/azure/storage/queue/_deserialize.py

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,22 @@
55
# --------------------------------------------------------------------------
66
# pylint: disable=unused-argument
77

8-
from azure.core.exceptions import ResourceExistsError
8+
from typing import Any, Dict, TYPE_CHECKING
99

10-
from ._shared.models import StorageErrorCode
10+
from azure.core.exceptions import ResourceExistsError
1111
from ._models import QueueProperties
12+
from ._shared.models import StorageErrorCode
1213
from ._shared.response_handlers import deserialize_metadata
1314

15+
if TYPE_CHECKING:
16+
from azure.core.pipeline import PipelineResponse
17+
1418

15-
def deserialize_queue_properties(response, obj, headers):
19+
def deserialize_queue_properties(
20+
response: "PipelineResponse",
21+
obj: Any,
22+
headers: Dict[str, Any]
23+
) -> QueueProperties:
1624
metadata = deserialize_metadata(response, obj, headers)
1725
queue_properties = QueueProperties(
1826
metadata=metadata,
@@ -21,18 +29,22 @@ def deserialize_queue_properties(response, obj, headers):
2129
return queue_properties
2230

2331

24-
def deserialize_queue_creation(response, obj, headers):
32+
def deserialize_queue_creation(
33+
response: "PipelineResponse",
34+
obj: Any,
35+
headers: Dict[str, Any]
36+
) -> Dict[str, Any]:
2537
response = response.http_response
26-
if response.status_code == 204:
38+
if response.status_code == 204: # type: ignore
2739
error_code = StorageErrorCode.queue_already_exists
2840
error = ResourceExistsError(
2941
message=(
3042
"Queue already exists\n"
3143
f"RequestId:{headers['x-ms-request-id']}\n"
3244
f"Time:{headers['Date']}\n"
3345
f"ErrorCode:{error_code}"),
34-
response=response)
35-
error.error_code = error_code
36-
error.additional_info = {}
46+
response=response) # type: ignore
47+
error.error_code = error_code # type: ignore
48+
error.additional_info = {} # type: ignore
3749
raise error
3850
return headers

0 commit comments

Comments
 (0)