diff options
author | Guido van Rossum <guido@python.org> | 2007-05-02 19:09:54 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-05-02 19:09:54 (GMT) |
commit | ef87d6ed94780fe00250a551031023aeb2898365 (patch) | |
tree | 1f8989aaaec7ec5f8b2f26498317f2022bf85531 /Lib/idlelib | |
parent | 572dbf8f1320c0b34b9c786e5c30ba4a4b61b292 (diff) | |
download | cpython-ef87d6ed94780fe00250a551031023aeb2898365.zip cpython-ef87d6ed94780fe00250a551031023aeb2898365.tar.gz cpython-ef87d6ed94780fe00250a551031023aeb2898365.tar.bz2 |
Rip out all the u"..." literals and calls to unicode().
Diffstat (limited to 'Lib/idlelib')
-rw-r--r-- | Lib/idlelib/EditorWindow.py | 2 | ||||
-rw-r--r-- | Lib/idlelib/IOBinding.py | 12 | ||||
-rw-r--r-- | Lib/idlelib/OutputWindow.py | 2 | ||||
-rw-r--r-- | Lib/idlelib/PyParse.py | 2 | ||||
-rw-r--r-- | Lib/idlelib/PyShell.py | 2 |
5 files changed, 10 insertions, 10 deletions
diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py index 7cd6c1f..7e75a6c 100644 --- a/Lib/idlelib/EditorWindow.py +++ b/Lib/idlelib/EditorWindow.py @@ -276,7 +276,7 @@ class EditorWindow(object): def _filename_to_unicode(self, filename): """convert filename to unicode in order to display it in Tk""" - if isinstance(filename, unicode) or not filename: + if isinstance(filename, str) or not filename: return filename else: try: diff --git a/Lib/idlelib/IOBinding.py b/Lib/idlelib/IOBinding.py index b433c9b..006e94b 100644 --- a/Lib/idlelib/IOBinding.py +++ b/Lib/idlelib/IOBinding.py @@ -255,7 +255,7 @@ class IOBinding: firsteol = self.eol_re.search(chars) if firsteol: self.eol_convention = firsteol.group(0) - if isinstance(self.eol_convention, unicode): + if isinstance(self.eol_convention, str): # Make sure it is an ASCII string self.eol_convention = self.eol_convention.encode("ascii") chars = self.eol_re.sub(r"\n", chars) @@ -298,18 +298,18 @@ class IOBinding: enc = None if enc: try: - return unicode(chars, enc) + return str(chars, enc) except UnicodeError: pass # If it is ASCII, we need not to record anything try: - return unicode(chars, 'ascii') + return str(chars, 'ascii') except UnicodeError: pass # Finally, try the locale's encoding. This is deprecated; # the user should declare a non-ASCII encoding try: - chars = unicode(chars, encoding) + chars = str(chars, encoding) self.fileencoding = encoding except UnicodeError: pass @@ -522,7 +522,7 @@ class IOBinding: self.opendialog = tkFileDialog.Open(master=self.text, filetypes=self.filetypes) filename = self.opendialog.show(initialdir=dir, initialfile=base) - if isinstance(filename, unicode): + if isinstance(filename, str): filename = filename.encode(filesystemencoding) return filename @@ -544,7 +544,7 @@ class IOBinding: self.savedialog = tkFileDialog.SaveAs(master=self.text, filetypes=self.filetypes) filename = self.savedialog.show(initialdir=dir, initialfile=base) - if isinstance(filename, unicode): + if isinstance(filename, str): filename = filename.encode(filesystemencoding) return filename diff --git a/Lib/idlelib/OutputWindow.py b/Lib/idlelib/OutputWindow.py index 787e9b0..ae795e1 100644 --- a/Lib/idlelib/OutputWindow.py +++ b/Lib/idlelib/OutputWindow.py @@ -39,7 +39,7 @@ class OutputWindow(EditorWindow): # we assume that they are in the locale's encoding if isinstance(s, str): try: - s = unicode(s, IOBinding.encoding) + s = str(s, IOBinding.encoding) except UnicodeError: # some other encoding; let Tcl deal with it pass diff --git a/Lib/idlelib/PyParse.py b/Lib/idlelib/PyParse.py index 1a9db67..463ad36 100644 --- a/Lib/idlelib/PyParse.py +++ b/Lib/idlelib/PyParse.py @@ -105,7 +105,7 @@ _tran = ''.join(_tran) del ch try: - UnicodeType = type(unicode("")) + UnicodeType = type(str("")) except NameError: UnicodeType = None diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py index 692467d..2d69157 100644 --- a/Lib/idlelib/PyShell.py +++ b/Lib/idlelib/PyShell.py @@ -1008,7 +1008,7 @@ class PyShell(OutputWindow): line = self.text.get("iomark", "end-1c") if len(line) == 0: # may be EOF if we quit our mainloop with Ctrl-C line = "\n" - if isinstance(line, unicode): + if isinstance(line, str): import IOBinding try: line = line.encode(IOBinding.encoding) |