Commit Graph

1791 Commits

Author SHA1 Message Date
Jelle Zijlstra
f7917453c9
Re-export black.Mode (#3875) 2023-09-10 16:12:20 -07:00
Jelle Zijlstra
0b62b9c9a4
Ignore aiohttp DeprecationWarning for 3.12 (#3876)
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
2023-09-10 15:45:13 -07:00
Hugo van Kemenade
c83ad6c077
Upgrade to Furo 2023.9.10 to fix docs build (#3873) 2023-09-10 14:36:25 -07:00
Shantanu
4eebfd1a7a
Add mypyc test marks to new tests that patch (#3871)
This is enough for me to get a clean test run on Python 3.9 with mypyc.
I have not been able to repro the pickle failures on either Linux or
macOS.
2023-09-10 07:53:27 -07:00
Richard Si
add161b367
Bump RTD Python version from 3.8 to 3.11 (#3868)
Recent ReadTheDocs builds have been failing as our documentation dependencies (notably Sphinx) require Python 3.9+.
2023-09-09 09:08:28 -07:00
Shantanu
4e93f2aa01
Add classifier for 3.12 (#3866) 2023-09-08 22:16:25 -07:00
Jelle Zijlstra
716fa08090
Upgrade mypy (#3864) 2023-09-08 22:16:15 -07:00
Jelle Zijlstra
b70b2c6196
Prepare release 23.9.0 (#3863) 2023-09-08 20:24:49 -07:00
konsti
b40b01ffe3
Blank line between nested and function def in stub files. (#3862)
The idea behind this change is that we stop looking into previous body to determine if there should be a blank before a function or class definition.

Input:

```python
import sys

if sys.version_info > (3, 7):
    class Nested1:
        assignment = 1
        def function_definition(self): ...
    def f1(self) -> str: ...
    class Nested2:
        def function_definition(self): ...
        assignment = 1
    def f2(self) -> str: ...

if sys.version_info > (3, 7):
    def nested1():
        assignment = 1
        def function_definition(self): ...
    def f1(self) -> str: ...
    def nested2():
        def function_definition(self): ...
        assignment = 1
    def f2(self) -> str: ...
```

Stable style
```python
import sys

if sys.version_info > (3, 7):
    class Nested1:
        assignment = 1
        def function_definition(self): ...

    def f1(self) -> str: ...

    class Nested2:
        def function_definition(self): ...
        assignment = 1
    def f2(self) -> str: ...

if sys.version_info > (3, 7):
    def nested1():
        assignment = 1
        def function_definition(self): ...

    def f1(self) -> str: ...
    def nested2():
        def function_definition(self): ...
        assignment = 1
    def f2(self) -> str: ...
```

In the stable formatting, we have a blank line sometimes, not depending on the previous statement on the same level, but on the last (potentially nested) statement in the previous body.

#2783/#3564 fixes this for classes in preview style:

```python
import sys

if sys.version_info > (3, 7):
    class Nested1:
        assignment = 1
        def function_definition(self): ...

    def f1(self) -> str: ...

    class Nested2:
        def function_definition(self): ...
        assignment = 1

    def f2(self) -> str: ...

if sys.version_info > (3, 7):
    def nested1():
        assignment = 1
        def function_definition(self): ...

    def f1(self) -> str: ...
    def nested2():
        def function_definition(self): ...
        assignment = 1
    def f2(self) -> str: ...
```

This PR additionally fixes this for function definitions:

```python
if sys.version_info > (3, 7):
    if sys.platform == "win32":
        assignment = 1
        def function_definition(self): ...

    def f1(self) -> str: ...
    if sys.platform != "win32":
        def function_definition(self): ...
        assignment = 1

    def f2(self) -> str: ...

if sys.version_info > (3, 8):
    if sys.platform == "win32":
        assignment = 1
        def function_definition(self): ...

    class F1: ...
    if sys.platform != "win32":
        def function_definition(self): ...
        assignment = 1

    class F2: ...
```

You can see the effect of this change on typeshed in https://github.com/konstin/typeshed/pull/1/files. As baseline, the preview mode changes without this PR are at https://github.com/konstin/typeshed/pull/2.

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-09-08 18:51:27 -07:00
Charlie Marsh
a20338cf10
Avoid removing whitespace for walrus operators within subscripts (#3823)
Co-authored-by: hauntsaninja <hauntsaninja@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-09-08 07:37:13 -07:00
Jonas Haag
74d3009ba4
Add Black PyCharm 2023.2 integration instructions (#3839) 2023-09-07 18:35:07 -07:00
KotlinIsland
8daa64a2e1
blackd: fix mishandling of single character input (#3558) 2023-09-07 00:11:50 -07:00
Shantanu
df50fee7fd
Apply ignore logic before symlink resolution (#3846)
This means, for instance, that a gitignored symlink cannot affect your
formatting. Fixes #3527, fixes #3826
2023-09-06 21:06:07 -07:00
Johnny.H
58f1bf69d2
Move coverage configurations to pyproject.toml (#3858) 2023-09-02 22:46:23 -04:00
dependabot[bot]
47676bf593
Bump furo from 2023.7.26 to 2023.8.19 in /docs + sphinx to 7.2.3 (#3848)
* Bump furo from 2023.7.26 to 2023.8.19 in /docs

Bumps [furo](https://github.com/pradyunsg/furo) from 2023.7.26 to 2023.8.19.
- [Release notes](https://github.com/pradyunsg/furo/releases)
- [Changelog](https://github.com/pradyunsg/furo/blob/main/docs/changelog.md)
- [Commits](https://github.com/pradyunsg/furo/compare/2023.07.26...2023.08.19)

---
updated-dependencies:
- dependency-name: furo
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

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

* Move to sphinx 7.2.3 + fix intersphinx_mapping

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Cooper Ry Lees <me@cooperlees.com>
2023-08-26 08:44:17 -05:00
Kjell-Magnus
d9c249c25a
Fix download badge link (#3853) 2023-08-22 12:40:10 -07:00
Shantanu
6310a405f6
Improve handling of root to get_sources (#3847)
This is a little more type safe and a little cleaner
2023-08-19 08:13:05 -07:00
Marc Mueller
066aa9210a
Remove tox pin (#3844) 2023-08-19 08:09:59 -07:00
Marc Mueller
c6a031e623
Improve caching by comparing file hashes as fallback for mtime and size (#3821)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2023-08-18 19:26:36 -07:00
Shantanu
793c2b5f9f
Pin tox to fix CI (#3843) 2023-08-18 18:32:47 -07:00
pre-commit-ci[bot]
ade371fd1c
[pre-commit.ci] pre-commit autoupdate (#3837) 2023-08-16 00:01:21 -07:00
Shantanu
7c4fe83bd8
Make pre-commit do less (#3838) 2023-08-15 06:51:26 -07:00
dependabot[bot]
66648c528a
Bump pypa/cibuildwheel from 2.14.1 to 2.15.0 (#3836) 2023-08-14 00:30:56 -07:00
Christian Proud
c36e468794
Remove ENV_PATH on Black action completion (#3759) 2023-08-08 11:12:05 -07:00
pre-commit-ci[bot]
77f19944f6
[pre-commit.ci] pre-commit autoupdate (#3833)
updates:
- [github.com/pre-commit/mirrors-prettier: v3.0.0 → v3.0.1](https://github.com/pre-commit/mirrors-prettier/compare/v3.0.0...v3.0.1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-08-08 08:41:39 -07:00
Shantanu
c160e4b7ce
More concise formatting for dummy implementations (#3796) 2023-08-03 19:11:21 -07:00
Shantanu
59e8936768
Document pre-commit mirror (#3828) 2023-08-03 18:46:08 -07:00
pre-commit-ci[bot]
1b028cc9d9
[pre-commit.ci] pre-commit autoupdate (#3825) 2023-08-01 01:48:21 -07:00
dependabot[bot]
8a16b25fb1
Bump furo from 2023.5.20 to 2023.7.26 in /docs (#3824)
Bumps [furo](https://github.com/pradyunsg/furo) from 2023.5.20 to 2023.7.26.
- [Release notes](https://github.com/pradyunsg/furo/releases)
- [Changelog](https://github.com/pradyunsg/furo/blob/main/docs/changelog.md)
- [Commits](https://github.com/pradyunsg/furo/compare/2023.05.20...2023.07.26)

---
updated-dependencies:
- dependency-name: furo
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-31 08:43:32 -07:00
Aneesh Agrawal
1a972e3e11
Add Lyft to organizations using black (#3818) 2023-07-27 14:50:51 -07:00
freddiewanah
133af57207
Rewrite mostly useless assert in test_trans.py (#3810)
This PR updates an assert statement that checks the bounds of a
string-slicing operation. The updated assertion provides more accurate
and informative error handling by specifically checking the relative
values of the indices and the string length.

The original assertion was essentially checking if Python's string
slicing was behaving as expected. However, it wasn't providing any
guarantees or useful information about the bounds i and j themselves.

The updated assertion checks that the indices used for slicing are
within the bounds of the string. It will throw an AssertionError if the
indices are out of bounds or if i > j, providing a more specific and
informative error.
2023-07-27 12:51:28 -04:00
Yury V. Zaytsev
d9d0a02d89
Fix typo in target-version param wrongly used in plural (#3817) 2023-07-27 07:12:38 -07:00
Pradeep Kumar
c3235e6da7
Fix unintentionally swapped words in index.md (#3809)
Fix unintentionally swapped words in index.md

I think the intent was to say "large changes in formatting", because it doesn't make sense to say "large formatting in changes".
2023-07-23 21:56:19 -07:00
mihazagar
13bd4fffae
Fixing pre-commit using pyyaml with broken version (#3804) 2023-07-22 11:12:37 -07:00
Shantanu
e7e8d6287b
Simplify empty line tracker (#3797) 2023-07-22 07:49:51 -08:00
rdrll
0b301f8095
Improvements to contributing docs (#3753) 2023-07-18 14:11:24 -07:00
Richard Si
2f68ac850b
Fix diff-shades comment missing newlines (#3799)
Preserving newlines is done differently when writing to $GITHUB_OUTPUT
over the deprecated :set-output: command.
2023-07-18 06:51:16 -08:00
dependabot[bot]
068f6fb8fa
Bump pypa/cibuildwheel from 2.13.1 to 2.14.1 (#3795)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-16 23:59:36 -07:00
Shantanu
c1e30d97fe
Fix most blib2to3 lint (#3794) 2023-07-16 21:33:58 -07:00
Richard Si
8d80aecd50
Maintainers += Shantanu Jain (hauntsaninja) (#3792) 2023-07-16 18:16:12 -07:00
Clément Robert
92e0f5b965
Avoid importing IPython if notebook cells do not contain magics (#3782)
Co-authored-by: hauntsaninja <hauntsaninja@gmail.com>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2023-07-16 21:09:26 -04:00
Shantanu
0e26ada66d
Continue to avoid Click typing issue (#3791) 2023-07-16 17:35:19 -07:00
rax
6123b4ac26
Document shebang comment behaviour (#3787) 2023-07-11 12:16:43 -07:00
pre-commit-ci[bot]
37895f8e50
[pre-commit.ci] pre-commit autoupdate (#3780)
updates:
- [github.com/pycqa/flake8: 4.0.1 → 6.0.0](https://github.com/pycqa/flake8/compare/4.0.1...6.0.0)
- [github.com/pre-commit/mirrors-prettier: v2.7.1 → v3.0.0](https://github.com/pre-commit/mirrors-prettier/compare/v2.7.1...v3.0.0)
- [github.com/pre-commit/pre-commit-hooks: v4.3.0 → v4.4.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.3.0...v4.4.0)
2023-07-11 07:50:52 -07:00
Shantanu
8d2110320b
Fix lint in test_ipynb (#3781)
Unblocks #3780
2023-07-11 07:35:41 -07:00
Alex Waygood
f4490acfd7
Remove unneeded mypy dependencies (#3783) 2023-07-11 07:21:36 -07:00
Nicola Soranzo
027afda403
Remove Python 3.7 from classifiers (#3784)
Follow-up on https://github.com/psf/black/pull/3765
2023-07-11 07:21:15 -07:00
skykasko
a062d5c985
Fix typo in CITATION.cff (#3779)
Fix tiny typo in CITATION.cff
2023-07-10 19:38:01 -07:00
Jelle Zijlstra
193ee766ca
Prepare release 23.7.0 (#3776) 2023-07-10 17:09:47 -07:00
Shantanu
38723bb778
Unpin pytest-xdist (#3772) 2023-07-10 11:49:40 -07:00