Autocomplete the Entry.
        
        :param delta: 0, 1 or -1: how to cycle through possible hits
        :type delta: int
179638
def autocomplete(self, delta=0):
        
        if delta:  # need to delete selection otherwise we would fix the current position
            self.delete(self.position, tk.END)
        else:  # set position to end so selection starts where textentry ended
            self.position = len(self.get())
        # collect hits
        _hits = []
        for element in self._completion_list:
            if element.lower().startswith(self.get().lower()):  # Match case-insensitively
                _hits.append(element)
        # if we have a new hit list, keep this in mind
        if _hits != self._hits:
            self._hit_index = 0
            self._hits = _hits
        # only allow cycling if we are in a known hit list
        if _hits == self._hits and self._hits:
            self._hit_index = (self._hit_index + delta) % len(self._hits)
        # now finally perform the auto completion
        if self._hits:
            self.delete(0, tk.END)
            self.insert(0, self._hits[self._hit_index])
            self.select_range(self.position, tk.END)
1360423
def for_prompt(cls, **kw):
        
        kw.setdefault('enable_abort_and_exit_bindings', True)
        kw.setdefault('enable_search', True)
        kw.setdefault('enable_auto_suggest_bindings', True)

        return cls(**kw)
395127
def complete(self, text, line, begin, end):
        
        self.fire_event('precomplete', text, line, begin, end)
        choices = self._complete(text, line, begin, end)
        choices -= self.completion_excludes
        sz = len(choices)
        if sz == 1:
            # XXX: This is pretty bad logic here.  In reality we need much
            # more complicated escape handling and imbalanced quote support.
            return set(shlex.quote(x) for x in choices)
        elif sz > 2:
            # We don't need the sentinel choice to prevent completion
            # when there is already more than 1 choice.
            choices -= {completer.ActionCompleter.sentinel}
        self.fire_event('postcomplete', choices)
        return choices
535764
@Override
    public void beforeCompletion() {
        if (tc.isEntryEnabled()) {
            Tr.entry(this, tc, "beforeCompletion");
            Tr.exit(this, tc, "beforeCompletion");
        }
    }
713460
def increment(self, delta=1, text=None):
        """"""
        return self.update(value=min(self.max, self.value + delta), text=text)
267187
def autocomplete(self, line):
        """"""
        current_length = len(line)
        self._current_line = line
        if current_length == 1 and self._last_position > 1:
            # Reset state.  This is likely from a user completing
            # a previous command.
            self.reset()
        elif current_length < self._last_position:
            # The user has hit backspace.  We'll need to check
            # the current words.
            return self._handle_backspace()
        elif not line:
            return []
        elif current_length != self._last_position + 1:
            return self._complete_from_full_parse()

        # This position is important.  We only update the _last_position
        # after we've checked the special cases above where that value
        # matters.
        self._last_position = len(line)
        if line and not line.strip():
            # Special case, the user hits a space on a new line so
            # we autocomplete all the top level commands.
            return self._current['commands']

        last_word = line.split()[-1]
        if last_word in self.arg_metadata or last_word in self._global_options:
            # The last thing we completed was an argument, record
            # this as self.last_arg
            self.last_option = last_word
        if line[-1] == ' ':
            # At this point the user has autocompleted a command
            # or an argument and has hit space.  If they've
            # just completed a command, we need to change the
            # current context and traverse into the subcommand.
            # "ec2 "
            #      ^--here, need to traverse into "ec2"
            #
            # Otherwise:
            # "ec2 --no-validate-ssl "
            #                        ^-- here, stay on "ec2" context.
            if not last_word.startswith('-'):
                next_command = self._current['children'].get(last_word)
                if next_command is not None:
                    self._current = next_command
                    self._current_name = last_word
                    self.cmd_path.append(self._current_name)
            elif last_word in self.arg_metadata and \
                    self.arg_metadata[last_word]['example']:
                # Then this is an arg with a shorthand example so we'll
                # suggest that example.
                return [self.arg_metadata[last_word]['example']]
            # Even if we don't change context, we still want to
            # autocomplete all the commands for the current context
            # in either of the above two cases.
            return self._current['commands'][:]
        elif last_word.startswith('-'):
            # TODO: cache this for the duration of the current context.
            # We don't need to recompute this until the args are
            # different.
            all_args = self._get_all_args()
            if self.match_fuzzy:
                return fuzzy_search(last_word, all_args)
            else:
                return substring_search(last_word, all_args)
        if self.match_fuzzy:
            return fuzzy_search(last_word, self._current['commands'])
        else:
            return substring_search(last_word, self._current['commands'])
36596
def _enter(self):
        """"""
        command = self.command
        logger.log(5, "Snippet keystroke `Enter`.")
        # NOTE: we need to set back the actions (mode_off) before running
        # the command.
        self.mode_off()
        self.run(command)
663870
def autocomplete(self):
        
        if self.completion_env_var_name not in os.environ:
            return
        cwords = os.environ['COMP_WORDS'].split()[1:]
        cword = int(os.environ['COMP_CWORD'])
        try:
            current = cwords[cword-1]
        except IndexError:
            current = ''
        cmd_names = self.get_commands().keys()

        if current:
            self.stdout.write(unicode(' '.join(
                [name for name in cmd_names if name.startswith(current)])))

        sys.exit(1)
1338409
def advance_time_delta(timedelta):
    """"""
    assert(utcnow.override_time is not None)
    try:
        for dt in utcnow.override_time:
            dt += timedelta
    except TypeError:
        utcnow.override_time += timedelta
605775
def _front_delta(self):
        """"""
        if self.flags & self.NO_MOVE:
            return Separator(0, 0)

        if self.clicked and self.hovered:  # the mouse is over the button
            delta = 2

        elif self.hovered and not self.flags & self.NO_HOVER:
            delta = 0

        else:
            delta = 0

        return Separator(delta, delta)
21459
public AutoComplete autoCompleteDirectory(String prefix) {
        final Trie<CliValueType> possibilities = childDirectories.subTrie(prefix).mapValues(CliValueType.DIRECTORY.<CliDirectory>getMapper());
        return new AutoComplete(prefix, possibilities);
    }
1145704
public void plusSeconds(long delta)
    {
        if (delta != 0)
        {
            long result = getSecond() + delta;
            setSecond((int) Math.floorMod(result, 60));
            plusMinutes(Math.floorDiv(result, 60));
        }
    }
1098766
def build_autocomplete_options
      # First parse to find illegal syntax in the existing query,
      # this method will throw exception on bad syntax.
      is_query_valid

      # get the completion options
      node = last_node
      completion = complete_options(node)

      suggestions = []
      suggestions += complete_keyword        if completion.include?(:keyword)
      suggestions += LOGICAL_INFIX_OPERATORS if completion.include?(:logical_op)
      suggestions += LOGICAL_PREFIX_OPERATORS + NULL_PREFIX_COMPLETER if completion.include?(:prefix_op)
      suggestions += complete_operator(node) if completion.include?(:infix_op)
      suggestions += complete_value          if completion.include?(:value)

      build_suggestions(suggestions, completion.include?(:value))
    end
975660
def setDelta(self, delta):
        
        days = int(delta.days)
        secs = int(delta.total_seconds())
        
        direction = 'from now'
        if secs < 0:
            direction = 'ago'
        
        if days and days % 365 == 0:
            number = days / 365
            unit = 'year(s)'
        elif days and days % 30 == 0:
            number = days / 30
            unit = 'month(s)'
        elif days and days % 7 == 0:
            number = days / 7
            unit = 'week(s)'
        elif days:
            number = days
            unit = 'day(s)'
        elif secs % 3600 == 0:
            number = secs / 3600
            unit = 'hour(s)'
        elif secs % 60 == 0:
            number = secs / 60
            unit = 'minute(s)'
        else:
            number = secs
            unit = 'second(s)'
        
        self._numberSpinner.setValue(abs(int(number)))
        self._unitCombo.setCurrentIndex(self._unitCombo.findText(unit))
        index = self._directionCombo.findText(direction)
        self._directionCombo.setCurrentIndex(index)
1109045
def set_completion_list(self, completion_list):
        
        self._completion_list = sorted(completion_list, key=str.lower)  # Work with a sorted list
        self._hits = []
        self._hit_index = 0
        self.position = 0
        self.bind('<KeyRelease>', self.handle_keyrelease)
1252067
def get_delta(D, k):
    ''''''
    if k < 0:
        raise Exception('k must be at least 0th order.')
    result = D
    for i in range(k):
        result = D.T.dot(result) if i % 2 == 0 else D.dot(result)
    return result
397975
public void add(T item, long delta) {
        MutableLong entry = map.get(item);
        if (entry == null) {
            entry = MutableLong.valueOf(delta);
            map.put(item, entry);
        } else {
            entry.value += delta;
        }
        total += delta;
    }