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())
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)
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())
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)
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)
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)
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
def complete(self, prefix): completions = sorted(['*'] + self.debugger.sigmgr.siglist) return Mcomplete.complete_token(completions, prefix)
def complete(self, prefix): return Mcomplete.complete_token(self.subcmds.subcmds.keys(), prefix)
def complete(self, prefix): m = sorted(list(self.proc.macros.keys()) + ["*"]) return Mcomplete.complete_token(m, prefix)
def complete(self, prefix): result = Mcomplete.complete_token(("on", "off"), prefix) return result
def complete(self, prefix): completions = sorted(["."] + file_list()) return Mcomplete.complete_token(completions, prefix)
def complete(self, prefix): completions = sorted(['*'] + self.proc.curframe.f_locals.keys()) return Mcomplete.complete_token(completions, prefix)
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)
def complete(self, prefix): result = Mcomplete.complete_token(('on', 'off'), prefix) return result
def complete(self, prefix): m = sorted(list(self.proc.macros.keys()) + ['*']) return Mcomplete.complete_token(m, prefix)
def complete(self, prefix): return Mcomplete.complete_token(self.proc.aliases.keys(), prefix)
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)
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)
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)
def complete(self, prefix): completions = [str(disp.number) for disp in self.proc.display_mgr.list] return Mcomplete.complete_token(completions, prefix)
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)
def complete(self, prefix): return Mcomplete.complete_token(style_names, prefix)
def complete(self, prefix): return Mcomplete.complete_token(SetHighlight.highlight_choices, prefix)
def complete(self, prefix): return complete_token(SetLogLevel.logger_choices, prefix)
def complete(self, prefix): completions = sorted(['.'] + file_list()) return Mcomplete.complete_token(completions, prefix)
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)
def complete(self, prefix): # files = Readline::FILENAME_COMPLETION_PROC.call(prefix) || [] opts = ["-v", "-Y", "-N", "-c"] # + files return complete_token(opts, prefix)
def complete(self, prefix): # files = Readline::FILENAME_COMPLETION_PROC.call(prefix) || [] opts = ['-v', '-Y', '-N', '-c'] # + files return Mcomplete.complete_token(opts, prefix)
def complete(self, prefix): return complete_token(choices, prefix)
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)