Mercurial > public > mercurial-scm > hg
diff mercurial/hgweb/wsgicgi.py @ 43076:2372284d9457
formatting: blacken the codebase
This is using my patch to black
(https://github.com/psf/black/pull/826) so we don't un-wrap collection
literals.
Done with:
hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**"' | xargs black -S
# skip-blame mass-reformatting only
# no-check-commit reformats foo_bar functions
Differential Revision: https://phab.mercurial-scm.org/D6971
author | Augie Fackler <augie@google.com> |
---|---|
date | Sun, 06 Oct 2019 09:45:02 -0400 |
parents | 2d5b5bcc3b9f |
children | 687b865b95ad |
line wrap: on
line diff
--- a/mercurial/hgweb/wsgicgi.py Sat Oct 05 10:29:34 2019 -0400 +++ b/mercurial/hgweb/wsgicgi.py Sun Oct 06 09:45:02 2019 -0400 @@ -12,29 +12,24 @@ import os -from .. import ( - pycompat, -) +from .. import pycompat -from ..utils import ( - procutil, -) +from ..utils import procutil -from . import ( - common, -) +from . import common + def launch(application): procutil.setbinary(procutil.stdin) procutil.setbinary(procutil.stdout) - environ = dict(os.environ.iteritems()) # re-exports + environ = dict(os.environ.iteritems()) # re-exports environ.setdefault(r'PATH_INFO', '') if environ.get(r'SERVER_SOFTWARE', r'').startswith(r'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):] + environ[r'PATH_INFO'] = environ[r'PATH_INFO'][len(scriptname) :] stdin = procutil.stdin if environ.get(r'HTTP_EXPECT', r'').lower() == r'100-continue': @@ -65,8 +60,10 @@ status, response_headers = headers_sent[:] = headers_set out.write('Status: %s\r\n' % pycompat.bytesurl(status)) for hk, hv in response_headers: - out.write('%s: %s\r\n' % (pycompat.bytesurl(hk), - pycompat.bytesurl(hv))) + out.write( + '%s: %s\r\n' + % (pycompat.bytesurl(hk), pycompat.bytesurl(hv)) + ) out.write('\r\n') out.write(data) @@ -79,7 +76,7 @@ # Re-raise original exception if headers sent raise exc_info[0](exc_info[1], exc_info[2]) finally: - exc_info = None # avoid dangling circular ref + exc_info = None # avoid dangling circular ref elif headers_set: raise AssertionError("Headers already set!") @@ -91,6 +88,6 @@ for chunk in content: write(chunk) if not headers_sent: - write('') # send headers now if body was empty + write('') # send headers now if body was empty finally: getattr(content, 'close', lambda: None)()