Commit Graph

712 Commits

Author SHA1 Message Date
Zsolt Dollenstein
7f4b275413
close event loop for all tests (#1394) 2020-05-08 16:27:50 +01:00
Hugo van Kemenade
362b722004
Test on Python 3.9-dev (#1393)
* Test on Python 3.9-dev

* Python 3.9 still in alpha, allow to fail
2020-05-08 08:19:06 -07:00
Zsolt Dollenstein
703faa3233 Fix mono test 2020-05-08 16:15:31 +01:00
Zsolt Dollenstein
6ea76e9b4f Improve error messages from BlackRunner 2020-05-08 16:15:31 +01:00
Jelle Zijlstra
702e459176
Update changelog and README (#1392)
* add two CHANGELOG entries

* update README on command-line options
2020-05-08 07:55:57 -07:00
Hugo van Kemenade
8e38b6626b
Remove deprecated --py36 option (#1236) 2020-05-08 07:47:54 -07:00
Giacomo Tagliabue
89c87d22e7
add --force-exclude argument (#1032)
Co-authored-by: Peter Yu <2057325+yukw777@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2020-05-08 07:47:26 -07:00
Zsolt Dollenstein
67726a7cf3
skip mono test while im working on it 2020-05-08 15:37:08 +01:00
Cooper Lees
a904771093
Update CHANGELOG with some PRs merged (#1391)
* Update CHANGELOG with some PRs merged
- Add section for vim plugin
- Add vim plugin now prefering virtualenv
- Add py3 tagged wheels

* packges

* Update CHANGES.md _Black_

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>

* Update CHANGES.md Vim

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2020-05-08 07:29:53 -07:00
Richard Si
8c3c190f99
Add Black compatible configurations in documentation (#1366 & #1205) (#1371)
* Add Black compatible configs in docs ( #1366 & #1205)

When users of Black are starting a new project or are adding Black to their
existing projects, they will usually have to config their existing tools like
flake8 to be compatible with Black. Usually, these configs are the same across
different projects. Yet, there isn't any consolidated infomation on what configs
are compatible. Leaving users of Black to dig out any infomation they can find
in README.md.

* Fix a bad max-line-length value

* Clean up pylint's configs

* Add explanations for each configurations

Copying and pasting code without understanding it is a bad idea. This goes the same
for users copying and pasting configurations.

* Capitalize Pylint

* Link from the README

* Fix the isort configuration

I referenced the wrong source. I used a pesonal configuration, not a pure Black-
compatible configuration.

* Improve the config explanations

The explanation for the isort configuration was pretty bad. After having fixed the
configuration (see commit 01c55d1), improving the its explanation was necessary to
make it more user-friendly and understandable. Also added fenced code blocks of the
raw configuration options so the explanations make sense.

* Improve README wording slightly

* Add @hugovk, @JelleZijlstra + my suggestions

Co-authored-by: Cooper Lees <cooper@fb.com>
2020-05-08 07:26:29 -07:00
Arnav Borborah
6695fd892f
Include an easier way to integrate black with Pycharm (#1268)
* Include an easier way to integrate black with Pycharm
2020-05-08 15:13:57 +01:00
Łukasz Langa
c5f87fb4ef
Make the use of a ThreadPoolExecutor explicit 2020-05-08 16:06:33 +02:00
Zsolt Dollenstein
9104ebe5ae
better test for mono executor 2020-05-08 14:57:32 +01:00
Autophagy
ede23ae7ff Add docstrings to fmt checking functions, add to docs
Follow up from #1325

Adds docstrings to the fmt checking functions.
Renames fmt_on to is_fmt_on.
Adds the functions to the autodocs.
2020-05-08 15:47:18 +02:00
Allan Simon
c0a7582e3d
permits black to run in AWS Lambda: (#1141)
AWS Lambda and some other virtualized environment may not permit access
to /dev/shm on Linux and as such, trying to use ProcessPoolExecutor will
fail.

As using parallelism is only a 'nice to have' feature of black, if it fails
we gracefully fallback to a monoprocess implementation, which permits black
to finish normally.

Co-authored-by: Allan Simon <asimon@yolaw.fr>
2020-05-08 15:46:07 +02:00
Ville Skyttä
26c9465a22
Add Change Log project URL (#1382)
* Add Change Log project URL

Co-authored-by: Cooper Lees <me@cooperlees.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2020-05-08 06:40:56 -07:00
kaiix
61f04e658b
Prefer virtualenv packages over global packages (#1383) (#1384) 2020-05-08 06:31:37 -07:00
Douglas Thor
8d6d92aa5b
Add option for printing a colored diff (#1266) 2020-05-08 14:30:10 +01:00
Jon Dufresne
1382eabb3f
Remove deprecated use of 'setup.py test' (#1275)
Since setuptools v41.5.0 (27 Oct 2019), the 'test' command is formally
deprecated and should not be used. Now use unittest as the test entry
point.
2020-05-08 06:23:50 -07:00
utsav-dbx
4041c560ec
Add Dropbox as a user of Black (#1335) 2020-05-08 15:23:22 +02:00
williamfzc
92c611cfdf
add bracket check in split_line (#1315) 2020-05-08 06:16:57 -07:00
David Lukes
68a3c75eb2
Make sure sys._base_executable is sane in Vim plugin (#1380)
The `venv` module relies on `sys._base_executable` to determine the
Python executable to run, but with recent versions of Vim, this is set
to the `vim` executable. A possible workaround is to just override it,
since the `black` plugin already overrides `sys.executable` (possibly
for similar reasons?) anyway.
2020-05-08 06:13:54 -07:00
Zsolt Dollenstein
1d3fb871be add change log entry for #1053 2020-05-08 14:09:15 +01:00
Alex Vandiver
a4c11a75e1
Re-indent the contents of docstrings (#1053)
* Re-indent the contents of docstrings when indentation changes

Keeping the contents of docstrings completely unchanged when
re-indenting (from 2-space intents to 4, for example) can cause
incorrect docstring indentation:

```
class MyClass:
  """Multiline
  class docstring
  """

  def method(self):
    """Multiline
    method docstring
    """
    pass
```
...becomes:
```
class MyClass:
    """Multiline
  class docstring
  """

    def method(self):
        """Multiline
    method docstring
    """
        pass
```

This uses the PEP 257 algorithm for determining docstring indentation,
and adjusts the contents of docstrings to match their new indentation
after `black` is applied.

A small normalization is necessary to `assert_equivalent` because the
trees are technically no longer precisely equivalent -- some constant
strings have changed.  When comparing two ASTs, whitespace after
newlines within constant strings is thus folded into a single space.

Co-authored-by: Luka Zakrajšek <luka@bancek.net>

* Extract the inner `_v` method to decrease complexity

This reduces the cyclomatic complexity to a level that makes flake8 happy.

* Blacken blib2to3's docstring which had an over-indent

Co-authored-by: Luka Zakrajšek <luka@bancek.net>
Co-authored-by: Zsolt Dollenstein <zsol.zsol@gmail.com>
2020-05-08 14:08:15 +01:00
Andrew Zhou
9938c92fd7
Add error on non-list target-version in config file (#1284) 2020-05-08 06:01:42 -07:00
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
Cooper Lees
07c046b7cd
Move to 'py3' tagged wheels (#1388)
- This makes black wheels to be tagged as py3 default
- `python_requires=">=3.6"` ensures we are >= 3.6

Test:
```
python3 -m venv /tmp/build_black
/tmp/build_black/bin/pip install --upgrade pip setuptools wheel
/tmp/build_black/bin/python setup.py bdist_wheel
...
black-19.10b1.dev53+g81bf9bb.d20200508-py3-none-any.whl
```

Addresses #1385
2020-05-08 05:49:51 -07:00
otstrel
892eddacd2
Fix for "# fmt: on" with decorators (#1325) 2020-05-08 14:37:17 +02:00
Vlad Emelianov
c8ca6b2b9f
Issue 1144: Fix type annotations for --config option (#1166) 2020-05-08 05:10:04 -07:00
dependabot[bot]
81bf9bb961
Bump bleach from 3.1.2 to 3.1.4 (#1326)
Bumps [bleach](https://github.com/mozilla/bleach) from 3.1.2 to 3.1.4.
- [Release notes](https://github.com/mozilla/bleach/releases)
- [Changelog](https://github.com/mozilla/bleach/blob/master/CHANGES)
- [Commits](https://github.com/mozilla/bleach/compare/v3.1.2...v3.1.4)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-05-08 04:31:46 -07:00
Toby Fleming
7a14a37981
Change exit code to 2 when config file doesn't exist (#1361)
Fixes #1360, where an invalid config file causes a return/exit code of 1. This
change means this case is caught earlier, treated like any other bad
parameters, and results in an exit code of 2.

Co-authored-by: Toby Fleming <tobywf@users.noreply.github.com>
2020-04-30 08:47:52 +01:00
shaoran
8126b4f6a9
Fixing the documentation of how to install the vim plugin (#1318)
* fix: Fixing the documentation of how to install the vim plugin

Solves the installation problem that currently exist because
the current master branch is not stable. See psf/black#1304 for
more information.

* fix: fixing incorrect path
2020-04-23 19:32:40 -07:00
Charles
8654e8d7ae
Update heredoc marker case to conform with vim patch 8.1.1723 (#1348) 2020-04-16 19:26:09 -07:00
MomIsBestFriend
af7105f9ab
Small nitpicks (#1340)
Co-authored-by: MomIsBestFriend <>
2020-04-11 20:30:24 -07:00
Rémi Verschelde
959848c176
Fix --diff output when encountering EOF (#1328)
`split("\n")` includes a final empty element `""` if the final line
ends with `\n` (as it should for POSIX-compliant text files), which
then became an extra `"\n"`.

`splitlines()` solves that, but there's a caveat, as it will split
on other types of line breaks too (like `\r`), which may not be
desired.

Fixes #526.
2020-04-04 22:02:57 -07:00
Zsolt Dollenstein
9ed2542e93
Omit commit hash and date stamp from doc version (#1322)
This also removes the dependency on setuptools-scm while building the
docs.

Fixes #1104.
2020-03-28 19:06:00 -07:00
Quentin Pradet
7e4c6bf71f
Add missing separator in README (#1320) 2020-03-27 10:28:10 -07:00
Zsolt Dollenstein
a33823e859
Fix readthedocs build (#1321)
* migrate to new rtd config format and pip

* no type field anymore

* use builtin re for docs
2020-03-27 11:43:41 +01:00
dependabot[bot]
453ad9500b
Bump bleach from 3.1.1 to 3.1.2 (#1313)
Bumps [bleach](https://github.com/mozilla/bleach) from 3.1.1 to 3.1.2.
- [Release notes](https://github.com/mozilla/bleach/releases)
- [Changelog](https://github.com/mozilla/bleach/blob/master/CHANGES)
- [Commits](https://github.com/mozilla/bleach/compare/v3.1.1...v3.1.2)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-03-27 08:24:51 +00:00
Łukasz Langa
991f19031c
Don't suggest using sudo with Docker
Thanks for the tip, @imomaliev.
2020-03-17 11:35:41 +01:00
Łukasz Langa
e44e0a6598
Compress RUN statements into one to avoid layer proliferation
Thanks for the suggestion, @imomaliev.
2020-03-17 11:33:57 +01:00
Łukasz Langa
fc804d5f59
Update dependencies 2020-03-17 11:33:02 +01:00
Max Smolens
729f2d8caf
Fix typo in README (#1306) 2020-03-12 19:42:17 +00:00
Hugo van Kemenade
3ac97a3084
Update wording and formatting (#1302) 2020-03-09 15:32:27 +00:00
Batuhan Taşkaya
9a50ba261c
Implement Black Version Gallery (#1294)
Closes #1290.
2020-03-09 14:42:26 +01:00
Abdur-Rahmaan Janhangeer
5fc9f2baab
[README.md] Updated Mail Address - Abdur-Rahmaan Janhangeer (#1301) 2020-03-09 14:38:54 +01:00
Łukasz Langa
5b552fab9d
Update the name of Mode in the reference docs, too 2020-03-04 23:19:21 +01:00
Łukasz Langa
06f2790b5c
Rename FileMode into just Mode
The mode was never just about files to begin with.  There are no other modes in
Black, this can be the default one.
2020-03-04 23:16:55 +01:00
Łukasz Langa
0626c89a5a
Document how to use format_str()
Closes #1064
2020-03-04 23:08:57 +01:00
Łukasz Langa
e253f1260d
Introduce a section of docs about exceptions 2020-03-04 22:26:45 +01:00