#black-formatter
1 messages ยท Page 23 of 1
Ironically, this is both the wrong and right channel to ask in
If you'd like help with your python code, check out #โ๏ฝhow-to-get-help
Black may be able to fix some of your simpler problems though, its a tool that auto formats your code
@plain atlas can you ask your question again, it got deleted unintentionally
Sorry about that
No worries, thanks for the swift action ๐
how are python warnings set to be emitted during running? Ik its something with the W flag....
yes ik it wasn't a black question but ๐
okay, got it
python -W always
or PYTHONWARNINGS=always
Description
Checklist - did you ...
- [ ] Add a CHANGELOG entry if necessary?
- [ ] Add / update tests if necessary?
- [ ] Add new / update outdated documentation?
Hi ๐
Is your feature request related to a problem? Please describe.
# TODO: Offer more options here
# e.g. Run on X random packages etc.
is written that adding more options to black-primer so that only a part of all the projects in config could be used should be done.
Describe the solution you'd like
Add an option --random-packages-count N, N being an int.
Then, only run ...
The more I review these sort of contributions the more I realize that we don't really have a good way to verify these claims are true. Seems unlikely that people would lie but it's always possible.
Anyway thank you!
Still surprisingly slow at ~1.2s on my machine but this is good enough (and won't slow build + test cycles by any reasonable margin). Thank you for the quick turnaround!
FWIW while it's great you're working on black-primer, I'm currently writing a semi-replacement for the development tool: https://github.com/ichard26/diff-shades. Fundamentally it takes the idea of black-primer and extends it with whatever great ideas mypy-primer added (theirs was inspired by ours), notably diffing support ...
Thank you so much for your contribution! You're awesome, @dawnofmidnight. (also that cat image is soo cute :3)
... now I think about it, I should probably check windows
U call?
Uhm what?
I usually like to break things on windows, anything I can help with?
Oh alright then, if you could setup a quick test environment for dawn's PR and cd into some random directory (\tests should do) that isn't the project root and verify no tests break that'd be awesome.
should be roughly these steps (yeah i'm not using pipenv)
although you'll have to checkout dawn's PR instead just cloning psf/black
Tested on 3.9, no unexpected failures
alright so dawn's PR is good to ship :)
woohoo!
thanks @tribal thistle and @silent apex 
Ahh, I completely missed Marco's second comment, thanks for fixing it!
I swear I copied that code directly from his comment, I guess I removed it for some reason
Speed is good. I did have to take a few passes tho to see how this worked. Like @ichard26 I was amazed that pytest log magic and click's magic get along.
92eeacc Use STDIN project in test_projects to ensure it... - nipunn1313
The comments aren't consistent
@red sedge in what way?
I suggested changes but the permalink link to them doesn't work?
yea not sure what happened to that link
Sometimes two and sometimes 2
It will be harder to grep for them when removing the code
I mean, I explicitly split the PR into two commits so we could just revert the second one
But sure I can do that
Black helps avoid a whole bunch of pedantry, it has to spill out somewhere
- This is due to 2021.10.8 having arm wheels and newer versions not
I will go see if I can help restore arm build @ https://bitbucket.org/mrabarnett/mrab-regex/issues/399/missing-wheel-for-macosx-and-the-new-m1 soon.
fair enough ๐
One has a semi and the other doesn't...
huh?
A semi colon
how does a semi-colon get into my code, sigh, where is it?
https://github.com/psf/black/pull/2523/files#diff-3b01c50563d8a5ba8893fc84303571a9b8a57bbcd2823ad65164008846d884acR77 missing a semi
Yeah I wouldn't have mentioned it if it didn't go with the two/2
Deprecate; python two support
Oh wow not only did mypyc NOT subtly change black's formatting behaviour (woo!) main has no formatting differences compared to 21.9b0 as well ๐
!remind @bright glacier 1y that bug that just cropped up? its def related to this. /hj
You can't mention other members/roles in your reminder!
damn it
I can't either unfortunately, mod+ only
aha
building python from source with all of main optimizations disabled + interpreted mypy = you're gonna be having a long "grab a cup of coffee break"
Let's merge some PRs
I'm opening one right now :)
somehow we didn't notice that the loop parameter was removed in the various asyncio high-level APIs in 3.10
I'm surprised we haven't gotten a report about this since this code should crash if hit
Thanks! I'm happy to add support for pypy, but have a few comments.
Description
Somehow we didn't notice that the loop parameter was removed in the various asyncio high-level APIs in 3.10 :p
Checklist - did you ...
- [x] Add a CHANGELOG entry if necessary?
- [x] Add / update tests if necessary? -> n/a
- [x] Add new / update outdated documentation? -> n/a
Other than ลukasz, I'm pretty sure the Python 2 deprecation PR has enough reviews. Should we merge it @dense jungle ?
I'll take a look soon, I'm like two PRs away from it
Considering how major it is, maybe not??
Looking at the --verbose one right now
-v is fun
ah yeah I ignored that one because I didn't want to think through their suggestion
Honestly the people on Python 2 should of knew this would be coming eventually.
I am fully expecting to merge it to be clear, just want to take another look at the code
Although
Should it be pending deprecation warning and then next month switch to deprecation warnings?
Because deprecation warnings can break stuff
Well black is still an application so I'm not sure how I'd feel using the warnings API
I mean, black both doesn't have an official API and Python 2 has been sun-setted for a long time now
I don't think the warning API is a good fit for us
Not yet although we want to work on this eventually. Personally I plan to work on this when I finish up with the various projects I'm currently working on (it's a lot btw).
Okay yeah
Just checked
Looks fine, mostly
What does err() do?
I'm on mobile right now so couldn't find the definition
One potential problem I do want to bring up is that right now each call to format_str with Python 2 warns
... that may be too noisy
A couple of points. We also need to resolve the other issues brought up above.
Could save a variable once it's warned once and only warn if that variable isn't x
yeah that seems like a decent idea
Is there a plan for an official api sometime?
....
^
Smh I missed that
Imagine finishing a project tho
I add a new one like every week or so
I'm trying to understand the print/exec stuff in the Python 2 PR now. Is the point of that to make sure we notice that the code is Python 2-only so we warn about it?
There's a bunch of other things we could look for, though I'm not sure it's worth the effort (except Exception, e:, 2L, def f((a, b)): come to mind)
oh and backticks though I'm not sure anyone ever used those
Noticed one typo.
I'm also still thinking about the feature detection stuff here and brought it up on Discord.
Hmmmmmmmmmmmmmmmmmmmmm
I wonder
Wouldn't the mode need to be set to python2 to format python 2 code?
Eg the list of modes to format for in pyproject.toml
nope
2L
By default we use a lib2to3 grammar that is compatible with both Python 2 and Python 3
How is 2L valid in py2??
Why doesn't black have an official API? Is there a reason there's not one, besides just not making it?
Because Ichard hasn't made it
It means a long literal
In Python 2 int was limited to a machine int (32 or 64 bit) and long was the arbitrary-precision type
We just haven't gotten around to it
Because it wasn't a thing initially, and no one has done it as black has grown over adoption, it will also be tough to do it as its a large refactoring
I think
Got it, makes sense
Ahhhhh ok
Yup!
those were the only Python 2 only things I knew off the top of my head
They're probably also the easiest to detect ๐ . I'm a bit worried it won't be enough since exec is rare anywhere and print is also rare in many big codebases
Then again, I don't really want to go out of my way to help people who still write Python 2-only code in 2021
Reading the what's new brought up a few more: 0360 for octal literals; raise Exception, "message" syntax; [x for x in 1, 2] (needs parens in Python 3). Honestly those are all pretty marginal though
there's also the automatic unpacking in parameters (mind blown btw)
Yes, I listed that above. That was pretty useful actually ๐ฆ I had to make some code uglier when migrating to Python 3 to deal with that
I think we should merge the Python 2 PR as is but there are conflicts blocking a rebase
I'll take a look tomorrow
lmao the test stuff that was causing a problem and not allowing the tests to be ran from a different directory....
I just made a simple script for my project so that isn't a problem lmao
although
i can't pass anything to it anymore, so uh, forget i said anything
e
thanks jelle for the review, will take a look soon
@median garnet This channel is for discussion about usage and development of Black, a python code formatter. I've deleted your messages since it's off-topic for this channel. See #โ๏ฝhow-to-get-help for instructions on claiming a help channel.
How do i compile python in windows 7 without actually having to download python (exe)
what are python developers trying to hide ?
Wrong channel, but also why?
the windows binaries are already compiled with PGO
that's OK, just please use a different channel then. I'm not sure which one would be ideal though.
so no one knows and python developers are trying to hide something ?
Well I don't work with C on a daily basis on Windows, and I doubt the core developers of a pure python project (psf/black) would know either. #c-extensions or #internals-and-peps *may* know more but I honestly have no idea.
TIL black-21.9b1.dev51+gb0b3709-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl is a valid wheel filename
that's alotta platform and ABI tags ๐
what's blocking the 0.920 mypy release btw @dense jungle ?
man, I hate you windows
oh lol I forgot mypyc doesn't support python 3.10 officially
well I guess I'll skip windows on python 3.10 then for the time being
yea... the # fmt: skip implementation is incredibly buggy ๐ฆ
because we don't support match case syntax
shouldn't it be skipped?
that's not how the fmt: off/on implementation works, the whole file is still parsed
ok, thanks
Describe the style change
This code is successfully formatted and accepted by Black:
assert name.rfc4514_string(
{NameOID.COMMON_NAME: "CommonName", NameOID.EMAIL_ADDRESS: "E"}
) == ("CommonName=Santa Claus,E=santa@northpole.fi")
# ^ ^
The parenthesis on the last line are redundant and can be removed. I wouldn't expect the formatting to be changed by Black.
However, with this input:
assert na...
should probably include the python 2 deprecation today then
I've been working on the mypyc project so far today
It ready for me to click merge?
which PR?
Your python2 deprecation - Looks it to me
Just did this to see if we still work apart from that known tricky unicode problem: https://github.com/psf/black/pull/new/remove_regex
@bright glacier - Want to see how much slower this is too?
As in you want me to benchmark it?
If it's easy
I'm a little too busy for that for the time being
No worries
If I get bored later I might try your tool
Just interested cause if we're not to much slower i might see if we can fix the unicode issues via monkey patching re possibly - Ideally we'd just fix it in cpython but that will take years to become the version everyone uses (but if I work it out I might submit the PR - but I need to remember all the context)
Idk how on windows, but ik how on Linux so it's definitely possible given its all open source and none of how to do it is hidden
Depends.... If you're gonna do a Halloween release the version in that pr should be updated to 22.1b
does lack support match statements in 3.10 yet?
Noot yet
sadness
@bright glacier about mypy 0.920, I don't know what's blocking it. mypy releases are done by the people at Dropbox and I don't have much insight into when they can do it
I heard they're no longer working on mypy full-time so it's probably just whenever they have time
I think the Python 2 PR needs to be rebased because we wanted to keep the two commits separate. I can do that later in the afternoon after I recover from climbing this hill ๐
there we go
- Install build-essential to avoid build issues like #2568 when dependencies don't have prebuilt wheels available
- Use multi-stage build instead of trying to purge packages and cache from the image
Copying/root/.local/installs only black's built Python dependencies (< 20 MB).
So the image is barely larger than python:3-slim base image
Tested locally and in my fork GitHub Actions: https://github.com/vbarbaresi/black/runs/4062490765?check_suite_focus=true
Awesome, thanks! Nice use of --user to get all the artifacts in an easy place to copy.
Ok, think I'll merge the docker and then cut a release unless anyone says not to - PR coming.
awesome thanks!
oh it wasn't rebase onto main, oh well
Looks good although I suspect some pre-commit hooks will fail.
Why do we have more manual things to do @ release ๐ฆ Booo
It was actually
We also have a lot of deprecation errors to fix
oh is GitHub mobile's UI not great at demonstrating that then?
I'mma check on a laptop
I think I'll put up a PR to remove this version manual step. I don't think the step it adds for each release now is worth it
And TIL we have two files called the_basics.md
Do I just not understand what a rebase merge is like or does that look like a squash merge?
Yea.. I regret calling them that
Damn, another file. We haz so much manual editing now. I might at least make a set_version.py or something that goes and does all the version replacing ...
we could probably automate it using a local sphinx extension
damn this will be our sixth release in a row in terms monthly releases, way to go on the consistent quicker deploy cycle
once again thank you @neon loom for getting the ball rolling on this front :)
We should probably let people know via other channels that this release is important as we now have a formatting stability policy AND Python 2 is deprecated
Where do you propose?
twitter and discuss.python.org are the only ones I know we have access to
we could also do a mailing list or two but do people even pay attention to those these days?
anyway, assuming https://github.com/psf/black/runs/4062923508?check_suite_focus=true passes (which it should) can we close psf/black#2568?
My suggestion is to stick a little banner at the top of https://black.rtfd.io, and maybe a note on the GitHub README
Maybe "banner" is the wrong word, but one of those 20px lines that are on the top of every page, or at least the first
also great ideas
something like the banner on this page? https://pradyunsg.me/furo/quickstart/
Yeah, the "if you like this theme" thing
Yup, was just waiting to see it make it to docker hub
48MB. Nice
speaking of deprecation warnings ... we totally didn't realize that the loop parameter was removed in the various asyncio APIs in 3.10 ... I'm surprised we haven't had a report about this
Banner etc. + twitter could be good. Maybe you start a post @bright glacier and I'll report and we nudge @ambv too
yeah, we should open a issue for each of them to cleanup.
I'm heading for dinner now - But if you don't get to it I'll try get some issues opened so we can fix em
Let me know if you tweet - I don't really look at twitter much
thankfully the loop parameter was only being passed in some exception / cleanup code so it'd be rare for those (crashing) pieces of code to be hit but yea we should probably set up pytest to fail loudly on new warnings
Yeah, lets get it clean and fail on warnings
Have a great dinner :)
Hey @errant barn ,
Re: https://github.com/psf/black/pull/2526#issuecomment-947563571
What do you think would be a good way to handle this, we are checking for configuration first so it is logged earlier, but if we don't check it earlier and black fails due to a config value (eg. pyi and ipynb- both were passed), it would never reach the project root log, so we need to log the configuration earlier.
hmm true, didn't consider that
this isn't the right channel. feel free to have a look at our resources https://www.pythondiscord.com/resources/ or check out #โ๏ฝhow-to-get-help if you need help
We're a large, friendly community focused around the Python programming language. Our community is open to those who wish to learn the language, as well as those looking to help others.
Thanks for help
Look, implementing tabs support is pretty simple and you don't have to make it default. You literally just have to add an option like --use-tabs and implement tabs in the code. Prettier does it, pretty much every other code formatted I use at least has an option to use tabs. you can't say that you are "LisTeNinG tO tHe CoMmUNity" when there are FOUR issues or pull requests relating to using tabs, and all of them have been rejected. You CAN'T ignore that there are some people w...
I'm a little nervous that @muted haven 's PR is going to break mypyc compatibility as it touches blib2to3 quite significantly but I can't imagine it would be horrible to fix ... unless there's dataclasses involved in which case CI gonna's be red :)
also the merge conflicts will be ... a bit of a pain to deal with :)
lol
I suspect this will undo some of my blib2to3 optimizations as well eek!
that was a good read
why are consumers of open source and free software the most entitled
I hope it won't be too bad, I'm excited about both of those things landing
Maybe if they yell harder next time I'll change my mind
lol i'm reading all of the issues that they linked
there is even a fricking solution
If you want tabs, there's a tool for doing that: https://linux.die.net/man/1/expand
Convert tabs in each FILE to spaces, writing to standard output. With no FILE, or when FILE is -, read standard input.
actually that does it in reverse
holy shit
you may already remember reading this, such a pedantic comment: https://github.com/psf/black/issues/47#issuecomment-439596440
oh is that the guy with the dictionary definitions?
yess
LOL
"Use tabs instead of spaces for indentation. "
"Tabs are always equal to 4 spaces."
which isn't true tho
tabs are just tabs
uh, sorry about that. I can type the code, but not sure if there are any stuff that would be problematic in mypyc
lmfao
for context the potentially conflicting changes are https://github.com/psf/black/pull/2431/files#diff-752cb00af77ac75adb6cb5b53d3c28691db40cee3e2f517d755bcea983e7ec99 vs. https://github.com/isidentical/black/commit/c22fca62bdeca503ef1fa56647b410cbd3d5af81. Looks like the addtoken method might get some gnarly conflicts and the match code needs some annotations.
This is so rude my god
I just don't get how this is such a thing
Because\tpeople\tneed\ttheir\ttabs
Pretty sure there's a fork/wrapper that runs black and replaces spaces with tabs
Many lol
Tabs for indentation spaces for alignment
Wouldn't py3 choke on that?
Hi, what is the function that reformats a file's content?
Are you asking for the cli command, or are you looking for the function in the source code
The function in the source code as I'm trying to reformat a string of code
Call chain is:
main -> reformat_one/reformat_many -> format_file_in_place -> format_file_contents -> format_str (also check_stability)
If you're reformatting just a string, you may be able to skip right down to format_str, but option parsing is still a thing
Alright thank you
You could use reformat_code though, which does take a string, no file
Yeah I will try both
picks an opinionated linter
Why can't I indent my code with tabs?
uses python
Why can't I use brackets?
;-;
Honestly i don't even know what that user was thinking
intellectually inconsistent
Like
WTF does that even mean
Only intellectually consistent people would get that ๐ค
Smh
what did black do :O
๐ค ... <goes and checks Black's dependencies> ...
Darn you typed-ast and regex! https://t.co/04Q0f2ds3t
They are compiled dependencies to be fair
i don't get that, tbh
<!--
Please make sure that the bug is not already fixed either in newer versions or the
current development version. To confirm this, you have three options:
- Update Black's version if a newer release exists:
pip install -U black - Use the online formatter at , which will use
the latest main branch. - Or run Black on your machine:
- create a new virtualenv (make sure it's the same Python version);
- clone this repository;
- run
pip install -e .[d,python2];
...
more pipenv fun
You know that it's my favourite pastime :p /s
Brett is welcome to do a PR removing regex ...
https://github.com/psf/black/tree/remove_regex - Works on many files I tested with, but fails with those unicode tests ...
Yes we'll probably need to change something in blib2to3
blib2to3 itself, too, uses regex ...
Yes, I think that's where we need it. But maybe we can do something manual in a few places so it still supports those exotic identifiers
This is a work-in-progress PR for the following issue: https://github.com/psf/black/issues/2242.
To-Do:
- Add tests
- Figure out why Python 2 tests are failing (the rest of the tests seem to be OK)
- Try primer / gallery as well as large dataset of source code to ensure it is still parsing everything it could before (only the handling of soft keywords changed, but still let's make sure of that since this touches the core part of the parser (
addtoken)).
@muted haven I'll do some testing on this PR as I (finally) have free time. I'll check mypyc compat and behaviour equivalence with my own tool, diff-shades, with is basically black-primer / gallery but more integrated and full-featured (eventually, it's a WIP). If I feel like it I'll do some benchmarking but I make no promises on this one :)
I honestly have no idea why those two tests are failing either :(
Apparently it's not printing the Python 2 deprecation message? Not sure why that would be
AFAIK it can't currently parse the python2 code, but don't know why it shouldn't affect much
I have not yet found time to research it
Yea... the grammar fallback code should handle it just fine ...
hopefully on weekend I can get to some of these issues
Oh and just to be clear please don't feel like your work on gallery was pointless, at the bare minimum it spawned the creation of black-primer, which then inspired mypy-primer which then inspired me to create diff-shades haha :)
Also I'm fairly confident other people from the core team has used gallery before, I just haven't
Your creation is a parent lol
Oh no worries on that. Gallery was an interesting experience for me, since it also inspired another project (reiz) that I ended up writing a paper about.
Of course, so gallery is the source of many great things ๐ /lh /gen
Indeed
Also it was my first contribution to black, so there's that. Hopefully this would be the second one (and perhaps more to come)
Oh my, the merge conflict on src/blib2to3/pgen2/parser.py with the mypyc branch as the base is way smaller than I expected ๐ :)
recursive merge strategy for the win I suppose!
Traceback (most recent call last):
File "/home/ichard26/.local/share/virtualenvs/black-Q9x7i-w-/bin/black", line 5, in <module>
from black import patched_main
File "src/black/__init__.py", line 39, in <module>
from black.nodes import STARS, syms, is_simple_decorator_expression
File "src/black/nodes.py", line 32, in <module>
pygram.initialize(CACHE_DIR)
File "src/blib2to3/pygram.py", line 175, in initialize
python_symbols = _python_symbols(python_grammar)
File "src/blib2to3/pygram.py", line 32, in __init__
setattr(self, name, symbol)
AttributeError: '_python_symbols' object has no attribute 'asexpr_test'
first issue trying to run the mypyc compiled version of the match PR :)
looks like we're just missing an entry in this list: https://github.com/psf/black/pull/2586/files#diff-f226b3f8be705bbb2a754559f1cd759b495e58bae3a9f21746af5c5f10a80753R135-R142
1โฏ black test.py --diff -v --fast
Using configuration from /home/ichard26/programming/tools/diff-shades/pyproject.toml.
Traceback (most recent call last):
File "/home/ichard26/programming/tools/diff-shades/venv/lib/python3.8/site-packages/black/__init__.py", line 643, in reformat_one
if changed is not Changed.CACHED and format_file_in_place(
File "/home/ichard26/programming/tools/diff-shades/venv/lib/python3.8/site-packages/black/__init__.py", line 796, in format_file_in_place
dst_contents = format_file_contents(src_contents, fast=fast, mode=mode)
File "/home/ichard26/programming/tools/diff-shades/venv/lib/python3.8/site-packages/black/__init__.py", line 920, in format_file_contents
dst_contents = format_str(src_contents, mode=mode)
File "/home/ichard26/programming/tools/diff-shades/venv/lib/python3.8/site-packages/black/__init__.py", line 1057, in format_str
src_node = lib2to3_parse(src_contents.lstrip(), mode.target_versions)
File "/home/ichard26/programming/tools/diff-shades/venv/lib/python3.8/site-packages/black/parsing.py", line 96, in lib2to3_parse
raise exc from None
black.parsing.InvalidInput: Cannot parse: 3:6: match xt:
error: cannot format test.py: Cannot parse: 3:6: match xt:
Oh no! ๐ฅ ๐ ๐ฅ
1 file would fail to reformat.
~/programming/tools/diff-shades on main [$?โก] via v3.8.5 (venv) took 400ms
123โฏ cat test.py
x = hi
match xt:
case (a, n):
pass
what-
pip install-ing a local clone with the match PR did not grant black the magical ability to parse match ๐ฆ
are you running the correct black?
and you don't have local .so files lying around?
no compiled C
o
it stands for shared object
ah
none as far as I can tell
lol
12 failed, 251 passed, 3 skipped, 12 deselected, 3 xfailed, 12 warnings in 22.15s
``` OK this might take a while to fix ...
hmm, looks like the token.* numbers got shifted around?
yup they did
I don't understand how the numerical IDs are calculated tho
Describe the style change
Examples in the current Black style
len_x1y1 = math.pow(rec_po[0].x - rec_po[1].x, 2) + math.pow(
rec_po[0].y - rec_po[1].y, 2
)
Desired style
len_x1y1 = math.pow(rec_po[0].x - rec_po[1].x, 2) + math.pow(rec_po[0].y - rec_po[1].y, 2)
# or
len_x1y1 = ( math.pow(rec_po[0].x - rec_po[1].x, 2)
+math.pow(rec_po[0].y - rec_po[1].y, 2))
Additional context
Describe the style change
Examples in the current Black style
#%% this is a cell
a = 12
Desired style
# %% this is a cell
a = 12
Additional context
I found black can't format the cell note.
Yes and no: no on the new syntax but yes on general runtime
is there a way to just have the formatter skip the lines so i can still format the rest of the file
fmt: off doesnt seem to be doing anything
as far as stopping a crash
We still need to parse the file, so unfortunately I think not
what do you suggest, should I just turn formatting off for the file until its supported?
you can follow psf/black#2242
In the meantime, probably yeah
Thanks
Is this related to a problem? Please describe.
Visiting https://black.readthedocs.io/ redirects one to https://black.readthedocs.io/en/stable/ . This is the documentation for version 21.9 , so users can easily misses changes made for 21.10, such as those in: https://black.readthedocs.io/en/latest/integrations/source_version_control.html .
Describe the solution you'd like
Update 'stable' to point to 21.10
Describe alternatives you've considered
n/a
**Additional co...
@silent apex do you mean all releases by "minor" or did you mean to say "major"?
Err, I meant whatever 21.09 and 21.10 are
Idk what versioning scheme black uses
Apologies if that was unclear, the only versioning I speak is semver
we don't really have major vs. minor versions, it's just a matter of how many we get out in a month
which does make it more awkward to select which versions to show in the docs
calsemver ;-;
Well then uh, whatever a new version is (21.09, 21.10, 21.11, etc.)
The terminology doesn't really matter
Powerplay: 21.101
!e
Description
Nice and simple change, a space was missing which was causing some ugly text:
Original:
DEPRECATION: Python 2 support will be removed in the first stable releaseexpected in January 2022
Now:
DEPRECATION: Python 2 support will be removed in the first stable release expected in January 2022
Checklist - did you ...
- [ ] Add a CHANGELOG entry if necessary?
- [ ] Add / update tests if necessary?
- [ ] Add new / update outdated documentation?
...
Describe the style change
Break up and indent long method chaining inside a dictionary in a more readable way
Examples in the current Black style
How black breaks up method chaining in variable assignments:
value = (
fn.chain()
.chain()
.chain()
.chain()
.chain()
.chain()
.chain()
.chain()
.chain()
.chain()
.chain()
)
How black does it with dictionary key assignments:
d = {
foo: fn....
Seems like we got some dependency problems again: https://github.com/psf/black/runs/4117987697?check_suite_focus=true. Something with coverage?
Don't think so, but we may not have pinned this dep
Yeah, it's a known issue with the latest version of coveralls
Actually, this isn't the first time a change in coverage.py has broken the coveralls package
A lot of the issue history is fixing that
Since I'm getting closer to integrating my mypyc work into main, I was wondering on how we'd collect field reports from users. My original idea was to use Google Forms but a GitHub issue would also work well. Google Forms would be more structured but the lack of transparency can be bit of an issue for some people. Additionally an issue would be easier to ask follow-up questions within while a Google Form would require a "contact info" field.
... I guess my pros-cons list is leaning towards a gh issue :)
Doesn't it come pretty naturally for people to just find the repository and open an issue?
Yes, I think issues are fine
GitHub issues or discussions (a single thread maybe, since there are comments on replies) sounds fine to me personally
feels good to be making actual progress on diff-shades even if I'm still horribly slow :)
src/diff_shades/analysis.py: # TODO: record log files if available
src/diff_shades/analysis.py: # TODO: allow more control w/ black.Mode so we could use diff-shades to compare
src/diff_shades/analysis.py: # TODO: refactor this and related functions cuz it's a bit of a mess :)
src/diff_shades/cli.py: # TODO: implement a list view
src/diff_shades/cli.py: # TODO: implement a diff + failures view
src/diff_shades/cli.py: # TODO: allow filtering of projects and files checked
src/diff_shades/cli.py: # TODO: more informative output (in particular on the differences)
src/diff_shades/cli.py: # TODO: Gracefully warn but accept analyses that weren't set up the exact same way.
src/diff_shades/cli.py: "[italic]-> Eventually this will be just a warning, but that's a TODO"
src/diff_shades/cli.py:# TODO: implement this command :p
got a ton of TODOs tho haha
black lives matter
Yes they do! .. although it's a little off-topic here fwiw
richard
yeah?
could you help me with something in #help-bread pls
this is terrible```py
# it is kw argument
partner_id_and_days=CustomCallable(
decode=lambda buf: 0
if buf.read_uint(pos=buf.pos) == 0
else (buf.read_uint(), buf.read_uint()),
encode=lambda buf, obj: buf.write_uint(0)
if obj == 0
else (buf.write_uint(obj[0]), buf.write_uint(obj[1])),
),
# ... other arguments
thanks ๐
psf/black#2278
hello guys
OK we have less than three months to get black ready for a stable release ... there's a lot of work to be done still:
improve Python 2 detection- integrate and deploy mypyc
implement basic / experimental match supportland PyPy support- merge psf/black#2278 (maybe lock this under the --future flag?)
- merge psf/black#1879 (and lock the formatting under the --future flag)
- turn on ESP
what's annoying about the first three is that they're connected and merging one of them will complicate the others
- turn on ESP
What's that?
our codename for --experimental-string-processing
Ah, got it
sigh, looks like I'll have to unbork CI: https://github.com/psf/black/actions/runs/1429457406
am I being dumb or is the following valid code:
value = (1, 2)
match value:
case x, y:
pass
I can't get the match support PR to accept this fwiw ๐ฆ
The interpreter accepts it ๐คทโโ๏ธ
on 3.10.0, at least
cc @muted haven
the following works:
value = (1, 2)
match value:
case (x, y):
pass
although I have no idea why, I'd need to take a closer look at the grammar to figure out why
I'd guess it's like x, y = (1, 2) and (x, y) = (1, 2)
match_stmt: "match" subject_expr ':' NEWLINE INDENT case_block+ DEDENT
subject_expr: namedexpr_test
# cases
case_block: "case" patterns [guard] ':' suite
guard: 'if' namedexpr_test
patterns: or_test ['as' or_test]
this is the main bit of the blib2to3 grammar that's powering the PR but I don't understand patterns in particular or_test very well
for the time being I'll work on item 1 and 3
If you could post it under the PR, I'll try to check if it works or not.
fyi I figured out why the python 2 tests are failing under your pr
the TLDR is that I messed up when writing up the python 2 deprecation PR
in more details I was using the token.* constants to detect the python 2 features. token.* is only guaranteed to be constant below a node type value <256 and the Python 2 nodes were above that. I should've been using pygram.python_symbols instead
For python2 detection can't we just use https://github.com/python/cpython/tree/main/Lib/lib2to3 and see if there is a diff?
I'm confused, could you elaborate?
!d lib2to3
Source code: Lib/lib2to3/
Deprecated since version 3.11, will be removed in version 3.13: Python 3.9 switched to a PEG parser (see PEP 617) while lib2to3 is using a less flexible LL(1) parser. Python 3.10 includes new language syntax that is not parsable by lib2to3โs LL(1) parser (see PEP 634). The lib2to3 module was marked pending for deprecation in Python 3.9 (raising PendingDeprecationWarning on import) and fully deprecated in Python 3.11 (raising DeprecationWarning). It will be removed from the standard library in Python 3.13. Consider third-party alternatives such as LibCST or parso.
Note
The lib2to3 API should be considered unstable and may change drastically in the future.
We use lib2to3 as our main parser, just a fork of it
fyi @tired shard black doesn't know that the code is there at all, black can format py2 without python2 installed.
lib2to3 reads python2 code and applies some fixes to make it compatible with python3 right? So if we just use this tool to convert the source and then check the original code and to check if there is a diff, we can find if the original code is python2 or 3.
Example
-print "printing something"
+print("printing something")
This is the first think that popped in my mind.
That's probably a bad idea from a performance perspective
the problem in that case is insane performance ^^
anyway I'm almost done with my solution
well yeah
cache
ah, where do i nuke that?
I actually have to clear the cache everytime I test something out
~/.cache/black
isn't there a clear cache option
nope.
it would good to have one imo
I've actually made my own dropblackcache utility for this exact reason lol
Thanks @bright glacier for the info, I'll try to get back to PR tomorrow and fix the case you sent!
oh well, ig it didn't make any file changes since they were already formatted 
welp, my git status is clean
Yup, and I'll put up another PR to improve and solidify my python 2 detection code your PR shouldn't bork it ^^
I also have a local patch fixing some other issues for your branch fyi
ran different formatter to mess up my code so i can give black a real test
30 modified files now
You are not allowed to use that command here. Please use the #bot-commands channel instead.
...
!snf 906600530388852747 906600635267424267
906600530388852747
Created at 2021-11-06 17:46:50.268000+00:00 (<t:1636220810:R>).
906600635267424267
Created at 2021-11-06 17:47:15.273000+00:00 (<t:1636220835:R>).
....that was 25 seconds
no, that was 5 seconds
wtf is wrong with time
41 files reformatted, 20 files left unchanged.
black . 23.61s user 0.75s system 613% cpu 3.974 total
are you reading the user time
cuz it won't be accurate due to multicore usage
IIRC
I honestly don't remember if time measures the wall clock or CPU time so I can't answer that quesiton
i was trying to get the cold evidence for it but i'm just gonna have to settle for my word...
50 files or in the repo and black will take around 10 seconds on pre-commit
even with no changes
yapf . -rip
Description
First of all this fixes a mistake I made in Python 2 deprecation PR
using token.* to check for print/exec statements. Turns out that
for nodes with a type value higher than 256 its numeric type isn't
guaranteed to be constant. Using syms.* instead fixes this.
Also add support for the following cases:
print "hello, world!"
exec "print('hello, world!')"
def set_position((x, y), value):
pass
try:
pass
except Exception, e...
oh yea ci is going to break most likely
Amazing, if it is related to the parts I introduced feel free to push my branch (I think maintainers have that privilege by default on GitHub, not sure).
looks like hypothesis's devtooling is now 3.8+ https://github.com/psf/black/runs/4127052658?check_suite_focus=true#step:5:282
@tribal thistle so wait, how am I supposed to fix coveralls breaking the action?
apparently the most recent release of coveralls-python should've fixed this but no?
Gah it pisses me off so much. The fix is upgrading, or downgrading coverage.py, either to before the change that broke this (6.0) or after the fix (not yet released, could ask nedbat for an ETA). More details in TheKevJames/coveralls-python#333
Either way, my professional recommendation is pin both coveralls and coverage
Or maybe give your thoughts on TheKevJames/coveralls-python#334 ๐
It does worry me about the coverage py bus factor...
Mmm, to get help, make sure to post your code as text instead of a screenshot
Isnโt pandas huge?
If it takes that long usually, itโs probably best to disable it
Yeah but it took over an hour when Django only took a quarter of that
it usually doesn't take an hour
Either diff-shades is broken or this PR I'm testing has seriously broken something... Or both!
Is this diff shades or primer
Ah
Roll back, test again. Keep rolling back until things work
Or all three!
Yeah I will but man will it take a while given how slow even a normal non-buggy run takes
30m on my laptop ๐ฆ
Lol right, hadnโt thought about that
I looked into using a VM but I don't have access
If it wasnโt so late rn, Iโd donate some CPU time
Tomorrow if youโre still at it
Holy hell that's long
thankfully it's just one project acting up
Running black test suite on pydis cluster ๐คก
so I can just focus my testing on that which should cut down the testing significantly
Tbf you could probably formulate a workflow, remove concurrency options, and just push your changes and then come back to it once gha has finished running them
Iirc there's already a workflow for this
honestly it would be faster but I don't feel like making it
We don't have one for diff-shades
Ah.
I'm testing the experimental match statement pr fwiw
Was just gonna run it on my laptop. Itโs pretty good, could probably crunch it out quicker
Well, I'm going to go continue to shoot my future self in the foot while I procrastinate
Yeah #dualCoreCPULife
2Core2Life
Is the code youโre testing pushed to a repo somewhere?
yea, ichard26/diff-shades although it's non functional on GitHub, I have a few hotfixes locally I haven't pushed since I don't know if they're contributing to the weird slowdown
also it's pretty involved to repeat the run I got set up right now and since I'm eating (what else am I going to do) so yeah
It isnโt, we removed the command
Idk then
.gh help
**```
.github
**Can also use:** `gh`, `git`
*Commands for finding information related to GitHub.*
**Subcommands:**
**`repository [repo...]`**
*Fetches a repositories' GitHub information.*
**`user <username>`**
*Fetches a user's GitHub information.*
Its locked
.gh ichard26/diff-shades
;-;
.gh repo ichard26/diff-shades
The Black shade analyser and comparison tool.
Uhh so where does analyze clone to lol
Also, on current main, 30 seconds in for a little above 50% on django
a temporary directory
Holy mother of deprecation warnings
also this isn't that useful as I'm testing a pr of black
just set PYTHONWARNINGS to ignore:::
yea locally I slapped a redirect_stderr context manager but I don't know if that's causing the slow down
it's not using the warnings API
Alright nice, total analysis time was 4:06, and a minute clone time (and it only crashed once! ๐ )
How fast is your laptop? ๐
Inb4 16
nah 64
4, but is this actually utilizing more than one lol
yea it's multicored
Actually, the sun is weaker than scale's legs with that much heat
wth ๐
Dude. Laptop connected to desk monitor. Ultimate setup
Smh I don't use my laptop on legs either smh mh smh
Was this meant to reformat like 18 of the 23 projects lol
I don't remember but that sounds close enough to right
@tribal thistle how fast is your internet?
Lemme get back to my computer
Uni internet goes brrr
25/2 for me ๐ฆ
Although I'd hope it's shallow cloning
25/2 black/clone time?
It is
Also I would hope it clones to a cache dir instead of tempfile smh
No, down/up Mbps
Ah
Lol I got so lost
This is shaping up really nicely so far btw
Just gotta suppress all them pesky warnings
Oh yeah I was meaning to rethink my life choices and read more documentation
That's what the --work-dir is for
I have written way too much extra code when apparently it's part of the stdlib, or even worse, part of builtins...
Bye
alright I'm back on my laptop
mostly just input and output of the formatting
Work on my code instead
lol
I've been on mobile this whole time
I seriously regret some code I've written lol
!d iter
iter(object[, sentinel])```
Return an [iterator](https://docs.python.org/3/glossary.html#term-iterator) object. The first argument is interpreted very differently depending on the presence of the second argument. Without a second argument, *object* must be a collection object which supports the iteration protocol (the `__iter__()` method), or it must support the sequence protocol (the `__getitem__()` method with integer arguments starting at `0`). If it does not support either of those protocols, [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "TypeError") is raised. If the second argument, *sentinel*, is given, then *object* must be a callable object. The iterator created in this case will call *object* with no arguments for each call to its [`__next__()`](https://docs.python.org/3/library/stdtypes.html#iterator.__next__ "iterator.__next__") method; if the value returned is equal to *sentinel*, [`StopIteration`](https://docs.python.org/3/library/exceptions.html#StopIteration "StopIteration") will be raised, otherwise the value will be returned.
Lol
I definitely do not have a few classes which exist to just make a generation methods iterators
I really don't have them, nope. None
If you want to rerun diff-shades like how I did it then read the following:
- clone https://github.com/psf/black/pull/2586 and install it
- set up diff-shades (I presume this is already done) in the same env
- download the analysis provided here: https://github.com/ichard26/black-mypyc-wheels/issues/1#issuecomment-955093775
- unpack it
- run
diff-shades analyze plz-gimme-a-reasonable-name.json --repeat-projects-from my-analysis-you-just-unzipped.json
the reason why you need that analysis file is so diff-shades clones the right revision of the projects
class GenerateID:
def __next__(self):
return generate_id()
so when comparing analyses only differences in the formatting output will be caught
thanks for the compliment! hopefully the rest of the core team agrees since I think this will be quite helpful as we stabilize black :)
shit sorry for interrupting
As apology I'll go review some code 
a run against a mainline version of black should see zero failures
assuming that diff-shades isn't borked, this is bad news for isidentical's match PR
Hmmmm
wait what
uhhhhhh this isn't a normal failure mode for black
I haven't looked at the code at all
This is only if the projects checked out arent changed between runs
two things
by failures I mean black erroring
and --repeat-projects-from exists for this very reason
I think either there's too many open file pointers as once or file permissions got messed up, not sure tho
Damn
Taking significantly longer, I wonder if my internet is just bad. Two minutes so far
My computer runs basically at 100% all the time
no, I think it's because I wrote this stupid code
import contextlib
import os
with open(os.devnull) as blackhole:
with contextlib.redirect_stderr(blackhole):
black.format_file_contents
I forgot the "w" mode argument :(
Ahhhhhh
so this entire analysis is junk anyway
Wait why stderr and not stdout?
because that's where the deprecation message is printed to
Where does devnul go on windows
btw I can push my (fixed) output suppress code so you can rerun diff-shades without a bunch of deprecation msgs
the NUL device
to be fair the analysis I gave you is rather old so the cloning is much more expensive as it can't just do a simple shallow clone
Ah, I see
you should probably use the --work-dir option btw so reruns don't have to clone as much
I wonder....
I feel like the deprecation message could use the warning api
And then in the main file
you were literally here when we discussed this
Configure the warnings to be printed
Yes but I explored more with the warning api since then smh
!d warnings
Source code: Lib/warnings.py
Warning messages are typically issued in situations where it is useful to alert the user of some condition in a program, where that condition (normally) doesnโt warrant raising an exception and terminating the program. For example, one might want to issue a warning when a program uses an obsolete module.
Python programmers issue warnings by calling the warn() function defined in this module. (C programmers use PyErr_WarnEx(); see Exception Handling for details).
Tldr I learned this was a thing
OK, I pushed an updated version of diff-shades
nice, I'll check it out once cloning is done
in the mean while I'm going to check pandas by itself
via the -s / --select option
I know, I really tried to make this a half-decent tool
Using click?
once you're done could you upload your analysis somewhere?
Well yeah, but if warnings can be configured to print them I don't see a problem with using it now lol
Yeah sure
I didn't take the time to implement decent diffing capabilities across analyses yet
right now the compare command is literally a binary "no changes found!" or "differences found!" operation
fwiw diff-shades is almost 1000 lines of python code already
well OK it appears that diff-shades (in particular the monkeypatching of sys.stdout / sys.stderr) isn't the one to blame
it's progressing at a much more reasonable rate with a pypi version of black
Hm, that's what I used my first time around, just pip install black
although to be fair I did change out the output suppression code to a non broken one
yeah that super slow run was with the match pr i LINKED ABOVE
WHOOPS
Mmm gobbling up my Keyboard interrupts lol
kids, don't type with intense lag
i didn't realize I pressed caplocks until it was too late
sometimes using a compute heavy multi-core program can be annoying
But yeah, significant speed loss on that PR from what little I've managed to get running
that's not good
inb4 a war erupts between people who want performance vs people who want match support /j
I wonder why it's so slow
(btw suppression seems to still be broken on the latest push, as well as... most output)
It's just outputting it for everything now
there's two main ways it could be slower, 1) parsing takes way longer as there's now a proxy in the heart of the parser to handle soft keywords, 2) the match support tweaked the formatting -> causing second passes -> slowdown
wtf
It might not actually be slower, it seems to have actually crashed the first time around
just froze
Why would that even have a difference??
i'm 80% through django in 1:50
because the match PR basically rewrites the core of our parser
So main and pypi shouldn't have much of a difference, should they?
is this a windows thing?
Maybe? It had the normal nice output previously, but a similar output when it hit the projects with deprecation warnings
Is the order different this time
Btw, it's back to normal now
After all the deprecation warnings have subsided
Did you resize the window?
@contextmanager
def suppress_output() -> Iterator:
with open(os.devnull, "w", encoding="utf-8") as blackhole:
with redirect_stdout(blackhole), redirect_stderr(blackhole):
yield
this is how I'm suppressing the output which works on linux
src = path.read_text("utf8")
try:
with suppress_output():
dst = black.format_file_contents(src, fast=False, mode=mode)
except black.NothingChanged:
return NothingChangedResult(src=src)
and at the callsite
That's a generator, not an iterator smh
It was broken before resizing. It seems redrawing the progress bar doesn't flush the line, and when the python warnings are going, that causes a
mess
are you sure the version of diff-shades you're using has the supress_output call in analysis.py:check_file ?
because this suppression worked on windows for a different funtion
Yeah, I have the files open in the background ๐
I can test again once this run is finished
Which project throws it
I'll check it out in a bit then
btw, we're up at 7m@40% now, so slower
But not too much
Wait no, it seems to have hung Just a really slow files
it probably hasn't (hopefully)
the chunksize I passed to multiprocessing.Pool isn't great but I haven't seen any major slowdowns from it yet
only chunk-y progress
Does pandas just have files with like a million lines
yeah its files are stupidly large
It feels like each file is taking well over a minute at this point
hmm maybe the slowdown I experienced wasn't just me
I'm really frustrated the suppression isn't working on windows fwiw
uhhhhh
what the hell is my code doing
So it seems to have finished, got stuck during some transition, and locked the terminal
A few button presses ougtha convince it
Yeah that did it
@tribal thistle how is your cpu process so low smh ;-;
well if it happened the first time then we can't blame my suppression code as it didn't exist on github when you first ran diff-shades
It was 100% for 10 minutes straight...
I doubt it's a rich bug
Back @100 now
if it's possible, do you think you could get the progress bar to display LOCs instead of files? It isn't a very accurate metric lol
60% after running pandas and django is uh...
yeah there's a huge difference between typeshed and django for instance
even tho by file count they're similar IIRC?
hard to tell now, that output has long scrolled out of my terminal backlog
I wonder if the package just wasn't installed properly
Tbf I didn't use editable, just ran a reinstall
gonna try to fix it, we're almost done
that reminds me of when something was going so wrong.... i'm not sure why i didn't pipe the output LOL
forcing colour mode in rich on gha windows is not a good idea btw lol
i ended up setting my terminal to give me an extra 1.5k lines of scrollback buffer
should've just piped it
I have my terminal set up for 15000 lines of scrollback IIRC
2.5k here
but that's also an integrated terminal in vscode
idk how long windows terminal is configured for
I- was mistaken ๐
So i was wrong
2380 (typeshed) vs 2860 for django
It hadn't scrolled away, it just hadn't started
yeah it's in alphabetical order
wait which 5 projects are already formatted with black?
this is a run with 21.9b0 IIRC
so wait the match PR introduces no failures and is only like 4 times slower?
Uhh... I just did a very stupid thing
Accidentally overwrote the output when testing out the deprecation warnings ๐ฅฒ
oops
so wait is the suppression code borked for you?
because in that case I have no idea how I'm supposed to fix it
other than monkeypatching black.output.err but that won't always work IIRC right now
It seems to be working now, just appears that running install without uninstalling didn't actually work
probably because I don't always change the version
actually wait no
isn't pip supposed to reinstall regardless of the version if you pass a local dir
i think uh force may be needed and it might not remove all files
Running everything again now to regen the output, but we're back to clean output again
nope, neverind
broken again
...
seems to have worked on attrs, but it's breaking on
seems to be django
Yeah that does it
i'm so annoyed
*sigh*
i can't even reproduce the python two deprecation warnings having removed the suppression code
why is everything not going to plan
because we are programmers
Yeah.
Is there a problem with the warnings themselves
oh huh interesting 21.10b0 doesn't warn on attrs but the match PR does
I have no idea why
uhhh that's even more confusing
oh right I know why
because my python 2 deprecation code was sketchy as heck
let's just ignore which projects the deprecation messages are on because the logic in black is currently broken
is the output suppression code working?
Which output does it supress
the deprecation warnings
I'm seeing them right now, so probably not
great /s
I guess mixing click.secho, contextlib.redirect_std*, multiprocessing, and rich together is breaking (on) windows ๐
I guess I'll have to boot up windows tomorrow
I mean I guess I could run black in a subprocess but then I'd get rid of my fancy progress bar
Honestly knowing myself, all of my code is broken on windows somehow
I gave up on diff-shades
Time to upload it before I destroy it
I don't need the analysis
oh lol
because the PR is broken anyway
What was the PR doing anyways
match support :)
mmm
I don't understand how redirecting stderr doesn't work on windows and yet it does on Linux (probably due to multiprocessing I suppose)
But oh well I'm too frustrated with all of this diff-shades work to continue work on it for the time being
i probably should have timed this
i decided to format my project's venv for the fun of it
i wonder what will be broken when done lmfao
oh shit, aside from all of the packages, i also have to get through the stdlib
ooo
@bright glacier if you want a challenge get black to format pyrepl
!pypi pyrepl
of my very long time to format my entire venv for no reason other than write cycles and boredom
1998 files reformatted, 584 files left unchanged, 4 files failed to reformat.
those four files are from pyrepl
reformatted /home/aru/.cache/pypoetry/virtualenvs/modmail-lmlBH83T-py3.8/lib/python3.8/site-packages/pyrepl/historical_reader.py
reformatted /home/aru/.cache/pypoetry/virtualenvs/modmail-lmlBH83T-py3.8/lib/python3.8/site-packages/pymdownx/magiclink.py
error: cannot format /home/aru/.cache/pypoetry/virtualenvs/modmail-lmlBH83T-py3.8/lib/python3.8/site-packages/pyrepl/keymaps.py: cannot use --safe with this file; failed to parse source file.
reformatted /home/aru/.cache/pypoetry/virtualenvs/modmail-lmlBH83T-py3.8/lib/python3.8/site-packages/pyrepl/module_lister.py
reformatted /home/aru/.cache/pypoetry/virtualenvs/modmail-lmlBH83T-py3.8/lib/python3.8/site-packages/pyrepl/keymap.py
error: cannot format /home/aru/.cache/pypoetry/virtualenvs/modmail-lmlBH83T-py3.8/lib/python3.8/site-packages/pyrepl/pygame_console.py: cannot use --safe with this file; failed to parse source file.
reformatted /home/aru/.cache/pypoetry/virtualenvs/modmail-lmlBH83T-py3.8/lib/python3.8/site-packages/pymdownx/superfences.py
error: cannot format /home/aru/.cache/pypoetry/virtualenvs/modmail-lmlBH83T-py3.8/lib/python3.8/site-packages/pyrepl/pygame_keymap.py: cannot use --safe with this file; failed to parse source file.
reformatted /home/aru/.cache/pypoetry/virtualenvs/modmail-lmlBH83T-py3.8/lib/python3.8/site-packages/pyrepl/simple_interact.py
reformatted /home/aru/.cache/pypoetry/virtualenvs/modmail-lmlBH83T-py3.8/lib/python3.8/site-packages/pyrepl/trace.py
reformatted /home/aru/.cache/pypoetry/virtualenvs/modmail-lmlBH83T-py3.8/lib/python3.8/site-packages/pyrepl/python_reader.py
@tribal thistle what the heck on my windows install it works totally fine
I hardcoded black to always print the deprecated message and yet it doesn't leak ๐
also man the new windows terminal is wayy sexier
can I now blame your system for being weird ๐ or is there another edge case where it breaks ๐
lol reformatting everything actually broke coverage
uhhhhh like the tool or the stat
the tool
should I be concened?
(i did also run isort)
ImportError: cannot import name '__version__' from partially initialized module 'coverage' (most likely due to a circular import) (/home/aru/.cache/pypoetry/virtualenvs/modmail-lmlBH83T-py3.8/lib/python3.8/site-packages/coverage/__init__.py)
I doubt black caused this
me either
but yeah this is why I'm strongly against black reordering imports
i'm reinstalling coverage and just running black on it
one minute
uhhhhhh
I'm going to create a new venv and just format coverage ๐
coverage seems like the only thing that broke with isort formatting
inb4 formatting black with isort breaks it /j
but doesn't seem like anything broke with black formatting
it didn't /srs
the black i used to format coverage was formatted with my isort config
is /srs an actual tone indictor, TIL
yes, its serious
oh of course lol
lmao
i'm used to using /gen as in genuine for the same purpose
what i want is a tone indicator for half serious
eg what if i used difflib to split these functions
half-joking doesn't make sense with that
half serious makes more sense
idfk lmao
uhhh whoops /g /lh
what is /g and /lh smh
/g = genuine | /lh = lighthearted
You are not allowed to use that command here. Please use the #bot-commands channel instead.
!charinfo ih
\u0069 : LATIN SMALL LETTER I - i
\u0068 : LATIN SMALL LETTER H - h
\u0069\u0068
you should become staff for dem commands \hj
perhaps someday ๐
ooh i don't think i'll get another chance to use this tone indicator
someday i will break black /th
/th threat
I have a list of tone indicators with me /li
๐
smh
lol
honestly at some point there's too many tone indicators imo
like
some of them are great but at some point the ones that aren't used as much.... idk
I think the concept is great tho
and i would like to see.....
moved to #ot2-the-original-pubsta message
wtf why is this broken
this happened after i formatted all of my files ๐
@bright glacier The first run after the update did actually work without deprecation warnings
But then I ran a full run, and that broke it
It broke for both individual and full runs
What is this thread for?
black - The uncompromising Python code formatter
what-
do you have any ideas or am I going to have just try various things until it works on your machine TM
Lol
I can do some debugging when I get home
Iโll try to get a solid repro method
Various ideas I have include: moving where I patch sys.stderr, redirecting at the file descriptor level, using a in-memory blackhole, and monkey patching click and black.output utilities... one of these has to work ๐
All 3 when
if you machine is a certified application stress tester which it seems to be already
Well naturally we'll answer: Yes of course it is ๐ saves you a heap of trouble especially when working in a team
In terms of learning curve, it doesn't really have one. Once you've set it up, calling it is as easy as it gets
oh , sounds promising
i'm just a bit confused on what it actually does
read about it before but what i got in a nutshell is that it makes ur code look better
Have a look at the pinned messages!
yeah exactly that
doesn't change it in any other way, just visually
sounds great , does it follow any specify guidelines like pep8 or any other ?
it's a strict version of pep8
fair
opinionated though, so you won't be able to use your style
is ambv the same person in this video https://www.youtube.com/watch?v=Xbl7XjFYsN4&list=PLhNSoGM2ik6SIkVGXWBwerucXjgP1rHmB
This series of videos introduces AsyncIO to Python programmers who haven't used it yet. The first episode is a high-level view on the async ecosystem. We cover:
- why you'd want to use asynchronous code at all;
- how latency drives the user experience;
- what the difference between concurrency and parallelism is;
- some of the problems you can...
same face
wouldn't matter if that style looks better than mine , its mostly an opinion but somethings are surely more readable than others
A more reliable way to quit diff-shades would be uhh
great lol
@bright glacier can you replicate the fix working on the parser rewrite branch? Switching the black version to main seems to have solved the problems with the deprecation warnings
I guess this involves installing a signal handler?
that's because the deprecation warnings are misfiring on the parser branch because of my questionable code
I mean, I guess so? Instead of using the buggy branch I just hard coded black to always emit the deprecation warnings
Ah yes, can confirm

