Mercurial > public > mercurial-scm > hg-stable
diff hgext/fsmonitor/watchmanclient.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 | ab1900323b1d |
children | 687b865b95ad |
line wrap: on
line diff
--- a/hgext/fsmonitor/watchmanclient.py Sat Oct 05 10:29:34 2019 -0400 +++ b/hgext/fsmonitor/watchmanclient.py Sun Oct 06 09:45:02 2019 -0400 @@ -13,6 +13,7 @@ from . import pywatchman + class Unavailable(Exception): def __init__(self, msg, warn=True, invalidate=False): self.msg = msg @@ -27,11 +28,13 @@ else: return 'Watchman unavailable: %s' % self.msg + class WatchmanNoRoot(Unavailable): def __init__(self, root, msg): self.root = root super(WatchmanNoRoot, self).__init__(msg) + class client(object): def __init__(self, ui, root, timeout=1.0): err = None @@ -59,8 +62,9 @@ def getcurrentclock(self): result = self.command('clock') if not util.safehasattr(result, 'clock'): - raise Unavailable('clock result is missing clock value', - invalidate=True) + raise Unavailable( + 'clock result is missing clock value', invalidate=True + ) return result.clock def clearconnection(self): @@ -86,7 +90,8 @@ self._watchmanclient = pywatchman.client( timeout=self._timeout, useImmutableBser=True, - watchman_exe=watchman_exe) + watchman_exe=watchman_exe, + ) return self._watchmanclient.query(*watchmanargs) except pywatchman.CommandError as ex: if 'unable to resolve root' in ex.msg: