Skip to content

Commit

Permalink
Merge branch 'main' into feat/pyproject-config
Browse files Browse the repository at this point in the history
  • Loading branch information
Shivansh-007 committed Oct 21, 2021
2 parents 88c80c2 + 847d468 commit 5f0147a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

- Add new `--workers` parameter (#2514)
- Bumped typed-ast version minimum to 1.4.3 for 3.10 compatibility (#2519)
- Fixed feature detection for positional-only arguments in lambdas (#2532)
- Bumped typed-ast version minimum to 1.4.3 for 3.10 compatiblity (#2519)
- Allow specifying `config` in config files (#2525)

### _Blackd_
Expand Down
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Used by ReadTheDocs; pinned requirements for stability.

myst-parser==0.15.1
Sphinx==4.1.2
Sphinx==4.2.0
sphinxcontrib-programoutput==0.17
sphinx_copybutton==0.4.0
6 changes: 5 additions & 1 deletion src/black/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1125,7 +1125,11 @@ def get_features_used(node: Node) -> Set[Feature]:
features.add(Feature.NUMERIC_UNDERSCORES)

elif n.type == token.SLASH:
if n.parent and n.parent.type in {syms.typedargslist, syms.arglist}:
if n.parent and n.parent.type in {
syms.typedargslist,
syms.arglist,
syms.varargslist,
}:
features.add(Feature.POS_ONLY_ARGUMENTS)

elif n.type == token.COLONEQUAL:
Expand Down
4 changes: 4 additions & 0 deletions tests/test_black.py
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,10 @@ def test_get_features_used(self) -> None:
self.assertEqual(black.get_features_used(node), set())
node = black.lib2to3_parse(expected)
self.assertEqual(black.get_features_used(node), set())
node = black.lib2to3_parse("lambda a, /, b: ...")
self.assertEqual(black.get_features_used(node), {Feature.POS_ONLY_ARGUMENTS})
node = black.lib2to3_parse("def fn(a, /, b): ...")
self.assertEqual(black.get_features_used(node), {Feature.POS_ONLY_ARGUMENTS})

def test_get_future_imports(self) -> None:
node = black.lib2to3_parse("\n")
Expand Down

0 comments on commit 5f0147a

Please sign in to comment.