Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _code128_impl(self, data, **kwargs):
codeset = kwargs.get('codeset', barcode.CODE128_A)
if not is_value_in(barcode.CODE128_CODESETS, codeset):
raise ValueError('Unknown Code 128 code set: {!r}'.format(codeset))
encoded_data = '{{{0}{1}'.format(codeset, data) # {<data>
commands = barcode.gs_k_barcode(barcode.CODE128, encoded_data, **kwargs)
for cmd in commands:
self.device.write(cmd)
time.sleep(0.25) # wait for barcode to be printed
return self.device.read()
</data>
lambda v: is_value_in(QRCODE_ERROR_CORRECTION_LEVELS, v),
}
lambda v: is_value_in(BARCODE_WIDTHS, v),
lambda v: is_value_in(QRCODE_MODULE_SIZES, v),
lambda v: is_value_in(BARCODE_HRI_POSITIONING, v),
}