From 821c25c20c983112647b44a3fe0a04ec8085ef85 Mon Sep 17 00:00:00 2001 From: Jozef Duc Date: Wed, 28 Jul 2021 11:11:17 +0200 Subject: [PATCH] Fix some "is literal" SyntaxWarning --- azure-storage-blob/azure/storage/blob/_deserialization.py | 2 +- azure-storage-blob/azure/storage/blob/_serialization.py | 4 ++-- azure-storage-blob/azure/storage/blob/blockblobservice.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/azure-storage-blob/azure/storage/blob/_deserialization.py b/azure-storage-blob/azure/storage/blob/_deserialization.py index 8d243c46..c94f8662 100644 --- a/azure-storage-blob/azure/storage/blob/_deserialization.py +++ b/azure-storage-blob/azure/storage/blob/_deserialization.py @@ -638,7 +638,7 @@ def _parse_sub_response_to_http_response(sub_response): num_empty_lines += 1 elif line.startswith("x-ms-error-code".encode('utf-8')): batch_http_sub_response.message = line.decode('utf-8').split(": ")[1].rstrip() - elif num_empty_lines is 2: + elif num_empty_lines == 2: batch_http_sub_response.body += line else: header = line.decode('utf-8').split(": ")[0] diff --git a/azure-storage-blob/azure/storage/blob/_serialization.py b/azure-storage-blob/azure/storage/blob/_serialization.py index 69b06013..59882e7d 100644 --- a/azure-storage-blob/azure/storage/blob/_serialization.py +++ b/azure-storage-blob/azure/storage/blob/_serialization.py @@ -186,7 +186,7 @@ def _serialize_batch_body(requests, batch_id): :return: The body bytes for this batch. """ - if requests is None or len(requests) is 0: + if requests is None or not len(requests): raise ValueError('Please provide sub-request(s) for this batch request') delimiter_bytes = (_get_batch_request_delimiter(batch_id, True, False) + _HTTP_LINE_ENDING).encode('utf-8') @@ -298,7 +298,7 @@ def _serialize_query(query): serialized_query.append(query_value) serialized_query.append("&") - if len(serialized_query) is not 0: + if serialized_query: del serialized_query[-1] return ''.join(serialized_query) diff --git a/azure-storage-blob/azure/storage/blob/blockblobservice.py b/azure-storage-blob/azure/storage/blob/blockblobservice.py index 57a27029..8151cc25 100644 --- a/azure-storage-blob/azure/storage/blob/blockblobservice.py +++ b/azure-storage-blob/azure/storage/blob/blockblobservice.py @@ -605,7 +605,7 @@ def create_blob_from_stream(self, container_name, blob_name, stream, count=None, data_chunk = data # to store the chunk of data read from stream each time # keep reading from stream util length of data >= count or reaching the end of stream - while len(data) < count and len(data_chunk) is not 0: + while len(data) < count and len(data_chunk): data_chunk = stream.read(count - len(data)) data += data_chunk