Size of the payload.
973239
def size(self) -> Optional[int]:
        """"""
        if not self._parts:
            return 0

        total = 0
        for part, encoding, te_encoding in self._parts:
            if encoding or te_encoding or part.size is None:
                return None

            total += int(
                2 + len(self._boundary) + 2 +  # b'--'+self._boundary+b'\r\n'
                part.size + len(part._binary_headers) +
                2  # b'\r\n'
            )

        total += 2 + len(self._boundary) + 4  # b'--'+self._boundary+b'--\r\n'
        return total
346973
def size(self, destination):
        
        if not destination in self.queue_metadata:
            return 0
        else:
            return len(self.queue_metadata[destination]['frames'])
946128
def __get_data_size(self):
        
        response = self.__response
        if response == const.CMD_PREPARE_DATA:
            size = unpack('I', self.__data[:4])[0]
            return size
        else:
            return 0
809188
def strsize (b):
    """"""
    if b < 0:
        raise ValueError("Invalid negative byte number")
    if b < 1024:
        return "%dB" % b
    if b < 1024 * 10:
        return "%dKB" % (b // 1024)
    if b < 1024 * 1024:
        return "%.2fKB" % (float(b) / 1024)
    if b < 1024 * 1024 * 10:
        return "%.2fMB" % (float(b) / (1024*1024))
    if b < 1024 * 1024 * 1024:
        return "%.1fMB" % (float(b) / (1024*1024))
    if b < 1024 * 1024 * 1024 * 10:
        return "%.2fGB" % (float(b) / (1024*1024*1024))
    return "%.1fGB" % (float(b) / (1024*1024*1024))
784645
public int length() {
        int length = 1 + 2 + deviceToken.length + 2 + payload.length;
        final int marshalledLength = marshall().length;
        assert marshalledLength == length;
        return length;
    }
524486
def size(self, type=None, failed=False):
        
        return len(self.nodes(type=type, failed=failed))
637098
def payload(self):
        """"""
        if not self._decoded_cache:
            self._decoded_cache = self.decode()
        return self._decoded_cache
357041
def SizeInBytes(sized_field, length, encoder=ENC_INT_DEFAULT, fuzzable=False, name=None):
    '''
    
    '''
    return Size(sized_field=sized_field, length=length, calc_func=lambda x: len(x) // 8, encoder=encoder, fuzzable=fuzzable, name=name)
677288
def from_payload(self, payload):
        """"""
        self.major_version = payload[0] * 256 + payload[1]
        self.minor_version = payload[2] * 256 + payload[3]
255235
def size(self):
        
        pos = self._stream.tell()
        # seek to the end of the stream
        self._stream.seek(0,2)
        size = self._stream.tell()
        self._stream.seek(pos, 0)

        return size
604298
def _readable_part_size(num_bytes):
    ""
    B = num_bytes
    KB = float(1024)
    MB = float(KB * 1024)
    GB = float(MB * 1024)
    TB = float(GB * 1024)

    if B < KB:
        return '{0} {1}'.format(B, 'bytes' if B != 1 else 'byte')
    elif KB <= B < MB:
        return '{0:.2f} KiB'.format(B/KB)
    elif MB <= B < GB:
        return '{0:.2f} MiB'.format(B/MB)
    elif GB <= B < TB:
        return '{0:.2f} GiB'.format(B/GB)
    elif TB <= B:
        return '{0:.2f} TiB'.format(B/TB)
1352416
def size(self, value):
        """"""
        self._size   = value
        self._thumb  = self._link_to_img()
189741
def sizeof_fmt(num):
    
    units = ['bytes', 'kB', 'MB', 'GB', 'TB', 'PB']
    decimals = [0, 0, 1, 2, 2, 2]
    if num > 1:
        exponent = min(int(log(num, 1024)), len(units) - 1)
        quotient = float(num) / 1024 ** exponent
        unit = units[exponent]
        num_decimals = decimals[exponent]
        format_string = '{0:.%sf} {1}' % (num_decimals)
        return format_string.format(quotient, unit)
    if num == 0:
        return '0 bytes'
    if num == 1:
        return '1 byte'
633932
def Size(self):
        
        return s.uint8 + s.uint8 + GetVarSize(self.Attributes) + GetVarSize(self.inputs) + GetVarSize(self.outputs) + GetVarSize(self.Scripts)
390543
def calculate_size(name, message):
    
    data_size = 0
    data_size += calculate_size_str(name)
    data_size += calculate_size_data(message)
    return data_size
542879
def get_size(self, name: str) -> int:
        """"""
        crc32 = binascii.crc32(name.encode())
        if crc32 in self.crc32_map:
            return self.crc32_map[crc32]

        if name in self.name_map:
            return self.name_map[name]

        return 0
194736
def build_payload(self, payload):
        """"""
        remaining_size = self.MAX_SEGMENT_PAYLOAD_SIZE

        for part in self.parts:
            part_payload = part.pack(remaining_size)
            payload.write(part_payload)
            remaining_size -= len(part_payload)