Commit Graph

16 Commits

Author SHA1 Message Date
Shantanu
2c90480e1a
Use strict mypy checking (#3222)
Co-authored-by: Richard Si <63936253+ichard26@users.noreply.github.com>
2022-08-30 20:46:46 -07:00
Shantanu
680cbe3a4f
Use --no-implicit-optional for type checking (#3220)
This makes type checking PEP 484 compliant (as of 2018).
mypy will change its defaults soon.

See:
https://github.com/python/mypy/issues/9091
https://github.com/python/mypy/pull/13401
2022-08-12 19:28:47 -07:00
Richard Si
82e150a13a
Keep tests working w/ upcoming aiohttp 4.0.0 (#2974)
aiohttp.test_utils.unittest_run_loop was deprecated since aiohttp 3.8
and aiohttp 4 (which isn't a thing quite yet) removes it. To maintain
compatibility with the full range of versions we declare to support,
test_blackd.py will now define a no-op replacement if it can't be
imported.

Also, mypy is painfully slow to use without a cache, let's reenable it.
2022-03-30 13:40:50 -07:00
Richard Si
a57ab326b2
Farewell black-primer, it was nice knowing you (#2924)
Enjoy your retirement at https://github.com/cooperlees/black-primer
2022-03-15 12:57:59 -07:00
Richard Si
117891878e
Implementing mypyc support pt. 2 (#2431) 2021-11-15 20:24:16 -08:00
Nipunn Koorapati
467efe1556
Add --projects cli flag to black-primer (#2555)
* Add --projects cli flag to black-primer

Makes it possible to run a subset of projects on black primer

* Refactor into click callback
2021-10-27 11:31:34 -07:00
Nipunn Koorapati
62ed5389fc
Remove some unneeded exceptions from mypy.ini (#2557) 2021-10-21 20:59:48 -07:00
Nipunn Koorapati
da8a5bb189
Disallow any Generics on mypy except in black_primer (#2556)
Only black_primer needs the disallowal - means we'll
get better typing everywhere else.
2021-10-21 19:38:39 -07:00
Marco Edward Gorelli
fcfead919b
set mypy_path in mypy.ini (#2455) 2021-08-28 06:55:34 -07:00
Łukasz Langa
b2ee211b5a
Click 8.0 renamed its "die on LANG=C" function so we need to look for that one too (#2227) 2021-05-12 21:47:32 +02:00
Shantanu
a522aa45c6
Remove all trace of flake8-mypy (#1867)
flake8-mypy is long dead and shouldn't be used, see
https://github.com/ambv/flake8-mypy. We appear to use pre-commit to run
mypy now anyway.

I ran `pipenv uninstall flake8-mypy`, which seems to have made several
changes to Pipfile.lock. Let me know if there's a better way to do this.

Co-authored-by: hauntsaninja <>
2020-12-13 23:20:25 -08:00
Cooper Lees
8acc22f114
Add black-primer unittests (#1426)
* Add black-primer unittests

- Get this tool covered with some decent unittests for all unittests wins
- Have a CLI and lib test class
- Import it from `test_black.py` so we always run tests
- Revert typing asyncio.Queue as Queue[str] so we can work in 3.6
- **mypy**: Until black > 3.6 disallow_any_generics=False for primer code

Test:
- Run tests: `coverage run tests/test_primer.py` or `coverage run -m unittest`
```
(b) cooper-mbp1:black cooper$ coverage report
Name                      Stmts   Miss  Cover
---------------------------------------------
src/black_primer/cli.py      49      8    84%
src/black_primer/lib.py     148     28    81%
tests/test_primer.py        114      1    99%
---------------------------------------------
TOTAL                       311     37    88%
```

* Use ProactorEventLoop for Windows + fix false path for Linux

* Set Windows to use ProactorEventLoop in  to benefit all callers

* sys.platform seems to not having the loop applied - So type ignore and use platform.system() gate

* Have each test loop correctly set to ProactorEventLoop on Windows for < 3.8 too
2020-05-17 12:18:49 -07:00
Michael J. Sullivan
3e60f6d454 Support compilation with mypyc (#1009)
* Make most of blib2to3 directly typed and mypyc-compatible

This used a combination of retype and pytype's merge-pyi to do the
initial merges of the stubs, which then required manual tweaking to
make actually typecheck and work with mypyc.

Co-authored-by: Sanjit Kalapatapu <sanjitkal@gmail.com>
Co-authored-by: Michael J. Sullivan <sully@msully.net>

* Make black able to compile and run with mypyc

The changes made fall into a couple categories:
 * Fixing actual type mistakes that slip through the cracks
 * Working around a couple mypy bugs (the most annoying of which being
   that we need to add type annotations in a number of places where
   variables are initialized to None)

Co-authored-by: Sanjit Kalapatapu <sanjitkal@gmail.com>
Co-authored-by: Michael J. Sullivan <sully@msully.net>
2019-10-30 07:29:29 -07:00
Zsolt Dollenstein
025d2ca4ba
use versioneer to manage __version__ (#981) 2019-08-21 15:42:30 +02:00
Zsolt Dollenstein
a82f186787 blackd: a HTTP server for blackening (#460) 2018-09-17 10:02:25 -07:00
Łukasz Langa
e74117f172 Initial commit 2018-03-14 12:55:32 -07:00