Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, device, features={}):
super(ElginGeneric, self).__init__(device)
self.hardware_features.update({
feature.CUTTER: False,
feature.CASHDRAWER_PORTS: True,
feature.CASHDRAWER_AVAILABLE_PORTS: 1,
})
self.hardware_features.update(features)
def __init__(self, device, features={}):
super(MP4200TH, self).__init__(device)
self.hardware_features.update({
feature.CUTTER: True,
feature.CASHDRAWER_PORTS: True,
feature.CASHDRAWER_AVAILABLE_PORTS: 1,
})
self.hardware_features.update(features)
self._escpos = _ESCPOS(self)
self._escbema = _ESCBematech(self)
def __init__(self, device, features={}):
super(TMT20, self).__init__(device)
self.hardware_features.update({
feature.CUTTER: True,
feature.CASHDRAWER_PORTS: True,
feature.CASHDRAWER_AVAILABLE_PORTS: 1,
})
self.hardware_features.update(features)
ports does not exists in the ESC/POS specification and it is just a
design decision to normalize cash drawers handling. From the user
application perspective, drawers are simply connected to port 0, 1, 2,
and so on.
If printer does not have this feature then no exception should be
raised.
:param int number: The port number to kick drawer (default is ``0``).
:raises CashDrawerException: If given port does not exists.
"""
if self.hardware_features.get(feature.CASHDRAWER_PORTS, False):
# if feature is available assume at least one port is available
max_ports = self.hardware_features.get(
feature.CASHDRAWER_AVAILABLE_PORTS, 1)
if port not in range(max_ports):
raise CashDrawerException('invalid cash drawer port: {!r} '
'(available ports are {!r})'.format(
port, range(max_ports)))
return self._kick_drawer_impl(port=port, **kwargs)
def __init__(self, device, features={}):
super(DarumaGeneric, self).__init__(device)
self.hardware_features.update({
feature.CUTTER: False,
feature.CASHDRAWER_PORTS: True,
feature.CASHDRAWER_AVAILABLE_PORTS: 1,
})
self.hardware_features.update(features)
def kick_drawer(self, port=0, **kwargs):
# although concrete implementations may have any number of available
# cash drawer ports, ESC/Bematech foresees two cash drawers anyways
available_ports = self._impl.hardware_features.get(
feature.CASHDRAWER_AVAILABLE_PORTS)
if port not in range(available_ports):
ports_list = ', '.join(str(p) for p in range(available_ports))
raise CashDrawerException('invalid cash drawer port: {!r} '
'(hardware features only ports: {})'.format(
port,
ports_list))
duration = kwargs.get('duration', CASHDRAWER_DEFAULT_DURATION)
if duration not in range(
_CASHDRAWER_DURATION_MIN, _CASHDRAWER_DURATION_MAX + 1):
raise ValueError('illegal cash drawer activation duration: {!r} '
'(in milliseconds, ranging from {!r} up to {!r}'.format(
duration,
_CASHDRAWER_DURATION_MIN,
_CASHDRAWER_DURATION_MAX))