From 17540b4f9b0db3bffe2968269ecb5794ee26bc80 Mon Sep 17 00:00:00 2001 From: xiafu Date: Mon, 9 Sep 2019 15:31:14 -0700 Subject: [PATCH] Fix Pylint --- .../blob/aio/blob_service_client_async.py | 3 +- .../azure/storage/blob/blob_client.py | 2 +- .../azure/storage/blob/blob_service_client.py | 13 +- ..._async.test_set_file_properties_async.yaml | 328 ++++++++++++++++++ 4 files changed, 337 insertions(+), 9 deletions(-) create mode 100644 sdk/storage/azure-storage-file/tests/recordings/test_file_async.test_set_file_properties_async.yaml diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/blob_service_client_async.py b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/blob_service_client_async.py index f8a277e838df..bb41ed0b95b6 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/blob_service_client_async.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/blob_service_client_async.py @@ -115,7 +115,8 @@ def __init__( @distributed_trace_async async def get_user_delegation_key(self, key_start_time, # type: datetime key_expiry_time, # type: datetime - timeout=None # type: Optional[int] + timeout=None, # type: Optional[int] + **kwargs # type: Any ): # type: (datetime, datetime, Optional[int]) -> UserDelegationKey """ diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/blob_client.py b/sdk/storage/azure-storage-blob/azure/storage/blob/blob_client.py index c99fa3f8604c..6c91cbf4751a 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/blob_client.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/blob_client.py @@ -29,7 +29,7 @@ validate_and_format_range_headers) from ._shared.response_handlers import return_response_headers, process_storage_error from ._generated import AzureBlobStorage -from ._generated.models import ( +from ._generated.models import ( # pylint: disable=unused-import DeleteSnapshotsOptionType, BlobHTTPHeaders, BlockLookupList, diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/blob_service_client.py b/sdk/storage/azure-storage-blob/azure/storage/blob/blob_service_client.py index 033e2b1912e9..a728a457f9c8 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/blob_service_client.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/blob_service_client.py @@ -10,10 +10,6 @@ TYPE_CHECKING ) -from ._generated.models import KeyInfo -from ._shared.parser import _to_utc_datetime -from ._shared.response_handlers import parse_to_internal_user_delegation_key - try: from urllib.parse import urlparse except ImportError: @@ -25,9 +21,11 @@ from ._shared.shared_access_signature import SharedAccessSignature from ._shared.models import LocationMode, Services, UserDelegationKey from ._shared.base_client import StorageAccountHostsMixin, parse_connection_str, parse_query -from ._shared.response_handlers import return_response_headers, process_storage_error +from ._shared.parser import _to_utc_datetime +from ._shared.response_handlers import return_response_headers, process_storage_error, \ + parse_to_internal_user_delegation_key from ._generated import AzureBlobStorage -from ._generated.models import StorageErrorException, StorageServiceProperties +from ._generated.models import StorageErrorException, StorageServiceProperties, KeyInfo from .container_client import ContainerClient from .blob_client import BlobClient from .models import ContainerProperties, ContainerPropertiesPaged @@ -231,7 +229,8 @@ def generate_shared_access_signature( @distributed_trace def get_user_delegation_key(self, key_start_time, # type: datetime key_expiry_time, # type: datetime - timeout=None # type: Optional[int] + timeout=None, # type: Optional[int] + **kwargs # type: Any ): # type: (datetime, datetime, Optional[int]) -> UserDelegationKey """ diff --git a/sdk/storage/azure-storage-file/tests/recordings/test_file_async.test_set_file_properties_async.yaml b/sdk/storage/azure-storage-file/tests/recordings/test_file_async.test_set_file_properties_async.yaml new file mode 100644 index 000000000000..676c3732a9bb --- /dev/null +++ b/sdk/storage/azure-storage-file/tests/recordings/test_file_async.test_set_file_properties_async.yaml @@ -0,0 +1,328 @@ +interactions: +- request: + body: null + headers: + User-Agent: + - azsdk-python-storage-file/12.0.0b2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + content-type: + - application/xml; charset=utf-8 + x-ms-client-request-id: + - 3a658f40-d357-11e9-a521-001a7dda7113 + x-ms-date: + - Mon, 09 Sep 2019 23:12:00 GMT + x-ms-version: + - '2019-02-02' + method: PUT + uri: https://storagename.file.core.windows.net/utsharebc1a12fe?restype=share + response: + body: + string: '' + headers: + ? !!python/object/new:multidict._istr.istr + - Content-Length + : '0' + ? !!python/object/new:multidict._istr.istr + - Date + : Mon, 09 Sep 2019 23:12:00 GMT + ? !!python/object/new:multidict._istr.istr + - Etag + : '"0x8D7357B1EAA605B"' + ? !!python/object/new:multidict._istr.istr + - Last-Modified + : Mon, 09 Sep 2019 23:12:00 GMT + ? !!python/object/new:multidict._istr.istr + - Server + : Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + x-ms-client-request-id: 3a658f40-d357-11e9-a521-001a7dda7113 + x-ms-request-id: 684e1630-f01a-006e-2963-6706db000000 + x-ms-version: '2019-02-02' + status: + code: 201 + message: Created + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - emilydevtest.file.core.windows.net + - /utsharebc1a12fe + - restype=share + - '' +- request: + body: null + headers: + User-Agent: + - azsdk-python-storage-file/12.0.0b2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + content-type: + - application/xml; charset=utf-8 + x-ms-client-request-id: + - 3a8c7bf8-d357-11e9-a069-001a7dda7113 + x-ms-content-length: + - '1024' + x-ms-date: + - Mon, 09 Sep 2019 23:12:00 GMT + x-ms-file-attributes: + - none + x-ms-file-creation-time: + - now + x-ms-file-last-write-time: + - now + x-ms-file-permission: + - Inherit + x-ms-type: + - file + x-ms-version: + - '2019-02-02' + method: PUT + uri: https://storagename.file.core.windows.net/utsharebc1a12fe/filebc1a12fe + response: + body: + string: '' + headers: + ? !!python/object/new:multidict._istr.istr + - Content-Length + : '0' + ? !!python/object/new:multidict._istr.istr + - Date + : Mon, 09 Sep 2019 23:12:01 GMT + ? !!python/object/new:multidict._istr.istr + - Etag + : '"0x8D7357B1ED1C9E2"' + ? !!python/object/new:multidict._istr.istr + - Last-Modified + : Mon, 09 Sep 2019 23:12:01 GMT + ? !!python/object/new:multidict._istr.istr + - Server + : Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + x-ms-client-request-id: 3a8c7bf8-d357-11e9-a069-001a7dda7113 + x-ms-file-attributes: Archive + x-ms-file-change-time: '2019-09-09T23:12:01.0529250Z' + x-ms-file-creation-time: '2019-09-09T23:12:01.0529250Z' + x-ms-file-id: '13835128424026341376' + x-ms-file-last-write-time: '2019-09-09T23:12:01.0529250Z' + x-ms-file-parent-id: '0' + x-ms-file-permission-key: 4099112195243312672*10394889115079208622 + x-ms-request-id: 64fb3cd0-501a-0093-7e63-6788fe000000 + x-ms-request-server-encrypted: 'true' + x-ms-version: '2019-02-02' + status: + code: 201 + message: Created + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - emilydevtest.file.core.windows.net + - /utsharebc1a12fe/filebc1a12fe + - '' + - '' +- request: + body: !!binary | + ECuRUvzcKOiNGbHFPa8Qg29TIWZGygkeAAmlledUC3IgR+dXigunvAY4febKY0iGTDGhEHfb4N/4 + iy0kBMdXFl1CaUBhOJ59P/z0lFyfJpr4oqJXrrLeHp4oP6RcWh2lyy7JRhFf6sBB3e92d+JfdyVk + BPCsg+/aSMGlAom7plQi72bEDM70dGdVNLaRGR2+yzd1b9RIjAIkTwUaK5UjhHTq2bk9xs32MDgN + QJKjvGpGbCTVmW8ZpRblrDYdYquFqaNT7yIwt4VKRIuoz9hO7cFvC7RgdPy8sWoZhJuttFs4wrik + +A7Q/t5bXUhGFggjU9mE0WIj3H/o5OrLXsm9E12jklCa4NN/x1DDurxto7BZQTfeM0uc96Np8tM0 + fcyDnfreQTC8wMFJZWXoWm7x1UKnzoG/fN5ShHlFqxCdJZfLNM4i80TXQuczAbD+QKHSNrMeuZ/N + qOO3c0GRpsCY1T4Xm5SWVBqFh7pLRqixlUU/KJzMZ6UhLEPaRPTsZaSkweSnLGD1JkQqpF07fCDu + Gsm8dHQE633KELgHCiCD8D1bICFTBdcf58wOzvAq8oRXJJohPbeaAGQQCH9YD81kbz0C8j0iuGJ3 + Bt9knBG3yGZN52UpRfBnv21J8Ipo4wVCQ0gRSsL9e1RyveItBiYRAh52+/i38ituIETv6QUZrpGC + YJH2OOORl7UzD/6pJKoOogt+xwaZMUS50QmCqEBl0aY8c4QpZLCVKO3aUkxcvwU/4Zmt/bidNNNP + 2OlaYuOUDK58YalYQvNpTa87Ix0aGi5e+LmYn/Rej3JBWB20GauIKlElellUuRqPfF1MRhXs952v + 7PK5yjxWXwDs7AZuRssgiIqYfdpjk81pDe71Y3mvD7hRtzTZ7uKfUpH534H0Xcdsq3BsJI0LgxM0 + al3EMuGuZPbdUBepQpitfpdjfYuvO+SplACIVinlccV0z8vibnMYMHHbY9R6buR1vJowvLjD7rPl + PTyllH3o2wrG/J/o+kOD8E+YQN4Rn6WIxTzGL+OcPJtfkjiT+trYNItQIlBorgqQAc6aCW39/AGA + fDY1LriI1d0BwbgoBRQH+/k7JMtwAF39HjWTAbCHGKbz+gXwD6ubKigcN9kmlOtZXtPFRCCQhA01 + EKCaPUXHVBHWLUpgNsOrGGPfqjJoChcTJ9mbNB8WXJBu3DsEF/4C0u/k9mjTrMjjGElFK4LRAUqE + 0jArnRtZWgakrOnTKprqgHTZEtRxwdsZduALZMWNOFhuM7wanHNx2uKBv7cnIy83N15CBAY5fYNd + dYjIcljzmUh3IsTWPILv1tvZZ/a2IFeJ4lVfLkhX3AOuNUUMk1yQNCD47xSIZ+f9YqUJpHhdeA== + headers: + Content-Length: + - '1024' + Content-Type: + - application/octet-stream + User-Agent: + - azsdk-python-storage-file/12.0.0b2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + x-ms-client-request-id: + - 3ab04b4c-d357-11e9-b80e-001a7dda7113 + x-ms-date: + - Mon, 09 Sep 2019 23:12:01 GMT + x-ms-range: + - bytes=0-1023 + x-ms-version: + - '2019-02-02' + x-ms-write: + - update + method: PUT + uri: https://storagename.file.core.windows.net/utsharebc1a12fe/filebc1a12fe?comp=range + response: + body: + string: '' + headers: + ? !!python/object/new:multidict._istr.istr + - Content-Length + : '0' + ? !!python/object/new:multidict._istr.istr + - Content-Md5 + : aHnHh6kpL9BLaCLM3XK+Zg== + ? !!python/object/new:multidict._istr.istr + - Date + : Mon, 09 Sep 2019 23:12:01 GMT + ? !!python/object/new:multidict._istr.istr + - Etag + : '"0x8D7357B1EDF3AA9"' + ? !!python/object/new:multidict._istr.istr + - Last-Modified + : Mon, 09 Sep 2019 23:12:01 GMT + ? !!python/object/new:multidict._istr.istr + - Server + : Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + x-ms-client-request-id: 3ab04b4c-d357-11e9-b80e-001a7dda7113 + x-ms-request-id: 64fb3cd2-501a-0093-7f63-6788fe000000 + x-ms-request-server-encrypted: 'true' + x-ms-version: '2019-02-02' + status: + code: 201 + message: Created + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - emilydevtest.file.core.windows.net + - /utsharebc1a12fe/filebc1a12fe + - comp=range + - '' +- request: + body: null + headers: + User-Agent: + - azsdk-python-storage-file/12.0.0b2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + content-type: + - application/xml; charset=utf-8 + x-ms-client-request-id: + - 3ab3d6de-d357-11e9-834d-001a7dda7113 + x-ms-content-disposition: + - inline + x-ms-content-language: + - spanish + x-ms-date: + - Mon, 09 Sep 2019 23:12:01 GMT + x-ms-file-attributes: + - preserve + x-ms-file-creation-time: + - preserve + x-ms-file-last-write-time: + - preserve + x-ms-file-permission: + - preserve + x-ms-version: + - '2019-02-02' + method: PUT + uri: https://storagename.file.core.windows.net/utsharebc1a12fe/filebc1a12fe?comp=properties + response: + body: + string: '' + headers: + ? !!python/object/new:multidict._istr.istr + - Content-Length + : '0' + ? !!python/object/new:multidict._istr.istr + - Date + : Mon, 09 Sep 2019 23:12:01 GMT + ? !!python/object/new:multidict._istr.istr + - Etag + : '"0x8D7357B1EE1FA79"' + ? !!python/object/new:multidict._istr.istr + - Last-Modified + : Mon, 09 Sep 2019 23:12:01 GMT + ? !!python/object/new:multidict._istr.istr + - Server + : Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + x-ms-client-request-id: 3ab3d6de-d357-11e9-834d-001a7dda7113 + x-ms-file-attributes: Archive + x-ms-file-change-time: '2019-09-09T23:12:01.1590265Z' + x-ms-file-creation-time: '2019-09-09T23:12:01.0529250Z' + x-ms-file-id: '13835128424026341376' + x-ms-file-last-write-time: '2019-09-09T23:12:01.0529250Z' + x-ms-file-parent-id: '0' + x-ms-file-permission-key: 4099112195243312672*10394889115079208622 + x-ms-request-id: 64fb3cd3-501a-0093-8063-6788fe000000 + x-ms-request-server-encrypted: 'true' + x-ms-version: '2019-02-02' + status: + code: 200 + message: OK + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - emilydevtest.file.core.windows.net + - /utsharebc1a12fe/filebc1a12fe + - comp=properties + - '' +- request: + body: null + headers: + User-Agent: + - azsdk-python-storage-file/12.0.0b2 Python/3.7.3 (Windows-10-10.0.18362-SP0) + content-type: + - application/xml; charset=utf-8 + x-ms-client-request-id: + - 3ab6551c-d357-11e9-b471-001a7dda7113 + x-ms-date: + - Mon, 09 Sep 2019 23:12:01 GMT + x-ms-version: + - '2019-02-02' + method: HEAD + uri: https://storagename.file.core.windows.net/utsharebc1a12fe/filebc1a12fe + response: + body: + string: '' + headers: + ? !!python/object/new:multidict._istr.istr + - Content-Disposition + : inline + ? !!python/object/new:multidict._istr.istr + - Content-Language + : spanish + ? !!python/object/new:multidict._istr.istr + - Content-Length + : '1024' + ? !!python/object/new:multidict._istr.istr + - Content-Type + : application/xml; charset=utf-8 + ? !!python/object/new:multidict._istr.istr + - Date + : Mon, 09 Sep 2019 23:12:01 GMT + ? !!python/object/new:multidict._istr.istr + - Etag + : '"0x8D7357B1EE1FA79"' + ? !!python/object/new:multidict._istr.istr + - Last-Modified + : Mon, 09 Sep 2019 23:12:01 GMT + ? !!python/object/new:multidict._istr.istr + - Server + : Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 + x-ms-client-request-id: 3ab6551c-d357-11e9-b471-001a7dda7113 + x-ms-file-attributes: Archive + x-ms-file-change-time: '2019-09-09T23:12:01.1590265Z' + x-ms-file-creation-time: '2019-09-09T23:12:01.0529250Z' + x-ms-file-id: '13835128424026341376' + x-ms-file-last-write-time: '2019-09-09T23:12:01.0529250Z' + x-ms-file-parent-id: '0' + x-ms-file-permission-key: 4099112195243312672*10394889115079208622 + x-ms-request-id: 64fb3cd4-501a-0093-0163-6788fe000000 + x-ms-server-encrypted: 'true' + x-ms-type: File + x-ms-version: '2019-02-02' + status: + code: 200 + message: OK + url: !!python/object/new:yarl.URL + state: !!python/tuple + - !!python/object/new:urllib.parse.SplitResult + - https + - emilydevtest.file.core.windows.net + - /utsharebc1a12fe/filebc1a12fe + - '' + - '' +version: 1