|
|
@ -697,11 +697,12 @@ class QrSegment(object):
|
|
|
|
return list(self._bitdata) # Make defensive copy
|
|
|
|
return list(self._bitdata) # Make defensive copy
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Calculates the number of bits needed to encode the given segments at the given version.
|
|
|
|
# Package-private function
|
|
|
|
# Returns a non-negative number if successful. Otherwise returns None if a segment has
|
|
|
|
|
|
|
|
# too many characters to fit its length field.
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
@staticmethod
|
|
|
|
def get_total_bits(segs, version):
|
|
|
|
def get_total_bits(segs, version):
|
|
|
|
|
|
|
|
"""Calculates the number of bits needed to encode the given segments at
|
|
|
|
|
|
|
|
the given version. Returns a non-negative number if successful. Otherwise
|
|
|
|
|
|
|
|
returns None if a segment has too many characters to fit its length field."""
|
|
|
|
if not (QrCode.MIN_VERSION <= version <= QrCode.MAX_VERSION):
|
|
|
|
if not (QrCode.MIN_VERSION <= version <= QrCode.MAX_VERSION):
|
|
|
|
raise ValueError("Version number out of range")
|
|
|
|
raise ValueError("Version number out of range")
|
|
|
|
result = 0
|
|
|
|
result = 0
|
|
|
|