Tweaked some miscellaneous code.

This commit is contained in:
Project Nayuki 2018-10-05 00:23:09 +00:00
parent 7d49af97e1
commit ac6ef8fe31
2 changed files with 4 additions and 2 deletions

View File

@ -144,7 +144,7 @@ public final class QrSegment {
else if (assignVal < (1 << 14)) {
bb.appendBits(2, 2);
bb.appendBits(assignVal, 14);
} else if (assignVal < 1000000) {
} else if (assignVal < 1_000_000) {
bb.appendBits(6, 3);
bb.appendBits(assignVal, 21);
} else

View File

@ -681,7 +681,9 @@ class QrSegment(object):
"""Creates a new QR Code segment with the given parameters and data.
The character count (numch) must agree with the mode and the bit buffer length,
but the constraint isn't checked. The given bit buffer is cloned and stored."""
if numch < 0 or not isinstance(mode, QrSegment.Mode):
if not isinstance(mode, QrSegment.Mode):
raise TypeError("QrSegment.Mode expected")
if numch < 0:
raise ValueError()
self._mode = mode