Try to convert the channel to an integer.

    :param channel:
        Channel string (e.g. can0, CAN1) or integer
    
    :returns: Channel integer or `None` if unsuccessful
    :rtype: int
430407
def channel2int(channel):
    
    if channel is None:
        return None
    if isinstance(channel, int):
        return channel
    # String and byte objects have a lower() method
    if hasattr(channel, "lower"):
        match = re.match(r'.*(\d+)$', channel)
        if match:
            return int(match.group(1))
    return None
263690
def to_int(d, key, default_to_zero=False, default=None, required=True):
    
    value = d.get(key) or default
    if (value in ["", None]) and default_to_zero:
        return 0
    if value is None:
        if required:
            raise ParseError("Unable to read %s from %s" % (key, d))
    else:
        return int(value)
282723
def _ConvertInteger(value):
  
  if isinstance(value, float) and not value.is_integer():
    raise ParseError('Couldn\'t parse integer: {0}.'.format(value))

  if isinstance(value, six.text_type) and value.find(' ') != -1:
    raise ParseError('Couldn\'t parse integer: "{0}".'.format(value))

  return int(value)
1340074
def toint(number):
    
    if isinstance(number, float):
        number = round(number, 0)
    return int(number)
161344
InputStream readChannel(int channel)
        throws IOException
    {
        while (!isClosed) {
            if (inputReady[channel]) {
                inputReady[channel] = false;
                return is;
            }

            boolean canRead = false;
            synchronized (READ_LOCK) {
                if (!isReadLocked) {
                    isReadLocked = true;
                    canRead = true;
                }
                else {
                    try {
                        READ_LOCK.wait(5000);
                    } catch (Exception e) {
                    }
                }
            }

            if (canRead) {
                try {
                    readData();
                } catch (IOException e) {
                    close();
                }
            }
        }

        return null;
    }
337793
def _int(ctx, number):
    
    return conversions.to_integer(conversions.to_decimal(number, ctx).to_integral_value(ROUND_FLOOR), ctx)
898581
def integer(token):
        
        token = token.strip()
        neg = False
        if token.startswith(compat.b('-')):
            token = token[1:]
            neg = True
        if token.startswith(compat.b('0x')):
            result = int(token, 16)     # hexadecimal
        elif token.startswith(compat.b('0b')):
            result = int(token[2:], 2)  # binary
        elif token.startswith(compat.b('0o')):
            result = int(token, 8)      # octal
        else:
            try:
                result = int(token)     # decimal
            except ValueError:
                result = int(token, 16) # hexadecimal (no "0x" prefix)
        if neg:
            result = -result
        return result
628884
def hasChannelType(self, chan):
        
        if self._chantypes is None:
            self._initChannelTypesList()
        return chan in self._chantypes
976823
def get(self, channel):
        """"""
        checked_channel = self._check_channel_no(channel)
        self.i2c.write_raw8(checked_channel  | self._dac_enabled)
        reading = self.i2c.read_raw8() 
        reading = self.i2c.read_raw8() 
        return reading / 255.0
930318
def can_convert(x):
        
        if len(x.shape) < 2 or len(x.shape) > 3:
            return False
        dtype = x.dtype
        height = x.shape[0]
        width = x.shape[1]
        channels = 1
        if len(x.shape) == 3:
            channels = x.shape[2]
        if channels > 4:
            return False
        return True
1258906
def ask_int(msg="Enter an integer", dft=None, vld=None, hlp=None):
    """"""
    vld = vld or [int]
    return ask(msg, dft=dft, vld=vld, fmt=partial(cast, typ=int), hlp=hlp)
837691
def IntegerLike(msg=None):
    '''
    
    '''
    def fn(value):
        if not any([
            isinstance(value, numbers.Integral),
            (isinstance(value, float) and value.is_integer()),
            (isinstance(value, basestring) and value.isdigit())
        ]):
            raise Invalid(msg or (
                'Invalid input <{0}>; expected an integer'.format(value))
            )
        else:
            return value
    return fn
708098
def getInt(self, name, default=0, parent_search=False, multikeys_search=False):
		
		try:
			value = self.get(name, default, parent_search, multikeys_search)
			return int(value)

		except:
			# pas de configuration trouvé ou convertion impossible ?
			return default
917953
def send_single_value(self, channel: int, value: int) -> int:
        
        SetSingleChannel = 1
        n = self._send_control_message(SetSingleChannel, value_or_length=value, channel=channel, data_or_length=1)
        return n
613210
def get_int(self, key, default=None):
        
        value = self.get(key, default)
        return None if value is None else int(value)
422815
def num_to_var_int(x):
    
    x = int(x)
    if x < 253:
        return from_int_to_byte(x)

    elif x < 65536:
        return from_int_to_byte(253) + encode(x, 256, 2)[::-1]

    elif x < 4294967296:
        return from_int_to_byte(254) + encode(x, 256, 4)[::-1]

    else:
        return from_int_to_byte(255) + encode(x, 256, 8)[::-1]
1218364
def safe_int(val, allow_zero=True):
    
    try:
        ret = int(val)
    except ValueError:
        print("Sorry, '%s' is not a valid integer." % val)
        return False
    if not allow_zero and ret == 0:
        print("Please enter a non-zero integer.")
        return False
    return ret