Commit Graph

257 Commits

Author SHA1 Message Date
Katie McLaughlin
b85c345dbc Remove happiness of error message (#852) 2019-05-16 13:02:17 +01:00
Jelle Zijlstra
957ba24bb6
remove obviously unnecessary parentheses (#850)
Fixes #548
2019-05-15 21:11:04 -07:00
Benjamin Woodruff
448885b256
Move tokenizer config onto grammar, rename flag
Based on the feedback in
https://github.com/python/black/pull/845#issuecomment-490622711

- Remove TokenizerConfig, and add a field to Grammar instead.
- Pass the Grammar to the tokenizer.
- Rename `ASYNC_IS_RESERVED_KEYWORD` to `ASYNC_KEYWORDS` and
  `ASYNC_IS_VALID_IDENTIFIER` to `ASYNC_IDENTIFIERS`.
2019-05-09 17:59:29 +02:00
Benjamin Woodruff
f8617f975d
Add support for always tokenizing async/await as keywords
Fixes #593

I looked into this bug with @ambv and @carljm, and we reached the
conclusion was that it's not possible for the tokenizer to determine if
async/await is a keyword inside all possible generators without breaking
the grammar for older versions of Python.

Instead, we introduce a new tokenizer mode for Python 3.7+ that will
cause all async/await instances to get parsed as a reserved keyword,
which should fix async/await inside generators.
2019-05-09 17:59:29 +02:00
Łukasz Langa
2227e6b1cd
Remove spurious prints 2019-05-09 04:49:48 +02:00
Łukasz Langa
6bb90f22ed
Use to handle legacy async/await handling in assert_equivalent 2019-05-08 23:33:39 +02: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
Carl Meyer
6fdbdb4ee3
Avoid unstable formatting when comment follows escaped newline. (#839). Fixes #767. 2019-05-08 09:53:20 -04:00
Jelle Zijlstra
14cbf737df
don't run more than 61 workers on Windows (#838) 2019-05-07 13:11:20 -04:00
Jelle Zijlstra
06004cd319 Add black -c "code" (#761) 2019-05-07 09:58:59 -04:00
Jelle Zijlstra
de806405d2 Add parentheses around tuple unpack assignment (#832)
Fixes #656
2019-05-07 09:51:28 -04:00
Jelle Zijlstra
18119d3846 Remove unnecessary parens around yield (#834) 2019-05-07 09:49:50 -04:00
Jelle Zijlstra
6b994fdb8a
fix handling of comments in from imports (#829)
Fixes #671
2019-05-06 09:13:25 -04:00
Tom Christie
e6ddb68c78 Wrap loop.run_in_executor up in asyncio.ensure_future for reliable cross-platform berhavior. (#679)
Closes #494

Task completion should also remove the task from `pending`.

Only replicates on some platforms. (eg. Can replicate on Python 3.7+, with either Windows or whatever default Linux distro Travis uses.)
2019-05-05 14:58:26 -04:00
Hugo
4a953b7241 ambv/black -> python/black (#819) 2019-05-02 20:19:52 +01:00
Hugo
597a0e102c Fix B011 (#820)
Do not call assert False since python -O removes these calls. Instead callers should raise AssertionError().
2019-05-02 20:09:49 +01:00
Jelle Zijlstra
cea13f4984
Split the TRAILING_COMMA feature (#763) 2019-03-25 08:22:02 -07:00
Jelle Zijlstra
ba64fc757c
redo grammar selection, add test (#765) 2019-03-16 11:35:18 -07:00
Jelle Zijlstra
b396f13761 fix incorrect call (#762) 2019-03-15 18:39:08 +01:00
Andy Freeland
d6db1c12a8 Fix print() function on Python 2 (#754)
Fixes #752
2019-03-14 16:42:54 -07:00
Łukasz Langa
026c81b834
v19.3b0 2019-03-14 18:09:10 +01:00
Jelle Zijlstra
129ebd53a6 Add back --py36 as a deprecated option (#750)
This partially reverts commit 21ab37a5d9.
2019-03-14 17:31:27 +01:00
Łukasz Langa
ca9ad698ef
Enhance the type comment patch 2019-03-14 16:26:41 +01:00
Hugo
d00eac9944 Fix PendingDeprecationWarning: Task.all_tasks() is deprecated, use asyncio.all_tasks() instead (#741) 2019-03-14 13:41:42 +01:00
Łukasz Langa
087fedb17e
Simplify the #606 patch
Thanks for the original patch to solve #509, @hauntsaninja.
2019-03-14 13:40:52 +01:00
Jelle Zijlstra
ea55ff2878
remove Python implementation-specific versions (#736) 2019-03-07 16:34:34 -08:00
Jelle Zijlstra
21ab37a5d9
remove --py36 (#724)
Fixes #703.
2019-02-24 09:15:03 -08:00
Jelle Zijlstra
f5b14b1afd
split long del statements into multiple lines (#698)
Fixes #693
2019-02-22 22:00:40 -08:00
Zsolt Dollenstein
250ba7f04b Remove numeric underscore normalization (#696) 2019-02-06 19:16:49 -08:00
Jelle Zijlstra
36d3c516d3
Add --target-version option to allow users to choose targeted Python versions (#618) 2019-02-06 18:43:50 -08:00
Jimmy Jia
1ec2470da7 chore: Fix noqa comment (#684)
Omitting the colon makes Flake8 ignore all errors, rather than the specific code.
2019-01-29 13:46:19 -08:00
Anthony Sottile
4d3107233f Atomically write cache files (#674) 2019-01-18 20:59:17 -08:00
Anthony Sottile
7546ed292c delete some dead code (#669)
dead code detected via [dead](https://github.com/asottile/dead)

- **`KEYWORDS`**: introduced (unreferenced) in e74117f172
- **`FLOW_CONTROL`**: last referenced in e9a940d69e

"clean" command:

```
dead --exclude '^(tests/data/|docs/conf.py|blib2to3/)' | grep -Ev '^(visit_.*|show|_stop_signal|lib2to3_unparse) '
```
2019-01-12 09:23:20 -08:00
Utsav Shah
024c9cab55 Add support for special comments in multiline functions (#642) 2019-01-05 11:20:12 -08:00
Tsuyoshi Hombashi
3b72ed0d48 Improve an error message when failed to load pyproject.toml (#653) 2018-12-31 05:03:31 -08:00
Peter Stensmyr
fe24a15b84 Fix multiprocessing support for Windows binary (#632)
* Fix multiprocessing support for Windows binary

The black and blackd binaries generated for Windows builds would fail on
reformatting multiple files due to a Windows-specific
multiprocessing issue. Fix by calling freeze_support() as
described in Python docs.
2018-12-14 15:01:50 +00:00
Jim Brännlund
55121195ce Add .eggs to default exclusions (#629) 2018-11-29 14:27:08 -08:00
hauntsaninja
e4e59f87a8 Improves performance on large commented logical lines (#606)
Fixes #509
2018-11-13 15:04:27 -08:00
hauntsaninja
5bc62a4a82 Fix two types to be Optional (#607) 2018-11-13 15:02:27 -08:00
Jelle Zijlstra
fbf59b60d7 remove unused variable (#604) 2018-11-13 21:23:56 +00:00
Chuck Wooters
5c2dd96a69 patch main to ensure click_patch() gets called (#572) 2018-10-29 11:10:32 +01:00
Felix Kohlgrüber
99c97c3d7f delete unused code (#588) 2018-10-29 11:09:06 +01:00
Łukasz Langa
61feadc0f8
v18.9b0 2018-09-26 13:05:49 -07:00
Łukasz Langa
7145fa325c
Remove whitespace at the beginning of the file
Fixes #399
2018-09-26 12:18:45 -07:00
Łukasz Langa
c6c8ef76a4
Fix mangling pweave and Spyder IDE special comments
Fixes #532.
2018-09-26 09:42:42 -07:00
Łukasz Langa
a4b5c085a3
Move should_explode handling to bracket_split_build_line 2018-09-26 08:53:56 -07:00
Łukasz Langa
1610fd6bc5
Add trailing comma for single as imports, too 2018-09-26 08:26:35 -07:00
Łukasz Langa
0c5c537431
Refactor left_hand_split and right_hand_split to deduplicate line building logic 2018-09-26 07:41:34 -07:00
Zsolt Dollenstein
25d24a10a4 Add trailing comma when a single import doesn't fit on a line. (#504)
Fixes #250.
2018-09-26 13:26:50 +01:00
Zsolt Dollenstein
5f9eb9e4f7 Add underscores to numeric literals with more than six digits (#529) 2018-09-26 12:32:11 +01:00