diff options
author | Walter Dörwald <walter@livinglogic.de> | 2002-06-03 15:58:32 (GMT) |
---|---|---|
committer | Walter Dörwald <walter@livinglogic.de> | 2002-06-03 15:58:32 (GMT) |
commit | 65230a2de758fbde57b3893c402436ae0202ada3 (patch) | |
tree | 4b0b8431990125dd567b23c4ad3325959dc91a2e /Lib/markupbase.py | |
parent | a401ae4010eeb385a0775c505637bbc332bc184c (diff) | |
download | cpython-65230a2de758fbde57b3893c402436ae0202ada3.zip cpython-65230a2de758fbde57b3893c402436ae0202ada3.tar.gz cpython-65230a2de758fbde57b3893c402436ae0202ada3.tar.bz2 |
Remove uses of the string and types modules:
x in string.whitespace => x.isspace()
type(x) in types.StringTypes => isinstance(x, basestring)
isinstance(x, types.StringTypes) => isinstance(x, basestring)
type(x) is types.StringType => isinstance(x, str)
type(x) == types.StringType => isinstance(x, str)
string.split(x, ...) => x.split(...)
string.join(x, y) => y.join(x)
string.zfill(x, ...) => x.zfill(...)
string.count(x, ...) => x.count(...)
hasattr(types, "UnicodeType") => try: unicode except NameError:
type(x) != types.TupleTuple => not isinstance(x, tuple)
isinstance(x, types.TupleType) => isinstance(x, tuple)
type(x) is types.IntType => isinstance(x, int)
Do not mention the string module in the rlcompleter docstring.
This partially applies SF patch http://www.python.org/sf/562373
(with basestring instead of string). (It excludes the changes to
unittest.py and does not change the os.stat stuff.)
Diffstat (limited to 'Lib/markupbase.py')
-rw-r--r-- | Lib/markupbase.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/Lib/markupbase.py b/Lib/markupbase.py index ae19869..acd0726 100644 --- a/Lib/markupbase.py +++ b/Lib/markupbase.py @@ -1,7 +1,6 @@ """Shared support for scanning document type declarations in HTML and XHTML.""" import re -import string _declname_match = re.compile(r'[a-zA-Z][-_.a-zA-Z0-9]*\s*').match _declstringlit_match = re.compile(r'(\'[^\']*\'|"[^"]*")\s*').match @@ -151,7 +150,7 @@ class ParserBase: j = j + 1 elif c == "]": j = j + 1 - while j < n and rawdata[j] in string.whitespace: + while j < n and rawdata[j].isspace(): j = j + 1 if j < n: if rawdata[j] == ">": @@ -160,7 +159,7 @@ class ParserBase: self.error("unexpected char after internal subset") else: return -1 - elif c in string.whitespace: + elif c.isspace(): j = j + 1 else: self.updatepos(declstartpos, j) @@ -203,7 +202,7 @@ class ParserBase: j = rawdata.find(")", j) + 1 else: return -1 - while rawdata[j:j+1] in string.whitespace: + while rawdata[j:j+1].isspace(): j = j + 1 if not rawdata[j:]: # end of buffer, incomplete @@ -268,7 +267,7 @@ class ParserBase: c = rawdata[j:j+1] if not c: return -1 - if c in string.whitespace: + if c.isspace(): j = j + 1 else: break |