Skip to content

Commit

Permalink
Rebase Pyink to psf@ec4a152.
Browse files Browse the repository at this point in the history
Also deprecate `--pyink-lines=` since _Black_ now supports `--lines-ranges=`.

PiperOrigin-RevId: 584193348
  • Loading branch information
yilei authored and copybara-github committed Nov 27, 2023
1 parent 3431f23 commit 4bb3130
Show file tree
Hide file tree
Showing 55 changed files with 2,853 additions and 953 deletions.
3 changes: 2 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ All notable changes to Pyink are recorded here.

## Unreleased

* Nothing notable unreleased.
* The CLI option `--pyink-lines` is now deprecated and replaced by _Black_'s
built-in option `--line-ranges`.

## 23.10.0

Expand Down
75 changes: 36 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ patches as possible in the future.

# What are the main differences?

* Support only formatting selected line ranges, using the `--pyink-lines=`
argument (see [psf/black#830](https://github.com/psf/black/issues/830)).

* Support two-space indentation, using the `pyink-indentation` option.

* Support inferring preferred quote style by calculating the majority in a
Expand Down Expand Up @@ -50,39 +47,6 @@ patches as possible in the future.
)
```

* Prefer not breaking lines between immediately nested brackets (see
[psf/black#1811](https://github.com/psf/black/issues/1811)). Example:

```python
# Pyink:
secrets = frozenset({
1001,
1002,
1003,
1004,
1005,
1006,
1007,
1008,
1009,
})

# Black:
secrets = frozenset(
{
1001,
1002,
1003,
1004,
1005,
1006,
1007,
1008,
1009,
}
)
```

* Add an empty line between class statements without docstrings, and the first
method. We expect we will simply remove this difference from *Pyink* at some
point. Example:
Expand Down Expand Up @@ -200,6 +164,42 @@ These are differences that existed in the past. We have upstreamed them to
] = some_long_expression_causing_long_line
```

* Prefer not breaking lines between immediately nested brackets (see
[psf/black#1811](https://github.com/psf/black/issues/1811)). Example:

```python
# Pyink:
secrets = frozenset({
1001,
1002,
1003,
1004,
1005,
1006,
1007,
1008,
1009,
})

# Black:
secrets = frozenset(
{
1001,
1002,
1003,
1004,
1005,
1006,
1007,
1008,
1009,
}
)
```

* Support only formatting selected line ranges, using the `--pyink-lines=`
argument (see [psf/black#830](https://github.com/psf/black/issues/830)).

# How do I use *Pyink*?

Same as `black`, except you'll use `pyink`. All `black` command line options are
Expand All @@ -214,9 +214,6 @@ There are also a few *Pyink* only options:
[default: pyink]
--pyink-indentation [2|4] The number of spaces used for indentation.
[default: 4]
--pyink-lines START-END Range of lines to format. Must be specified
as "START-END", index is 1-based and
inclusive on both ends.
--pyink-use-majority-quotes When normalizing string quotes, infer
preferred quote style by calculating the
majority in the file. Multi-line strings and
Expand Down
Loading

0 comments on commit 4bb3130

Please sign in to comment.