Commit Graph

937 Commits

Author SHA1 Message Date
Łukasz Langa
773e4a22d5
Revert "Use lowercase hex numbers fixes #1692 (#1775)"
This reverts commit 7d032fa848.
2021-04-25 19:13:23 +02:00
Felix Hildén
368f043f13
Document experimental string processing and docstring indentation (#2106) 2021-04-22 10:37:27 -07:00
CiderMan
5316bbff0e
Handle Docstrings as bytes + strip all whitespace (#2037)
(fixes #1844, fixes #1923, fixes #1851, fixes #2002, fixes #2103)
2021-04-22 08:40:51 -07:00
Mark Bell
1fc3215e8c
Make black remove leading and trailing spaces from one-line docstrings (#1740)
Fixes #1738. Fixes #1812.

Previously, Black removed leading and trailing spaces in multiline docstrings but failed to remove them from one-line docstrings.
2021-04-22 08:23:41 -07:00
Felix Hildén
7b4ca4bd90
Instructions on documenting code style modifications (#2109) 2021-04-18 14:18:39 -07:00
Laurent Tréguier
9eb29a6d47
Fix small comment typo (#2112)
We probably don't need to fall back on "polling" when setting up an asyncio loop
2021-04-16 10:41:19 -07:00
Pierre Verkest
6d0bdc2f38
Add missing instructions to make test passed (#2100) 2021-04-12 06:18:11 -07:00
Pierre Sassoulas
d960d5d238
Remove NBSP at the beginning of comments (#2092)
Closes #2091
2021-04-11 14:41:22 -07:00
Simon
ea4e714b9a
Added not formatting files in gitignore (psf#1682) (#1734) 2021-04-11 14:00:03 -07:00
Jelle Zijlstra
2116eca51f
fix typing issue around lru_cache arguments (#2098)
This was found by python/mypy#10308
2021-04-11 07:49:42 -07:00
johnthagen
e4003c2c43
Exclude venv directory by default (#1683)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-04-10 05:07:34 -07:00
Jelle Zijlstra
4d36304a2c
Fix error from upcoming typeshed change (#2096)
See python/typeshed#5190
2021-04-08 10:25:37 -07:00
Cooper Lees
8e0803e7e5
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
2021-04-07 21:13:11 -07:00
dependabot[bot]
9cbf1f1622
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>
2021-04-06 11:07:57 -07:00
Jakub Warczarek
e114ef5514
Get rid of redundant spaces in docs (#2085)
Thanks!
2021-04-04 07:21:33 -07:00
Cooper Lees
201b331e55
Run lint in latest python + update precommit (#2081)
- Lets move to latest and greatest of lints
2021-04-01 16:15:50 -07:00
Richard Si
48dfda084a
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.
2021-04-01 14:24:18 -07:00
Cooper Lees
53a6216cd5
Add CONTRBUTING info about CHANGES.md requirement (#2073)
Instruct contributors to add the change line to help save maintainer / releaser time
2021-04-01 18:54:45 +02:00
Cooper Lees
125ed5b260
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
2021-04-01 18:41:55 +02:00
Harish Rajagopal
9451c57d1c
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.
2021-04-01 18:39:18 +02:00
KotlinIsland
ed9d58b741 don't require typed-ast 2021-04-01 17:38:04 +02:00
dependabot[bot]
c702588daa
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>
2021-03-29 18:59:57 -07:00
Mark Bell
dc8b0a4383
GREP for PR reference accepts references that are split over a line (#2072)
Fixes #2070
2021-03-28 16:01:37 -07:00
Shantanu
4218ae18c0
Add --skip-magic-trailing-comma to CHANGES.md (#2064) 2021-03-26 07:21:18 -07:00
Richard Si
580b4fe8bc
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.
2021-03-24 16:38:07 -07:00
Cooper Lees
5d33f20a2a
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
2021-03-21 13:05:24 -07:00
Richard Si
0be7f96d9c
Fix indentation in docs/editor_integration.md (#2056)
Numbered list entries' bodies need to be indented or else the list won't
render correctly.
2021-03-20 12:15:55 -07:00
Jairo Llopis
d62d677ca2
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]: e82bb8d8b8 (opinionated-warnings)
2021-03-18 08:14:15 -07:00
Konstantin Alekseev
5446a92f01
Use vim autoload script (#1157) 2021-03-07 16:13:25 -08:00
Richard Si
b332cfa655
Add missing changelog entry for fmt: skip (#2025) 2021-03-06 12:02:25 -08:00
John Meow
1f7e73506c
Add ALE (#1753) 2021-03-05 20:22:19 -08:00
Hadi Alqattan
b3ceb293d9
Remove unused import statements using Pycln. (#2021)
* remove unused imports using Pycln.

* reverse comma style.
2021-03-05 11:58:00 -08:00
dependabot[bot]
12f98219bc
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>
2021-03-05 10:43:54 -08:00
Hugo van Kemenade
24418a5450
Black requires Python 3.6.2+ (#1668) 2021-03-04 05:59:31 -08:00
Utkarsh Gupta
e293473ea9
Add formatters-python for atom to editor_integration (#1834) 2021-03-03 16:46:27 -08:00
Joshua Cannon
e3c71c3a47
Turn test_regex into a click callback (#2016)
Co-authored-by: Richard Si <63936253+ichard26@users.noreply.github.com>
2021-03-02 17:21:50 -08:00
Austin Pray
cac18293d5
Adds --stdin-filename back to changelog (#2017)
* Adds --stdin-filename back to changelog

Looks like this went missing dea81b7ad5 (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>
2021-03-01 16:35:57 -08:00
Joshua Cannon
beecd6fd0a
Add --extend-exclude parameter (#2005)
Look ma! I contribute to open source!

Co-authored-by: Richard Si <63936253+ichard26@users.noreply.github.com>
2021-03-01 14:07:36 -08:00
Rishav Kundu
858225d34d
Strip redundant parentheses from assignment exprs (#1906)
Fixes #1656
2021-02-27 17:20:23 -08:00
tpilewicz
b06cd15666
Wrap arithmetic and binary arithmetic expressions in invisible parentheses (#2001) 2021-02-24 03:56:56 -08:00
James Addison
e1c86f987e
Fuzzer testing: less strict special-case regex match passthrough for multi-line EOF exceptions (#1998) 2021-02-22 07:49:38 -08:00
James Addison
fe4a9d6bee
Fixup: update function name in docs to match source (#1997) 2021-02-22 07:46:38 -08:00
James
24e8dad575
Fix for enum changes in 3.10 (#1999) 2021-02-22 07:42:05 -08:00
Paul "TBBle" Hampson
cd4295dd98
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>
2021-02-21 22:43:23 -08:00
James Addison
0cbe19c813 Minimize changes: more closely resemble original conditional logic 2021-02-20 19:36:21 +01:00
James Addison
22127c633e Readability: reduce boolean nesting 2021-02-20 19:36:21 +01:00
James Addison
24700806f6 Cleanup: remove unused / redundant variables from conditionals 2021-02-20 19:36:21 +01:00
James Addison
e0d766727d Simplification: only yield empty omit list when magic trailing comma is present 2021-02-20 19:36:21 +01:00
James Addison
829331a877 Simplification: only use special-case token retrieval logic when magic trailing comma is present 2021-02-20 19:36:21 +01:00
James Addison
89c42a0011 Clarity: special case: avoid using variables that have the same names as methods 2021-02-20 19:36:21 +01:00