summaryrefslogtreecommitdiffstats
path: root/Lib/reconvert.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-03-26 21:13:24 (GMT)
committerGuido van Rossum <guido@python.org>1998-03-26 21:13:24 (GMT)
commit45e2fbc2e70ef28b1f0327207f33dab3a4e825c5 (patch)
tree24cafdb6ffb07170188292a02440935291327cde /Lib/reconvert.py
parent9ea7024754f0e42d7fc70fd1c8f6f6cfbf7e1cf0 (diff)
downloadcpython-45e2fbc2e70ef28b1f0327207f33dab3a4e825c5.zip
cpython-45e2fbc2e70ef28b1f0327207f33dab3a4e825c5.tar.gz
cpython-45e2fbc2e70ef28b1f0327207f33dab3a4e825c5.tar.bz2
Mass check-in after untabifying all files that need it.
Diffstat (limited to 'Lib/reconvert.py')
-rwxr-xr-xLib/reconvert.py64
1 files changed, 32 insertions, 32 deletions
diff --git a/Lib/reconvert.py b/Lib/reconvert.py
index f0b61fc..2b044b6 100755
--- a/Lib/reconvert.py
+++ b/Lib/reconvert.py
@@ -108,36 +108,36 @@ def convert(s, syntax=None):
"""
table = mastertable.copy()
if syntax is None:
- syntax = regex.get_syntax()
+ syntax = regex.get_syntax()
if syntax & RE_NO_BK_PARENS:
- del table[r'\('], table[r'\)']
- del table['('], table[')']
+ del table[r'\('], table[r'\)']
+ del table['('], table[')']
if syntax & RE_NO_BK_VBAR:
- del table[r'\|']
- del table['|']
+ del table[r'\|']
+ del table['|']
if syntax & RE_BK_PLUS_QM:
- table['+'] = r'\+'
- table['?'] = r'\?'
- table[r'\+'] = '+'
- table[r'\?'] = '?'
+ table['+'] = r'\+'
+ table['?'] = r'\?'
+ table[r'\+'] = '+'
+ table[r'\?'] = '?'
if syntax & RE_NEWLINE_OR:
- table['\n'] = '|'
+ table['\n'] = '|'
res = ""
i = 0
end = len(s)
while i < end:
- c = s[i]
- i = i+1
- if c == '\\':
- c = s[i]
- i = i+1
- key = '\\' + c
- key = table.get(key, key)
- res = res + key
- else:
- c = table.get(c, c)
- res = res + c
+ c = s[i]
+ i = i+1
+ if c == '\\':
+ c = s[i]
+ i = i+1
+ key = '\\' + c
+ key = table.get(key, key)
+ res = res + key
+ else:
+ c = table.get(c, c)
+ res = res + c
return res
@@ -155,21 +155,21 @@ def quote(s, quote=None):
"""
if quote is None:
- q = "'"
- altq = "'"
- if q in s and altq not in s:
- q = altq
+ q = "'"
+ altq = "'"
+ if q in s and altq not in s:
+ q = altq
else:
- assert quote in ('"', "'")
- q = quote
+ assert quote in ('"', "'")
+ q = quote
res = q
for c in s:
- if c == q: c = '\\' + c
- elif c < ' ' or c > '~': c = "\\%03o" % ord(c)
- res = res + c
+ if c == q: c = '\\' + c
+ elif c < ' ' or c > '~': c = "\\%03o" % ord(c)
+ res = res + c
res = res + q
if '\\' in res:
- res = 'r' + res
+ res = 'r' + res
return res
@@ -179,7 +179,7 @@ def main():
s = eval(sys.stdin.read())
sys.stdout.write(quote(convert(s)))
if sys.stdout.isatty():
- sys.stdout.write("\n")
+ sys.stdout.write("\n")
if __name__ == '__main__':