/usr/lib/python2.7/dist-packages/syslogng/debuggercli/readline.py is in syslog-ng-mod-python 3.8.1-10.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | #############################################################################
# Copyright (c) 2015-2016 Balabit
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 as published
# by the Free Software Foundation, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# As an additional exemption you are allowed to compile & link against the
# OpenSSL libraries as published by the OpenSSL project. See the file
# COPYING for details.
#
#############################################################################
from __future__ import absolute_import, print_function
import readline
import traceback
from .debuggercli import DebuggerCLI
class ReadlineCompleteHook(object):
def __init__(self, completer):
self._completer = completer
self._last_contents = (None, None)
self._last_completions = []
def complete(self, text, state):
# pylint: disable=broad-except
try:
entire_text = readline.get_line_buffer()[:readline.get_endidx()]
completions = self._get_completions(entire_text, text)
return completions[state]
except Exception:
traceback.print_exc()
def _get_completions(self, entire_text, text):
if self._last_contents == (entire_text, text):
return self._last_completions
self._last_completions = self._completer.complete(entire_text, text)
self._last_completions.append(None)
self._last_contents = (entire_text, text)
return self._last_completions
__setup_performed__ = False
def setup_readline():
# pylint: disable=global-statement
global __setup_performed__
if __setup_performed__:
return
debuggercli = DebuggerCLI()
readline.parse_and_bind("tab: complete")
readline.set_completer(ReadlineCompleteHook(debuggercli.get_root_completer()).complete)
readline.set_completer_delims(' \t\n\"\'`@><=;|&')
__setup_performed__ = True
|