Skip to content

Commit

Permalink
Merge branch 'main' into doubletest
Browse files Browse the repository at this point in the history
  • Loading branch information
JelleZijlstra authored Dec 17, 2022
2 parents 39c8778 + c0089ef commit cc3bb3a
Show file tree
Hide file tree
Showing 24 changed files with 487 additions and 112 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/fuzz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pypi_upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
- uses: actions/checkout@v3

- name: Build wheels via cibuildwheel
uses: pypa/cibuildwheel@v2.11.2
uses: pypa/cibuildwheel@v2.11.3
env:
CIBW_ARCHS_MACOS: "${{ matrix.macos_arch }}"

Expand Down
57 changes: 0 additions & 57 deletions .github/workflows/test-311.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "pypy-3.7", "pypy-3.8"]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "pypy-3.7", "pypy-3.8"]
os: [ubuntu-latest, macOS-latest, windows-latest]

steps:
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ repos:
- flake8-simplify

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.971
rev: v0.991
hooks:
- id: mypy
exclude: ^docs/conf.py
Expand Down
17 changes: 17 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,20 @@

<!-- Changes that affect Black's stable style -->

- Fix a crash when a colon line is marked between `# fmt: off` and `# fmt: on` (#3439)

### Preview style

<!-- Changes that affect Black's preview style -->

- Fix a crash in preview style with assert + parenthesized string (#3415)
- Fix crashes in preview style with walrus operators used in function return annotations
and except clauses (#3423)
- Do not put the closing quotes in a docstring on a separate line, even if the line is
too long (#3430)
- Long values in dict literals are now wrapped in parentheses; correspondingly
unnecessary parentheses around short values in dict literals are now removed; long
string lambda values are now wrapped in parentheses (#3440)

### Configuration

Expand All @@ -26,6 +33,9 @@

<!-- Changes to how Black is packaged, such as dependency requirements -->

- Upgrade mypyc from `0.971` to `0.991` so mypycified _Black_ can be built on armv7
(#3380)

### Parser

<!-- Changes to the parser or to version autodetection -->
Expand All @@ -38,6 +48,9 @@

<!-- Changes to Black's terminal output and error messages -->

- Verbose logging now shows the values of `pyproject.toml` configuration variables
(#3392)

### _Blackd_

<!-- Changes to blackd -->
Expand All @@ -46,6 +59,8 @@

<!-- For example, Docker, GitHub Actions, pre-commit, editors -->

- Move 3.11 CI to normal flow now all dependencies support 3.11 (#3446)

### Documentation

<!-- Major changes to documentation and policies. Small docs changes
Expand All @@ -62,6 +77,8 @@
present) or as a single newline character (if a newline is present) (#3348)
- Implicitly concatenated strings used as function args are now wrapped inside
parentheses (#3307)
- For assignment statements, prefer splitting the right hand side if the left hand side
fits on a single line (#3368)
- Correctly handle trailing commas that are inside a line's leading non-nested parens
(#3370)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Try it out now using the [Black Playground](https://black.vercel.app). Watch the
### Installation

_Black_ can be installed by running `pip install black`. It requires Python 3.7+ to run.
If you want to format Jupyter Notebooks, install with `pip install 'black[jupyter]'`.
If you want to format Jupyter Notebooks, install with `pip install "black[jupyter]"`.

If you can't wait for the latest _hotness_ and want to install from GitHub, use:

Expand Down
2 changes: 1 addition & 1 deletion docs/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Also, you can try out _Black_ online for minimal fuss on the
## Installation

_Black_ can be installed by running `pip install black`. It requires Python 3.7+ to run.
If you want to format Jupyter Notebooks, install with `pip install 'black[jupyter]'`.
If you want to format Jupyter Notebooks, install with `pip install "black[jupyter]"`.

If you can't wait for the latest _hotness_ and want to install from GitHub, use:

Expand Down
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ Sphinx==5.3.0
docutils==0.19
sphinxcontrib-programoutput==0.17
sphinx_copybutton==0.5.1
furo==2022.9.29
furo==2022.12.7
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ sources = ["src"]
enable-by-default = false
dependencies = [
"hatch-mypyc>=0.13.0",
"mypy==0.971",
"mypy==0.991",
# Required stubs to be removed when the packages support PEP 561 themselves
"types-typed-ast>=1.4.2",
]
Expand Down
3 changes: 3 additions & 0 deletions src/black/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,9 @@ def main( # noqa: C901
out("Using configuration from project root.", fg="blue")
else:
out(f"Using configuration in '{config}'.", fg="blue")
if ctx.default_map:
for param, value in ctx.default_map.items():
out(f"{param}: {value}")

error_msg = "Oh no! 💥 💔 💥"
if (
Expand Down
12 changes: 11 additions & 1 deletion src/black/comments.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ def generate_ignored_nodes(

# fix for fmt: on in children
if children_contains_fmt_on(container, preview=preview):
for child in container.children:
for index, child in enumerate(container.children):
if isinstance(child, Leaf) and is_fmt_on(child, preview=preview):
if child.type in CLOSING_BRACKETS:
# This means `# fmt: on` is placed at a different bracket level
Expand All @@ -241,6 +241,16 @@ def generate_ignored_nodes(
# The alternative is to fail the formatting.
yield child
return
if (
child.type == token.INDENT
and index < len(container.children) - 1
and children_contains_fmt_on(
container.children[index + 1], preview=preview
)
):
# This means `# fmt: on` is placed right after an indentation
# level, and we shouldn't swallow the previous INDENT token.
return
if children_contains_fmt_on(child, preview=preview):
return
yield child
Expand Down
2 changes: 1 addition & 1 deletion src/black/handle_ipynb_magics.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def jupyter_dependencies_are_installed(*, verbose: bool, quiet: bool) -> bool:
if verbose or not quiet:
msg = (
"Skipping .ipynb files as Jupyter dependencies are not installed.\n"
"You can fix this by running ``pip install black[jupyter]``"
'You can fix this by running ``pip install "black[jupyter]"``'
)
out(msg)
return False
Expand Down
Loading

0 comments on commit cc3bb3a

Please sign in to comment.