]> git.madduck.net Git - etc/vim.git/log

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

etc/vim.git
2 years agogitignore update
martin f. krafft [Wed, 9 Feb 2022 14:43:19 +0000 (15:43 +0100)]
gitignore update

2 years agoadd dallarmi abbrevs
martin f. krafft [Thu, 1 Sep 2022 08:20:46 +0000 (10:20 +0200)]
add dallarmi abbrevs

2 years agoremove snippets
martin f. krafft [Thu, 1 Sep 2022 08:20:39 +0000 (10:20 +0200)]
remove snippets

2 years agouse provided python snippets
martin f. krafft [Thu, 3 Feb 2022 06:20:40 +0000 (07:20 +0100)]
use provided python snippets

2 years agoultisnips listing with q
martin f. krafft [Thu, 3 Feb 2022 06:19:37 +0000 (07:19 +0100)]
ultisnips listing with q

2 years agoRevert "Move iabs to UltiSnips"
martin f. krafft [Mon, 18 Oct 2021 01:40:03 +0000 (14:40 +1300)]
Revert "Move iabs to UltiSnips"

This reverts commit b546781a4dfb5c244a8813c1ee3e6383e3d725fb.

2 years agoadd flake8 exceptions to trace line
martin f. krafft [Mon, 18 Oct 2021 01:36:19 +0000 (14:36 +1300)]
add flake8 exceptions to trace line

3 years agoUpdate vcsh gitignore file
martin f. krafft [Thu, 14 Oct 2021 02:24:35 +0000 (15:24 +1300)]
Update vcsh gitignore file

3 years agoNo longer using vimplate
martin f. krafft [Thu, 14 Oct 2021 02:23:53 +0000 (15:23 +1300)]
No longer using vimplate

3 years agouse artesanal colour scheme
martin f. krafft [Thu, 14 Oct 2021 01:40:48 +0000 (14:40 +1300)]
use artesanal colour scheme

3 years agoMerge commit '907d4569b0384e76f9e3ca4a6a7ee917712c031d' into tmp
martin f. krafft [Thu, 14 Oct 2021 02:22:02 +0000 (15:22 +1300)]
Merge commit '907d4569b0384e76f9e3ca4a6a7ee917712c031d' into tmp

3 years agoenable lastplace
martin f. krafft [Thu, 14 Oct 2021 02:16:01 +0000 (15:16 +1300)]
enable lastplace

3 years agoblack pyenv
martin f. krafft [Thu, 14 Oct 2021 02:15:47 +0000 (15:15 +1300)]
black pyenv

3 years agoEnable khuno
martin f. krafft [Thu, 14 Oct 2021 02:14:16 +0000 (15:14 +1300)]
Enable khuno

3 years agomarkdown config
martin f. krafft [Thu, 14 Oct 2021 02:13:59 +0000 (15:13 +1300)]
markdown config

3 years agoSpecial markdown configuration for in mail mode
martin f. krafft [Thu, 14 Oct 2021 02:13:29 +0000 (15:13 +1300)]
Special markdown configuration for in mail mode

3 years agoenable editorconfig
martin f. krafft [Thu, 14 Oct 2021 02:07:28 +0000 (15:07 +1300)]
enable editorconfig

3 years agoEnable fugitive
martin f. krafft [Thu, 14 Oct 2021 02:07:17 +0000 (15:07 +1300)]
Enable fugitive

3 years agoEnable YCM
martin f. krafft [Thu, 14 Oct 2021 02:06:41 +0000 (15:06 +1300)]
Enable YCM

3 years agoBetter map for funky arrow
martin f. krafft [Thu, 14 Oct 2021 01:45:57 +0000 (14:45 +1300)]
Better map for funky arrow

3 years agoRemove airline config
martin f. krafft [Thu, 14 Oct 2021 01:45:46 +0000 (14:45 +1300)]
Remove airline config

3 years agoRemove unused navigation maps
martin f. krafft [Thu, 14 Oct 2021 01:45:18 +0000 (14:45 +1300)]
Remove unused navigation maps

3 years agoWhatHighlight syntax analysis
martin f. krafft [Thu, 14 Oct 2021 01:41:49 +0000 (14:41 +1300)]
WhatHighlight syntax analysis

3 years agoDo not use special navigation for wrap mode
martin f. krafft [Thu, 14 Oct 2021 01:41:35 +0000 (14:41 +1300)]
Do not use special navigation for wrap mode

3 years agoHandle #. formatted lists in &flp
martin f. krafft [Thu, 14 Oct 2021 01:27:46 +0000 (14:27 +1300)]
Handle #. formatted lists in &flp

3 years agonew lbdbq plugin location
martin f. krafft [Thu, 14 Oct 2021 01:27:28 +0000 (14:27 +1300)]
new lbdbq plugin location

3 years agoUpdated settings for Python
martin f. krafft [Thu, 14 Oct 2021 01:20:48 +0000 (14:20 +1300)]
Updated settings for Python

3 years agovim-snippets enabled
martin f. krafft [Thu, 14 Oct 2021 02:11:23 +0000 (15:11 +1300)]
vim-snippets enabled

3 years agoAdd '.vim/bundle/black/' from commit '2f3fa1f6d0cbc2a3f31c7440c422da173b068e7b'
martin f. krafft [Thu, 14 Oct 2021 02:03:27 +0000 (15:03 +1300)]
Add '.vim/bundle/black/' from commit '2f3fa1f6d0cbc2a3f31c7440c422da173b068e7b'

git-subtree-dir: .vim/bundle/black
git-subtree-mainline: 3f68af9813542a5e277b7a51b316644241c372d7
git-subtree-split: 2f3fa1f6d0cbc2a3f31c7440c422da173b068e7b

3 years agoAdd '.vim/bundle/vim-python-pep8-indent/' from commit '60ba5e11a61618c0344e2db1902101...
martin f. krafft [Thu, 14 Oct 2021 02:01:27 +0000 (15:01 +1300)]
Add '.vim/bundle/vim-python-pep8-indent/' from commit '60ba5e11a61618c0344e2db190210145083c91f8'

git-subtree-dir: .vim/bundle/vim-python-pep8-indent
git-subtree-mainline: 2de20d9c659d6350a6408dc1ec4aa6e0b1dea6ac
git-subtree-split: 60ba5e11a61618c0344e2db190210145083c91f8

3 years agoAdd '.vim/bundle/vim-flake8/' from commit 'ddceec6c457fd59bc2a9321cbf817e42aa4bfd86'
martin f. krafft [Thu, 14 Oct 2021 01:59:28 +0000 (14:59 +1300)]
Add '.vim/bundle/vim-flake8/' from commit 'ddceec6c457fd59bc2a9321cbf817e42aa4bfd86'

git-subtree-dir: .vim/bundle/vim-flake8
git-subtree-mainline: b546781a4dfb5c244a8813c1ee3e6383e3d725fb
git-subtree-split: ddceec6c457fd59bc2a9321cbf817e42aa4bfd86

3 years agoMove iabs to UltiSnips
martin f. krafft [Thu, 14 Oct 2021 01:43:09 +0000 (14:43 +1300)]
Move iabs to UltiSnips

3 years agoconfigure ultisnips
martin f. krafft [Thu, 14 Oct 2021 01:44:37 +0000 (14:44 +1300)]
configure ultisnips

3 years agoBetter mail backup writing
martin f. krafft [Thu, 14 Oct 2021 01:20:15 +0000 (14:20 +1300)]
Better mail backup writing

3 years agomake markdown formatting available in mail
martin f. krafft [Thu, 14 Oct 2021 00:36:52 +0000 (13:36 +1300)]
make markdown formatting available in mail

3 years agoupdate mail identity shortcuts
martin f. krafft [Thu, 14 Oct 2021 00:36:17 +0000 (13:36 +1300)]
update mail identity shortcuts

3 years agoremove broken symlinks
martin f. krafft [Thu, 14 Oct 2021 00:34:48 +0000 (13:34 +1300)]
remove broken symlinks

3 years agoFix feature detection for positional-only arguments in lambdas (#2532)
Zac Hatfield-Dodds [Tue, 12 Oct 2021 04:45:58 +0000 (15:45 +1100)]
Fix feature detection for positional-only arguments in lambdas (#2532)

3 years agochore(ci): use official Python 3.10 (#2521)
Mathieu Kniewallner [Tue, 5 Oct 2021 21:22:56 +0000 (23:22 +0200)]
chore(ci): use official Python 3.10 (#2521)

Python 3.10 (final) was released yesterday and is now available on GHA!

3 years agoBump typed-ast minimum to 1.4.3 for 3.10 compat (#2519)
Richard Si [Tue, 5 Oct 2021 00:36:57 +0000 (20:36 -0400)]
Bump typed-ast minimum to 1.4.3 for 3.10 compat (#2519)

3 years agoMNT: remove unnecessary test deps + some refactoring (GH-2510)
Richard Si [Sat, 2 Oct 2021 23:37:32 +0000 (19:37 -0400)]
MNT: remove unnecessary test deps + some refactoring (GH-2510)

The main goals of this commit include:

* improving consistency on how strict the test suite is -- Jelle has
  seen cases where a test did not fail to an incomplete test setup
  even though it should've
* simplifying tests for both ease of creation and reading via
  parametrization and helpers
* reorganizing the test suite by grouping more tests
* dropping test suite dependencies that aren't strictly necessary

The test suite could definitely do with more refactoring, but this is a
good first pass. Anyway it would've gotten too big to review effectively
if I did continue on this PR.

Commit history before squash merge:

* Drop parameterized dep and refactor format tests

Since the test suite is already using pytest-only features we can drop
the parameterized test dependency in favour of pytest's own offering.

I also added an utility function called assert_format that makes it
even easier to verify Black formats some code correctly. We already
have great tooling if the case is very simple in test_format.py but
any sort of complication makes it hard to use. Also if you're writing
a non-standard test case, you have to be careful to include all of
the steps so issues don't go undetected. assert_format aims to
1) improve consistency, 2) avoid wasted CPU cycles, and 3) avoid
logical errors that hide issues.

Finally, quite a few tests were either moved and/or simplified with
the new setup.

* Move file collection tests
* Add assert_collected_sources helper function

Testing source collection involves a lot of repetitive boilerplate,
something that black.files.get_sources's signature does not help with.
So to cut down on boilerplate like `report=black.Report()` I added
a convenience function to tests/test_black.py which wraps
black.get_sources. Its signature is designed to be much more lax to
make it much easier to use. Somehow this leads to cutting 100 lines!

Also IMO the test cases are much easier to read since it's more
declarative than really procedural now.

* Run isort on some test files
* Move cache tests
* Use pytest-style asserts & add parametrization
* Drop now unnecessary test dependencies

*pytest-cases might be interesting for further refactoring but I
haven't been able to wrap my head around it for the time being. We
can always revisit anyway.

3 years agoAdd --workers CLI parameter (fixes #2513) (#2514)
Fergus Mitchell [Wed, 29 Sep 2021 16:50:44 +0000 (17:50 +0100)]
Add --workers CLI parameter (fixes #2513) (#2514)

Fixes #2513

3 years agoAllow to pass the FileMode options in the vim plugin (#1319)
shaoran [Wed, 29 Sep 2021 00:31:29 +0000 (02:31 +0200)]
Allow to pass the FileMode options in the vim plugin (#1319)

3 years agoFix python_version markers in Pipfile.lock (#2511)
Richard Si [Tue, 28 Sep 2021 22:41:35 +0000 (18:41 -0400)]
Fix python_version markers in Pipfile.lock (#2511)

This took way too much effort but in the end I was able to achieve a
(mostly) functional Pipfile.lock ranging from 3.6 to 3.9 🎉

3 years agoAdd test to cover when unable to replace magics (#2471)
Marco Edward Gorelli [Sat, 25 Sep 2021 19:46:36 +0000 (20:46 +0100)]
Add test to cover when unable to replace magics (#2471)

Another follow-up from #2357, adding a test for uncovered code.

3 years agoBump required aiohttp version to 3.7.4 (#2509)
Zsolt Dollenstein [Sat, 25 Sep 2021 19:45:13 +0000 (20:45 +0100)]
Bump required aiohttp version to 3.7.4 (#2509)

Commit history before merge:

* Bump required aiohttp version to 3.7.4

This release includes an important security fix
(https://github.com/aio-libs/aiohttp/security/advisories/GHSA-v6wp-4m6f-gcjg) and many
other improvements.

* add changelog entry
* Let's not forget about Pipfile

Co-authored-by: Richard Si <63936253+ichard26@users.noreply.github.com>
3 years agore-implement simple CORS middleware for blackd (#2500)
Zsolt Dollenstein [Sat, 25 Sep 2021 11:58:44 +0000 (12:58 +0100)]
re-implement simple CORS middleware for blackd (#2500)

* re-implement simple CORS middleware for blackd
* remove aiohttp-cors from setup.py
* Remove aiohttp-cors from Pipfile.lock

Co-authored-by: Richard Si <63936253+ichard26@users.noreply.github.com>
3 years agoAdd Kedro to project list and QuantumBlack to orgs (#2502)
Deepyaman Datta [Fri, 24 Sep 2021 02:20:48 +0000 (22:20 -0400)]
Add Kedro to project list and QuantumBlack to orgs (#2502)

3 years agoDOC: cleanup pre-commit instructions following #2430 (#2481)
Clément Robert [Sun, 19 Sep 2021 09:15:39 +0000 (11:15 +0200)]
DOC: cleanup pre-commit instructions following #2430 (#2481)

3 years agoadd check for version in the-basics example (#2459)
Marco Edward Gorelli [Sun, 19 Sep 2021 03:24:09 +0000 (04:24 +0100)]
add check for version in the-basics example (#2459)

3 years agofix all b904s (#2501)
Zsolt Dollenstein [Sat, 18 Sep 2021 21:18:06 +0000 (22:18 +0100)]
fix all b904s (#2501)

3 years agoUpdate CHANGES.md for 21.9b0 release (#2494)
Jelle Zijlstra [Tue, 14 Sep 2021 02:23:11 +0000 (19:23 -0700)]
Update CHANGES.md for 21.9b0 release (#2494)

3 years agoFix missing toml extra w/ setuptools-scm (GH-2475)
Sorin Sbarnea [Mon, 6 Sep 2021 21:10:39 +0000 (22:10 +0100)]
Fix missing toml extra w/ setuptools-scm (GH-2475)

Project packaging is using TOML due to pyproject.toml but fails to
mention it, causing installation failures with newer setuptools-scm 6.3.0.

Commit history before merge:

* Fix missing toml extra

Fixed breakage uncovered by setuptools-scm 6.3.0 where installation
would fail for project that missed to mention the toml extra.

* Bump setuptools[-scm] to avoid toml extra

https://github.com/psf/black/pull/2475#issuecomment-912730714

> If you constraint greater than 6.3.0 and setuptools greater than 45
> you can skip the extra,

* Actually for safety reasons, just use the extra

Co-authored-by: Richard Si <63936253+ichard26@users.noreply.github.com>
3 years agoRemove `blackcellmagic` reference (#2477)
Marco Edward Gorelli [Sun, 5 Sep 2021 14:52:16 +0000 (15:52 +0100)]
Remove `blackcellmagic` reference (#2477)

This package seems to be unmaintained (last commit is from > 2 years ago), and `black` now runs on Jupyter Notebooks directly

3 years agoAdd hidden import to PyInstaller build (GH-2466)
Jameel Al-Aziz [Wed, 1 Sep 2021 22:05:11 +0000 (15:05 -0700)]
Add hidden import to PyInstaller build (GH-2466)

Add new platformdirs dependencies as hidden imports when creating
PyInstaller-based binaries.

platformdirs imports the module for each platform dynamically, which
PyInstaller is unable to correctly detect for packing. By adding the
modules as hidden imports, we are telling PyInstaller to include the
modules in the packaged binary.

This issue seems to have been introduce when switching to platformdirs
in #2375. fixes #2464

Commit history before merge:

* Add hidden import to PyInstaller build

Add new platformdirs dependency as a hidden import when creating
PyInstaller based binaries.

* Only include the platformdirs for the relevant os

3 years agoChange docker workflow for latest_release tag (#2468)
pszlazak [Tue, 31 Aug 2021 18:26:31 +0000 (20:26 +0200)]
Change docker workflow for latest_release tag (#2468)

3 years agofix: run pypi / docker upload from published draft releases (#2461)
aru [Mon, 30 Aug 2021 17:26:21 +0000 (13:26 -0400)]
fix: run pypi / docker upload from published draft releases (#2461)

Draft releases don't trigger the workflows (that's good!) but since they only

Commit history before merge:

* fix: run pypi upload from published draft releases
* Fix broken task list markup in PR template
* change docker workflow to build on release publish

Co-authored-by: Richard Si <63936253+ichard26@users.noreply.github.com>
3 years agoExclude broken typing-extensions version + fix import (#2460)
Richard Si [Sun, 29 Aug 2021 21:04:49 +0000 (17:04 -0400)]
Exclude broken typing-extensions version + fix import (#2460)

re. import, the ipynb code was assuming that typing-extensions would
always be available, but that's not the case! There's an environment
marker on the requirement meaning it won't get installed on 3.10 or
higher. The test suite didn't catch this issue since aiohttp pulls in
typing-extensions unconditionally.

3 years agoPrepare CHANGES.md for release 21.8b0 (#2458)
Richard Si [Sun, 29 Aug 2021 18:56:22 +0000 (14:56 -0400)]
Prepare CHANGES.md for release 21.8b0 (#2458)

Hopefully my first release doesn't end up in flames 🔥

Commit history before merge:

* Prepare CHANGES.md for release 21.8b0
* I need to add a check for this too.

3 years agoPin setuptools-scm build time dependency (#2457)
Richard Si [Sat, 28 Aug 2021 19:37:53 +0000 (15:37 -0400)]
Pin setuptools-scm build time dependency (#2457)

The setuptools-scm dependency in setup.cfg did not have a version
specified, leading to the issues described in #2449 after a faulty release
of setuptools-scm was published. To avoid this issue in the future, the
last version before that faulty update is now pinned.

Commit history before merge:

* Pin setuptools-scm dependency version (#2449)
* Update CHANGES.md
* Let's pin in pyproject.toml too

Mostly since it's non-build-backend specific configuration and more
widely standardized file. Not sure what benefits pinning in setup.cfg
gives us on top of pyproject.toml but I'd rather not find out during
the release that is supposed to happen today :wink:

Co-authored-by: FiNs <24248249+FabianNiehaus@users.noreply.github.com>
3 years agoadd test which covers stdin filename ipynb (#2454)
Marco Edward Gorelli [Sat, 28 Aug 2021 15:27:55 +0000 (16:27 +0100)]
add test which covers stdin filename ipynb (#2454)

3 years agoset mypy_path in mypy.ini (#2455)
Marco Edward Gorelli [Sat, 28 Aug 2021 13:55:34 +0000 (14:55 +0100)]
set mypy_path in mypy.ini (#2455)

3 years agoDocument jupyter hook (#2416)
Marco Edward Gorelli [Fri, 27 Aug 2021 20:21:08 +0000 (21:21 +0100)]
Document jupyter hook (#2416)

This also introduces a script so we can reference the latest version in
the example pre-commit configuration in the docs without forgetting to
update it when doing a release!

Commit history before merge:

* document jupyter hook
* note minimum version
* add check for pre-commit version
* use git tag
* curl api during ci
* parse version from changes file
* fixup script
* rename variables
* Tweak the docs & magical script
* fix couple of typos
* pin additional dependencies in hook
* Add types-PyYAML to lockfile

Co-authored-by: Richard Si <63936253+ichard26@users.noreply.github.com>
3 years agoblib2to3: support unparenthesized wulruses in more places (#2447)
Richard Si [Thu, 26 Aug 2021 20:59:01 +0000 (16:59 -0400)]
blib2to3: support unparenthesized wulruses in more places (#2447)

Implementation stolen from PR davidhalter/parso#162. Thanks parso!

I could add support for these newer syntactical constructs in the
target version detection logic, but until I get diff-shades up
and running I don't feel very comfortable adding the code.

3 years agoStop changing return type annotations to tuples (#2384)
Richard Si [Thu, 26 Aug 2021 01:32:27 +0000 (21:32 -0400)]
Stop changing return type annotations to tuples (#2384)

This fixes a bug where a trailing comma would be added to a
parenthesized return annotation changing its type to a tuple.
Here's one case where this bug shows up:

```
def spam() -> (
    this_is_a_long_type_annotation_which_should_NOT_get_a_trailing_comma
):
    pass
```

The root problem was that the type annotation was treated as if it was
a parameter & import list (is_body=True to linegen::bracket_split_build_line)
where a trailing comma is usually fine. Now there's another check in the
aforementioned function to make sure the body it's operating on isn't
a return annotation before truly adding a trailing comma.

3 years agoMNT: add pull request template (#2443)
Richard Si [Thu, 26 Aug 2021 01:25:44 +0000 (21:25 -0400)]
MNT: add pull request template (#2443)

So we don't have to request changes on these basic requirements as
often - hopefully :)

3 years agoAdd cpython Lib/ repository config into primer config - Disabled (#2429)
Cooper Lees [Tue, 24 Aug 2021 21:29:49 +0000 (14:29 -0700)]
Add cpython Lib/ repository config into primer config - Disabled (#2429)

* Add CPython repository into primer runs

- CPython tests is probably the best repo for black to test on as the stdlib's unittests should use all syntax
  - Limit to running in recent versions of the python runtime - e.g. today >= 3.9
    - This allows us to parse more syntax
- Exclude all failing files for now
  - Definitely have bugs to explore there - Refer to #2407 for more details there
  - Some test files on purpose have syntax errors, so we will never be able to parse them
- Add new black command arguments logging in debug mode; very handy for seeing how CLI arguments are formatted

CPython now succeeds ignoring 16 files:
```
Oh no! 💥 💔 💥
1859 files would be reformatted, 148 files would be left unchanged.
```

Testing
- Ran locally with and without string processing - Very little runtime difference BUT 3 more failed files
```
time /tmp/tb/bin/black --experimental-string-processing --check . 2>&1 | tee /tmp/black_cpython_esp
...
Oh no! 💥 💔 💥
1859 files would be reformatted, 148 files would be left unchanged, 16 files would fail to reformat.

real 4m8.563s
user 16m21.735s
sys 0m6.000s
```
- Add unittest for new covienence config file flattening that allows long arguments to be broke up into an array/list of strings

Addresses #2407

---

Commit history before merge:

* Add new `timeout_seconds` support into primer.json
- If present, will set forked process limit to that value in seconds
- Otherwise, stay with default 10 minutes (600 seconds)

* Add new "base_path" concept to black-primer
- Rather than start at the repo root start at a configured path within the repository
  - e.g. for cpython only run black on `Lib`

* Disable by default - It's too much for GitHub Actions. But let's leave config for others to use
* Minor tweak to _flatten_cli_args

Co-authored-by: Richard Si <63936253+ichard26@users.noreply.github.com>
3 years agoChange sys.exit to raise ImportError (#2440)
erykoff [Tue, 24 Aug 2021 20:59:24 +0000 (13:59 -0700)]
Change sys.exit to raise ImportError (#2440)

The fix for #1688 in #1761 breaks help("modules") introspection and also leads
to unhappy results when inadvertently importing blackd from Python. Basically
the sys.exit(-1) causes the whole Python REPL to exit -- not great to suffice.

Commit history before merge:

* Change sys.exit to Raise.
* Add #2440 to changelog.
* Fix lint error from prettier
* Remove exception chain for more helpful user message.

Co-authored-by: Richard Si <63936253+ichard26@users.noreply.github.com>
3 years agoAdd test requirements to Pipfile[.lock] & bump deps (#2436)
Richard Si [Mon, 23 Aug 2021 03:20:06 +0000 (23:20 -0400)]
Add test requirements to Pipfile[.lock] & bump deps (#2436)

While this development environment / requirements situation is a mess,
let's at least make it consistent. We're effectively supporting two
modes of development in this project, 1) tox based dev commands
(e.g. `tox -e fuzz`) that are dead simple to use, and 2) manual dev
commands (e.g. `pytest -n auto`) that give more control and are usually
faster.

Right now the Pipfile.lock based development environment is incomplete
missing the test requirements specified in ./test_requirements.txt.
This is annoying since manual test commands (e.g. `pytest -k fmtonoff`)
fail. Let's fix this by making Pipfile.lock basically a
"everything you need" requirements file (fuzzing not included since
running it locally is not something common).

Oh and let's bump some documentation deps (and bring some requirements
across .pre-commit-config.yaml, Pipfile, and docs/requirement.txt in
alignment again). Don't worry, I tested these changes so they should
be fine (hopefully!).

3 years agoImprove f-string expression detection regex so ... (#2437)
Richard Si [Mon, 23 Aug 2021 02:52:19 +0000 (22:52 -0400)]
Improve f-string expression detection regex so ... (#2437)

we don't accidentally add backslashes to them when normalizing quotes
because that's invalid syntax!

The problem this commit fixes is that matches would eat too much
blocking important matches to occur. For example, here's one f-string
body:

    {a}{b}{c}

I know there's no risk of introducing backslashes here, but the regex
already goes sideways with this. Throwing this example at regex101
I get:

    {a}{b}{c}   # The As and Bs are the two matches, and the upper
    ---- ----   # case letters are the groups with those matches.
    aAaa bbBb

... we've missed the middle expression (so if any backslashes in a
more complex example were introduced there we wouldn't bail out
even though we should -- hence the bug). As it stands the regex
needs somesort of extra character (or the start/end of the body)
around the expressions but that isn't always the case as shown
above.

The fix implemented here is to turn the "eat a surrounding non-curly
bracket character" groups ie. `(?:[^{]|^)` and `(?:[^}]|$)` into
negative lookaheads and lookbehinds. This still guarantees the
already specified rules but without problematically eating extra
characters ^^

3 years agoPresent a more user-friendly error if .gitignore is invalid (#2414)
Nipunn Koorapati [Fri, 20 Aug 2021 23:54:53 +0000 (16:54 -0700)]
Present a more user-friendly error if .gitignore is invalid (#2414)

Fixes #2359.

This commit now makes Black exit with an user-friendly error message if a
.gitignore file couldn't be parsed -- a massive improvement over an opaque
traceback!

3 years agoRemove `language_version` for pre-commit (#2430)
Aneesh Agrawal [Wed, 18 Aug 2021 16:24:14 +0000 (09:24 -0700)]
Remove `language_version` for pre-commit (#2430)

* Remove `language_version` for pre-commit

At my company, we set the Python version in `default_language_version`
in each repo's `.pre-commit-config.yaml`,
so that all hooks are running with the same Python version.

However, this currently doesn't work for black,
as the `language_version` specified here
in the upstream `.pre-commit-hooks.yaml` takes precedence.
Currently, this requires us to manually set `language_version`
specifically for black,
duplicating the value from `default_language_version`.
The failure mode otherwise is subtle -
black works most of the time,
but try to add a walrus operator and it suddenly breaks!

Given that black's `setup.py` already has `python_requires>=3.6.2`,
specifying that `python3` must be used here isn't needed
as folks inadvertently using Python 2 will get hook-install-time failures anyways.
Remove the `language_version` from these upstream hook configs
so that users of black are able to use `default_language_version`
and have it apply to all their hooks, black included.

Example `.pre-commit-config.yaml` before:
```
default_language_version:
  python: python3.8
repos:
-   repo: https://github.com/psf/black
    rev: 21.7b0
    hooks:
    -   id: black
        language_version: python3.8
```

After:
```
default_language_version:
  python: python3.8
repos:
-   repo: https://github.com/psf/black
    rev: 21.7b0
    hooks:
    -   id: black
```

* Add changelog entry

3 years agoEnhance transparency to SignColumn and FoldColumn
Stefan Wimmer [Mon, 16 Aug 2021 14:58:21 +0000 (16:58 +0200)]
Enhance transparency to SignColumn and FoldColumn

3 years agoAdd jupyter deps to Pipfile.lock (#2419)
Marco Edward Gorelli [Mon, 16 Aug 2021 02:54:42 +0000 (03:54 +0100)]
Add jupyter deps to Pipfile.lock (#2419)

3 years agoUpdate language server links (#2425)
Tom Fryers [Thu, 12 Aug 2021 22:45:33 +0000 (23:45 +0100)]
Update language server links (#2425)

python-language-server is no longer maintained.

3 years agofix: remove unneccessary escape character (#2423)
aru [Thu, 12 Aug 2021 01:50:46 +0000 (21:50 -0400)]
fix: remove unneccessary escape character (#2423)

3 years agoJupyter notebook support (#2357)
Marco Edward Gorelli [Fri, 6 Aug 2021 20:57:46 +0000 (21:57 +0100)]
Jupyter notebook support (#2357)

To summarise, based on what was discussed in that issue:

due to not being able to parse automagics (e.g. pip install black)
without a running IPython kernel, cells with syntax which is parseable
by neither ast.parse nor IPython will be skipped cells with multiline
magics will be skipped trailing semicolons will be preserved, as they
are often put there intentionally in Jupyter Notebooks to suppress
unnecessary output

Commit history before merge (excluding merge commits):

* wip
* fixup tests
* skip tests if no IPython
* install test requirements in ipynb tests
* if --ipynb format all as ipynb
* wip
* add some whole-notebook tests
* docstrings
* skip multiline magics
* add test for nested cell magic
* remove ipynb_test.yml, put ipynb tests in tox.ini
* add changelog entry
* typo
* make token same length as magic it replaces
* only include .ipynb by default if jupyter dependencies are found
* remove logic from const
* fixup
* fixup
* re.compile
* noop
* clear up
* new_src -> dst
* early exit for non-python notebooks
* add non-python test notebook
* add repo with many notebooks to black-primer
* install extra dependencies for black-primer
* fix planetary computer examples url
* dont run on ipynb files by default
* add scikit-lego (Expected to change) to black-primer
* add ipynb-specific diff
* fixup
* run on all (including ipynb) by default
* remove --include .ipynb from scikit-lego black-primer
* use tokenize so as to mirror the exact logic in IPython.core.displayhooks quiet
* fixup
* :art:
* clarify docstring
* add test for when comment is after trailing semicolon
* enumerate(reversed) instead of [::-1]
* clarify docstrings
* wip
* use jupyter and no_jupyter marks
* use THIS_DIR
* windows fixup
* perform safe check cell-by-cell for ipynb
* only perform safe check in ipynb if not fast
* remove redundant Optional
* :art:
* use typeguard
* dont process cell containing transformed magic
* require typing extensions before 3.10 so as to have TypeGuard
* use dataclasses
* mention black[jupyter] in docs as well as in README
* add faq
* add message to assertion error
* add test for indented quieted cell
* use tokenize_rt else we cant roundtrip
* fmake fronzet set for tokens to ignore when looking for trailing semicolon
* remove planetary code examples as recent commits result in changes
* use dataclasses which inherit from ast.NodeVisitor
* bump typing-extensions so that TypeGuard is available
* bump typing-extensions in Pipfile
* add test with notebook with empty metadata
* pipenv lock
* deprivative validate_cell
* Update README.md
* Update docs/getting_started.md
* dont cache notebooks if jupyter dependencies arent found
* dont write to cache if jupyter deps are not installed
* add notebook which cant be parsed
* use clirunner
* remove other subprocess calls
* add docstring
* make verbose and quiet keyword only
* :art:
* run second many test on directory, not on file
* test for warning message when running on directory
* early return from non-python cell magics
* move NothingChanged to report to avoid circular import
* remove circular import
* reinstate --ipynb flag

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
3 years agoFix type dependencies of mypy invocation (#2411)
Taneli Hukkinen [Fri, 6 Aug 2021 18:53:24 +0000 (21:53 +0300)]
Fix type dependencies of mypy invocation (#2411)

Commit history before merge:

* Fix type dependencies of mypy invocation
* Consistent version upper bound

3 years agoTest on Python 3.10-dev (#2406)
Hugo van Kemenade [Wed, 28 Jul 2021 14:29:11 +0000 (17:29 +0300)]
Test on Python 3.10-dev (#2406)

3 years agoFix issue templates + add docs template (#2399)
Richard Si [Wed, 28 Jul 2021 00:38:04 +0000 (20:38 -0400)]
Fix issue templates + add docs template (#2399)

The template weren't applying the default labels ever since I renamed
the labels.

There has been enough issues about documentation opened recently so it's
probably worth a template for it.

3 years agoAdd ESP to sqlalchemy for black-primer (#2400)
Richard Si [Sun, 25 Jul 2021 00:04:01 +0000 (20:04 -0400)]
Add ESP to sqlalchemy for black-primer (#2400)

The crash has been fixed for a little while now. Tentatively assuming
that this will lead to changes.

3 years agoClarify contributing docs (#2398)
Jelle Zijlstra [Sat, 24 Jul 2021 22:59:53 +0000 (15:59 -0700)]
Clarify contributing docs (#2398)

"as configurable as gofmt" means little to people who haven't used gofmt.

3 years agoisort docs have changed urls (#2390)
David Szotten [Thu, 22 Jul 2021 14:04:53 +0000 (15:04 +0100)]
isort docs have changed urls (#2390)

3 years agoadd context manager to temporarily change the cwd (#2377)
Jelle Zijlstra [Sat, 17 Jul 2021 02:21:34 +0000 (19:21 -0700)]
add context manager to temporarily change the cwd (#2377)

Commit history before merge:

* add context manager to temporarily change the cwd
* Iterator, not Iterable

3 years agoUse platformdirs over appdirs (#2375)
Bernát Gábor [Fri, 16 Jul 2021 17:45:47 +0000 (18:45 +0100)]
Use platformdirs over appdirs (#2375)

Signed-off-by: Bernát Gábor <bgabor8@bloomberg.net>
Signed-off-by: Bernát Gábor <gaborjbernat@gmail.com>
3 years agoUpdate CHANGES.md for 21.7b0 release (#2376)
Cooper Lees [Fri, 16 Jul 2021 14:42:47 +0000 (07:42 -0700)]
Update CHANGES.md for 21.7b0 release (#2376)

* Update CHANGES.md for 21.7b0 release

* move some changes to the right section

* another one

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
3 years agoCreate Docker tag 'latest_release' (#2374)
pszlazak [Fri, 16 Jul 2021 14:26:29 +0000 (16:26 +0200)]
Create Docker tag 'latest_release' (#2374)

Docker images created during release process will have extra tag 'latest_release'.

This closes #2373.

3 years agoDon't include profiling/ to cut down sdist by ~2x (#2362)
Richard Si [Fri, 16 Jul 2021 00:21:53 +0000 (20:21 -0400)]
Don't include profiling/ to cut down sdist by ~2x (#2362)

They seem to be used as test cases for a specific region of formatting
that was slow. Now performance testing is probably something end users
won't be needing to do, so this is an easy way of reducing the sdist
size sigificantly.

3 years agoImprove AST safety parsing error message (#2304)
Felix Hildén [Tue, 13 Jul 2021 17:24:55 +0000 (20:24 +0300)]
Improve AST safety parsing error message (#2304)

Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>
3 years agoSwitch `toml` TOML library for `tomli` (#2301)
Richard Si [Mon, 12 Jul 2021 20:01:38 +0000 (16:01 -0400)]
Switch `toml` TOML library for `tomli` (#2301)

toml unfortunately has a lack of maintainership issue right now. It's
evident by the fact toml only supports TOML v0.5.0. TOML v1.0.0 has
been recently released and right now Black crashes hard on its usage.

tomli is a brand new parse only TOML library. It supports TOML
v1.0.0. Although TBH we're switching to this one mostly because
pip is doing the same.

*The upper bound was included at the library maintainer's request.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Taneli Hukkinen <3275109+hukkin@users.noreply.github.com>
3 years agoAdd LocalStack and Twisted to projects using Black
Łukasz Langa [Mon, 12 Jul 2021 09:56:03 +0000 (11:56 +0200)]
Add LocalStack and Twisted to projects using Black

3 years agoSecond run of tox -e py results in a test error for test marked with no_python2 ...
Marco Edward Gorelli [Sun, 11 Jul 2021 20:03:36 +0000 (21:03 +0100)]
Second run of tox -e py results in a test error for test marked with no_python2 (#2369)

Fixes #2367

3 years agoUse setuptools.find_packages in setup (#2363)
Felix Hildén [Sat, 10 Jul 2021 00:09:29 +0000 (03:09 +0300)]
Use setuptools.find_packages in setup (#2363)

* Use setuptools.find_packages in setup

* Address mypy errors

3 years agoAvoid src being marked as optional in help (#2356)
Richard Si [Fri, 9 Jul 2021 01:46:32 +0000 (21:46 -0400)]
Avoid src being marked as optional in help (#2356)

3 years agoMerge pull request #93 from pmrowla/ignore-count
Vincent Driessen [Tue, 6 Jul 2021 07:06:10 +0000 (09:06 +0200)]
Merge pull request #93 from pmrowla/ignore-count

ignore `flake8 --count` lines

3 years agoignore --count lines
Peter Rowlands [Tue, 6 Jul 2021 06:45:20 +0000 (15:45 +0900)]
ignore --count lines

3 years agofix typo (#2358)
Marco Edward Gorelli [Sun, 4 Jul 2021 18:23:00 +0000 (19:23 +0100)]
fix typo (#2358)

3 years agoAccept empty stdin (close #2337) (#2346)
simaki [Wed, 23 Jun 2021 19:11:23 +0000 (04:11 +0900)]
Accept empty stdin (close #2337) (#2346)

Commit history before merge:

* Accept empty stdin (close #2337)
* Update tests/test_black.py
* Add changelog
* Assert Black reformats an empty string to an empty string (#2337) (#2346)
* fix

3 years agoGet `click` types from main repo (#2344)
Taneli Hukkinen [Tue, 22 Jun 2021 15:58:49 +0000 (18:58 +0300)]
Get `click` types from main repo (#2344)

Click types have been moved to click repo itself. See pallets/click#1856

I've had some issues with typeshed types being outdated in another project
so might be good to avoid that here.

Commit history before merge:

* Get `click` types from main repo
* Fix mypy errors
* Require click v8 for type annotations
* Update Pipfile

3 years agoUpdate pre-commit config (#2331)
SADIK KUZU [Tue, 22 Jun 2021 01:28:25 +0000 (04:28 +0300)]
Update pre-commit config (#2331)

via `pre-commit autoupdate`

```
Updating https://gitlab.com/pycqa/flake8
... updating 3.9.0 -> 3.9.2.
Updating https://github.com/pre-commit/mirrors-mypy
... updating v0.812 -> v0.902.
Updating https://github.com/pre-commit/mirrors-prettier
... updating v2.2.1 -> v2.3.1.
```

Signed-off-by: SADIK KUZU <sadikkuzu@hotmail.com>
* Add necessary typeshed packages to requirements

Co-authored-by: Richard Si <63936253+ichard26@users.noreply.github.com>