]>
git.madduck.net Git - etc/vim.git/commitdiff
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:
summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (parent:
28d1442 )
Fixes #21
# Keep in sync with setup.cfg which is used for source packages.
[flake8]
# Keep in sync with setup.cfg which is used for source packages.
[flake8]
+ignore = E266, E501, W503
max-line-length = 80
max-complexity = 15
select = B,C,E,F,W,T4,B9
max-line-length = 80
max-complexity = 15
select = B,C,E,F,W,T4,B9
if leaf.type == token.STRING and self.previous.type == token.STRING:
self.delimiters[id(self.previous)] = STRING_PRIORITY
elif (
if leaf.type == token.STRING and self.previous.type == token.STRING:
self.delimiters[id(self.previous)] = STRING_PRIORITY
elif (
- leaf.type == token.NAME and
- leaf.value == 'for' and
- leaf.parent and
- leaf.parent.type in {syms.comp_for, syms.old_comp_for}
+ leaf.type == token.NAME
+ and leaf.value == 'for'
+ and leaf.parent
+ and leaf.parent.type in {syms.comp_for, syms.old_comp_for}
):
self.delimiters[id(self.previous)] = COMPREHENSION_PRIORITY
elif (
):
self.delimiters[id(self.previous)] = COMPREHENSION_PRIORITY
elif (
- leaf.type == token.NAME and
- leaf.value == 'if' and
- leaf.parent and
- leaf.parent.type in {syms.comp_if, syms.old_comp_if}
+ leaf.type == token.NAME
+ and leaf.value == 'if'
+ and leaf.parent
+ and leaf.parent.type in {syms.comp_if, syms.old_comp_if}
):
self.delimiters[id(self.previous)] = COMPREHENSION_PRIORITY
):
self.delimiters[id(self.previous)] = COMPREHENSION_PRIORITY
+ elif (
+ leaf.type == token.NAME
+ and leaf.value in LOGIC_OPERATORS
+ and leaf.parent
+ ):
+ self.delimiters[id(self.previous)] = LOGIC_PRIORITY
if leaf.type in OPENING_BRACKETS:
self.bracket_match[self.depth, BRACKET[leaf.type]] = leaf
self.depth += 1
if leaf.type in OPENING_BRACKETS:
self.bracket_match[self.depth, BRACKET[leaf.type]] = leaf
self.depth += 1
@property
def is_class(self) -> bool:
return (
@property
def is_class(self) -> bool:
return (
- bool(self) and
- self.leaves[0].type == token.NAME and
- self.leaves[0].value == 'class'
+ bool(self)
+ and self.leaves[0].type == token.NAME
+ and self.leaves[0].value == 'class'
except IndexError:
second_leaf = None
return (
except IndexError:
second_leaf = None
return (
- (first_leaf.type == token.NAME and first_leaf.value == 'def') or
- (
- first_leaf.type == token.NAME and
- first_leaf.value == 'async' and
- second_leaf is not None and
- second_leaf.type == token.NAME and
- second_leaf.value == 'def'
+ (first_leaf.type == token.NAME and first_leaf.value == 'def')
+ or (
+ first_leaf.type == token.NAME
+ and first_leaf.value == 'async'
+ and second_leaf is not None
+ and second_leaf.type == token.NAME
+ and second_leaf.value == 'def'
)
)
@property
def is_flow_control(self) -> bool:
return (
)
)
@property
def is_flow_control(self) -> bool:
return (
- bool(self) and
- self.leaves[0].type == token.NAME and
- self.leaves[0].value in FLOW_CONTROL
+ bool(self)
+ and self.leaves[0].type == token.NAME
+ and self.leaves[0].value in FLOW_CONTROL
)
@property
def is_yield(self) -> bool:
return (
)
@property
def is_yield(self) -> bool:
return (
- bool(self) and
- self.leaves[0].type == token.NAME and
- self.leaves[0].value == 'yield'
+ bool(self)
+ and self.leaves[0].type == token.NAME
+ and self.leaves[0].value == 'yield'
)
def maybe_remove_trailing_comma(self, closing: Leaf) -> bool:
if not (
)
def maybe_remove_trailing_comma(self, closing: Leaf) -> bool:
if not (
- self.leaves and
- self.leaves[-1].type == token.COMMA and
- closing.type in CLOSING_BRACKETS
+ self.leaves
+ and self.leaves[-1].type == token.COMMA
+ and closing.type in CLOSING_BRACKETS
appended will appear "too long" when splitting.
"""
if not (
appended will appear "too long" when splitting.
"""
if not (
- comment.type == STANDALONE_COMMENT and
- self.bracket_tracker.any_open_brackets()
+ comment.type == STANDALONE_COMMENT
+ and self.bracket_tracker.any_open_brackets()
- self.previous_line and
- self.previous_line.is_import and
- not current_line.is_import and
- depth == self.previous_line.depth
+ self.previous_line
+ and self.previous_line.is_import
+ and not current_line.is_import
+ and depth == self.previous_line.depth
):
return (before or 1), 0
if (
):
return (before or 1), 0
if (
- self.previous_line and
- self.previous_line.is_yield an d
- (not current_line.is_yield or depth != self.previous_line.depth)
+ self.previous_line
+ and self.previous_line.is_yiel d
+ and (not current_line.is_yield or depth != self.previous_line.depth)
):
return (before or 1), 0
):
return (before or 1), 0
- p.type == syms.listmaker or
- p.type == syms.testlist_gexp or
- p.type == syms.subscriptlist
+ p.type == syms.listmaker
+ or p.type == syms.testlist_gexp
+ or p.type == syms.subscriptlist
):
# list interior, including unpacking
if not prev:
):
# list interior, including unpacking
if not prev:
if leaf.type == token.COMMA:
return COMMA_PRIORITY
if leaf.type == token.COMMA:
return COMMA_PRIORITY
- if leaf.type == token.NAME and leaf.value in LOGIC_OPERATORS:
- return LOGIC_PRIORITY
-
if leaf.type in COMPARATORS:
return COMPARATOR_PRIORITY
if (
if leaf.type in COMPARATORS:
return COMPARATOR_PRIORITY
if (
- leaf.type in MATH_OPERATORS and
- leaf.parent and
- leaf.parent.type not in {syms.factor, syms.star_expr}
+ leaf.type in MATH_OPERATORS
+ and leaf.parent
+ and leaf.parent.type not in {syms.factor, syms.star_expr}
matching_bracket = None
for leaf in line.leaves:
if (
matching_bracket = None
for leaf in line.leaves:
if (
- current_leaves is body_leaves and
- leaf.type in CLOSING_BRACKETS and
- leaf.opening_bracket is matching_bracket
+ current_leaves is body_leaves
+ and leaf.type in CLOSING_BRACKETS
+ and leaf.opening_bracket is matching_bracket
):
current_leaves = tail_leaves if body_leaves else head_leaves
current_leaves.append(leaf)
):
current_leaves = tail_leaves if body_leaves else head_leaves
current_leaves.append(leaf)
current_line.append(comment_after, preformatted=True)
lowest_depth = min(lowest_depth, leaf.bracket_depth)
if (
current_line.append(comment_after, preformatted=True)
lowest_depth = min(lowest_depth, leaf.bracket_depth)
if (
- leaf.bracket_depth == lowest_depth and
- leaf.type == token.STAR or
- leaf.type == token.DOUBLESTAR
+ leaf.bracket_depth == lowest_depth
+ and leaf.type == token.STAR
+ or leaf.type == token.DOUBLESTAR
):
trailing_comma_safe = trailing_comma_safe and py36
leaf_priority = delimiters.get(id(leaf))
):
trailing_comma_safe = trailing_comma_safe and py36
leaf_priority = delimiters.get(id(leaf))
current_line = Line(depth=line.depth, inside_brackets=line.inside_brackets)
if current_line:
if (
current_line = Line(depth=line.depth, inside_brackets=line.inside_brackets)
if current_line:
if (
- delimiter_priority == COMMA_PRIORITY and
- current_line.leaves[-1].type != token.COMMA and
- trailing_comma_safe
+ delimiter_priority == COMMA_PRIORITY
+ and current_line.leaves[-1].type != token.COMMA
+ and trailing_comma_safe
):
current_line.append(Leaf(token.COMMA, ','))
normalize_prefix(current_line.leaves[0])
):
current_line.append(Leaf(token.COMMA, ','))
normalize_prefix(current_line.leaves[0])
t = leaf.type
v = leaf.value
return bool(
t = leaf.type
v = leaf.value
return bool(
- t == token.NAME and
- (
- (v == 'import' and p and p.type == syms.import_name) or
- (v == 'from' and p and p.type == syms.import_from)
+ t == token.NAME
+ and (
+ (v == 'import' and p and p.type == syms.import_name)
+ or (v == 'from' and p and p.type == syms.import_from)
- n.type == syms.typedargslist and
- n.children and
- n.children[-1].type == token.COMMA
+ n.type == syms.typedargslist
+ and n.children
+ and n.children[-1].type == token.COMMA
):
for ch in n.children:
if ch.type == token.STAR or ch.type == token.DOUBLESTAR:
):
for ch in n.children:
if ch.type == token.STAR or ch.type == token.DOUBLESTAR:
body,
parameters.children[-1], # )2
]
body,
parameters.children[-1], # )2
]
- if (self._proc is not None and
+ if (self._proc is not None
# has the child process finished?
# has the child process finished?
- self._returncode is None and
+ and self._returncode is None
# the child process has finished, but the
# transport hasn't been notified yet?
# the child process has finished, but the
# transport hasn't been notified yet?
- self._proc.poll() is None):
+ and self._proc.poll() is None):
parameters.children[-1], # )2
]
if (
parameters.children[-1], # )2
]
if (
- self._proc is not None and
# has the child process finished?
# has the child process finished?
- self._returncode is None and
+ and self._returncode is None
# the child process has finished, but the
# transport hasn't been notified yet?
# the child process has finished, but the
# transport hasn't been notified yet?
- self._proc.poll() is None
+ and self._proc.poll() is None
async def f():
await some.complicated[0].call(with_args=(True or (1 is not 1)))
async def f():
await some.complicated[0].call(with_args=(True or (1 is not 1)))
+if (
+ threading.current_thread() != threading.main_thread() and
+ threading.current_thread() != threading.main_thread() or
+ signal.getsignal(signal.SIGINT) != signal.default_int_handler
+):
+ return True
async def f():
await some.complicated[0].call(with_args=(True or (1 is not 1)))
async def f():
await some.complicated[0].call(with_args=(True or (1 is not 1)))
+
+
+if (
+ threading.current_thread() != threading.main_thread()
+ and threading.current_thread() != threading.main_thread()
+ or signal.getsignal(signal.SIGINT) != signal.default_int_handler
+):
+ return True