Commit Graph

9 Commits

Author SHA1 Message Date
Bryan Bugyi
544ea9c217
Improve String Handling (#1132)
This pull request's main intention is to wraps long strings (as requested by #182); however, it also provides better string handling in general and, in doing so, closes the following issues:

Closes #26
Closes #182
Closes #933
Closes #1183
Closes #1243
2020-05-08 14:56:21 +02:00
Michael J. Sullivan
7b11f04d54 Fix type: ignore line breaking when there is a destructuring assignment (#1065)
It turns out we also need to handle invisible *left* parens added at
the *start* of a line. Refactor `contains_unsplittable_type_ignore` to
handle this more cleanly.
2019-10-14 18:15:18 -07:00
Michael J. Sullivan
1336094634 Fix missed cases in the # type: ignore logic (#1059)
In #1040 I had convinced myself that the type ignore logic didn't
need anything like the ignored_ids from the type comment logic, but I
was wrong, and we do.

We hit these cases in practice a bunch.
2019-10-10 18:25:33 -07:00
Michael J. Sullivan
d9e71a75cc Don't break long lines when type: ignore is present (#1040)
Fixes #997.
2019-10-02 18:57:49 -07:00
Michael J. Sullivan
0c44220e21 Don't allow type comments to be merged behind regular comments (#1027)
Type comments only apply if they are the first comment on the line,
which means that allowing them to be pushed behind a regular comment
when joining lines is a semantic change (and, indeed, one that black
catches and fails on).
2019-09-17 13:40:03 -07:00
Zsolt Dollenstein
8f380911e0
Pin comment to single leaf in invisible parens (#872) 2019-06-15 07:29:09 +01:00
Jason Fried
866be06646 Make --safe work for Python2.7 syntax, by using typed_ast for safe validation (#840) 2019-05-08 07:45:59 -07:00
Łukasz Langa
ca9ad698ef
Enhance the type comment patch 2019-03-14 16:26:41 +01:00
Utsav Shah
024c9cab55 Add support for special comments in multiline functions (#642) 2019-01-05 11:20:12 -08:00