Mercurial > hg
comparison mercurial/exthelper.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 | c07dcf7a0247 |
children | 687b865b95ad |
comparison
equal
deleted
inserted
replaced
43075:57875cf423c9 | 43076:2372284d9457 |
---|---|
18 pycompat, | 18 pycompat, |
19 registrar, | 19 registrar, |
20 ) | 20 ) |
21 | 21 |
22 from hgdemandimport import tracing | 22 from hgdemandimport import tracing |
23 | |
23 | 24 |
24 class exthelper(object): | 25 class exthelper(object): |
25 """Helper for modular extension setup | 26 """Helper for modular extension setup |
26 | 27 |
27 A single helper should be instantiated for each module of an | 28 A single helper should be instantiated for each module of an |
279 | 280 |
280 def dec(wrapper): | 281 def dec(wrapper): |
281 if extension is None: | 282 if extension is None: |
282 self._commandwrappers.append((command, wrapper, opts)) | 283 self._commandwrappers.append((command, wrapper, opts)) |
283 else: | 284 else: |
284 self._extcommandwrappers.append((extension, command, wrapper, | 285 self._extcommandwrappers.append( |
285 opts)) | 286 (extension, command, wrapper, opts) |
287 ) | |
286 return wrapper | 288 return wrapper |
289 | |
287 return dec | 290 return dec |
288 | 291 |
289 def wrapfunction(self, container, funcname): | 292 def wrapfunction(self, container, funcname): |
290 """Decorated function is a function wrapper | 293 """Decorated function is a function wrapper |
291 | 294 |
298 @eh.function(discovery, 'checkheads') | 301 @eh.function(discovery, 'checkheads') |
299 def wrapfunction(orig, *args, **kwargs): | 302 def wrapfunction(orig, *args, **kwargs): |
300 ui.note('His head smashed in and his heart cut out') | 303 ui.note('His head smashed in and his heart cut out') |
301 return orig(*args, **kwargs) | 304 return orig(*args, **kwargs) |
302 """ | 305 """ |
306 | |
303 def dec(wrapper): | 307 def dec(wrapper): |
304 self._functionwrappers.append((container, funcname, wrapper)) | 308 self._functionwrappers.append((container, funcname, wrapper)) |
305 return wrapper | 309 return wrapper |
310 | |
306 return dec | 311 return dec |