remove usage of six.print_()

This commit is contained in:
Alexandre Detiste
2024-03-20 14:39:16 +01:00
committed by Scott Talbert
parent 5abeba2f5d
commit beb9932241
7 changed files with 67 additions and 59 deletions

View File

@@ -6,8 +6,9 @@ printTreeDocs and printTreeSpec.
:license: BSD, see LICENSE_BSD_Simple.txt for details.
"""
from __future__ import print_function
import sys
from .. import py2and3
__all__ = ('printImported', 'StructMsg', 'Callback', 'Enum' )
@@ -16,7 +17,7 @@ def printImported():
"""Output a list of pubsub modules imported so far"""
ll = sorted([mod for mod in sys.modules if mod.find('pubsub') >= 0])
py2and3.print_('\n'.join(ll))
print('\n'.join(ll))
class StructMsg:

View File

@@ -45,6 +45,8 @@ of the XML tree.
:license: BSD, see LICENSE_BSD_Simple.txt for details.
"""
from __future__ import print_function
__author__ = 'Joshua R English'
__revision__ = 6
__date__ = '2013-07-27'
@@ -80,7 +82,7 @@ def _get_elem(elem):
try:
elem = ET.fromstring(elem)
except:
py2and3.print_("Value Error", elem)
print("Value Error", elem)
raise ValueError("Cannot convert to element")
return elem

View File

@@ -31,9 +31,11 @@ Usage: python pywxrc.py -h
-o, --output output filename, or - for stdout
"""
from __future__ import print_function
import sys, os, getopt, glob, re
import xml.dom.minidom as minidom
from six import print_, byte2int
from six import byte2int
#----------------------------------------------------------------------
@@ -286,7 +288,7 @@ class XmlResourceCompiler:
gettextStrings += self.FindStringsInNode(resourceDocument.firstChild)
# now write it all out
print_(self.templates.FILE_HEADER, file=outputFile)
print(self.templates.FILE_HEADER, file=outputFile)
# Note: Technically it is not legal to have anything other
# than ascii for class and variable names, but since the user
@@ -295,23 +297,23 @@ class XmlResourceCompiler:
# later when they try to run the program.
if subclasses:
subclasses = self.ReplaceBlocks(u"\n".join(subclasses))
print_(subclasses, file=outputFile)
print(subclasses, file=outputFile)
if classes:
classes = self.ReplaceBlocks(u"\n".join(classes))
print_(classes, file=outputFile)
print(classes, file=outputFile)
print_(self.templates.INIT_RESOURE_HEADER, file=outputFile)
print(self.templates.INIT_RESOURE_HEADER, file=outputFile)
if embedResources:
print_(self.templates.PREPARE_MEMFS, file=outputFile)
print(self.templates.PREPARE_MEMFS, file=outputFile)
resources = u"\n".join(resources)
print_(resources, file=outputFile)
print(resources, file=outputFile)
if generateGetText:
# gettextStrings is a list of unicode strings as returned by ConvertText
conversions = [u' _("%s")' % s for s in gettextStrings]
conversion_block = u"\n".join(conversions)
conversion_func = self.templates.GETTEXT_DUMMY_FUNC % conversion_block
print_(conversion_func, file=outputFile)
print(conversion_func, file=outputFile)
#-------------------------------------------------------------------
@@ -327,7 +329,7 @@ class XmlResourceCompiler:
strings = self.FindStringsInNode(resource)
# strings is a list of unicode strings as returned by ConvertText
strings = ['_("%s");' % s for s in strings]
print_("\n".join(strings), file=outputFile)
print("\n".join(strings), file=outputFile)
#-------------------------------------------------------------------
@@ -940,10 +942,10 @@ def main(args=None):
except IOError as exc:
print_("%s." % str(exc), file=sys.stderr)
print("%s." % str(exc), file=sys.stderr)
else:
if outputFilename != "-":
print_("Resources written to %s." % outputFilename, file=sys.stderr)
print("Resources written to %s." % outputFilename, file=sys.stderr)
if __name__ == "__main__":
main(sys.argv[1:])