Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _ean13_impl(self, data, **kwargs):
commands = barcode.gs_k_barcode(barcode.JAN13_EAN13, data, **kwargs)
for cmd in commands:
self.device.write(cmd)
time.sleep(0.25) # wait for barcode to be printed
return self.device.read()
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>
def _ean8_impl(self, data, **kwargs):
commands = barcode.gs_k_barcode(barcode.JAN8_EAN8, data, **kwargs)
for cmd in commands:
self.device.write(cmd)
time.sleep(0.25) # wait for barcode to be printed
return self.device.read()