Skip to content

Commit 77f5443

Browse files
authored
Use b"" instead of bytes(). Don't use str on a string. (Azure#38733)
Fixed using ruff check --exclude="script*" --exclude="tools*" --select "UP018" --fix Co-authored-by: Mads Jensen <[email protected]>
1 parent b847310 commit 77f5443

File tree

8 files changed

+8
-8
lines changed

8 files changed

+8
-8
lines changed

sdk/confidentialledger/azure-confidentialledger/azure/confidentialledger/receipt/_receipt_verification.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ def _compute_root_node_hash(leaf_hash: bytes, proof: List[ProofElement]) -> byte
258258
"Invalid proof element in receipt: element must contain either one left or right node hash."
259259
)
260260

261-
parent_node_hash = bytes()
261+
parent_node_hash = b""
262262

263263
# If the current element contains a left hash, concatenate the left hash and the current node hash
264264
if element.left is not None:

sdk/eventhub/azure-eventhub/azure/eventhub/_pyamqp/_transport.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def set_cloexec(fd, cloexec): # noqa # pylint: disable=inconsistent-return-stat
9494
AMQP_PORT = 5672
9595
AMQPS_PORT = 5671
9696
AMQP_FRAME = memoryview(b"AMQP")
97-
EMPTY_BUFFER = bytes()
97+
EMPTY_BUFFER = b""
9898
SIGNED_INT_MAX = 0x7FFFFFFF
9999

100100
# Match things like: [fe80::1]:5432, from RFC 2732

sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/export/trace/_exporter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def _get_otel_resource_envelope(self, resource: Resource) -> TelemetryItem:
125125
envelope.tags.update(_utils._populate_part_a_fields(resource)) # pylint: disable=W0212
126126
envelope.instrumentation_key = self._instrumentation_key
127127
data_point = MetricDataPoint(
128-
name=str("_OTELRESOURCE_")[:1024],
128+
name="_OTELRESOURCE_"[:1024],
129129
value=0,
130130
)
131131

sdk/servicebus/azure-servicebus/azure/servicebus/_pyamqp/_transport.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def set_cloexec(fd, cloexec): # noqa # pylint: disable=inconsistent-return-stat
9393
AMQP_PORT = 5672
9494
AMQPS_PORT = 5671
9595
AMQP_FRAME = memoryview(b"AMQP")
96-
EMPTY_BUFFER = bytes()
96+
EMPTY_BUFFER = b""
9797
SIGNED_INT_MAX = 0x7FFFFFFF
9898

9999
# Match things like: [fe80::1]:5432, from RFC 2732

sdk/storage/azure-storage-blob/azure/storage/blob/_shared/request_handlers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def serialize_batch_body(requests, batch_id):
185185
# final line of body MUST have \r\n at the end, or it will not be properly read by the service
186186
batch_body.append(newline_bytes)
187187

188-
return bytes().join(batch_body)
188+
return b"".join(batch_body)
189189

190190

191191
def _get_batch_request_delimiter(batch_id, is_prepend_dashes=False, is_append_dashes=False):

sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/request_handlers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def serialize_batch_body(requests, batch_id):
185185
# final line of body MUST have \r\n at the end, or it will not be properly read by the service
186186
batch_body.append(newline_bytes)
187187

188-
return bytes().join(batch_body)
188+
return b"".join(batch_body)
189189

190190

191191
def _get_batch_request_delimiter(batch_id, is_prepend_dashes=False, is_append_dashes=False):

sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/request_handlers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def serialize_batch_body(requests, batch_id):
185185
# final line of body MUST have \r\n at the end, or it will not be properly read by the service
186186
batch_body.append(newline_bytes)
187187

188-
return bytes().join(batch_body)
188+
return b"".join(batch_body)
189189

190190

191191
def _get_batch_request_delimiter(batch_id, is_prepend_dashes=False, is_append_dashes=False):

sdk/storage/azure-storage-queue/azure/storage/queue/_shared/request_handlers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def serialize_batch_body(requests, batch_id):
185185
# final line of body MUST have \r\n at the end, or it will not be properly read by the service
186186
batch_body.append(newline_bytes)
187187

188-
return bytes().join(batch_body)
188+
return b"".join(batch_body)
189189

190190

191191
def _get_batch_request_delimiter(batch_id, is_prepend_dashes=False, is_append_dashes=False):

0 commit comments

Comments
 (0)