formatting: run black version 19.10b0 on the codebase
The latest version of black is out and contains the change we needed. So we can
start using it now.
note: `test-check-format.t` will complains about this changes because it still
use `grey` and need to be migrated to `black`. See next changesets for this.
--- a/hgext/gpg.py Sun Oct 27 20:16:59 2019 +0100
+++ b/hgext/gpg.py Tue Oct 29 10:41:30 2019 +0100
@@ -76,10 +76,9 @@
fp = os.fdopen(fd, r'wb')
fp.write(data)
fp.close()
- gpgcmd = b"%s --logger-fd 1 --status-fd 1 --verify \"%s\" \"%s\"" % (
- self.path,
- sigfile,
- datafile,
+ gpgcmd = (
+ b"%s --logger-fd 1 --status-fd 1 --verify \"%s\" \"%s\""
+ % (self.path, sigfile, datafile,)
)
ret = procutil.filter(b"", gpgcmd)
finally:
--- a/mercurial/config.py Sun Oct 27 20:16:59 2019 +0100
+++ b/mercurial/config.py Tue Oct 29 10:41:30 2019 +0100
@@ -212,11 +212,9 @@
def read(self, path, fp=None, sections=None, remap=None):
if not fp:
fp = util.posixfile(path, b'rb')
- assert (
- getattr(fp, 'mode', r'rb') == r'rb'
- ), b'config files must be opened in binary mode, got fp=%r mode=%r' % (
- fp,
- fp.mode,
+ assert getattr(fp, 'mode', r'rb') == r'rb', (
+ b'config files must be opened in binary mode, got fp=%r mode=%r'
+ % (fp, fp.mode,)
)
self.parse(
path, fp.read(), sections=sections, remap=remap, include=self.read
--- a/mercurial/context.py Sun Oct 27 20:16:59 2019 +0100
+++ b/mercurial/context.py Tue Oct 29 10:41:30 2019 +0100
@@ -1187,10 +1187,9 @@
assert (
changeid is not None or fileid is not None or changectx is not None
- ), b"bad args: changeid=%r, fileid=%r, changectx=%r" % (
- changeid,
- fileid,
- changectx,
+ ), (
+ b"bad args: changeid=%r, fileid=%r, changectx=%r"
+ % (changeid, fileid, changectx,)
)
if filelog is not None:
--- a/mercurial/manifest.py Sun Oct 27 20:16:59 2019 +0100
+++ b/mercurial/manifest.py Tue Oct 29 10:41:30 2019 +0100
@@ -867,12 +867,15 @@
return not self._dirs or all(m._isempty() for m in self._dirs.values())
def __repr__(self):
- return b'<treemanifest dir=%s, node=%s, loaded=%s, dirty=%s at 0x%x>' % (
- self._dir,
- hex(self._node),
- bool(self._loadfunc is _noop),
- self._dirty,
- id(self),
+ return (
+ b'<treemanifest dir=%s, node=%s, loaded=%s, dirty=%s at 0x%x>'
+ % (
+ self._dir,
+ hex(self._node),
+ bool(self._loadfunc is _noop),
+ self._dirty,
+ id(self),
+ )
)
def dir(self):
--- a/tests/run-tests.py Sun Oct 27 20:16:59 2019 +0100
+++ b/tests/run-tests.py Tue Oct 29 10:41:30 2019 +0100
@@ -3116,9 +3116,7 @@
vlog("# Using HGTMP", _strpath(self._hgtmp))
vlog("# Using PATH", os.environ["PATH"])
vlog(
- "# Using",
- _strpath(IMPL_PATH),
- _strpath(osenvironb[IMPL_PATH]),
+ "# Using", _strpath(IMPL_PATH), _strpath(osenvironb[IMPL_PATH]),
)
vlog("# Writing to directory", _strpath(self._outputdir))