MCPcopy Index your code
hub / github.com/lincolnloop/python-qrcode / to_bytestring

Function to_bytestring

qrcode/util.py:394–401  ·  view source on GitHub ↗

Convert data to a (utf-8 encoded) byte-string if it isn't a byte-string already.

(data)

Source from the content-addressed store, hash-verified

392
393
394def to_bytestring(data):
395 """
396 Convert data to a (utf-8 encoded) byte-string if it isn't a byte-string
397 already.
398 """
399 if not isinstance(data, bytes):
400 data = str(data).encode("utf-8")
401 return data
402
403
404def optimal_mode(data):

Callers 2

optimal_data_chunksFunction · 0.85
__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected