Mercurial > public > mercurial-scm > hg-stable
diff mercurial/hgweb/wsgicgi.py @ 43554:9f70512ae2cf
cleanup: remove pointless r-prefixes on single-quoted strings
This is the promised second step on single-quoted strings. These had
existed because our source transformer didn't turn r'' into b'', so we
had tagged some strings as r-strings to get "native" strings on both
Pythons. Now that the transformer is gone, we can dispense with this
nonsense.
Methodology:
I ran
hg locate 'set:added() or modified() or clean()' | egrep '.*\.py$' | xargs egrep --color=never -n -- \[\^b\]\[\^a-z\]r\'\[\^\'\\\\\]\*\'\[\^\'\
in an emacs grep-mode buffer, and then used a keyboard macro to
iterate over the results and remove the r prefix as needed.
# skip-blame removing unneeded r prefixes left over from Python 3 migration.
Differential Revision: https://phab.mercurial-scm.org/D7306
author | Augie Fackler <augie@google.com> |
---|---|
date | Fri, 08 Nov 2019 11:19:20 -0800 |
parents | d783f945a701 |
children | 873d0fecb9a3 |
line wrap: on
line diff
--- a/mercurial/hgweb/wsgicgi.py Sun Nov 10 07:30:14 2019 -0800 +++ b/mercurial/hgweb/wsgicgi.py Fri Nov 08 11:19:20 2019 -0800 @@ -25,28 +25,28 @@ procutil.setbinary(procutil.stdout) environ = dict(pycompat.iteritems(os.environ)) # re-exports - environ.setdefault(r'PATH_INFO', b'') - if environ.get(r'SERVER_SOFTWARE', r'').startswith(r'Microsoft-IIS'): + environ.setdefault('PATH_INFO', b'') + if environ.get('SERVER_SOFTWARE', '').startswith('Microsoft-IIS'): # IIS includes script_name in PATH_INFO - scriptname = environ[r'SCRIPT_NAME'] - if environ[r'PATH_INFO'].startswith(scriptname): - environ[r'PATH_INFO'] = environ[r'PATH_INFO'][len(scriptname) :] + scriptname = environ['SCRIPT_NAME'] + if environ['PATH_INFO'].startswith(scriptname): + environ['PATH_INFO'] = environ['PATH_INFO'][len(scriptname) :] stdin = procutil.stdin - if environ.get(r'HTTP_EXPECT', r'').lower() == r'100-continue': + if environ.get('HTTP_EXPECT', '').lower() == '100-continue': stdin = common.continuereader(stdin, procutil.stdout.write) - environ[r'wsgi.input'] = stdin - environ[r'wsgi.errors'] = procutil.stderr - environ[r'wsgi.version'] = (1, 0) - environ[r'wsgi.multithread'] = False - environ[r'wsgi.multiprocess'] = True - environ[r'wsgi.run_once'] = True + environ['wsgi.input'] = stdin + environ['wsgi.errors'] = procutil.stderr + environ['wsgi.version'] = (1, 0) + environ['wsgi.multithread'] = False + environ['wsgi.multiprocess'] = True + environ['wsgi.run_once'] = True - if environ.get(r'HTTPS', r'off').lower() in (r'on', r'1', r'yes'): - environ[r'wsgi.url_scheme'] = r'https' + if environ.get('HTTPS', 'off').lower() in ('on', '1', 'yes'): + environ['wsgi.url_scheme'] = 'https' else: - environ[r'wsgi.url_scheme'] = r'http' + environ['wsgi.url_scheme'] = 'http' headers_set = [] headers_sent = []