dhunter/util/util.py
def size_to_int(val: str) -> int:
        """Parses size string trying to get size as int from it.

        Supported formats:
            "123" => 123
            "12k" => 12 * 1024
            "12M" => 12 * 1024 * 1024

        :param val: string representing sine
        :return: filesize

        :raise Raises InvalidArgument if cannot parse string
        """
        import re

        val = val.strip().replace(' ', '').lower()

        match = re.match(r'^([0-9]+)([bkmgt]?)$', val)
        if match is None:
            raise ValueError('Unable to parse provided size string %r' % val)

        unit = match.group(2) if match.group(2) != '' else 'b'
        return int(match.group(1)) * pow(1024, 'bkmgt'.find(unit))
Parses size string trying to get size as int from it.

        Supported formats:
            "123" => 123
            "12k" => 12 * 1024
            "12M" => 12 * 1024 * 1024

        :param val: string representing sine
        :return: filesize

        :raise Raises InvalidArgument if cannot parse string
        
Parses size string trying to get size as int from it.

:param val: string representing sine
:return: filesize

:raise Raises InvalidArgument if cannot parse string
Parses size string trying to get size as int from it . : param val : string representing sine : return : filesize : raise Raises InvalidArgument if cannot parse string
def size_to_int(val: str) -> int:
        import re
        val = val.strip().replace(' ', '').lower()
        match = re.match(r'^([0-9]+)([bkmgt]?)$', val)
        if match is None:
            raise ValueError('Unable to parse provided size string %r' % val)
        unit = match.group(2) if match.group(2) != '' else 'b'
        return int(match.group(1)) * pow(1024, 'bkmgt'.find(unit))
def size_to_int ( val : str ) -> int : import re val = val . strip ( ) . replace ( ' ' , '' ) . lower ( ) match = re . match ( r'^([0-9]+)([bkmgt]?)$' , val ) if match is None : raise ValueError ( 'Unable to parse provided size string %r' % val ) unit = match . group ( 2 ) if match . group ( 2 ) != '' else 'b' return int ( match . group ( 1 ) ) * pow ( 1024 , 'bkmgt' . find ( unit ) )
Parses size string trying to get size as int from it.
Parses size string trying to get size as int from it .
"""Parses size string trying to get size as int from it.

        Supported formats:
            "123" => 123
            "12k" => 12 * 1024
            "12M" => 12 * 1024 * 1024

        :param val: string representing sine
        :return: filesize

        :raise Raises InvalidArgument if cannot parse string
        """
val
str