Mercurial > public > mercurial-scm > hg-stable
diff hgext/lfs/pointer.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 | b63dee7bd0d9 |
children | 687b865b95ad |
line wrap: on
line diff
--- a/hgext/lfs/pointer.py Sat Oct 05 10:29:34 2019 -0400 +++ b/hgext/lfs/pointer.py Sun Oct 06 09:45:02 2019 -0400 @@ -15,13 +15,13 @@ error, pycompat, ) -from mercurial.utils import ( - stringutil, -) +from mercurial.utils import stringutil + class InvalidPointer(error.StorageError): pass + class gitlfspointer(dict): VERSION = 'https://git-lfs.github.com/spec/v1' @@ -34,9 +34,10 @@ def deserialize(cls, text): try: return cls(l.split(' ', 1) for l in text.splitlines()).validate() - except ValueError: # l.split returns 1 item instead of 2 - raise InvalidPointer(_('cannot parse git-lfs text: %s') - % stringutil.pprint(text)) + except ValueError: # l.split returns 1 item instead of 2 + raise InvalidPointer( + _('cannot parse git-lfs text: %s') % stringutil.pprint(text) + ) def serialize(self): sortkeyfunc = lambda x: (x[0] != 'version', x) @@ -67,17 +68,22 @@ if not self._requiredre[k].match(v): raise InvalidPointer( _('unexpected lfs pointer value: %s=%s') - % (k, stringutil.pprint(v))) + % (k, stringutil.pprint(v)) + ) requiredcount += 1 elif not self._keyre.match(k): raise InvalidPointer(_('unexpected lfs pointer key: %s') % k) if not self._valuere.match(v): - raise InvalidPointer(_('unexpected lfs pointer value: %s=%s') - % (k, stringutil.pprint(v))) + raise InvalidPointer( + _('unexpected lfs pointer value: %s=%s') + % (k, stringutil.pprint(v)) + ) if len(self._requiredre) != requiredcount: miss = sorted(set(self._requiredre.keys()).difference(self.keys())) - raise InvalidPointer(_('missing lfs pointer keys: %s') - % ', '.join(miss)) + raise InvalidPointer( + _('missing lfs pointer keys: %s') % ', '.join(miss) + ) return self + deserialize = gitlfspointer.deserialize