Commit Graph

72 Commits

Author SHA1 Message Date
Jan Hnátek
f6643c4f0c Fix location of expression.diff in the change notification message (#670) 2019-02-04 18:42:42 -08:00
Utsav Shah
024c9cab55 Add support for special comments in multiline functions (#642) 2019-01-05 11:20:12 -08:00
Jim Brännlund
4809e365d4 Silence expected stderr (#621)
* Silence expected stderr output during test

* Change based on PR comment
2018-11-29 21:43:22 +00:00
Jelle Zijlstra
8d58827376
Refactor Travis (#614)
Fixes #305 

- Run separate jobs for mypy, self-formatting, flake8, and test runs.
- Don't run flake8 in 3.8 because it is broken (and we can't really expect flake8 to always keep up with 3.8 development).
- Fix unused variable in test
2018-11-20 08:42:43 -08:00
Zsolt Dollenstein
5f9eb9e4f7 Add underscores to numeric literals with more than six digits (#529) 2018-09-26 12:32:11 +01:00
Zsolt Dollenstein
a82f186787 blackd: a HTTP server for blackening (#460) 2018-09-17 10:02:25 -07:00
Zsolt Dollenstein
66a6be642c fix lint errors 2018-08-26 21:27:33 +01:00
Zsolt Dollenstein
401836d02e add test case for preserving newlines from stdin 2018-08-26 21:19:22 +01:00
Jelle Zijlstra
b53cb94743 fix bracket match bug (#470)
* fix bracket match bug

* add missing test file
2018-08-23 12:52:07 +01:00
Zsolt Dollenstein
883689366c Support parsing of async generators in non-async functions (#165)
This is a new syntax added in python3.7, so black can't verify that reformatting will not change the ast unless black itself is run with 3.7. We'll need to change the error message black gives in this case. @ambv any ideas?

Fixes #125.
2018-08-20 14:47:58 +01:00
Jelle Zijlstra
b719d85ccc
autodetect Python 3.6 on the basis of underscores (#461) 2018-08-19 21:02:06 -07:00
Jelle Zijlstra
cc48bc56ca normalize numeric literals (#454)
Fixes #452

I ended up making a couple of other normalizations to numeric literals
too (lowercase everything, don't allow leading or trailing . in floats,
remove redundant + sign in exponent). I don't care too much about those,
so I'm happy to change the behavior there.

For reference, here is Python's grammar for numeric literals:
https://docs.python.org/3/reference/lexical_analysis.html#numeric-literals
2018-08-17 15:03:58 +01:00
Zsolt Dollenstein
df965b0558 update to mypy 0.620 and make tests pass again
Fixes #408
2018-07-18 22:10:52 +01:00
Zsolt Dollenstein
dd8bde6d2f Improve get_future_imports implementation.
Closes #389.
2018-07-02 17:49:47 +01:00
Łukasz Langa
048efa7476 Trivial nits 2018-06-19 23:08:10 -07:00
Łukasz Langa
2dfa69bb7f Stop Click from crashing Black on invalid environments
Fixes #277
2018-06-19 22:55:57 -07:00
Łukasz Langa
df2ae3bbe6 Use the separate pass for # fmt: off on all code
This removes the hacky exception-based handling that didn't work across
statement boundaries.

Fixes #335
2018-06-19 17:32:41 -07:00
Neraste
42a3fe5331 Ignore symbolic links pointing outside of the root directory (#339)
Fixes #338
2018-06-13 00:07:04 -07:00
Łukasz Langa
ec31ee967d Make test_black.py work in profilers 2018-06-09 18:49:39 -07:00
Łukasz Langa
489d00ed8f Support pyproject.toml
Fixes #65
2018-06-06 17:02:10 -07:00
Łukasz Langa
f71db23824 Move test data to data 2018-06-06 15:48:38 -07:00
Zsolt Dollenstein
33baccd88e Change tests with stdin/out to exercise black.main (#307) 2018-06-06 15:42:50 -07:00
Łukasz Langa
7fc6ce9906 Fix handling of empty files 2018-06-04 19:04:29 -07:00
Łukasz Langa
728e5a2f1e Properly format unified diff
Previously we weren't using timestamps.
2018-06-04 18:07:03 -07:00
Łukasz Langa
ed91dd4de6 Make source handling use sets instead of lists
Also, sort cached file output to be (more) deterministic.
2018-06-04 15:53:37 -07:00
Zsolt Dollenstein
00a302560b Preserve line endings when formatting a file in place (#288) 2018-06-04 15:52:06 -07:00
Łukasz Langa
4c352ad4be Add --verbose and report excluded paths in it, too
Fixes #283
2018-06-04 12:09:18 -07:00
Łukasz Langa
36bed855e1 Introduce "project root" as a concept
This is required for regular expressions in `--include=` and `--exclude=` not
to catch false positives from directories outside of the project.
2018-06-04 11:03:18 -07:00
Zsolt Dollenstein
ef903ecd46 Skip symlink test if can't create one (#287) 2018-06-01 14:47:07 -07:00
Łukasz Langa
8a82e0bf9a Make empty --include mean "anything goes", simplify gen_python_files_in_dir 2018-05-31 19:40:07 -07:00
Mika⠙
51756a405c Added --include and --exclude cli options (#281)
These 2 options allow you to pass in regular expressions that determine
whether files/directories are included or excluded in the recursive file
search.

Fixes #270
2018-05-31 17:51:15 -07:00
Łukasz Langa
8ebbd26888 Add --skip-string-normalization
Fixes #118
2018-05-30 12:56:16 -07:00
Łukasz Langa
023e61a254 Refactor --pyi and --py36 into FileMode 2018-05-29 01:53:54 -07:00
Luka Sterbic
e818260f1a Class new line between docstrings / vars / methods (#219)
Partially addresses #144
2018-05-28 23:48:59 -07:00
Carl Meyer
07b1b2f3dd Add --pyi and --py36 flags (#249)
Fixes #244.
2018-05-23 11:01:26 -07:00
Jelle Zijlstra
14ba1bf8b6 Add support for pyi files (#210)
Fixes #207
2018-05-15 15:09:35 -04:00
Miguel Gaiowski
c667b85a7f Check for broken symlinks before checking file data (#202) 2018-05-15 01:13:48 -04:00
Jelle Zijlstra
21c8dc85f5 Remove u prefix if unicode_literals is present (#199) 2018-05-09 18:26:41 -04:00
Łukasz Langa
1747c388bb Discover whether a file is Python 3.6+ also by stars in calls
Fixes a pathological situation where if a function signature used a trailing
comma but was later reformatted to a single line (with the trailing comma
removed), Black would change its mind whether a file is Python
3.6-compatible between runs.
2018-05-08 21:57:09 -07:00
snlkapil
6dbb657681 Removing empty parentheses after class name (#180) 2018-05-07 10:15:24 -07:00
Christian Heimes
2d9eaafa97 Output something when no files are reformatted (#190)
Just executing ``black`` without any argument does not print any message
to stdout or stderr. It's rather confusing, because the user doesn't
know what happened.

In ``len(sources) == 0`` case, black now prints ``No paths given. Nothing to
do``.

Signed-off-by: Christian Heimes <christian@python.org>
2018-05-07 10:12:47 -07:00
Zsolt Dollenstein
9f096d5536 Format subscriptions in a PEP-8 compliant way (#178)
Fixes #157
2018-04-30 22:49:30 -07:00
Jonas Obrist
92957a41e3 Make cache work with non-default line lenghts (#163) 2018-04-24 11:56:50 -07:00
Łukasz Langa
52fda8b0e9 Support sticky standalone comments (comments preceding defs, classes, and decorators)
Fixes #56
Fixes #154
2018-04-24 11:50:31 -07:00
Vishwas B Sharma
29e97d1d4a [#154] Handle comments between decorators properly (#166) 2018-04-24 09:38:12 -07:00
Łukasz Langa
54d707e10a Allow standalone comments to close code blocks
Fixes #16
Fixes #32
2018-04-23 16:17:12 -07:00
Łukasz Langa
06e95b1e9b Show full path on diffs
Fixes #130
2018-04-23 12:00:03 -07:00
Zsolt Dollenstein
c012c70176 Fix tests on windows (#159) 2018-04-23 11:23:36 -07:00
Vishwas B Sharma
5e1e1a1820 [#149] Make check and diff not mutually exclusive (#161)
Fixes #149.
2018-04-23 11:23:11 -07:00
Łukasz Langa
8429f3a63b Revert format_file_in_place() and format_stdin_to_stdout() to return bools
`Changed.CACHED` is meaningless for those two functions.
2018-04-18 17:46:03 -07:00