]> git.madduck.net Git - etc/vim.git/log

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

etc/vim.git
4 years agoadd bracket check in split_line (#1315)
williamfzc [Fri, 8 May 2020 13:16:57 +0000 (21:16 +0800)]
add bracket check in split_line (#1315)

4 years agoMake sure sys._base_executable is sane in Vim plugin (#1380)
David Lukes [Fri, 8 May 2020 13:13:54 +0000 (15:13 +0200)]
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.

4 years agoadd change log entry for #1053
Zsolt Dollenstein [Fri, 8 May 2020 13:09:15 +0000 (14:09 +0100)]
add change log entry for #1053

4 years agoRe-indent the contents of docstrings (#1053)
Alex Vandiver [Fri, 8 May 2020 13:08:15 +0000 (06:08 -0700)]
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>
4 years agoAdd error on non-list target-version in config file (#1284)
Andrew Zhou [Fri, 8 May 2020 13:01:42 +0000 (08:01 -0500)]
Add error on non-list target-version in config file (#1284)

4 years agoImprove String Handling (#1132)
Bryan Bugyi [Fri, 8 May 2020 12:56:21 +0000 (08:56 -0400)]
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

4 years agoMove to 'py3' tagged wheels (#1388)
Cooper Lees [Fri, 8 May 2020 12:49:51 +0000 (05:49 -0700)]
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

4 years agoFix for "# fmt: on" with decorators (#1325)
otstrel [Fri, 8 May 2020 12:37:17 +0000 (15:37 +0300)]
Fix for "# fmt: on" with decorators (#1325)

4 years agoIssue 1144: Fix type annotations for --config option (#1166)
Vlad Emelianov [Fri, 8 May 2020 12:10:04 +0000 (14:10 +0200)]
Issue 1144: Fix type annotations for --config option (#1166)

4 years agoBump bleach from 3.1.2 to 3.1.4 (#1326)
dependabot[bot] [Fri, 8 May 2020 11:31:46 +0000 (04:31 -0700)]
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>
4 years agoChange exit code to 2 when config file doesn't exist (#1361)
Toby Fleming [Thu, 30 Apr 2020 07:47:52 +0000 (00:47 -0700)]
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>
4 years agoFixing the documentation of how to install the vim plugin (#1318)
shaoran [Fri, 24 Apr 2020 02:32:40 +0000 (04:32 +0200)]
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

4 years agoUpdate heredoc marker case to conform with vim patch 8.1.1723 (#1348)
Charles [Fri, 17 Apr 2020 02:26:09 +0000 (09:26 +0700)]
Update heredoc marker case to conform with vim patch 8.1.1723 (#1348)

4 years agoSmall nitpicks (#1340)
MomIsBestFriend [Sun, 12 Apr 2020 03:30:24 +0000 (06:30 +0300)]
Small nitpicks (#1340)

Co-authored-by: MomIsBestFriend <>
4 years agoFix --diff output when encountering EOF (#1328)
Rémi Verschelde [Sun, 5 Apr 2020 05:02:57 +0000 (07:02 +0200)]
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.

4 years agoOmit commit hash and date stamp from doc version (#1322)
Zsolt Dollenstein [Sun, 29 Mar 2020 02:06:00 +0000 (03:06 +0100)]
Omit commit hash and date stamp from doc version (#1322)

This also removes the dependency on setuptools-scm while building the
docs.

Fixes #1104.

4 years agoAdd missing separator in README (#1320)
Quentin Pradet [Fri, 27 Mar 2020 17:28:10 +0000 (21:28 +0400)]
Add missing separator in README (#1320)

4 years agoFix readthedocs build (#1321)
Zsolt Dollenstein [Fri, 27 Mar 2020 10:43:41 +0000 (10:43 +0000)]
Fix readthedocs build (#1321)

* migrate to new rtd config format and pip

* no type field anymore

* use builtin re for docs

4 years agoBump bleach from 3.1.1 to 3.1.2 (#1313)
dependabot[bot] [Fri, 27 Mar 2020 08:24:51 +0000 (08:24 +0000)]
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>
4 years agoDon't suggest using `sudo` with Docker
Łukasz Langa [Tue, 17 Mar 2020 10:35:41 +0000 (11:35 +0100)]
Don't suggest using `sudo` with Docker

Thanks for the tip, @imomaliev.

4 years agoCompress RUN statements into one to avoid layer proliferation
Łukasz Langa [Tue, 17 Mar 2020 10:33:57 +0000 (11:33 +0100)]
Compress RUN statements into one to avoid layer proliferation

Thanks for the suggestion, @imomaliev.

4 years agoUpdate dependencies
Łukasz Langa [Tue, 17 Mar 2020 10:33:02 +0000 (11:33 +0100)]
Update dependencies

4 years agoFix typo in README (#1306)
Max Smolens [Thu, 12 Mar 2020 19:42:17 +0000 (15:42 -0400)]
Fix typo in README (#1306)

4 years agoUpdate wording and formatting (#1302)
Hugo van Kemenade [Mon, 9 Mar 2020 15:32:27 +0000 (17:32 +0200)]
Update wording and formatting (#1302)

4 years agoImplement Black Version Gallery (#1294)
Batuhan Taşkaya [Mon, 9 Mar 2020 13:42:26 +0000 (16:42 +0300)]
Implement Black Version Gallery (#1294)

Closes #1290.

4 years ago[README.md] Updated Mail Address - Abdur-Rahmaan Janhangeer (#1301)
Abdur-Rahmaan Janhangeer [Mon, 9 Mar 2020 13:38:54 +0000 (17:38 +0400)]
[README.md] Updated Mail Address - Abdur-Rahmaan Janhangeer (#1301)

4 years agoUpdate the name of Mode in the reference docs, too
Łukasz Langa [Wed, 4 Mar 2020 22:19:21 +0000 (23:19 +0100)]
Update the name of Mode in the reference docs, too

4 years agoRename FileMode into just Mode
Łukasz Langa [Wed, 4 Mar 2020 22:16:55 +0000 (23:16 +0100)]
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.

4 years agoDocument how to use format_str()
Łukasz Langa [Wed, 4 Mar 2020 22:08:57 +0000 (23:08 +0100)]
Document how to use format_str()

Closes #1064

4 years agoIntroduce a section of docs about exceptions
Łukasz Langa [Wed, 4 Mar 2020 21:26:45 +0000 (22:26 +0100)]
Introduce a section of docs about exceptions

4 years agoRun prettier and fix whitespace on CHANGES.md (#1296)
Łukasz Langa [Wed, 4 Mar 2020 18:10:17 +0000 (19:10 +0100)]
Run prettier and fix whitespace on CHANGES.md (#1296)

4 years agoAdd @cooperlees to maintainers
Łukasz Langa [Wed, 4 Mar 2020 15:57:24 +0000 (16:57 +0100)]
Add @cooperlees to maintainers

Fixes #1295

4 years agoTell people where Change Log went
Łukasz Langa [Wed, 4 Mar 2020 15:46:20 +0000 (16:46 +0100)]
Tell people where Change Log went

4 years agoSplit out Change Log (#1117)
Cooper Lees [Wed, 4 Mar 2020 15:40:48 +0000 (15:40 +0000)]
Split out Change Log (#1117)

* Split out Change Log
- Move to CHANGES.md to allow bots to see changes
- MANIFEST.in already includes *.md so CHANGES.md will be included
- THis maintains format but the change log will now be after acknowledgements
- This also ensure this gets added to pypi.org via setup.py function

4 years agostring prefixes: don't normalise capital R-strings (#1271)
Shantanu [Tue, 3 Mar 2020 13:55:14 +0000 (05:55 -0800)]
string prefixes: don't normalise capital R-strings (#1271)

Resolves #1244

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
4 years agoNotify users of missing Python lazily (#1210)
Paul Ganssle [Tue, 3 Mar 2020 12:00:52 +0000 (07:00 -0500)]
Notify users of missing Python lazily (#1210)

Currently this message shows up with no context prior to the start of
Vim. By changing this to a lazy message, the user will only be notified
of a problem with the Black plugin when they are attempting to use the
Black plugin.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
4 years agoTeach the Vim plugin to respect pyproject.toml (issue 414) (#1273)
Tal Amuyal [Tue, 3 Mar 2020 11:23:28 +0000 (13:23 +0200)]
Teach the Vim plugin to respect pyproject.toml (issue 414) (#1273)

Creates two separate functions:

1) abspath_pyproject_toml: find the absolute path to pyproject.toml
2) parse_pyproject_toml: finds black-specific toml config

Co-authored-by: Samuel Roeca <samuel.roeca@gmail.com>
4 years agoSimplify Line.contains_multiline_strings method (#1267)
Yurii Karabas [Sun, 9 Feb 2020 21:21:46 +0000 (00:21 +0300)]
Simplify Line.contains_multiline_strings method (#1267)

4 years agoUpdate README.md to include appropriate command to install Vim with Python 3 on macOS...
Shinya Fujino [Sun, 26 Jan 2020 13:31:49 +0000 (22:31 +0900)]
Update README.md to include appropriate command to install Vim with Python 3 on macOS (#1247)

* Update README.md to include appropriate command to install Vim with Python 3 on macOS

* Run pre-commit hooks

4 years agoChange error message to specify its origin. (#1240)
Matthew Clapp [Thu, 23 Jan 2020 16:18:57 +0000 (08:18 -0800)]
Change error message to specify its origin. (#1240)

4 years agoSupport py38-style starred expressions in return statement (#1121)
Vlad Emelianov [Sat, 18 Jan 2020 15:21:46 +0000 (16:21 +0100)]
Support py38-style starred expressions in return statement (#1121)

4 years agoRemove unused variables tokenprog, Token and PlainToken (#1137)
Jon Dufresne [Sat, 18 Jan 2020 15:21:19 +0000 (07:21 -0800)]
Remove unused variables tokenprog, Token and PlainToken (#1137)

4 years agochange pyproject.toml relative path to absolute path in README.md (#1152)
Yazdan [Sat, 18 Jan 2020 15:19:54 +0000 (18:49 +0330)]
change pyproject.toml relative path to absolute path in README.md (#1152)

because in the readthedocs hosted version this pyproject.toml will route to readthedocs does not exist page

4 years agoAdd comment to flake8 configuration explaining line-length mismatch (#1206)
Michael Aquilina [Sat, 18 Jan 2020 15:17:06 +0000 (17:17 +0200)]
Add comment to flake8 configuration explaining line-length mismatch (#1206)

4 years agoUse conditional case for diff reports (#1226)
kyle hausmann [Sat, 18 Jan 2020 15:13:15 +0000 (10:13 -0500)]
Use conditional case for diff reports (#1226)

When --diff flag is used, black will now use the
conditional case in the Report output: eg "would
be reformatted"

4 years agobump regex version, providing wheels (#1232)
Mr. Outis [Sat, 18 Jan 2020 15:12:24 +0000 (09:12 -0600)]
bump regex version, providing wheels (#1232)

Close #1112

4 years agofind_project_root: allow .git to be a file (#1217)
hauntsaninja [Thu, 2 Jan 2020 22:33:30 +0000 (14:33 -0800)]
find_project_root: allow .git to be a file (#1217)

Fixes #1213

4 years agoSkip the broken version of regex (#1209)
Hugo van Kemenade [Mon, 16 Dec 2019 21:46:44 +0000 (23:46 +0200)]
Skip the broken version of regex (#1209)

4 years agoThis MANIFEST.in not needed with setuptools_scm (#1200)
Hugo van Kemenade [Wed, 11 Dec 2019 10:23:26 +0000 (12:23 +0200)]
This MANIFEST.in not needed with setuptools_scm (#1200)

4 years agoAdd Thonny-black-code-format plugin (#1195)
Francisco [Sun, 8 Dec 2019 18:13:50 +0000 (18:13 +0000)]
Add Thonny-black-code-format plugin (#1195)

4 years agoAdd GitHub Actions badge to README.md (#1134)
Cooper Lees [Wed, 4 Dec 2019 08:33:25 +0000 (00:33 -0800)]
Add GitHub Actions badge to README.md (#1134)

4 years agoFix list literal example in README
Zsolt Dollenstein [Sat, 30 Nov 2019 11:16:33 +0000 (11:16 +0000)]
Fix list literal example in README

The literal as written is going to be exploded because of the trailing comma.

4 years agoAdd Home Assistant to 'Used by' section (#1182)
springstan [Fri, 29 Nov 2019 14:19:36 +0000 (15:19 +0100)]
Add Home Assistant to 'Used by' section (#1182)

See the following post: https://developers.home-assistant.io/blog/2019/07/31/black.html

4 years agoFix unstable formatting with some `# type: ignore`s (#1113)
Michael J. Sullivan [Mon, 25 Nov 2019 22:16:00 +0000 (14:16 -0800)]
Fix unstable formatting with some `# type: ignore`s (#1113)

`type: ignore` shouldn't block collapsing a line, since it will still
apply fine to the merged line. This prevents an issue where a reformat
causes it to shift lines and then be merged on a subsequent pass.

There is a downside to this, which is that it can cause a `type:
ignore` to apply to more code than was originally intended. There
might be a way to apply this in a more limited situation, but I'm not
sure what it is.

Fixes #1061.

4 years agoSimple docs cleanup (#1168)
Denis Laxalde [Sat, 23 Nov 2019 04:38:46 +0000 (05:38 +0100)]
Simple docs cleanup (#1168)

* Remove reference to format_int_string in docs

The function got dropped in 250ba7f04b300df284ba80cd4bb4122b45b41efb.

* Remove reference to is_python36 in docs

The function got removed in 36d3c516d3c09fc5f05c420900dd6b854e3c8bbd.

4 years agoCI: Add Python 3.8 and lint to GitHub Actions (#1173)
Hugo van Kemenade [Fri, 22 Nov 2019 08:14:57 +0000 (10:14 +0200)]
CI: Add Python 3.8 and lint to GitHub Actions (#1173)

* CI: Test Python 3.8 on GitHub Actions

* pre-commit autoupdate

* CI: Lint on GitHub Actions

4 years agoSuggest `extend-ignore` over `ignore` for flake8 (#1165)
Anthony Sottile [Fri, 22 Nov 2019 08:13:23 +0000 (00:13 -0800)]
Suggest `extend-ignore` over `ignore` for flake8 (#1165)

this option was introduced in flake8 3.7.x and is generally preferred over `ignore` (which unsets all default ignores)

4 years agoFix simple typo: intput -> input (#1146)
Tim Gates [Thu, 7 Nov 2019 20:57:39 +0000 (07:57 +1100)]
Fix simple typo: intput -> input (#1146)

Fixes #1147

5 years agoRemove duplicate paragraph about blackd headers (#1124)
Richard Fearn [Thu, 31 Oct 2019 00:20:27 +0000 (00:20 +0000)]
Remove duplicate paragraph about blackd headers (#1124)

5 years agoSupport compilation with mypyc (#1009)
Michael J. Sullivan [Wed, 30 Oct 2019 14:29:29 +0000 (07:29 -0700)]
Support compilation with mypyc (#1009)

* Make most of blib2to3 directly typed and mypyc-compatible

This used a combination of retype and pytype's merge-pyi to do the
initial merges of the stubs, which then required manual tweaking to
make actually typecheck and work with mypyc.

Co-authored-by: Sanjit Kalapatapu <sanjitkal@gmail.com>
Co-authored-by: Michael J. Sullivan <sully@msully.net>
* Make black able to compile and run with mypyc

The changes made fall into a couple categories:
 * Fixing actual type mistakes that slip through the cracks
 * Working around a couple mypy bugs (the most annoying of which being
   that we need to add type annotations in a number of places where
   variables are initialized to None)

Co-authored-by: Sanjit Kalapatapu <sanjitkal@gmail.com>
Co-authored-by: Michael J. Sullivan <sully@msully.net>
5 years agoreplace broken rtfd pypi badge (#1120)
Thomas Grainger [Wed, 30 Oct 2019 14:27:20 +0000 (14:27 +0000)]
replace broken rtfd pypi badge (#1120)

5 years agoSwitch from attrs to dataclasses (#1116)
Michael J. Sullivan [Wed, 30 Oct 2019 04:06:34 +0000 (21:06 -0700)]
Switch from attrs to dataclasses (#1116)

The main motivation here is that mypyc is going to have custom support
for dataclasses but probably not attrs.

5 years agoRemove Poetry metadata
Łukasz Langa [Mon, 28 Oct 2019 21:55:17 +0000 (22:55 +0100)]
Remove Poetry metadata

5 years agoTest Windows, macOS and Linux on GitHub Actions (#1085)
Hugo van Kemenade [Mon, 28 Oct 2019 20:00:43 +0000 (22:00 +0200)]
Test Windows, macOS and Linux on GitHub Actions (#1085)

5 years agoacks += llchan
Łukasz Langa [Mon, 28 Oct 2019 19:58:06 +0000 (20:58 +0100)]
acks += llchan

5 years agoFix fmt on/off when multiple exist in leaf prefix (#1086)
Lawrence Chan [Mon, 28 Oct 2019 19:51:45 +0000 (14:51 -0500)]
Fix fmt on/off when multiple exist in leaf prefix (#1086)

The old behavior would detect the existence of a `# fmt: on` in a leaf
node's comment prefix and immediately mark the node as formatting-on,
even if a subsequent `# fmt: off` in the same comment prefix would turn
it back off. This change modifies that logic to track the state through
the entire prefix and take the final state.

Note that this does not fully solve on/off behavior, since any _comment_
lines between the off/on are still formatted. We may need to add
virtual leaf nodes to truly solve that. I will leave that for a separate
commit/PR.

Fixes #1005

5 years agoAlways move the prefix out when wrapping with parentheses (#1103)
Łukasz Langa [Mon, 28 Oct 2019 19:34:37 +0000 (20:34 +0100)]
Always move the prefix out when wrapping with parentheses (#1103)

Fixes #1097

5 years agoRestore simple form of if statement
Łukasz Langa [Mon, 28 Oct 2019 18:39:48 +0000 (19:39 +0100)]
Restore simple form of if statement

5 years agoSimplify some code flow
Łukasz Langa [Mon, 28 Oct 2019 16:44:30 +0000 (17:44 +0100)]
Simplify some code flow

Put empty lines after control flow changes.

5 years agoExplicitly close .gitignore during processing
Łukasz Langa [Mon, 28 Oct 2019 16:42:46 +0000 (17:42 +0100)]
Explicitly close .gitignore during processing

5 years agoRemove unnecessary casts after pinning Mypy to >= 0.740
Łukasz Langa [Mon, 28 Oct 2019 16:35:33 +0000 (17:35 +0100)]
Remove unnecessary casts after pinning Mypy to >= 0.740

5 years agoUse early returns in `get_grammars()` to save an indentation level
Łukasz Langa [Mon, 28 Oct 2019 16:09:25 +0000 (17:09 +0100)]
Use early returns in `get_grammars()` to save an indentation level

5 years agoReword comment
Łukasz Langa [Mon, 28 Oct 2019 14:31:37 +0000 (15:31 +0100)]
Reword comment

5 years agoline_length=1 to reduce churn (#1092)
Jelle Zijlstra [Mon, 28 Oct 2019 14:25:42 +0000 (07:25 -0700)]
line_length=1 to reduce churn (#1092)

5 years agoFix regression: unexpected parentheses around non-mathematical powers
Łukasz Langa [Mon, 28 Oct 2019 13:53:25 +0000 (14:53 +0100)]
Fix regression: unexpected parentheses around non-mathematical powers

This was caused by an overly liberal application of parentheses in #909 that
fixed #646.

Fixes #1041

5 years agoAdd diff support to blackd (#969)
Joe Antonakakis [Mon, 28 Oct 2019 13:25:26 +0000 (06:25 -0700)]
Add diff support to blackd (#969)

5 years agoUpgrade typed-ast to 1.4.0
Łukasz Langa [Mon, 28 Oct 2019 13:09:57 +0000 (14:09 +0100)]
Upgrade typed-ast to 1.4.0

5 years agoPut missing contributors in the list (THANKS!)
Łukasz Langa [Mon, 28 Oct 2019 12:34:52 +0000 (13:34 +0100)]
Put missing contributors in the list (THANKS!)

5 years agoLet readers know E203 and W503 are explained later
Łukasz Langa [Mon, 28 Oct 2019 12:21:30 +0000 (13:21 +0100)]
Let readers know E203 and W503 are explained later

5 years agoPut missing features and fixes in the change log
Łukasz Langa [Mon, 28 Oct 2019 12:12:58 +0000 (13:12 +0100)]
Put missing features and fixes in the change log

5 years agoDocstring nit
Łukasz Langa [Mon, 28 Oct 2019 12:00:31 +0000 (13:00 +0100)]
Docstring nit

5 years agofix crash with long type annotations (#1093)
Jelle Zijlstra [Sun, 27 Oct 2019 11:31:10 +0000 (04:31 -0700)]
fix crash with long type annotations (#1093)

5 years agocoverage: omit tests/data (#1095)
Jelle Zijlstra [Sun, 27 Oct 2019 11:29:08 +0000 (04:29 -0700)]
coverage: omit tests/data (#1095)

Noticed that when it complains about falling coverage, it's sometimes because code in tests/data isn't executed.

5 years agoDo not crash when failing to read an entry (#1090)
Tzu-ping Chung [Thu, 24 Oct 2019 21:19:13 +0000 (05:19 +0800)]
Do not crash when failing to read an entry (#1090)

5 years agosetup.py: rename _version.py to _black_version.py (#1089)
Michael McClimon [Thu, 24 Oct 2019 04:15:12 +0000 (00:15 -0400)]
setup.py: rename _version.py to _black_version.py (#1089)

In #1082, _version.py was renamed to _black_version.py, but the
py_modules line in setup.py wasn't changed, which meant that when
installed from source, running it failed with something like:

```
Traceback (most recent call last):
  File "~/.pyenv/versions/3.6.5/bin/black", line 5, in <module>
    from black import patched_main
  File "~/.pyenv/versions/3.6.5/lib/python3.6/site-packages/black.py", line 55, in <module>
    from _black_version import version as __version__
ModuleNotFoundError: No module named '_black_version'
```

5 years agos/_version.py/_black_version.py/ (#1082)
Łukasz Langa [Mon, 21 Oct 2019 13:03:01 +0000 (15:03 +0200)]
s/_version.py/_black_version.py/ (#1082)

Some users are installing Black as a dependency in their project. Having
a _version.py in site-packages is asking for a conflict sooner or later.

Ideally we shouldn't require a separate version file at all, that's an
additional import we need to make. But I'll leave that bikeshedding for
a different time.

5 years agoadd gitignore support using pathspec (#878)
jgirardet [Mon, 21 Oct 2019 09:44:53 +0000 (11:44 +0200)]
add gitignore support using pathspec (#878)

5 years agoAutomatic markdown and YAML formatting with Prettier (#874)
Yngve Høiseth [Mon, 21 Oct 2019 09:42:46 +0000 (11:42 +0200)]
Automatic markdown and YAML formatting with Prettier (#874)

5 years agoRestore all cursors, instead of only the current window (#978)
Alexander Huynh [Mon, 21 Oct 2019 09:21:05 +0000 (02:21 -0700)]
Restore all cursors, instead of only the current window (#978)

If we have the same buffer open in multiple windows/tabs, we'll only
restore the current window's cursor.

Iterate through all tabs and windows, and save/restore all cursor
positions of windows that contain our buffer.

Addendum to #433.

5 years agoDo not load incompatible cache (#875) (#1034)
Matt VanEseltine [Mon, 21 Oct 2019 09:20:13 +0000 (05:20 -0400)]
Do not load incompatible cache (#875) (#1034)

A black cache created in Python 3.8 throws an unhandled
ValueError in earlier versions. This is because 3.6 does
not recognize the pickle protocol used as default in 3.8.
Accordingly, this commit:

  - Fixes read_cache to return an empty cache instead.

  - Changes the pickle protocol to 4 as the highest protocol
    fully supported by black's supported Python versions.

5 years agoRun pre-commit on Travis CI (#1081)
Hugo van Kemenade [Mon, 21 Oct 2019 09:18:23 +0000 (12:18 +0300)]
Run pre-commit on Travis CI (#1081)

5 years agoRevert "restore cursor to same line of code, not same line of buffer (#989)"
Łukasz Langa [Mon, 21 Oct 2019 09:16:34 +0000 (11:16 +0200)]
Revert "restore cursor to same line of code, not same line of buffer (#989)"

This reverts commit 65c5a0d9f180c4b36ea98917cb3b569f8e4f892f.

Edge cases were discovered on the pull request post merge.

5 years agoBack out #850 (#1079)
Jelle Zijlstra [Sun, 20 Oct 2019 16:02:17 +0000 (09:02 -0700)]
Back out #850 (#1079)

Fixes #1042 (and probably #1044 which looks like the same thing).

The issue with the "obviously unnecessary" parentheses that #850 removed is that sometimes they're necessary to help Black fit something in one line. I didn't see an obvious solution that still removes the parens #850 was intended to remove, so let's back out this change for now in the interest of unblocking a release.

This PR also adds a test adapted from the failing example in #1042, so that if we try to reapply the #850 change we don't break the same case again.

5 years agofix CI (#1078)
Jelle Zijlstra [Sun, 20 Oct 2019 15:35:57 +0000 (08:35 -0700)]
fix CI (#1078)

5 years agoSet correct return statement for `is_type_comment` function (#929)
Yurii Karabas [Sun, 20 Oct 2019 14:52:07 +0000 (17:52 +0300)]
Set correct return statement for `is_type_comment` function (#929)

5 years agoUse better default venv dir when using neovim (#937)
Asger Hautop Drewsen [Sun, 20 Oct 2019 14:43:02 +0000 (16:43 +0200)]
Use better default venv dir when using neovim (#937)

5 years agoCreate new issue templates (#934)
Zsolt Dollenstein [Sun, 20 Oct 2019 14:30:44 +0000 (07:30 -0700)]
Create new issue templates (#934)

* Create new issue templates

* style -> design

* Apply suggestions from code review

Co-Authored-By: Hugo van Kemenade <hugovk@users.noreply.github.com>
5 years agoUpdate README.md (#906)
Andrew Thorp [Sun, 20 Oct 2019 14:26:17 +0000 (10:26 -0400)]
Update README.md (#906)

Add Kakoune integration instructions

5 years agoChange how venv path is modified in vim plugin (#804)
Josh Bode [Sun, 20 Oct 2019 14:24:50 +0000 (16:24 +0200)]
Change how venv path is modified in vim plugin (#804)

- Check if black venv path is not already in `sys.path`
- Append (not insert) path so that black doesn't incorrectly import backports (e.g. `typing`)

Avoids this error if `typing` is present in venv:
```
Traceback (most recent call last):
  File "<string>", line 56, in <module>
  File "/home/josh/.virtualenvs/default/lib/python3.7/site-packages/black.py", line 19, in <module>
    from typing import (
  File "/home/josh/.virtualenvs/default/lib/python3.7/site-packages/typing.py", line 1356, in <module>
    class Callable(extra=collections_abc.Callable, metaclass=CallableMeta):
  File "/home/josh/.virtualenvs/default/lib/python3.7/site-packages/typing.py", line 1004, in __new__
    self._abc_registry = extra._abc_registry
AttributeError: type object 'Callable' has no attribute '_abc_registry'
```

5 years agoAdd .svn to default exclusion list (#965)
Joe Antonakakis [Sun, 20 Oct 2019 14:16:26 +0000 (07:16 -0700)]
Add .svn to default exclusion list (#965)