From b81d9ec9ffdb93cf988e4f74c3f4680340ff184f Mon Sep 17 00:00:00 2001 From: Slávek Banko Date: Mon, 16 Jan 2023 21:04:18 +0100 Subject: Drop python2 support. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Slávek Banko --- languages/python/kde_pydoc.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'languages/python/kde_pydoc.py') diff --git a/languages/python/kde_pydoc.py b/languages/python/kde_pydoc.py index 0516f172..c7c246bc 100755 --- a/languages/python/kde_pydoc.py +++ b/languages/python/kde_pydoc.py @@ -6,7 +6,7 @@ __author__ = "David Nolden, Ka-Ping Yee __version__ = "6 April 2006" import sys, imp, os, stat, re, types, cgi -from repr import Repr +from reprlib import Repr from string import expandtabs, find, join, lower, split, strip, rstrip import pydoc @@ -67,9 +67,9 @@ def writedocs(path, pkgpath='', depth=0, notprocessed=[]): if(depth == 1): if(len(notprocessed) != 0): - print "
the following paths were not processed because they are deeper than the maximum depth of " + str(__maxdepth) + ":
" + print("
the following paths were not processed because they are deeper than the maximum depth of " + str(__maxdepth) + ":
") for x in notprocessed: - print cgi.escape(x) + "
" + print(cgi.escape(x) + "
") def writedoc(key,top=False): """Write HTML documentation to a file in the current directory.""" @@ -86,19 +86,19 @@ def writedoc(key,top=False): seen = {} for dir in pydoc.pathdirs(): indices.append(pydoc.html.index(dir, seen)) - print cleanlinks(heading + join(indices)) + print(cleanlinks(heading + join(indices))) return if(type(key) != types.ModuleType): object = pydoc.locate(key) if(object == None and top): - print "could not locate module/object for key " + \ - cgi.escape(key) + "
go to index"; + print("could not locate module/object for key " + \ + cgi.escape(key) + "
go to index"); else: object = key if object: - print cleanlinks(pydoc.html.page(pydoc.describe(object), pydoc.html.document(object))) + print(cleanlinks(pydoc.html.page(pydoc.describe(object), pydoc.html.document(object)))) @@ -109,9 +109,9 @@ if __name__ == '__main__': try: opts, args = getopt.getopt(sys.argv[1:], 'k:p:w') - print "" - print "" - print "" + print("") + print("") + print("") if args: for arg in args: @@ -121,11 +121,11 @@ if __name__ == '__main__': if os.path.isfile(arg): arg = pydoc.importfile(arg) writedoc(arg, True) - except pydoc.ErrorDuringImport, value: - print 'problem in %s - %s' % ( - cgi.escape(value.filename), cgi.escape(value.exc)) + except pydoc.ErrorDuringImport as value: + print('problem in %s - %s' % ( + cgi.escape(value.filename), cgi.escape(value.exc))) else: raise BadUsage except (getopt.error, BadUsage): - print "need parameters\n" + print("need parameters\n") -- cgit v1.2.3