]> 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
3 years agoFix small comment typo (#2112)
Laurent Tréguier [Fri, 16 Apr 2021 17:41:19 +0000 (19:41 +0200)]
Fix small comment typo (#2112)

We probably don't need to fall back on "polling" when setting up an asyncio loop

3 years agoAdd missing instructions to make test passed (#2100)
Pierre Verkest [Mon, 12 Apr 2021 13:18:11 +0000 (15:18 +0200)]
Add missing instructions to make test passed (#2100)

3 years agoRemove NBSP at the beginning of comments (#2092)
Pierre Sassoulas [Sun, 11 Apr 2021 21:41:22 +0000 (23:41 +0200)]
Remove NBSP at the beginning of comments (#2092)

Closes #2091

3 years agoAdded not formatting files in gitignore (psf#1682) (#1734)
Simon [Sun, 11 Apr 2021 21:00:03 +0000 (07:00 +1000)]
Added not formatting files in gitignore (psf#1682) (#1734)

3 years agofix typing issue around lru_cache arguments (#2098)
Jelle Zijlstra [Sun, 11 Apr 2021 14:49:42 +0000 (07:49 -0700)]
fix typing issue around lru_cache arguments (#2098)

This was found by python/mypy#10308

3 years agoExclude venv directory by default (#1683)
johnthagen [Sat, 10 Apr 2021 12:07:34 +0000 (08:07 -0400)]
Exclude venv directory by default (#1683)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
3 years agoFix error from upcoming typeshed change (#2096)
Jelle Zijlstra [Thu, 8 Apr 2021 17:25:37 +0000 (10:25 -0700)]
Fix error from upcoming typeshed change (#2096)

See python/typeshed#5190

3 years agoAdd `black` Dockerfile (#1916)
Cooper Lees [Thu, 8 Apr 2021 04:13:11 +0000 (21:13 -0700)]
Add `black` Dockerfile (#1916)

* Add `black` Dockerfile
- Build a `black` container based on python3-slim
- Test: `docker build --network-host --tag black .`
```console
cooper-mbp1:black cooper$ docker image ls
REPOSITORY                                         TAG            IMAGE ID       CREATED              SIZE
black                                              latest         0c7636402ac2   4 seconds ago        332MB
```

Addresses part of #1914

* Build with colorama + d extra installs - Adds ~9mb

* Combine all build commands in 1 run
- Combine the commands all into 1 RUN to down the size
- Get to 65.98 MB image size now: https://hub.docker.com/repository/docker/cooperlees/black/tags?page=1&ordering=last_updated

* Add rm -r of /var/lib/apt/lists/* + save 10mb down to 55mb

3 years agoBump urllib3 from 1.26.3 to 1.26.4 (#2090)
dependabot[bot] [Tue, 6 Apr 2021 18:07:57 +0000 (11:07 -0700)]
Bump urllib3 from 1.26.3 to 1.26.4 (#2090)

Bumps [urllib3](https://github.com/urllib3/urllib3) from 1.26.3 to 1.26.4.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](https://github.com/urllib3/urllib3/compare/1.26.3...1.26.4)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
3 years agoGet rid of redundant spaces in docs (#2085)
Jakub Warczarek [Sun, 4 Apr 2021 14:21:33 +0000 (16:21 +0200)]
Get rid of redundant spaces in docs (#2085)

Thanks!

3 years agoRun lint in latest python + update precommit (#2081)
Cooper Lees [Thu, 1 Apr 2021 23:15:50 +0000 (16:15 -0700)]
Run lint in latest python + update precommit (#2081)

- Lets move to latest and greatest of lints

3 years agoPush contributors to use Next PR Number (#2080)
Richard Si [Thu, 1 Apr 2021 21:24:18 +0000 (17:24 -0400)]
Push contributors to use Next PR Number (#2080)

This is a tool of my own making. Right now our requirement to have the
PR number in the changelog entry is pretty painful / annoying since
the contributor either has to guess or add the # retroactively after
the PR creation. This tool should make it way less painful by making
it simple to get your PR number beforehand.

3 years agoAdd CONTRBUTING info about CHANGES.md requirement (#2073)
Cooper Lees [Thu, 1 Apr 2021 16:54:45 +0000 (09:54 -0700)]
Add CONTRBUTING info about CHANGES.md requirement (#2073)

Instruct contributors to add the change line to help save maintainer / releaser time

3 years agoAdd a GitHub Action to build + Upload black to PyPI (#1848)
Cooper Lees [Thu, 1 Apr 2021 16:41:55 +0000 (09:41 -0700)]
Add a GitHub Action to build + Upload black to PyPI (#1848)

* Add a GitHub Action to build + Upload black to PyPI
- Build a wheel + sdist
- Upload via twine using token stored in GitHub secrets

3 years agoSupport for top-level user configuration (#1899)
Harish Rajagopal [Thu, 1 Apr 2021 16:39:18 +0000 (18:39 +0200)]
Support for top-level user configuration (#1899)

* Added support for top-level user configuration

At the user level, a TOML config can be specified in the following locations:
* Windows: ~\.black
* Unix-like: $XDG_CONFIG_HOME/black (~/.config/black fallback)

Instead of changing env vars for the entire black-primer process, they
are now changed only for the black subprocess, using a tmpdir.

3 years agodon't require typed-ast
KotlinIsland [Tue, 16 Mar 2021 09:31:18 +0000 (19:31 +1000)]
don't require typed-ast

3 years agoBump pygments from 2.6.1 to 2.7.4 in /docs (#2076)
dependabot[bot] [Tue, 30 Mar 2021 01:59:57 +0000 (18:59 -0700)]
Bump pygments from 2.6.1 to 2.7.4 in /docs (#2076)

Bumps [pygments](https://github.com/pygments/pygments) from 2.6.1 to 2.7.4.
- [Release notes](https://github.com/pygments/pygments/releases)
- [Changelog](https://github.com/pygments/pygments/blob/master/CHANGES)
- [Commits](https://github.com/pygments/pygments/compare/2.6.1...2.7.4)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
3 years agoMerge pull request #92 from bot-boi/master
Vincent Driessen [Mon, 29 Mar 2021 12:31:55 +0000 (14:31 +0200)]
Merge pull request #92 from bot-boi/master

Ensure b:showing_message is always defined.

3 years agoGREP for PR reference accepts references that are split over a line (#2072)
Mark Bell [Sun, 28 Mar 2021 23:01:37 +0000 (00:01 +0100)]
GREP for PR reference accepts references that are split over a line (#2072)

Fixes #2070

3 years agoEnsure b:showing_message is always defined.
bot-boi [Sun, 28 Mar 2021 00:56:04 +0000 (20:56 -0400)]
Ensure b:showing_message is always defined.

3 years agoAdd `--skip-magic-trailing-comma` to CHANGES.md (#2064)
Shantanu [Fri, 26 Mar 2021 14:21:18 +0000 (07:21 -0700)]
Add `--skip-magic-trailing-comma` to CHANGES.md (#2064)

3 years agoAdd entry for `--extend-exclude` in the right place (#2061)
Richard Si [Wed, 24 Mar 2021 23:38:07 +0000 (19:38 -0400)]
Add entry for `--extend-exclude` in the right place (#2061)

The PR author added the changelog entry for their `extend-exclude` addition
in `docs/change_log.md` which is understandable but incorrect as it will be
overwritten since it's autogenerated from the readme.

3 years agoAdd a GitHub CHANGELOG/News Check (#2057)
Cooper Lees [Sun, 21 Mar 2021 20:05:24 +0000 (13:05 -0700)]
Add a GitHub CHANGELOG/News Check (#2057)

- Run grep to see commit has a line mentioning it to CHANGES.md
- Also add a label to disable this being required for PRs that don't need a change entry

3 years agoFix indentation in docs/editor_integration.md (#2056)
Richard Si [Sat, 20 Mar 2021 19:15:55 +0000 (15:15 -0400)]
Fix indentation in docs/editor_integration.md (#2056)

Numbered list entries' bodies need to be indented or else the list won't
render correctly.

3 years agoRecommend B950 + 88 char limit instead of 80 (#2050)
Jairo Llopis [Thu, 18 Mar 2021 15:14:15 +0000 (15:14 +0000)]
Recommend B950 + 88 char limit instead of 80 (#2050)

[The section about line length][1] was contradictory.

On one side, it said:

> Black will try to respect that [line length limit]. However, sometimes it won't be able to without breaking other rules. In those rare cases, auto-formatted code will exceed your allotted limit.

So black doesn't guarantee that your code is formatted at 88 chars, even when configured with `--line-length=88` (default). Black uses this limit as a "hint" more than a "rule".

OTOH, it also said:

> If you're using Flake8, you can bump max-line-length to 88 and forget about it. Alternatively, use Bugbear's B950 warning instead of E501 and keep the max line length at 80 which you are probably already using.

But that's not true. You can't "forget about it" because Black sometimes won't respect the limit. Both E501 at 88 and B950 at 80 behave the same: linter error at 89+ length. So, if Black happens to decide that a line of code is better at 90 characters that some other fancy style, you land on a unlucky situation where both tools will fight.

So, AFAICS, the best way to align flake8 and black is to:

1. Use flake8-bugbear
2. Enable B950
3. Disable E501
4. Set `max-line-length = 88`

This way, we also tell flake8 that 88 limit is a "hint" and not a "rule". The real rule will be 88 + 10%. If black decides that a line fits better in 97 characters than in 88 + some formatting, _that_ probably means your code has a real problem.

To avoid further confusion, I change the official recommendation here.

[1]: https://github.com/PyCQA/flake8-bugbear/tree/e82bb8d8b855adbf1f6f9757fb1527e93039e0d9#opinionated-warnings

3 years ago- migrate to new Colortemplate v2.1 syntax
Stefan Wimmer [Thu, 11 Mar 2021 14:41:06 +0000 (15:41 +0100)]
- migrate to new Colortemplate v2.1 syntax
- indentation
- make light & dark colours variations more similar with one specific colour as origin
- add SignColumn
- add bold to CursorLine only

3 years agoUse vim autoload script (#1157)
Konstantin Alekseev [Mon, 8 Mar 2021 00:13:25 +0000 (03:13 +0300)]
Use vim autoload script (#1157)

3 years agoAdd missing changelog entry for fmt: skip (#2025)
Richard Si [Sat, 6 Mar 2021 20:02:25 +0000 (15:02 -0500)]
Add missing changelog entry for fmt: skip (#2025)

3 years agoAdd ALE (#1753)
John Meow [Sat, 6 Mar 2021 04:22:19 +0000 (07:22 +0300)]
Add ALE (#1753)

3 years agoRemove unused import statements using Pycln. (#2021)
Hadi Alqattan [Fri, 5 Mar 2021 19:58:00 +0000 (22:58 +0300)]
Remove unused import statements using Pycln. (#2021)

* remove unused imports using Pycln.

* reverse comma style.

3 years agoBump aiohttp from 3.7.3 to 3.7.4 (#2009)
dependabot[bot] [Fri, 5 Mar 2021 18:43:54 +0000 (10:43 -0800)]
Bump aiohttp from 3.7.3 to 3.7.4 (#2009)

Bumps [aiohttp](https://github.com/aio-libs/aiohttp) from 3.7.3 to 3.7.4.
- [Release notes](https://github.com/aio-libs/aiohttp/releases)
- [Changelog](https://github.com/aio-libs/aiohttp/blob/master/CHANGES.rst)
- [Commits](https://github.com/aio-libs/aiohttp/compare/v3.7.3...v3.7.4)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
3 years agoBlack requires Python 3.6.2+ (#1668)
Hugo van Kemenade [Thu, 4 Mar 2021 13:59:31 +0000 (15:59 +0200)]
Black requires Python 3.6.2+ (#1668)

3 years agoAdd formatters-python for atom to editor_integration (#1834)
Utkarsh Gupta [Thu, 4 Mar 2021 00:46:27 +0000 (06:16 +0530)]
Add formatters-python for atom to editor_integration (#1834)

3 years agoTurn test_regex into a click callback (#2016)
Joshua Cannon [Wed, 3 Mar 2021 01:21:50 +0000 (19:21 -0600)]
Turn test_regex into a click callback (#2016)

Co-authored-by: Richard Si <63936253+ichard26@users.noreply.github.com>
3 years agoAdds --stdin-filename back to changelog (#2017)
Austin Pray [Tue, 2 Mar 2021 00:35:57 +0000 (18:35 -0600)]
Adds --stdin-filename back to changelog (#2017)

* Adds --stdin-filename back to changelog

Looks like this went missing https://github.com/psf/black/commit/dea81b7ad5cfa04c3572771c34af823449d0a8f3#diff-729efdd61772b108539268bdbfd7472521bdc05a7cae6113f62ed2649a3ad9c7

* Update CHANGES.md

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* Update CHANGES.md

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
3 years agoAdd --extend-exclude parameter (#2005)
Joshua Cannon [Mon, 1 Mar 2021 22:07:36 +0000 (16:07 -0600)]
Add --extend-exclude parameter (#2005)

Look ma! I contribute to open source!

Co-authored-by: Richard Si <63936253+ichard26@users.noreply.github.com>
3 years agoStrip redundant parentheses from assignment exprs (#1906)
Rishav Kundu [Sun, 28 Feb 2021 01:20:23 +0000 (06:50 +0530)]
Strip redundant parentheses from assignment exprs (#1906)

Fixes #1656

3 years agoWrap arithmetic and binary arithmetic expressions in invisible parentheses (#2001)
tpilewicz [Wed, 24 Feb 2021 11:56:56 +0000 (12:56 +0100)]
Wrap arithmetic and binary arithmetic expressions in invisible parentheses (#2001)

3 years agoFuzzer testing: less strict special-case regex match passthrough for multi-line EOF...
James Addison [Mon, 22 Feb 2021 15:49:38 +0000 (15:49 +0000)]
Fuzzer testing: less strict special-case regex match passthrough for multi-line EOF exceptions (#1998)

3 years agoFixup: update function name in docs to match source (#1997)
James Addison [Mon, 22 Feb 2021 15:46:38 +0000 (15:46 +0000)]
Fixup: update function name in docs to match source (#1997)

3 years agoFix for enum changes in 3.10 (#1999)
James [Mon, 22 Feb 2021 15:42:05 +0000 (15:42 +0000)]
Fix for enum changes in 3.10 (#1999)

3 years agoIndicate that a final newline was added in --diff (#1897) (#1897)
Paul "TBBle" Hampson [Mon, 22 Feb 2021 06:43:23 +0000 (17:43 +1100)]
Indicate that a final newline was added in --diff (#1897) (#1897)

Fixes: #1662
Work-around for https://bugs.python.org/issue2142

The test has to slightly mess with its input data, because the utility
functions default to ensuring the test data has a final newline, which
defeats the point of the test.

Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
3 years agoMinimize changes: more closely resemble original conditional logic
James Addison [Wed, 10 Feb 2021 12:33:50 +0000 (12:33 +0000)]
Minimize changes: more closely resemble original conditional logic

3 years agoReadability: reduce boolean nesting
James Addison [Tue, 9 Feb 2021 21:13:57 +0000 (21:13 +0000)]
Readability: reduce boolean nesting

3 years agoCleanup: remove unused / redundant variables from conditionals
James Addison [Thu, 4 Feb 2021 18:07:43 +0000 (18:07 +0000)]
Cleanup: remove unused / redundant variables from conditionals

3 years agoSimplification: only yield empty omit list when magic trailing comma is present
James Addison [Thu, 4 Feb 2021 17:48:38 +0000 (17:48 +0000)]
Simplification: only yield empty omit list when magic trailing comma is present

3 years agoSimplification: only use special-case token retrieval logic when magic trailing comma...
James Addison [Thu, 4 Feb 2021 17:45:45 +0000 (17:45 +0000)]
Simplification: only use special-case token retrieval logic when magic trailing comma is present

3 years agoClarity: special case: avoid using variables that have the same names as methods
James Addison [Thu, 4 Feb 2021 17:40:42 +0000 (17:40 +0000)]
Clarity: special case: avoid using variables that have the same names as methods

3 years agoConsistency: use variable names that correspond to the methods they invoke
James Addison [Thu, 4 Feb 2021 17:38:55 +0000 (17:38 +0000)]
Consistency: use variable names that correspond to the methods they invoke

3 years agoBrevity: only use the variables required to convey the intended expressions
James Addison [Thu, 4 Feb 2021 17:37:25 +0000 (17:37 +0000)]
Brevity: only use the variables required to convey the intended expressions

3 years agoClarity: isolate and extract each responsibility from an overloaded variable
James Addison [Thu, 4 Feb 2021 17:30:05 +0000 (17:30 +0000)]
Clarity: isolate and extract each responsibility from an overloaded variable

3 years agoBrevity: rename method
James Addison [Thu, 4 Feb 2021 17:26:29 +0000 (17:26 +0000)]
Brevity: rename method

3 years agofuzzer: add special-case for multi-line EOF TokenError (#1991)
James Addison [Sat, 20 Feb 2021 16:44:48 +0000 (16:44 +0000)]
fuzzer: add special-case for multi-line EOF TokenError (#1991)

* Add special-case for multi-line EOF TokenError under Python3.7

* Update conditional check to correspond to original issue description (and include issue hyperlink)

* Add warning and hint regarding replaying the fuzzer code generation

* Include code review suggestion (with modifications for this to follow)

Co-authored-by: Zac Hatfield-Dodds <zac.hatfield.dodds@gmail.com>
* Remove Python version check, since this issue does exist across more recent Python versions than 3.7

* Update explanatory comment

* Add clarification for potentially-ambiguous blib2to3 import

* Update explanatory comment

* Bring comment into consistent format with previous comment

* Revert "Add clarification for potentially-ambiguous blib2to3 import"

This reverts commit 357b7cc03bdb19dd924f1accd428352f4bb44e5c.

Co-authored-by: Zac Hatfield-Dodds <zac.hatfield.dodds@gmail.com>
3 years agoUse 'args' to Avoid GH workflow warning (#1990)
Romain Rigaux [Tue, 16 Feb 2021 21:10:23 +0000 (13:10 -0800)]
Use 'args' to Avoid GH workflow warning (#1990)

Unexpected input(s) 'black_args', valid inputs are ['entryPoint', 'args']

3 years agoadd gedit integration (#1988)
Archit Gopal [Mon, 15 Feb 2021 16:05:23 +0000 (21:35 +0530)]
add gedit integration (#1988)

3 years agoAdd "# fmt: skip" directive to black (#1800)
Sagi Shadur [Mon, 15 Feb 2021 16:02:48 +0000 (18:02 +0200)]
Add "# fmt: skip" directive to black (#1800)

Fixes #1162

3 years agoreadme: Include Zulip in used-by section (#1987)
rht [Sun, 14 Feb 2021 15:32:29 +0000 (10:32 -0500)]
readme: Include Zulip in used-by section (#1987)

Zulip has recently formatted their code in Black and also set Black as a linter: https://github.com/zulip/zulip/pull/15662.
See also https://chat.zulip.org/#narrow/stream/2-general/topic/black.

3 years agoFix duplication of checks on internal PRs (#1986)
Richard Si [Sun, 14 Feb 2021 15:23:47 +0000 (10:23 -0500)]
Fix duplication of checks on internal PRs (#1986)

Internal PRs (that come from branches of psf/black) match both the push
and pull_request events. This leads to a duplication of test, lint, etc.
checks on such PRs. Not only is it a waste of resources, it makes the
Status Checks UI more frustrating to go through.

Patch taken from:
https://github.community/t/duplicate-checks-on-push-and-pull-request-simultaneous-event/18012

3 years agoStability fixup: interaction between newlines and comments (#1975)
James Addison [Thu, 11 Feb 2021 20:11:42 +0000 (20:11 +0000)]
Stability fixup: interaction between newlines and comments (#1975)

* Add test case to illustrate the issue

* Accept carriage returns as valid separators while enumerating comments

Without this acceptance, escaped multi-line statments that use carriage returns will not be counted into the 'ignored_lines' variable since the emitted line values will end with a CR and not an escape character.  That leads to comments associated with the line being incorrectly labeled with the STANDALONE_COMMENT type, affecting comment placement and line space management.

* Remove comment linking to ephemeral build log

3 years agoBump cryptography from 3.3.1 to 3.3.2 (#1981)
dependabot[bot] [Wed, 10 Feb 2021 02:17:23 +0000 (18:17 -0800)]
Bump cryptography from 3.3.1 to 3.3.2 (#1981)

Bumps [cryptography](https://github.com/pyca/cryptography) from 3.3.1 to 3.3.2.
- [Release notes](https://github.com/pyca/cryptography/releases)
- [Changelog](https://github.com/pyca/cryptography/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/pyca/cryptography/compare/3.3.1...3.3.2)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
3 years agoRegenerate documentation (#1980)
James Addison [Wed, 10 Feb 2021 01:10:02 +0000 (01:10 +0000)]
Regenerate documentation (#1980)

Resolves #1979 and ensures that the content from #1861 is included in the repository-published documentation.

3 years agoUpdate prettier in pre-commit config (#1966)
Richard Si [Fri, 5 Feb 2021 04:10:45 +0000 (23:10 -0500)]
Update prettier in pre-commit config (#1966)

With older versions of prettier, when the hook failed a bunch of
"[error] No parser could be inferred for file: {PATH}" error lines
showed up because of lack of support of a flag that pre-commit
passes for us by default. It made figuring out why the prettier hook
failed annoying.

3 years agospeed up cache by approximately 42x by avoiding pathlib (#1953)
Anthony Sottile [Thu, 4 Feb 2021 21:03:42 +0000 (13:03 -0800)]
speed up cache by approximately 42x by avoiding pathlib (#1953)

3 years agoBump bleach from 3.2.1 to 3.3.0 (#1957)
dependabot[bot] [Tue, 2 Feb 2021 23:54:14 +0000 (15:54 -0800)]
Bump bleach from 3.2.1 to 3.3.0 (#1957)

Bumps [bleach](https://github.com/mozilla/bleach) from 3.2.1 to 3.3.0.
- [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.2.1...v3.3.0)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
3 years agoRemove placeholder exit code in unreachable 'black-primer' subprocess handler (#1952)
James Addison [Mon, 1 Feb 2021 17:54:19 +0000 (17:54 +0000)]
Remove placeholder exit code in unreachable 'black-primer' subprocess handler (#1952)

3 years agoUpdate example exclude to match only files in root (#1861)
Oliver Newman [Wed, 27 Jan 2021 17:36:21 +0000 (12:36 -0500)]
Update example exclude to match only files in root (#1861)

* Update example exclude to match only files in root

The `exclude` section of the example `pyproject.toml` file didn't work
as expected. It claimed to exclude matched files only in the project
root, but it actually excluded matched files at any directory level
within the project. We can address this by prepending `^/` to the regex
to ensure that it only matches files in the project root.

See https://github.com/psf/black/issues/1473#issuecomment-740008873 for
explanation.

* Mention excluding directories as well

3 years agoAdd --skip-magic-trailing-comma (#1824)
Shantanu [Mon, 18 Jan 2021 00:59:06 +0000 (16:59 -0800)]
Add --skip-magic-trailing-comma (#1824)

3 years agoOSS-Fuzz integration (#1930)
Zac Hatfield-Dodds [Sat, 16 Jan 2021 00:05:15 +0000 (11:05 +1100)]
OSS-Fuzz integration (#1930)

3 years agoFix typo (#1931)
Emilv2 [Fri, 15 Jan 2021 22:43:23 +0000 (23:43 +0100)]
Fix typo (#1931)

3 years agoUpdate link pointing to how-black-wraps-lines (#1925)
Peter Stensmyr [Thu, 14 Jan 2021 23:57:45 +0000 (10:57 +1100)]
Update link pointing to how-black-wraps-lines (#1925)

The section about the Black code style has been moved to its own file.
Update link on the compatible configs page to point to the right place.

3 years agoUpdate Contributing Docs (#1915)
Cooper Lees [Wed, 13 Jan 2021 23:17:30 +0000 (15:17 -0800)]
Update Contributing Docs (#1915)

* Update Contributing Docs
- Update docs with all new tox hotness
- Test running docs build:
  - `sphinx-build -a -b html -W docs/ docs/_build/`

Fixes #1907

* Fix docs/contributing_to_black.md lint

* Remove autogenerated copy pasta

* Fix review typos + regen automated docs via Running Sphinx v1.8.5

3 years agoSet gh action entrypoint interpreter to bash (#1919)
Thomas Hagebols [Mon, 11 Jan 2021 16:23:11 +0000 (17:23 +0100)]
Set gh action entrypoint interpreter to bash (#1919)

3 years agofix #1917 (#1918)
Shota Ray Imaki [Mon, 11 Jan 2021 16:21:14 +0000 (01:21 +0900)]
fix #1917 (#1918)

3 years agoChanged max workers on windows to 60 (#1912)
Troy Murray [Fri, 8 Jan 2021 20:26:42 +0000 (07:26 +1100)]
Changed max workers on windows to 60 (#1912)

3 years agoRelease gh action (#1909)
Rick Staa [Fri, 8 Jan 2021 19:47:03 +0000 (20:47 +0100)]
Release gh action (#1909)

* Gets gh-action ready for marketplace release

* Updates documentation and removes redundant gh-action input argument

* Fixes gh-action bug

This commit fixes a bug which caused not all input arguments were forwarder to the black formatter.

* Update README.md

Co-authored-by: Cooper Lees <me@cooperlees.com>
Co-authored-by: Cooper Lees <me@cooperlees.com>
3 years agoOnly require typing-extensions if Python < 3.8 (#1873)
Taneli Hukkinen [Sun, 3 Jan 2021 16:14:59 +0000 (17:14 +0100)]
Only require typing-extensions if Python < 3.8 (#1873)

3 years agoUse Prettier pre-commit mirror (#1896)
Paul "TBBle" Hampson [Fri, 1 Jan 2021 18:54:35 +0000 (05:54 +1100)]
Use Prettier pre-commit mirror (#1896)

This fixes Prettier install failures similar to those seen in
https://github.com/prettier/prettier/issues/9459, and is the solution
recommended there.

Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
3 years agoBump minimum_pre_commit_version per recommendation (#1895)
Jon Dufresne [Thu, 31 Dec 2020 19:10:18 +0000 (11:10 -0800)]
Bump minimum_pre_commit_version per recommendation (#1895)

Recommended by @asottile, the pre-commit author and maintainer, to avoid
some breakages in version 2.9.0.

3 years agoAdd pyi file support to .pre-commit-hooks.yaml (#1875)
Jon Dufresne [Thu, 31 Dec 2020 17:09:07 +0000 (09:09 -0800)]
Add pyi file support to .pre-commit-hooks.yaml (#1875)

Since pre-commit 2.9.0 (2020-11-21), the types_or key can be used to
match multiple disparate file types. For more upstream details, see:
https://github.com/pre-commit/pre-commit/issues/607

Add the minimum_pre_commit_version to require pre-commit 2.9.0+.

Fixes #402

3 years agoBump typed-ast to fix for s390x (#1892)
Hugo van Kemenade [Thu, 31 Dec 2020 17:07:31 +0000 (19:07 +0200)]
Bump typed-ast to fix for s390x (#1892)

* Bump typed-ast to fix for s390x

* pipenv install typed-ast==1.4.2

3 years agoAs long as it's black (#1893)
Hugo van Kemenade [Thu, 31 Dec 2020 17:03:39 +0000 (19:03 +0200)]
As long as it's black (#1893)

Make background transparent for dark mode

3 years agoFix INTERNAL ERROR caused by removing parens from pointless string (#1888)
Bryan Bugyi [Mon, 28 Dec 2020 20:30:23 +0000 (15:30 -0500)]
Fix INTERNAL ERROR caused by removing parens from pointless string (#1888)

Fixes #1846.

3 years agoBump mypy to 0.780 in pre-commit config (#1887)
Richard Si [Mon, 28 Dec 2020 02:38:11 +0000 (21:38 -0500)]
Bump mypy to 0.780 in pre-commit config (#1887)

To avoid hitting a mypy bug causes pre-commit to always fail on CPython
3.9. Even though it's still an outdated version, the bug effectively
blocks development on CPython 3.9 so that's why this commit exists
instead of waiting for cooperlees to finish his bump to 0.790 PR.

Also this fixes primer to ensure it always raises CalledProcessError
with an int error code. I stole the patch from cooperlees's mypy bump
PR.

It's funny how mypy 0.790 is already asked for in our
Pipfile.lock file, but oh well mypy is probably more commonly run
through pre-commit than standalone I guess.

Oh and if you're curious why the bug doesn't up on CPython 3.8 or lower:
there was some subscription AST changes in CPython 3.9.

3 years agoFuzz on Python 3.9 too (#1882)
Richard Si [Sun, 27 Dec 2020 15:19:08 +0000 (10:19 -0500)]
Fuzz on Python 3.9 too (#1882)

Fuzzing on Python 3.9 used to cause errors but now they have disappeared
on more modern Python 3.9 and Hypothesmith.

3 years agofix format_str() docstring to prevent users from running into NameError (#1885)
nikkie [Sun, 27 Dec 2020 15:18:35 +0000 (00:18 +0900)]
fix format_str() docstring to prevent users from running into NameError (#1885)

3 years agoRemove all trace of flake8-mypy (#1867)
Shantanu [Mon, 14 Dec 2020 07:20:25 +0000 (23:20 -0800)]
Remove all trace of flake8-mypy (#1867)

flake8-mypy is long dead and shouldn't be used, see
https://github.com/ambv/flake8-mypy. We appear to use pre-commit to run
mypy now anyway.

I ran `pipenv uninstall flake8-mypy`, which seems to have made several
changes to Pipfile.lock. Let me know if there's a better way to do this.

Co-authored-by: hauntsaninja <>
3 years agovim plugin: Add quiet flag so non-error actions go unreported (#1733)
Noel Evans [Wed, 9 Dec 2020 23:40:45 +0000 (23:40 +0000)]
vim plugin: Add quiet flag so non-error actions go unreported (#1733)

4 years agoSwitch back to Python 3.8 for ReadTheDocs (#1839)
Richard Si [Thu, 26 Nov 2020 00:26:35 +0000 (19:26 -0500)]
Switch back to Python 3.8 for ReadTheDocs (#1839)

ReadTheDocs doesn't support Python 3.9 yet.

4 years agoAllow same RHS expressions in annotated assignments as in regular assignments (#1835)
Richard Si [Tue, 24 Nov 2020 09:39:25 +0000 (04:39 -0500)]
Allow same RHS expressions in annotated assignments as in regular assignments (#1835)

4 years agoProvide a stdin-filename to allow stdin to respect force-exclude rules (#1780)
Thiago Bellini Ribeiro [Fri, 13 Nov 2020 15:26:07 +0000 (12:26 -0300)]
Provide a stdin-filename to allow stdin to respect force-exclude rules (#1780)

* Provide a stdin-filename to allow stdin to respect exclude/force-exclude rules

This will allow automatic tools to enforce the project's
exclude/force-exclude rules even if they pass the file through stdin to
update its buffer.

This is a similar solution to --stdin-display-name in flake8.

* Update src/black/__init__.py

Co-authored-by: Richard Si <63936253+ichard26@users.noreply.github.com>
* --stdin-filename should only respect --exclude-filename

* Update README with the new --stdin-filename option

* Write some tests for the new stdin-filename functionality

* Apply suggestions from code review

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
* Force stdin output when we asked for stdin even if the file exists

* Add an entry in the changelog regarding --stdin-filename

* Reduce disk reads if possible

Co-authored-by: Richard Si <63936253+ichard26@users.noreply.github.com>
* Check for is_stdin and p.is_file before checking for p.is_dir()

Co-authored-by: Richard Si <63936253+ichard26@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
4 years agoUse lowercase hex numbers fixes #1692 (#1775)
Casper Weiss Bang [Fri, 13 Nov 2020 15:25:17 +0000 (16:25 +0100)]
Use lowercase hex numbers fixes #1692 (#1775)

* Made hex lower case

* Refactored numeric formatting section

* Redid some refactoring and removed bloat

* Removed additions from test_requirements.txt

* Primer now expects expected changes

* Undid some refactoring

* added to changelog

* Update src/black/__init__.py

Co-authored-by: Zsolt Dollenstein <zsol.zsol@gmail.com>
Co-authored-by: Zsolt Dollenstein <zsol.zsol@gmail.com>
Co-authored-by: Cooper Lees <me@cooperlees.com>
4 years agoCorrectly handle inline tabs in docstrings (#1810)
Justin Prieto [Mon, 9 Nov 2020 19:58:23 +0000 (14:58 -0500)]
Correctly handle inline tabs in docstrings (#1810)

The `fix_docstring` function expanded all tabs, which caused a
difference in the AST representation when those tabs were inline and not
leading. This changes the function to only expand leading tabs so inline
tabs are preserved.

Fixes #1601.

4 years agoFix bug which causes f-expressions to be split (#1809)
Bryan Bugyi [Sat, 7 Nov 2020 00:17:23 +0000 (19:17 -0500)]
Fix bug which causes f-expressions to be split (#1809)

Closes #1807.

4 years agoAutomatically build and upload binaries on release (#1743)
Richard Si [Sun, 1 Nov 2020 21:17:23 +0000 (16:17 -0500)]
Automatically build and upload binaries on release (#1743)

This commit adds a new GitHub Actions workflow that builds self-contained
binaries / executables and uploads them as release assets to the triggering
release. Publishing a release, drafting one doesn't count, will trigger this
workflow.

I personally used GitHub Actions only because it's the CI/CD platform(?)
I am familiar with. Only Windows and Linux binaries are supported since
I don't have any systems running Mac OS.

For Linux, I had originally planned to use the manylinux2010 docker image
the PyPA provides for highly compatible wheel building, but unfortunately
it wasn't feasible due to GitHub Actions and PyInstaller incompatibilities.
As a stopgap the oldest versions of Linux and Windows are used although
Windows Server 2019 isn't that old nor is Ubuntu 16.04! I guess someone
(maybe me) could work out something else if compatibility is big problem.

A few things you should know about the workflow:
 - You don't need to set the `GITHUB_TOKEN` secret as it is automatically
   provided by GitHub.
 - matrix.pathsep is used because PyInstaller configuration's format is OS
   dependent for some reason ...

Also it's worth mentioning that Black once had Travis CI and AppVeyor
configuration that did the same thing as this commit. They were committed
in mid 2018 and worked (somewhat) well. Eventually we stopped using AppVeyor
and the refactor to packages broke the Travis CI config. This commit
replaces the still existing and broken Travis CI config wholesale.

Co-authored-by: Anders Fredrik Kiær <31612826+anders-kiaer@users.noreply.github.com>
 - Anders told me that I could get the release asset upload URL directly
   from the github.event.release payload. I originally planned to use
   bruceadams/get-release to get such URL.

4 years agoFix bug where black tries to split string on escaped space (#1799)
Bryan Bugyi [Sat, 31 Oct 2020 17:42:36 +0000 (13:42 -0400)]
Fix bug where black tries to split string on escaped space (#1799)

Closes #1505.

4 years agoStart using Python 3.9 on Travis (#1790)
Abdullah Selek [Fri, 30 Oct 2020 15:24:18 +0000 (15:24 +0000)]
Start using Python 3.9 on Travis (#1790)

* Start using Python 3.9 on Travis

* Remove allow_failures

4 years agoBump cryptography from 3.1 to 3.2 (#1791)
dependabot[bot] [Fri, 30 Oct 2020 15:15:09 +0000 (08:15 -0700)]
Bump cryptography from 3.1 to 3.2 (#1791)

Bumps [cryptography](https://github.com/pyca/cryptography) from 3.1 to 3.2.
- [Release notes](https://github.com/pyca/cryptography/releases)
- [Changelog](https://github.com/pyca/cryptography/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/pyca/cryptography/compare/3.1...3.2)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
4 years agoAdd compatible configuration files. (psf#1789) (#1792)
Shota Ray Imaki [Fri, 30 Oct 2020 15:13:55 +0000 (00:13 +0900)]
Add compatible configuration files. (psf#1789) (#1792)

* Add compatible configuration files. (psf#1789)

* Simplify isort configuration files. (#1789)

4 years agoExtract formatting tests (#1785)
Sagi Shadur [Fri, 30 Oct 2020 15:12:04 +0000 (17:12 +0200)]
Extract formatting tests (#1785)

* Update test versions

* Use parametrize to remove tests duplications

* Extract sources format tests

* Fix mypy errors

* Fix .travis.yml

4 years agoDocument some culprits with pre-commit (#1783)
Bibo-Joshi [Tue, 27 Oct 2020 20:59:43 +0000 (21:59 +0100)]
Document some culprits with pre-commit (#1783)

* Document some culprits with pre-commit

* make pre-commit happy

* don't use monospace for black & pre-commit

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
* make pre-commit happy again

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