Mercurial > public > mercurial-scm > hg-stable
comparison contrib/byteify-strings.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 | bc9a9016467d |
children | 6000f5b25c9b |
comparison
equal
deleted
inserted
replaced
45956:346af7687c6f | 45957:89a2afe31e82 |
---|---|
211 # This looks like a function call. | 211 # This looks like a function call. |
212 if t.type == token.NAME and _isop(i + 1, '('): | 212 if t.type == token.NAME and _isop(i + 1, '('): |
213 fn = t.string | 213 fn = t.string |
214 | 214 |
215 # *attr() builtins don't accept byte strings to 2nd argument. | 215 # *attr() builtins don't accept byte strings to 2nd argument. |
216 if fn in ( | 216 if ( |
217 'getattr', | 217 fn |
218 'setattr', | 218 in ( |
219 'hasattr', | 219 'getattr', |
220 'safehasattr', | 220 'setattr', |
221 'wrapfunction', | 221 'hasattr', |
222 'wrapclass', | 222 'safehasattr', |
223 'addattr', | 223 'wrapfunction', |
224 ) and (opts['allow-attr-methods'] or not _isop(i - 1, '.')): | 224 'wrapclass', |
225 'addattr', | |
226 ) | |
227 and (opts['allow-attr-methods'] or not _isop(i - 1, '.')) | |
228 ): | |
225 arg1idx = _findargnofcall(1) | 229 arg1idx = _findargnofcall(1) |
226 if arg1idx is not None: | 230 if arg1idx is not None: |
227 _ensuresysstr(arg1idx) | 231 _ensuresysstr(arg1idx) |
228 | 232 |
229 # .encode() and .decode() on str/bytes/unicode don't accept | 233 # .encode() and .decode() on str/bytes/unicode don't accept |