returns played percentage [0,1] of item
760655
def percentage_played(self):
    ''''''
    played = self.object_dict.get('UserData', {}).get('PlaybackPositionTicks')
    total  = self.object_dict.get('RunTimeTicks') or 1
    return (played or 0)/total
986128
def percentage(self):
        
        total_vote_count = self.poll.vote_count
        if total_vote_count:
            return self.vote_count * 100.0 / total_vote_count
        return 0
901782
def critical_items(percentage = 75)
      raise ArgumentError, "Percentage must be an Integer between 0 and 100" if !percentage.between?(0, 100)
      response = api_response("critical-items", percentage)
      return response["requested_information"]
    end
1371739
def scores(self):
        
        return map(
            lambda x: (x[0], sum(x[1]) * len(x[1]) ** -.5),
            iter(self.items.viewitems())
        )
383014
def _percent_to_integer(percent):
    
    num = float(percent.split('%')[0]) / 100.0 * 255
    e = num - math.floor(num)
    return e < 0.5 and int(math.floor(num)) or int(math.ceil(num))
1334876
def to_percentage(number, rounding=2):
    
    number = float(number) * 100
    number_as_int = int(number)
    rounded = round(number, rounding)

    return '{}%'.format(number_as_int if number_as_int == rounded else rounded)
1042972
def get(self):
        """"""
        ret = sparklines(self.percents)[0]
        if self.__with_text:
            percents_without_none = [x for x in self.percents if x is not None]
            if len(percents_without_none) > 0:
                ret = '{}{:5.1f}%'.format(ret, percents_without_none[-1])
        return nativestr(ret)
129523
def percent_of_the_time(p):
    
    def decorator(fn):

        def wrapped(*args, **kwargs):
            if in_percentage(p):
                fn(*args, **kwargs)

        return wrapped

    return decorator
1256195
def get_real_percent(self):
        """"""
        if not (self.votes and self.score):
            return 0
        return 100 * (self.get_real_rating() / self.field.range)
980420
def get(self):
        """"""
        frac, whole = modf(self.size * self.percent / 100.0)
        ret = curses_bars[8] * int(whole)
        if frac > 0:
            ret += curses_bars[int(frac * 8)]
            whole += 1
        ret += self.__empty_char * int(self.size - whole)
        if self.__with_text:
            ret = '{}{:5.1f}%'.format(ret, self.percent)
        return ret
223363
def health_percentage(self) -> Union[int, float]:
        
        if self._proto.health_max == 0:
            return 0
        return self._proto.health / self._proto.health_max
440909
def home_save_percentage(self):
        
        try:
            save_pct = float(self.home_saves) / float(self.away_shots_on_goal)
            return round(save_pct, 3)
        except ZeroDivisionError:
            return 0.0
198313
def entropy_calc(item, POP):
    
    try:
        result = 0
        for i in item.keys():
            likelihood = item[i] / POP[i]
            if likelihood != 0:
                result += likelihood * math.log(likelihood, 2)
        return -result
    except Exception:
        return "None"
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();
        }
      }
    }
1069305
def _get_things(self, method, thing, thing_type, params=None, cacheable=True):
        """"""

        limit = params.get("limit", 1)
        seq = []
        for node in _collect_nodes(
            limit, self, self.ws_prefix + "." + method, cacheable, params
        ):
            title = _extract(node, "name")
            artist = _extract(node, "name", 1)
            playcount = _number(_extract(node, "playcount"))

            seq.append(TopItem(thing_type(artist, title, self.network), playcount))

        return seq
506711
def Percentile(pmf, percentage):
    
    p = percentage / 100.0
    total = 0
    for val, prob in pmf.Items():
        total += prob
        if total >= p:
            return val
193453
def perc(arr, p=95, **kwargs):
    """"""
    offset = (100 - p) / 2
    return np.percentile(arr, (offset, 100 - offset), **kwargs)