Commit Graph

790 Commits

Author SHA1 Message Date
Charles Reid
65c5a0d9f1 restore cursor to same line of code, not same line of buffer (#989) 2019-10-20 16:00:48 +02:00
Michael J. Sullivan
0ff718e1e2 Blacken .py files in blib2to3 (#1011)
* Blacken .py files in blib2to3

This is in preparation for adding type annotations to blib2to3 in
order to compiling it with mypyc (#1009, which I can rebase on top of
this).

To enforce that it stays blackened, I just cargo-culted the existing
test code used for validating formatting. It feels pretty clunky now,
though, so I can abstract the common logic out into a helper if that
seems better. (But error messages might be less clear then?)

* Tidy up the tests
2019-10-20 15:55:31 +02:00
Hugo van Kemenade
3bfb66971f Test on Python 3.8 final (#1070) 2019-10-15 11:56:28 -07:00
Hugo van Kemenade
be35b1ed2d Declare support for Python 3.8 (#1069) 2019-10-15 10:08:44 -07: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
788f87cb58 Update Pipfile.lock (#1062) 2019-10-14 12:30:57 -07:00
Michael J. Sullivan
34aeee6879 Add .eggs to .gitignore (#1063)
I don't know what .eggs is but it keeps showing up when I work on black
so...
2019-10-14 12:30:37 -07:00
Linus Groh
73bd7038fb Add black version header to blackd responses (#1046) 2019-10-13 11:35:31 -07:00
Zsolt Dollenstein
57ab909bde
Require regex version 2019.8 2019-10-13 10:24:11 -07:00
Andrey
6aef6c9d45 #455 Fix bug with tricky unicode symbols (#1047)
* add test for special unicode symbol which usual re can not process correctly
add regex lib which supports unicode 12.1.0 standard
replace re usage in project in favor to regex

* #455 fix dependency
2019-10-13 10:21:15 -07:00
Hugo van Kemenade
faaa2c8d59 Used by: add pandas and Pillow (#1057) 2019-10-10 20:19:43 -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
6fe800933d Fix issue with type comments on lines with trailing commas (#1058)
The code introduced in #1027 to detect whether a type comment appeared
after a regular comment in a Line would spuriously misfire when a leaf
was in the comments dict but had an empty list of comments. This can
occur as an artifact of how comments on trailing commas are handled,
it seems.

(This was discovered trying to test black out on mypy.)
2019-10-10 11:50:51 -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
c5637a7085 Fix typechecking under mypy 0.730 (#1039)
mypy 0.730 fixed a bug involving nonexistent attributes accessed on
modules, which caused an error since COLONEQUAL never got added to
token.pyi. Add it.
2019-10-01 15:30:51 -07:00
Zsolt Dollenstein
0acad54c02 fix environment for readthedocs 2019-09-18 14:08:03 +01:00
Zsolt Dollenstein
47861a6a3b fix doc generation 2019-09-18 14:00:18 +01:00
Zsolt Dollenstein
1521d3d2dc Bump dependencies 2019-09-18 13:51:09 +01:00
vezeli
5938106ac4 Switch from versioneer to setuptools-scm (#1008) 2019-09-18 13:34:20 +01:00
Zsolt Dollenstein
7ae084aaa1 fix tests 2019-09-18 13:33:14 +01:00
Pablo Galindo
673327449f Support PEP 572 in while statements (#1028)
Commit d8fa8df052 added support for
parsing and formatting PEP572, but it missed the posibility to add
PEP572 syntax in while statements.
2019-09-18 12:54:40 +01: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
Rishikesh Jha
ae5588cf07 Print a separate message when there are no inputs given (#999)
Fixes #886.
2019-09-04 12:51:32 +01:00
vezeli
c4d2db4323 Change variable in README according to the PEP8 (#1002)
* Change variable in README according to the PEP8
* Change variable in tests according to the PEP8
2019-09-04 09:11:07 +01:00
Joe Antonakakis
3dc461a41a Fix unstable formatting involving unwrapping multiple parentheses (#836) (#961)
This change also unwraps all unnecessary parentheses.
2019-08-23 15:51:29 +01:00
Zsolt Dollenstein
c9689b80fb
fix doc generation 2019-08-21 16:41:11 +02:00
Zsolt Dollenstein
025d2ca4ba
use versioneer to manage __version__ (#981) 2019-08-21 15:42:30 +02:00
Zsolt Dollenstein
40e8b3a231 [blackd] Support py36-style values in X-Python-Variant header (#979) 2019-08-13 08:26:01 -07:00
Zsolt Dollenstein
bd0ab3cba2
Reraise exception in skip_if_exception decorator 2019-08-05 10:07:43 +01:00
Joe Antonakakis
154b98579d Fix async blackd tests which won't fail currently (#966) 2019-08-05 10:06:12 +01:00
Joe Antonakakis
c7495b9aa0 Fix unstable format involving backslash + whitespace at beginning of file (#948) 2019-08-04 10:03:19 +01:00
Joe Antonakakis
65ea568e33 Remove unnecessary if-statement in maybe_make_parens_invisible_in_atom (#964) 2019-08-03 16:33:23 -07:00
Zsolt Dollenstein
e66451761f appease flake8... 2019-07-28 16:40:04 +01:00
Zsolt Dollenstein
6b5eb7d465 skip tests touching aiohttp when known exception occurs 2019-07-28 16:35:10 +01:00
Zsolt Dollenstein
720dd415f7 add change log entry 2019-07-28 16:22:17 +01:00
Zsolt Dollenstein
2848e2e1d6
Support PEP-570 (positional only arguments) (#946)
Code using positional only arguments is considered >= 3.8
2019-07-28 16:17:33 +01:00
Zsolt Dollenstein
d8fa8df052
Add support for walrus operator (#935)
* Parse `:=` properly
* never unwrap parenthesis around `:=`
* When checking for AST-equivalence, use `ast` instead of `typed-ast` when running on python >=3.8
* Assume code that uses `:=` is at least 3.8
2019-07-28 16:03:23 +01:00
Abdur-Rahmaan Janhangeer
cad4138050 CONTRIBUTING.md - update Python version (#942) 2019-07-25 08:19:30 +01:00
Mariatta
eb5f84eb8c Fix Travis CI badge (#939)
It should point to travis-ci.com instead of .org
2019-07-24 18:09:55 -07:00
Asger Hautop Drewsen
235a0b5bcb Change repo name to psf/black in README (#938) 2019-07-24 17:54:05 +01:00
Zsolt Dollenstein
18654bb52a update Pipfile.lock to work with Py3.[78]
Note: had to pin `docutils==0.15` because of https://github.com/pypa/pipenv/issues/3865
2019-07-24 10:12:05 +01:00
Hugo van Kemenade
ffa676cd7d python/black -> psf/black (#936) 2019-07-23 09:50:50 +01:00
Zsolt Dollenstein
77b6ed1b70 Hello github.com/psf! 2019-07-22 21:41:45 +01:00
Yurii Karabas
90d205d1f5 Use nullcontext in case when lock is None. Shutdown pool after code formatting. (#928) 2019-07-16 18:45:56 +01:00
Min ho Kim
f3bb22a828 Fix typo (#916) 2019-07-01 07:42:30 -07:00
Brandt Bucher
b073c9a4e9 Force parentheses between unary op and binary power. (#909) 2019-06-29 09:35:16 -07:00
Zsolt Dollenstein
7d213c6d43
Fix docstring of schedule_formatting
Fixes #914.
2019-06-28 17:31:54 +01:00
Brandt Bucher
9d9f96a7b4 Fix mypy errors. (#911) 2019-06-25 09:44:12 -07:00
Juan Luis Cano Rodríguez
7c556faf5f Ignore broken E203 (#910)
See https://github.com/python/black/issues/565
2019-06-25 07:27:02 -07:00
Adam Johnson
1fbf7251cc Add W503 to default flake8 ignore list (#894)
W503 and W504 are mutually exclusive, to do with splitting binary operators across lines. Black reformats code according to W504, putting the operator on the start of the newline, therefore W503 needs to be ignored in the suggested Flake8 config to use with Black.
2019-06-16 08:39:03 -07:00