Mercurial > hg-stable
comparison mercurial/registrar.py @ 45957:89a2afe31e82
formating: upgrade to black 20.8b1
This required a couple of small tweaks to un-confuse black, but now it
works. Big formatting changes come from:
* Dramatically improved collection-splitting logic upstream
* Black having a strong (correct IMO) opinion that """ is better than '''
Differential Revision: https://phab.mercurial-scm.org/D9430
author | Augie Fackler <raf@durin42.com> |
---|---|
date | Fri, 27 Nov 2020 17:03:29 -0500 |
parents | d7a508a75d72 |
children | c1bb02738f96 |
comparison
equal
deleted
inserted
replaced
45956:346af7687c6f | 45957:89a2afe31e82 |
---|---|
93 raise error.ProgrammingError(msg) | 93 raise error.ProgrammingError(msg) |
94 | 94 |
95 self._table.update(registrarbase._table) | 95 self._table.update(registrarbase._table) |
96 | 96 |
97 def _parsefuncdecl(self, decl): | 97 def _parsefuncdecl(self, decl): |
98 """Parse function declaration and return the name of function in it | 98 """Parse function declaration and return the name of function in it""" |
99 """ | |
100 i = decl.find(b'(') | 99 i = decl.find(b'(') |
101 if i >= 0: | 100 if i >= 0: |
102 return decl[:i] | 101 return decl[:i] |
103 else: | 102 else: |
104 return decl | 103 return decl |
119 'doc' is '__doc__.strip()' of the registered function. | 118 'doc' is '__doc__.strip()' of the registered function. |
120 """ | 119 """ |
121 return self._docformat % (decl, doc) | 120 return self._docformat % (decl, doc) |
122 | 121 |
123 def _extrasetup(self, name, func): | 122 def _extrasetup(self, name, func): |
124 """Execute extra setup for registered function, if needed | 123 """Execute extra setup for registered function, if needed""" |
125 """ | |
126 | 124 |
127 | 125 |
128 class command(_funcregistrarbase): | 126 class command(_funcregistrarbase): |
129 """Decorator to register a command function to table | 127 """Decorator to register a command function to table |
130 | 128 |
343 func._callstatus = callstatus | 341 func._callstatus = callstatus |
344 func._weight = weight | 342 func._weight = weight |
345 | 343 |
346 | 344 |
347 class _templateregistrarbase(_funcregistrarbase): | 345 class _templateregistrarbase(_funcregistrarbase): |
348 """Base of decorator to register functions as template specific one | 346 """Base of decorator to register functions as template specific one""" |
349 """ | |
350 | 347 |
351 _docformat = b":%s: %s" | 348 _docformat = b":%s: %s" |
352 | 349 |
353 | 350 |
354 class templatekeyword(_templateregistrarbase): | 351 class templatekeyword(_templateregistrarbase): |