]>
git.madduck.net Git - etc/vim.git/blobdiff - src/black/__init__.py
madduck's git repository
Every one of the projects in this repository is available at the canonical
URL git://git.madduck.net/madduck/pub/<projectpath> — see
each project's metadata for the exact URL.
All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@ git. madduck. net .
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
SSH access, as well as push access can be individually
arranged .
If you use my repositories frequently, consider adding the following
snippet to ~/.gitconfig and using the third clone URL listed for each
project:
[url "git://git.madduck.net/madduck/"]
insteadOf = madduck:
# if the leaves in the parsed string include a PERCENT, we need to
# make sure the initial LPAR is NOT preceded by an operator with
# higher or equal precedence to PERCENT
# if the leaves in the parsed string include a PERCENT, we need to
# make sure the initial LPAR is NOT preceded by an operator with
# higher or equal precedence to PERCENT
- if (
- is_valid_index(idx - 2)
- and token.PERCENT in {leaf.type for leaf in LL[idx - 1 : next_idx]}
- and (
+ if is_valid_index(idx - 2):
+ # mypy can't quite follow unless we name this
+ before_lpar = LL[idx - 2]
+ if token.PERCENT in {leaf.type for leaf in LL[idx - 1 : next_idx]} and (
in {
token.STAR,
token.AT,
in {
token.STAR,
token.AT,
)
or (
# only unary PLUS/MINUS
)
or (
# only unary PLUS/MINUS
- not is_valid_index(idx - 3)
- and (LL[idx - 2].type in {token.PLUS, token.MINUS})
+ before_lpar.parent
+ and before_lpar.parent.type == syms.factor
+ and (before_lpar.type in {token.PLUS, token.MINUS})
# Should be followed by a non-empty RPAR...
if (
# Should be followed by a non-empty RPAR...
if (