Commit Graph

275 Commits

Author SHA1 Message Date
Rishikesh Jha
ae5588cf07 Print a separate message when there are no inputs given (#999)
Fixes #886.
2019-09-04 12:51:32 +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
025d2ca4ba
use versioneer to manage __version__ (#981) 2019-08-21 15:42:30 +02: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
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
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
Zsolt Dollenstein
8f380911e0
Pin comment to single leaf in invisible parens (#872) 2019-06-15 07:29:09 +01:00
dylanjblack
9394de150e Fix trailing comma for function with one arg (#880) (#891)
Modified maybe_remove_trailing_comma to remove trailing commas for
typedarglists (in addition to arglists), and updated line split logic
to ensure that all lines in a function definition that contain only one
arg have a trailing comma.
2019-06-14 21:49:49 -07:00
Jelle Zijlstra
1c43252aa3 fix some out-of-date docstrings; other cleanup (#865) 2019-05-26 12:09:11 +02:00
Zsolt Dollenstein
519c06a8cc
Don't introduce quotes to f-string sub-expressions on string boundaries (#871) 2019-05-26 11:58:00 +02:00
Michael Flaxman
cbe455ad66 minor performance improvement (~2% speedup in unit tests) (#858) 2019-05-21 20:02:17 -07:00
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