示例#1
0
 def complete(self, prefix):
     names = [sig for sig in signal.__dict__.keys() if
              sig.startswith('SIG')]
     nums  = [str(eval("signal."+name)) for name in names]
     lnames = [sig.lower() for sig in names]
     completions = lnames + nums + ['unconditional']
     return Mcomplete.complete_token(completions, prefix.lower())
示例#2
0
def complete_identifier(cmd, prefix):
    """Complete an arbitrary expression."""
    if not cmd.proc.curframe:
        return [None]
    # Collect globals and locals.  It is usually not really sensible to also
    # complete builtins, and they clutter the namespace quite heavily, so we
    # leave them out.
    ns = cmd.proc.curframe.f_globals.copy()
    ns.update(cmd.proc.curframe.f_locals)
    if "." in prefix:
        # Walk an attribute chain up to the last part, similar to what
        # rlcompleter does.  This will bail if any of the parts are not
        # simple attribute access, which is what we want.
        dotted = prefix.split(".")
        try:
            obj = ns[dotted[0]]
            for part in dotted[1:-1]:
                obj = getattr(obj, part)
        except (KeyError, AttributeError):
            return []
        pre_prefix = ".".join(dotted[:-1]) + "."
        return [pre_prefix + n for n in dir(obj) if n.startswith(dotted[-1])]
    else:
        # Complete a simple name.
        return Mcomplete.complete_token(ns.keys(), prefix)
示例#3
0
 def complete(self, prefix):
     names = [sig for sig in signal.__dict__.keys() if
              sig.startswith('SIG')]
     nums  = [str(eval("signal."+name)) for name in names]
     lnames = [sig.lower() for sig in names]
     completions = lnames + nums + ['unconditionally']
     return Mcomplete.complete_token(completions, prefix.lower())
示例#4
0
def complete_identifier(cmd, prefix):
    '''Complete an arbitrary expression.'''
    if not cmd.proc.curframe: return [None]
    # Collect globals and locals.  It is usually not really sensible to also
    # complete builtins, and they clutter the namespace quite heavily, so we
    # leave them out.
    ns = cmd.proc.curframe.f_globals.copy()
    ns.update(cmd.proc.curframe.f_locals)
    if '.' in prefix:
        # Walk an attribute chain up to the last part, similar to what
        # rlcompleter does.  This will bail if any of the parts are not
        # simple attribute access, which is what we want.
        dotted = prefix.split('.')
        try:
            obj = ns[dotted[0]]
            for part in dotted[1:-1]:
                obj = getattr(obj, part)
        except (KeyError, AttributeError):
            return []
        pre_prefix = '.'.join(dotted[:-1]) + '.'
        return [pre_prefix + n for n in dir(obj) if
                n.startswith(dotted[-1])]
    else:
        # Complete a simple name.
        return Mcomplete.complete_token(ns.keys(), prefix)
示例#5
0
 def complete(self, prefix):
     proc_obj = self.proc
     matches = Mcomplete.complete_token(
         list(categories.keys()) + ['*', 'all'] +
         list(proc_obj.commands.keys()), prefix)
     aliases = Mcomplete.complete_token_filtered(proc_obj.aliases, prefix,
                                                 matches)
     return sorted(matches + aliases)
示例#6
0
 def complete(self, prefix):
     proc_obj = self.proc
     matches = Mcomplete.complete_token(list(categories.keys())
                                        + ['*', 'all'] +
                                        list(proc_obj.commands.keys()),
                                        prefix)
     aliases = Mcomplete.complete_token_filtered(proc_obj.aliases, prefix,
                                                 matches)
     return sorted(matches + aliases)
示例#7
0
    def test_complete(self):

        hash = {'ab': 1, 'aac': 2, 'aa': 3, 'a': 4}
        ary = sorted(hash.keys())
        for result, prefix in [[[], 'b'], [ary, 'a'], [['aa', 'aac'], 'aa'],
                               [ary, ''], [['ab'], 'ab'], [[], 'abc']]:
            self.assertEqual(result, Mcomplete.complete_token(ary, prefix),
                             "Trouble matching %s on %s" % (repr(ary), prefix))
            pass
        for result_keys, prefix in [[ary, 'a'], [['aa', 'aac'], 'aa'],
                                    [['ab'], 'ab'], [[], 'abc']]:
            result = [[key, hash[key]] for key in result_keys]
            self.assertEqual(
                result, Mcomplete.complete_token_with_next(hash, prefix),
                "Trouble matching %s on %s" % (repr(hash), prefix))
            pass
        return
    def test_complete(self):

        hash = {'ab': 1, 'aac': 2, 'aa': 3, 'a':  4}
        ary = sorted(hash.keys())
        for result, prefix in [
                [[], 'b'], [ary, 'a'],
                [['aa', 'aac'], 'aa'],
                [ary, ''], [['ab'], 'ab'], [[], 'abc']]:
            self.assertEqual(result, Mcomplete.complete_token(ary, prefix),
                             "Trouble matching %s on %s" %
                              (repr(ary), prefix))
            pass
        for result_keys, prefix in [
            [ary, 'a'],
            [['aa', 'aac'], 'aa'],
            [['ab'], 'ab'], [[], 'abc']]:
            result = [[key, hash[key]] for key in result_keys]
            self.assertEqual(result,
                             Mcomplete.complete_token_with_next(hash, prefix),
                             "Trouble matching %s on %s" %
                             (repr(hash), prefix))
            pass
        return
示例#9
0
 def complete(self, prefix):
     completions = sorted(['*'] + self.debugger.sigmgr.siglist)
     return Mcomplete.complete_token(completions, prefix)
示例#10
0
 def complete(self, prefix):
     return Mcomplete.complete_token(self.subcmds.subcmds.keys(), prefix)
示例#11
0
 def complete(self, prefix):
     m = sorted(list(self.proc.macros.keys()) + ["*"])
     return Mcomplete.complete_token(m, prefix)
示例#12
0
 def complete(self, prefix):
     result = Mcomplete.complete_token(("on", "off"), prefix)
     return result
示例#13
0
 def complete(self, prefix):
     completions = sorted(["."] + file_list())
     return Mcomplete.complete_token(completions, prefix)
示例#14
0
 def complete(self, prefix):
     completions = sorted(['*'] +
                           self.proc.curframe.f_locals.keys())
     return Mcomplete.complete_token(completions, prefix)
示例#15
0
def complete_break_linenumber(self, prefix):
    canonic_name = self.proc.curframe.f_code.co_filename
    completions = pyficache.trace_line_numbers(canonic_name)
    return Mcomplete.complete_token([str(i) for i in completions],
                                    prefix)
示例#16
0
 def complete(self, prefix):
     result = Mcomplete.complete_token(('on', 'off'), prefix)
     return result
示例#17
0
 def complete(self, prefix):
     m = sorted(list(self.proc.macros.keys()) + ['*'])
     return Mcomplete.complete_token(m, prefix)
示例#18
0
 def complete(self, prefix):
     return Mcomplete.complete_token(self.proc.aliases.keys(), prefix)
示例#19
0
def complete_id_and_builtins(cmd, prefix):
    if not cmd.proc.curframe: return [None]
    items = (list(cmd.proc.curframe.f_builtins.keys()) +
             complete_identifier(cmd, prefix))
    return Mcomplete.complete_token(items, prefix)
示例#20
0
 def complete(self, prefix):
     completions = sorted(['*'] + self.debugger.sigmgr.siglist)
     return Mcomplete.complete_token(completions, prefix)
示例#21
0
 def complete(self, prefix):
     result = Mcomplete.complete_token(('on', 'off'), prefix)
     return result
示例#22
0
 def complete(self, prefix):
     proc_obj = self.proc
     low, high = Mframe.frame_low_high(proc_obj, None)
     ary = [str(low+i) for i in range(high-low+1)]
     # FIXME: add in Thread names
     return Mcomplete.complete_token(ary, prefix)
示例#23
0
def frame_complete(proc_obj, prefix, direction):
    low, high = frame_low_high(proc_obj, direction)
    ary = [str(low+i) for i in range(high-low+1)]
    return Mcomplete.complete_token(ary, prefix)
示例#24
0
 def complete(self, prefix):
     completions = [str(disp.number) for disp in self.proc.display_mgr.list]
     return Mcomplete.complete_token(completions, prefix)
示例#25
0
 def complete(self, prefix):
     proc_obj = self.proc
     low, high = Mframe.frame_low_high(proc_obj, None)
     ary = [str(low + i) for i in range(high - low + 1)]
     # FIXME: add in Thread names
     return Mcomplete.complete_token(ary, prefix)
示例#26
0
 def complete(self, prefix):
     return Mcomplete.complete_token(style_names, prefix)
示例#27
0
 def complete(self, prefix):
     return Mcomplete.complete_token(SetHighlight.highlight_choices, prefix)
示例#28
0
 def complete(self, prefix):
     completions = [str(disp.number) for disp in self.proc.display_mgr.list]
     return Mcomplete.complete_token(completions, prefix)
示例#29
0
 def complete(self, prefix):
     return Mcomplete.complete_token(style_names, prefix)
示例#30
0
 def complete(self, prefix):
     return complete_token(SetLogLevel.logger_choices, prefix)
示例#31
0
def complete_break_linenumber(self, prefix):
    canonic_name = self.proc.curframe.f_code.co_filename
    completions = pyficache.trace_line_numbers(canonic_name)
    return Mcomplete.complete_token([str(i) for i in completions], prefix)
示例#32
0
 def complete(self, prefix):
     completions = sorted(['.'] + file_list())
     return Mcomplete.complete_token(completions, prefix)
示例#33
0
def complete_id_and_builtins(cmd, prefix):
    if not cmd.proc.curframe:
        return [None]
    items = list(cmd.proc.curframe.f_builtins.keys()) + complete_identifier(cmd, prefix)
    return Mcomplete.complete_token(items, prefix)
示例#34
0
 def complete(self, prefix):
     # files = Readline::FILENAME_COMPLETION_PROC.call(prefix) || []
     opts = ["-v", "-Y", "-N", "-c"]  # + files
     return complete_token(opts, prefix)
示例#35
0
 def complete(self, prefix):
     return Mcomplete.complete_token(self.subcmds.subcmds.keys(), prefix)
示例#36
0
 def complete(self, prefix):
     return Mcomplete.complete_token(SetHighlight.highlight_choices,
                                     prefix)
示例#37
0
 def complete(self, prefix):
     # files = Readline::FILENAME_COMPLETION_PROC.call(prefix) || []
     opts = ['-v', '-Y', '-N', '-c']  # + files
     return Mcomplete.complete_token(opts, prefix)
示例#38
0
 def complete(self, prefix):
     return complete_token(choices, prefix)
示例#39
0
 def complete(self, prefix):
     completions = sorted(['*'] + self.proc.curframe.f_locals.keys())
     return Mcomplete.complete_token(completions, prefix)
示例#40
0
 def complete(self, prefix):
     return Mcomplete.complete_token(self.proc.aliases.keys(), prefix)
示例#41
0
 def complete(self, prefix):
     # files = Readline::FILENAME_COMPLETION_PROC.call(prefix) || []
     opts = ['-v', '-Y', '-N', '-c']  # + files
     return Mcomplete.complete_token(opts, prefix)
示例#42
0
def frame_complete(proc_obj, prefix, direction):
    low, high = frame_low_high(proc_obj, direction)
    ary = [str(low + i) for i in range(high - low + 1)]
    return Mcomplete.complete_token(ary, prefix)