-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix outdated references to 3.6 and run pyupgrade #3286
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -270,8 +270,7 @@ def _generate_ignored_nodes_from_fmt_skip( | |
while "\n" not in prev_sibling.prefix and prev_sibling.prev_sibling is not None: | ||
prev_sibling = prev_sibling.prev_sibling | ||
siblings.insert(0, prev_sibling) | ||
for sibling in siblings: | ||
yield sibling | ||
yield from siblings | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this require typing change ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, the code is equivalent (IIRC there are subtle differences around exception handling but those don't matter here). |
||
elif ( | ||
parent is not None and parent.type == syms.suite and leaf.type == token.NEWLINE | ||
): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,12 +58,7 @@ def shutdown(loop: asyncio.AbstractEventLoop) -> None: | |
|
||
for task in to_cancel: | ||
task.cancel() | ||
if sys.version_info >= (3, 7): | ||
loop.run_until_complete(asyncio.gather(*to_cancel, return_exceptions=True)) | ||
else: | ||
loop.run_until_complete( | ||
asyncio.gather(*to_cancel, loop=loop, return_exceptions=True) | ||
) | ||
loop.run_until_complete(asyncio.gather(*to_cancel, return_exceptions=True)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Much cleaner. |
||
finally: | ||
# `concurrent.futures.Future` objects cannot be cancelled once they | ||
# are already running. There might be some when the `shutdown()` happened. | ||
|
@@ -191,9 +186,6 @@ async def schedule_formatting( | |
sources_to_cache.append(src) | ||
report.done(src, changed) | ||
if cancelled: | ||
if sys.version_info >= (3, 7): | ||
await asyncio.gather(*cancelled, return_exceptions=True) | ||
else: | ||
await asyncio.gather(*cancelled, loop=loop, return_exceptions=True) | ||
await asyncio.gather(*cancelled, return_exceptions=True) | ||
if sources_to_cache: | ||
write_cache(cache, sources_to_cache, mode) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1256,7 +1256,7 @@ def do_transform(self, line: Line, string_idx: int) -> Iterator[TResult[Line]]: | |
|
||
string_op_leaves = self._get_string_operator_leaves(LL) | ||
string_op_leaves_length = ( | ||
sum([len(str(prefix_leaf)) for prefix_leaf in string_op_leaves]) + 1 | ||
sum(len(str(prefix_leaf)) for prefix_leaf in string_op_leaves) + 1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure what this has to do with 3.6 but I'll take it. |
||
if string_op_leaves | ||
else 0 | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wish we could remove the copy pasta somehow ...