Gets the average cycletime of the current user for the past week.
        This includes any ticket that was marked "In Progress" but not reopened.
6706
def get_week_avg_cycletime(self):
        
        def moving_average(new_val, old_avg, prev_n):
            return (new_val + old_avg) / (prev_n + 1)

        active_tickets_jql = 'assignee=currentUser() and status was "In Progress" DURING (startOfWeek(), endofweek()) and status not in (Backlog, Open) ORDER BY updated DESC'

        week_active_tickets = self.search_issues(active_tickets_jql)

        avg_cycletime = 0
        n_issues = 0
        for issue in week_active_tickets:
            cycle_time = self.get_cycle_time(self.get_issue(issue.key))
            avg_cycletime = moving_average(cycle_time, avg_cycletime, n_issues)
            n_issues = n_issues + 1

        return avg_cycletime
491502
def progress(UserUser_presence=0):
    """"""
    a = TpPd(pd=0x3)
    b = MessageType(mesType=0x3)  # 00000011
    c = ProgressIndicator()
    packet = a / b / c
    if UserUser_presence is 1:
        d = UserUserHdr()
        packet = packet / d
    return packet
444470
def get_current_user(self):
        """"""
        url = self.current_user_url
        result = self.get(url)
        return result
1146770
function() {
      if (progress.length) {
        SpeedIndex = 0;
        var lastTime = 0;
        var lastProgress = 0;
        for (var i = 0; i < progress.length; i++) {
          var elapsed = progress[i].tm - lastTime;
          if (elapsed > 0 && lastProgress < 1)
            SpeedIndex += (1 - lastProgress) * elapsed;
          lastTime = progress[i].tm;
          lastProgress = progress[i].progress;
        }
      } else {
        SpeedIndex = firstPaint;
      }
    }
439216
def get_current_time(self):
        
        current_time = c_double()
        self.library.get_current_time.argtypes = [POINTER(c_double)]
        self.library.get_current_time.restype = None
        self.library.get_current_time(byref(current_time))
        return current_time.value
1289435
def metrics(self, ticket):
        
        return self._query_zendesk(self.endpoint.metrics, 'ticket_metric', id=ticket)
1353820
def getUptime(self):
        
        try:
            fp = open(uptimeFile, 'r')
            line = fp.readline()
            fp.close()
        except:
            raise IOError('Failed reading stats from file: %s' % uptimeFile)
        return float(line.split()[0])
584246
def last_written_time(self):
    """"""
    if not self._registry_key and self._registry:
      self._GetKeyFromRegistry()

    if not self._registry_key:
      return None

    return self._registry_key.last_written_time
1195204
def get_elapsed_time(self, issue):
        
        last_mark = None

        # Get the last mark from the work logs
        worklogs = self.get_worklog(issue)
        if worklogs:
            last_worklog = worklogs[-1]
            last_mark = dateutil.parser.parse(last_worklog.raw['updated'])

        # If no worklogs, get the time since the issue was marked In Progress
        if not last_mark:
            last_mark = self.get_datetime_issue_in_progress(issue)

        if last_mark:
            now = datetime.datetime.now(dateutil.tz.tzlocal())
            delta = now - last_mark
            minutes = int(utils.timedelta_total_seconds(delta) / 60)
            if minutes > 0:
                return str(minutes) + 'm'
            else:
                return None
279714
public long checkPause() {
        if (pauseOnLongQueue &&
                (getNumOfPendingMessages() > queue4Sink.remainingCapacity() ||
                getNumOfPendingMessages() > MAX_PENDING_MESSAGES_TO_PAUSE)) {
            double throughputRate = Math.max(throughput.meanRate(), 1.0);
            return (long) (getNumOfPendingMessages() / throughputRate);
        } else {
            return 0;
        }
    }
882838
protected double getCurrentRate() {
        long rampUp = owner.getRampUpSeconds();
        long hold = owner.getHoldSeconds();
        long steps = owner.getStepsAsLong();
        double throughput = owner.getTargetLevelFactored();
        double timeOffset = rollingTime / 1000.0 - startTime;

        if (timeOffset >= rampUp + hold) {
            return -1; // means no more requests
        }

        if (rampUp == 0 || timeOffset > rampUp) {
            return throughput;
        } else if (steps > 0) {
            double stepSize = throughput / (double) steps;
            double stepLen = rampUp / (double) steps;
            return stepSize * (Math.floor(timeOffset / stepLen) + 1);
        } else {
            double slope = throughput / rampUp;
            return slope * Math.sqrt(2 * scheduledCount / slope);
        }
    }
639409
@JmxGetter(name = "avgFetchKeysNetworkTimeMs", description = "average time spent on network, for fetch keys")
    public double getAvgFetchKeysNetworkTimeMs() {
        return networkTimeCounterMap.get(Operation.FETCH_KEYS).getAvgEventValue() / Time.NS_PER_MS;
    }
172875
def __get_metrics(self):
        
        esfilters_merge = None
        esfilters_abandon = None
        esfilters_submit = None
        if self.esfilters:
            esfilters_merge = self.esfilters.copy()
            esfilters_abandon = self.esfilters.copy()
            esfilters_submit = self.esfilters.copy()

        merged = Merged(self.es_url, self.es_index,
                        start=self.start, end=self.end,
                        esfilters=esfilters_merge, interval=self.interval)
        # For BMI we need when the ticket was closed
        merged.FIELD_DATE = 'closed'

        abandoned = Abandoned(self.es_url, self.es_index,
                              start=self.start, end=self.end,
                              esfilters=esfilters_abandon, interval=self.interval)
        # For BMI we need when the ticket was closed
        abandoned.FIELD_DATE = 'closed'

        submitted = Submitted(self.es_url, self.es_index,
                              start=self.start, end=self.end,
                              esfilters=esfilters_submit,
                              interval=self.interval)

        return (merged, abandoned, submitted)
227303
def recent(self, include=None):
        
        return self._query_zendesk(self.endpoint.recent, 'ticket', id=None, include=include)
842233
def get_ticket_results(mgr, ticket_id, update_count=1):
    
    ticket = mgr.get_ticket(ticket_id)

    table = formatting.KeyValueTable(['name', 'value'])
    table.align['name'] = 'r'
    table.align['value'] = 'l'

    table.add_row(['id', ticket['id']])
    table.add_row(['title', ticket['title']])
    table.add_row(['priority', PRIORITY_MAP[ticket.get('priority', 0)]])
    if ticket.get('assignedUser'):
        user = ticket['assignedUser']
        table.add_row([
            'user',
            "%s %s" % (user.get('firstName'), user.get('lastName')),
        ])

    table.add_row(['status', ticket['status']['name']])
    table.add_row(['created', ticket.get('createDate')])
    table.add_row(['edited', ticket.get('lastEditDate')])

    # Only show up to the specified update count
    updates = ticket.get('updates', [])
    count = min(len(updates), update_count)
    count_offset = len(updates) - count + 1  # Display as one-indexed
    for i, update in enumerate(updates[-count:]):
        wrapped_entry = ""

        # Add user details (fields are different between employee and users)
        editor = update.get('editor')
        if editor:
            if editor.get('displayName'):
                wrapped_entry += "By %s (Employee)\n" % (editor['displayName'])
            if editor.get('firstName'):
                wrapped_entry += "By %s %s\n" % (editor.get('firstName'),
                                                 editor.get('lastName'))

        # NOTE(kmcdonald): Windows new-line characters need to be stripped out
        wrapped_entry += click.wrap_text(update['entry'].replace('\r', ''))
        table.add_row(['update %s' % (count_offset + i,), wrapped_entry])

    return table
1663
def get_ticket(self, service):
        """"""
        return self.auth_tickets \
            .filter(expires__gt=datetime.now(timezone.utc), service=service) \
            .last()
1243865
def get_cycle_mrkr(self, end=False):
        
        if self.annot is None:  # remove if buttons are disabled
            self.parent.statusBar().showMessage('No score file loaded')
            return

        window_start = self.parent.value('window_start')
        window_length = self.parent.value('window_length')

        try:
            self.annot.set_cycle_mrkr(window_start, end=end)

        except KeyError:
            msg = ('The start of the window does not correspond to any epoch '
                   'in sleep scoring file')
            self.parent.statusBar().showMessage(msg)
            lg.debug(msg)

        else:
            bound = 'start'
            if end:
                bound = 'end'
            lg.info('User marked ' + str(window_start) + ' as cycle ' +
                    bound)

            self.parent.overview.mark_cycles(window_start, window_length,
                                             end=end)