packet loss as a percentage
486232
def packet_loss(self):
        ''''''
        if self.mav_count == 0:
            return 0
        return (100.0*self.mav_loss)/(self.mav_count+self.mav_loss)
911791
def percent_encode(text, encode_set=DEFAULT_ENCODE_SET, encoding='utf-8'):
    '''
    '''
    byte_string = text.encode(encoding)

    try:
        mapping = _percent_encoder_map_cache[encode_set]
    except KeyError:
        mapping = _percent_encoder_map_cache[encode_set] = PercentEncoderMap(
            encode_set).__getitem__

    return ''.join([mapping(char) for char in byte_string])
42120
def percent_bandwidth(data, period, std=2.0):
    
    catch_errors.check_for_period_error(data, period)

    period = int(period)
    percent_bandwidth = ((np.array(data) -
                         lower_bollinger_band(data, period, std)) /
                         bb_range(data, period, std)
                         )

    return percent_bandwidth
1091685
function Packet(e) {
    if(e instanceof Buffer) {
        this.data   = e;
        this.length = this.data.length;
    }else if((typeof Buffer) != 'undefined' && e.data instanceof Buffer) {
        this.data   = e.data;
        this.length = this.data.length;
    }else{
        this.data   = new DataView(e.data);
        this.length = this.data.byteLength;
    }

    this.offset = 0;
}
64961
def _recv_robust(self, sock, size):
        
        while True:
            try:
                return sock.recv(size)
            except socket.error as e:
                if e.errno != errno.EINTR:
                    raise
169751
function(param) {
            var percentEncoded = encodeURIComponent(param);

            // %-encode characters not handled by `encodeURIComponent` (to follow RFC 3986)
            percentEncoded = percentEncoded.replace(/[!'()]/g, escape);

            // %-encode characters not handled by `escape` (to follow RFC 3986)
            percentEncoded = percentEncoded.replace(/\*/g, "%2A");

            // replace percent-encoded spaces with a "+"
            return percentEncoded.replace(/%20/g, "+");
        }
289699
def print_packet_count():
    """"""
    for name in archive.list_packet_names():
        packet_count = 0
        for group in archive.list_packet_histogram(name):
            for rec in group.records:
                packet_count += rec.count
        print('  {: <40} {: >20}'.format(name, packet_count))
612022
def exitClient(self):
    """"""
    self.sendRtspRequest(self.TEARDOWN)
    #self.handler()
    os.remove(CACHE_FILE_NAME + str(self.sessionId) + CACHE_FILE_EXT) # Delete the cache image from video
    rate = float(self.counter/self.frameNbr)
    print('-'*60 + "\nRTP Packet Loss Rate :" + str(rate) +"\n" + '-'*60)
    sys.exit(0)
459807
function() {
      var currPercentage = 0;
      log('_bytesTotal = ' + _bytesTotal);
      log('_bytesLoaded = ' + _bytesLoaded);
      currPercentage = Math.round((_bytesLoaded / _bytesTotal) * 100);

      log('Percentage: ' + currPercentage + '%');

      onUpdate(currPercentage);

      if (!_files[_currentSegment].length) {

        // Is there another group of files.
        _currentSegment++;

        if (_files[_currentSegment]) {
          startLoading();
        } else {
          onComplete();
        }
      }
    }
910987
def _get_loss_fn(self):
        """"""
        criteria = self.criteria.to(self.config["device"])
        loss_fn = lambda X, Y: sum(
            criteria(Y_tp, Y_t) for Y_tp, Y_t in zip(self.forward(X), Y)
        )
        return loss_fn
916951
function checkRateRange(num) {
    var numString = num.substring(0, num.length - 1);
    var parseNum = parseInt(numString);
    if (parseNum < 20) {
        throw new Error("The minimum rate is twenty percentage. Received: " + parseNum);
    }
}
347671
def percent(args=None):
    '''
    
    '''
    if __grains__['kernel'] == 'Linux':
        cmd = 'df -P'
    elif __grains__['kernel'] == 'OpenBSD' or __grains__['kernel'] == 'AIX':
        cmd = 'df -kP'
    else:
        cmd = 'df'
    ret = {}
    out = __salt__['cmd.run'](cmd, python_shell=False).splitlines()
    for line in out:
        if not line:
            continue
        if line.startswith('Filesystem'):
            continue
        comps = line.split()
        while len(comps) >= 2 and not comps[1].isdigit():
            comps[0] = '{0} {1}'.format(comps[0], comps[1])
            comps.pop(1)
        if len(comps) < 2:
            continue
        try:
            if __grains__['kernel'] == 'Darwin':
                ret[comps[8]] = comps[4]
            else:
                ret[comps[5]] = comps[4]
        except IndexError:
            log.error('Problem parsing disk usage information')
            ret = {}
    if args and args not in ret:
        log.error(
            'Problem parsing disk usage information: Partition \'%s\' '
            'does not exist!', args
        )
        ret = {}
    elif args:
        return ret[args]

    return ret
1193844
def packet_write(self):
        """"""
        bytes_written = 0
        
        if self.sock == NC.INVALID_SOCKET:
            return NC.ERR_NO_CONN, bytes_written
        
        while len(self.out_packet) > 0:
            pkt = self.out_packet[0]
            write_length, status = nyamuk_net.write(self.sock, pkt.payload)
            if write_length > 0:
                pkt.to_process -= write_length
                pkt.pos += write_length
                
                bytes_written += write_length
                
                if pkt.to_process > 0:
                    return NC.ERR_SUCCESS, bytes_written
            else:
                if status == errno.EAGAIN or status == errno.EWOULDBLOCK:
                    return NC.ERR_SUCCESS, bytes_written
                elif status == errno.ECONNRESET:
                    return NC.ERR_CONN_LOST, bytes_written
                else:
                    return NC.ERR_UNKNOWN, bytes_written
            
            """
            if pkt.command & 0xF6 == NC.CMD_PUBLISH and self.on_publish is not None:
                self.in_callback = True
                self.on_publish(pkt.mid)
                self.in_callback = False
            """
            
            #next
            del self.out_packet[0]
            
            #free data (unnecessary)
            
            self.last_msg_out = time.time()
            
        
        return NC.ERR_SUCCESS, bytes_written
590486
def gprsSuspensionRequest():
    """"""
    a = TpPd(pd=0x6)
    b = MessageType()
    c = Tlli()
    d = RoutingAreaIdentification()
    e = SuspensionCause()
    packet = a / b / c / d / e
    return packet
238767
def percent
      return unless (buffer = accept_stripped :exp_percent)
      match_start = buffer[-1]
      match_name = :"percent#{match_start}"

      unless Tokens[match_name]
        match_end = Tokens.bracket(match_start) || match_start

        match_inner = "\\#{match_start}"
        match_inner += "\\#{match_end}" unless match_end == match_start

        pattern = /(((?:[^#{match_inner}\\]|\\.)*?)#{'\\' + match_end})/

        Tokens[match_name] = pattern
      end

      buffer += accept match_name
      buffer
    end
679456
def format_throughput(available, used=None):
    
    if used is None:
        return str(available)
    percent = float(used) / available
    return "{0:.0f}/{1:.0f} ({2:.0%})".format(used, available, percent)
344886
def _sense_packet_to_data(packet):
        """"""
        data = bytearray(0)
        last = 0
        i = 1
        while (i < len(packet)):
            if not (last == 2 and packet[i] == 0):
                data.append(packet[i])
            last = packet[i]
            i += 1

        return data