#voice-chat-text-1
1 messages · Page 13 of 1
I'd expect sqrt to be faster
but insignificantly
python doesn't like to introduce specific cases when there might be such for optimisation sake
as in
can we handle this case faster?
we won't
somewhat works
the problem is that characters have non-1:1 ratio
" #"[...]
trying to render an elliptic curve
works poorly because I'm using a wrong way to calculate distances
box
A hexahedron (plural: hexahedra or hexahedrons) or sexahedron (plural: sexahedra or sexahedrons) is any polyhedron with six faces. A cube, for example, is a regular hexahedron with all its faces square, and three squares around each vertex.
There are seven topologically distinct convex hexahedra, one of which exists in two mirror image forms. Th...
In geometry, a parallelepiped is a three-dimensional figure formed by six parallelograms (the term rhomboid is also sometimes used with this meaning). By analogy, it relates to a parallelogram just as a cube relates to a square. In Euclidean geometry, the four concepts—parallelepiped and cube in three dimensions, parallelogram and square in two ...
there's also code bases which are so cursed you can't automate the refactoring of it
why the hell is it pronounced like "pipe"
paralelo-pipe-it
par·al·lel·e·pi·ped
https://www.activestate.com/resources/quick-reads/how-to-display-data-in-a-table-using-tkinter/
https://stackoverflow.com/questions/50625306/what-is-the-best-way-to-show-data-in-a-table-in-tkinter
https://www.tutorialspoint.com/what-is-the-best-way-to-show-data-in-a-table-in-tkinter
https://www.plus2net.com/python/tkinter-mysql.php
These all have different ways of doing this kind of thing, @dapper frost
something went wrong
That's a rather snazzy mistake.
Geometry on the surface of a sphere is non-euclidean.
For long distance navigation, you use non-euclidean geometry.
it's even worse than just non-euclidean
as like
breaks more stuff than the main contested axiom
HA
Is it like using a different co-ordinate system
time doesn't differ that much
usually
faster/slower to external observers
space is moving
(in GR)
limit on speed is local
in some sense, parts of space can move relatively to each other faster than the speed of light
"working with congress to make sure to spend as much budget as possible"
@primal quarry addition of velocities is not linear
quite important to understand how special relativity works
@primal quarry
https://en.wikipedia.org/wiki/Lorentz_transformation
This all hurts my brain
this is wrong when adding velocities
[x0,y0,z0]+[x1,y1,z1]=[x0+x1,y0+y1,z0+z1]
Yea cause you have to like take the average if the 2 positions or whatever
simplified formula
lights and photons are properties of the field
@mild flume they do have mass in some sense, like exerting gravity
Sure
whereas being affected by gravity doesn't even require mass
Super stupid question: when light hits something, does it get heavier?
Like.... it can't right?
if it absorbs it
heating up increases mass but too little
chemical reactions are doing that better
But it does in some form, just in an infinitesimal way
and nuclear even more
Hmm
yes, unless it gets reflected intact
I understand every other word of this
it usually doesn't get reflected in full
depends on the speed of the thing too
and frame of reference
As far as I know there isn't anything that 100% reflects light
Sure, but at scale
it can drain energy if the thing moves fast enough towards light
and is reflective enough
because light gains energy (by increasing its frequency)
particle is just a property
particularly stable one
it was written for physicists lol
this in particular is about how particles or equivalent thereof exist as emergent properties
I guess it's akin to learning how to read a programming language?
yeah
in this case, properties of sound
its just syntax for representing concepts
Yeah back shortly
particle-wave duality isn't that much of duality given how waves are the primary thing (even if particles can seem simple)
not that
that thing is small
there are way more disabled elements inside
disabled/useless/etc.
Good afternoon lads,
Guys I need help with a HTTP Requests
yeah I saw a yt video about it but its more complex than that
I need something supper specific
Super*
bru l(
😭
ughgh
2 secs boys
let me type
Ight wait let me type it rq
XD
Yes
I made a GIF on Tenor and for it to be be viewed in GIF search on Discord the GIF needs at least x amount of views
and every time I past the link it counts as one view
yes
how do I automate it
nah but if open it on 2 different tabs it counts as 2 views
how do I do that?
yeah let me show you what I got
import requests
r = requests.get("the link")
print((r))
thats what I got from the indian man on yt
But that dosent count towards the views, idk why
requests.get("https://catfact.ninja/fact").text
wait can i say shit
ight wait let me get a link
bro whats this dark web shit XD
facts
but then how come if I open the same link multiple times it counts as views
ahh
acctly?
!rule 5
5. Do not provide or request help on projects that may violate terms of service, or that may be deemed inappropriate, malicious, or illegal.
bru I just need the thing to open the link multiple times 😭
😉
wear gloves*
go where ?
XD
Wait so whats wrong with this request?
is it cus of the tomfoolery
ahh so its a ethical thing
yeah I understand, its like view farming on yt
so is it unethical to open the same link multiple times 🤷♂️
😂
Sorry lads just before I go why dosen't this work again and can you just give me a nudge of how to make it work
import requests
r = requests.get("the link")
bro send the link
plssss
JUST LOOK NO TOUCH
thats a hint !!!!
Ight thanks lads ❤️
||| code courtesy of the tf source leak |||
Music: Hall of the Mountain King
channel discord --- https://discord.gg/8TYgJhwA7S
channel patreon --- https://www.patreon.com/shounic
channel tracker --- https://trello.com/b/L3B65jUX
[ todo list / current progress on upcoming videos / channel roadmap ]
feedback --- https://forms.gle/bkuGF6attQrRPc6o...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
!d dis
Source code: Lib/dis.py
The dis module supports the analysis of CPython bytecode by disassembling it. The CPython bytecode which this module takes as an input is defined in the file Include/opcode.h and used by the compiler and the interpreter.
!e
from timeit import timeit
def one():
a = 1
for _ in [0]*100_000:
a *=0.5
a /=0.5
return a
def two():
a = 1
for _ in [0]*100_000:
a /=2
a *=2
return a
def three():
a = 1
for _ in [0]*100_000:
a /=0.5
a /=2
return a
def four():
a = 1
for _ in [0]*100_000:
a *=0.5
a *=2
return a
print(timeit(one, number=1))
print(timeit(two, number=1))
print(timeit(three, number=1))
print(timeit(four, number=1))
@primal quarry :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | 0.011712657287716866
002 | 0.014990424737334251
003 | 0.012963864952325821
004 | 0.011407922953367233
Oh and fun fact
We have !timeit
If you like video game music
!e
from timeit import timeit
def one():
a = 1
for _ in range(100_000):
a *=0.5
a /=0.5
return a
def two():
a = 1
for _ in range(100_000):
a /=2
a *=2
return a
def three():
a = 1
for _ in range(100_000):
a /=0.5
a /=2
return a
def four():
a = 1
for _ in range(100_000):
a *=0.5
a *=2
return a
print(timeit(one, number=1))
print(timeit(two, number=1))
print(timeit(three, number=1))
print(timeit(four, number=1))
@delicate wren :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | 0.010808145627379417
002 | 0.012251565232872963
003 | 0.01144053228199482
004 | 0.011360730975866318
most of the time difference is from int->float conversion
2->2.0
it takes time
extremely unreliable, for some reason
!timeit
code
!timeit [python_version] [setup_code] <code, ...>
Can also use: ti
Profile Python Code to find execution time.
This command supports multiple lines of code, including code wrapped inside a formatted code block. Code can be re-evaluated by editing the original message within 10 seconds and clicking the reaction that subsequently appears.
If multiple formatted codeblocks are provided, the first one will be the setup code, which will not be timed. The remaining codeblocks will be joined together and timed.
By default, your code is run on Python 3.11. A python_version arg of 3.10 can also be specified.
We've done our best to make this sandboxed, but do let us know if you manage to find an issue with it!
you can almost never say it's definitely faster
it varies a lot
the rest seems to correlate with the number of divisions/multiplications
with divisions being faster
floats
@terse osprey You here bud?
maybe optimisations similar to |0 in JS but a little different
inconsistently
will be quite a sad situation if it's just memory layout related speed difference
you can look at it and think "it's clearly 10 times larger, so numbers are fine"
but it's not always 49:53
what are the different between random.chiose and random.choises?
Lmao
one result vs multiple
Oh, I ran the a function twice
also, afaik, only choices allows weights
b is 2.665035800077021
how multiple?
No documentation found for the requested symbol.
random.choices(population, weights=None, *, cum_weights=None, k=1)```
Return a *k* sized list of elements chosen from the *population* with replacement. If the *population* is empty, raises [`IndexError`](https://docs.python.org/3/library/exceptions.html#IndexError "IndexError").
If a *weights* sequence is specified, selections are made according to the relative weights. Alternatively, if a *cum\_weights* sequence is given, the selections are made according to the cumulative weights (perhaps computed using [`itertools.accumulate()`](https://docs.python.org/3/library/itertools.html#itertools.accumulate "itertools.accumulate")). For example, the relative weights `[10, 5, 30, 5]` are equivalent to the cumulative weights `[10, 15, 45, 50]`. Internally, the relative weights are converted to cumulative weights before making selections, so supplying the cumulative weights saves work.
k=
thanks
!e
from random import choices
print(choices([1,2,5], k=4))
@delicate wren :white_check_mark: Your 3.11 eval job has completed with return code 0.
[5, 5, 1, 1]
perfetc thanks
same code
Very odd
it probably is
:(
But it's a pretty measurable difference
I think you just have a faulty processor
?
Maybe it was wired wrong
re-run this 10-ish times
as in
redefine the function
it may give different results
Trying it
each time you redefine the function, its performance changes
It seems like it but I'm getting the multiplication consistently faster
@mild flume you try it
Hmm
@random minnow it's random
@delicate wren :x: Your 3.11 eval job timed out or ran out of memory.
001 | -0.054138174280524254
002 | -0.054851265624165535
003 | -0.05147458799183369
@delicate wren :x: Your 3.11 eval job timed out or ran out of memory.
001 | 0.024440566077828407
002 | 0.015820952132344246
003 | 0.015387816354632378
look
!e
from timeit import timeit
def div_float():
for _ in range(100_000):
a = 3.0
a /= 2.0
def mul_float():
for _ in range(100_000):
a = 3.0
a *= 0.5
for i in range(5):
print(timeit(div_float, number=100) - timeit(mul_float, number=100))
@delicate wren :x: Your 3.11 eval job timed out or ran out of memory.
001 | 0.021370904520154
002 | 0.02712751366198063
003 | 0.018711324781179428
I'm pasting the same code lol
@delicate wren :x: Your 3.11 eval job timed out or ran out of memory.
001 | 0.031604014337062836
002 | 0.02675784006714821
003 | 0.010857302695512772
!e
from timeit import timeit # comment to avoid getting rate-limited by bot #1
def div_float():
for _ in range(100_000):
a = 3.0
a /= 2.0
def mul_float():
for _ in range(100_000):
a = 3.0
a *= 0.5
for i in range(5):
print(timeit(div_float, number=100) - timeit(mul_float, number=100))
@delicate wren :x: Your 3.11 eval job timed out or ran out of memory.
001 | 0.0203707292675972
002 | 0.024002408608794212
003 | 0.03762888163328171
!e
from timeit import timeit
def div_float():
for _ in range(100_000):
a = 3.0
a /= 2.0
def mul_float():
for _ in range(100_000):
a = 3.0
a *= 0.5
for i in range(5):
print(timeit(div_float, number=100) - timeit(mul_float, number=100))```
it should be positive mostly
@primal quarry :x: Your 3.11 eval job timed out or ran out of memory.
001 | 0.027432087808847427
002 | 0.03222465328872204
003 | 0.02642926201224327
!e
from timeit import timeit
def div_float():
for _ in [0]*100_000:
a = 3.0
a /= 2.0
def mul_float():
for _ in [0]*100_000:
a = 3.0
a *= 0.5
for i in range(5):
print(timeit(div_float, number=100) - timeit(mul_float, number=100))```
@primal quarry :x: Your 3.11 eval job timed out or ran out of memory.
001 | 0.013793524354696274
002 | 0.012729119509458542
003 | 0.026121320202946663
004 | -0.006698824465274811
I'll go restart the ipython kernel
still getting negative numbers mostly
can you do a random in a random let me explain i have 3 list and i what to randoms the thinks in 3 list in one variable
choice, then choice again
depends on how you want the distribution to look like
!e
from random import choice
lists = [[1,2,3],[4,5,6],[7,8,9]]
print(choice(choice(lists)))
@delicate wren :white_check_mark: Your 3.11 eval job has completed with return code 0.
3
!d itertools.chain
itertools.chain(*iterables)```
Make an iterator that returns elements from the first iterable until it is exhausted, then proceeds to the next iterable, until all of the iterables are exhausted. Used for treating consecutive sequences as a single sequence. Roughly equivalent to:
```py
def chain(*iterables):
# chain('ABC', 'DEF') --> A B C D E F
for it in iterables:
for element in it:
yield element
!d itertools.chain.from_iterable
classmethod chain.from_iterable(iterable)```
Alternate constructor for [`chain()`](https://docs.python.org/3/library/itertools.html#itertools.chain "itertools.chain"). Gets chained inputs from a single iterable argument that is evaluated lazily. Roughly equivalent to:
```py
def from_iterable(iterables):
# chain.from_iterable(['ABC', 'DEF']) --> A B C D E F
for it in iterables:
for element in it:
yield element
The key is to write code that neither the human nor the machine can read
person who was asking about logarithms earlier
Where are these from?
@mild flume https://usdebtclock.org
Ooo, neat
@fallen cape
hii i'm sky
from india.
i just rejoined the server
i lost speak permission
what about u?
where r u from?
what r u working on these days ?
can re-verify already
!voice
Can’t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
the channel is hidden if you re-verify I think
I don't see the channel
but I can access it
Thanku @delicate wren ,Alisa i just sent voce verification command and got access again!
!voice
Can’t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
!Voiceverify
hi
":According to the results of this study, probiotic mouthwashes are considered an effective solution for maintaining oral health. However, probiotics are more effective in reducing plaque accumulation after a month of use."
wow nice porject I want to hop in
In this repo read me is not explain a lot kindly show something
@shy osprey hello
@forest ore I want to contribute in your repo
@tranquil quest
can someone help me with mayavi module of python?
Haven't heard of it before
What's up?
I've seen a few docs about it, but am not sure about it really.

It damages the Cerebellum
As per the reports
Yarp
It just affects the overall stability of the body.
That's effin crazy lmao!
How goes it
great
@zenith wedge From the NPR report:
Del Pozo said many reported fentanyl overdoses among police involve symptoms that look more like panic attacks than opioid overdoses.
"So when an officer just at the thought of being exposed to fentanyl falls over, goes unconscious or panics, that's a health problem. That's something the officer needs help for."
i remember some guy tried to kidnap me with a lolipop, i was 5 and he was forcing me eat it.. plus he was lookin weird af
to eat*
i ran away and said NO!
@fair heart Probably "What's Love Got to Do With It"
Aspiring Fascist? 👀
You’re under no obligation to choose a license and it’s your right not to include one with your code or project. But please note that opting out of open source licenses doesn’t mean you’re opting out of copyright law.
This always baffles me
Funny video of David Mitchell from the Mitchell and Webb Situation.
An Englishman visits Scotland in the 1700s.
"You what, mate?"
"Aye, that be me, lad."
I'm sticking with the goat sacrifice suggestion
@onyx kernel How're you? Haven't been able to ask you over voice yet
Why should you never visit a mechanic run by a rhinoceros?
Why
Because they charge too much.
lol
Also, they're a rhinoceros. They're not exactly the most dextrous.
@raven orbit I don't get how you tolerate SQLAlchemy
I'm running into issues while even trying to do the tutorial
@unborn hawk 👋
Can someone please help with this - https://discord.com/channels/267624335836053506/1111680221976985640
What in gods name is that from
If the ability to do that exists, it will be in your IDE interface.
Project settings of some sort.
I expect.
So I am trying something like this -
import sys
if __name__ == '__main__':
argc = len(sys.argv)
if argc < 2:
print("error")
sys.argv[1] = "quote"
if sys.argv=="quote":
print("Those who wander aren't always lost")
@merry mica https://en.wikipedia.org/wiki/SQL#History
Structured Query Language (SQL) ( (listen) S-Q-L, sometimes "sequel" for historical reasons), is a domain-specific language used in programming and designed for managing data held in a relational database management system (RDBMS), or for stream processing in a relational data stream management system (RDSMS). It is particularly useful in handl...
"Is this the weasel place?
"We sell weasels."
"Weasel weasels?"
"No, we sell weasels."
"What do you mean weasel weasels?"
"We sell...weasels."
"...Weasel weasels?"
"Out!"
Devil's Dust: With Anthony Hayes, Don Hany, Ewen Leslie, Alexandra Schepisi. Follow the corporate scandal surrounding multi-national asbestos company, James Hardie, the life or death fight against their strategy of ignoring the dangers of asbestos for decades, and the desperate fight to expose their crimes.
/rg'ɨb/
That tracks
gtg
The Voice of God weapon — a device that projects voices into your head to make you think God is speaking to you — is the military’s equivalent of an urban myth. Meaning, it’s mentioned periodically at defense workshops (ironically, I first heard about it at the same defense conference where I first met Noah), […]
Dallas: The Television Role-Playing Game is a role-playing game created by the wargame publisher Simulations Publications, Inc. (SPI) in 1980 based on the popular television soap opera Dallas. The game was an attempt by debt-ridden SPI to find a new audience, but the game did not sell well and also alienated their wargame clientele.
I would love to have feedback on this work... https://github.com/dancergraham/HeadFirstDesignPatterns_python
wtf...increasingly.
!voice
Can’t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
ffs... I keep typing entity as entitiy
I don't know why
And it's irritating me
#tools-and-devops @small plaza
Keychron Q6 is a fully customized full-size layout mechanical keyboard packed with all premium features and endless possibilities. Q6 is an all-metal keyboard that allows customizable capabilities for every key switch, keycap, knob, and stabilizer. It’s made for your personalized experience and a more comfortable typing experience.
@delicate wren :white_check_mark: Your 3.11 eval job has completed with return code 0.
2.719642216442853
ah, nvm
either
factorials are weird in terms of asymptotics
!e
from math import e
print(e)
@delicate wren :white_check_mark: Your 3.11 eval job has completed with return code 0.
2.718281828459045
it always grows but it's bound
there is a second sequence which always shrinks
@mild flume yes
and it's always greater
so they approach each other an meet in the infinity
still didn't succeed in approximating this thing
it's, like log(x+stuff)
I think my formal education stopped somewhere right before that
e^(-x^2) is quite useful actually
because it's base for normal distribution
(or, rather, normal distribution PDF, probability distribution function)
this is now my graphing software
the problem is:
it's not actually working correctly, it's checking distance vertically
so it's just graph+(0,.05), graph-(0,.05) and everything in-between
trying to find distances would be difficult
Dude. Just
I don't even know where to start
I know there is a formula to find distances to cubic curves
This is incredibly childish, Maro. If someone doesn't want to talk to you at the moment, let it go
It's like the constant texts you get from an ex
so true))
but instead of "from" you change it to "to" 🫠
Yes, which I sent once. Not the 8ish messages and passive aggressive comments that you deleted only after being called out on
Did I take moderative action? No. I saw something that was highly uncomfortable in my eyes and mentioned it
When you're in a public space, more than other people can see and comment on things
You're free to call it out.
@mild flume we need you.
I'm in a meeting, what's going on
it can wait
@eager tinsel How are you?
good
how about you
why would you send it?
send it here, not to dm
so now you are aware
there are bunch of other channels
to send msg
coelacanth
Coelacanths ( (listen) SEE-lə-kanth) (order Coelacanthiformes) are an ancient group of lobe-finned fish (Sarcopterygii) in the class Actinistia. As sarcopterygians, they are more closely related to lungfish and tetrapods (which includes amphibians, reptiles, birds and mammals) than to ray-finned fish.
Well-represented in both freshwater and mari...
can you stop dming me?
you literately send me message
I am saying that you sent me message to my dm
I am not saying that you asked something, I am saying that you sent me message privately
and I am asking to stop sending them
yeah, never mind, I will just block you
are you kidding ?
good decision
now he is sending me from another account
why would I?
<@&831776746206265384>
!pban 474600906923573250 nsfw troll
:incoming_envelope: :ok_hand: applied ban to @north bough permanently.
@tender haven can you block this person too?
he was spamming people earlier to dm's and now he joking around
<@&831776746206265384>
!pban 555740152832589827 nsfw troll
:incoming_envelope: :ok_hand: applied ban to @ruby mantle permanently.
thanks
you've already been warned for bothering people. here's your second, and final, warning about trolling.
I believe!
<@&831776746206265384>
<@&831776746206265384>
And I believe in reincarnation too.
!pban 479357820186132480 nsfw troll
:incoming_envelope: :ok_hand: applied ban to @blissful horizon permanently.
thanks
finally
^
The Egg
Story by Andy Weir
Animated by Kurzgesagt
A Big Thanks to Andy Weir for allowing us to use his story.
The original was released here: http://www.galactanet.com/oneoff/theegg_mod.html
Visit his website here: http://www.andyweirauthor.com/
If you want to support us, please check out those beautiful Egg posters we made:
https://shop.kurz...
do you mind if I take some pics that you sent earlier ?
no go haded
Great video! I'm from Brazil, and here the third most popular religion is Kardecist spiritism. The core of the religion is reincarnation.
Donald Trump is overseas visiting Belgium, England, Scotland and then his pal Putin in Russia. It is imperative that America has strong relationships with and knowledge about other nations, and that responsibility extends to all of us. So we came up with a test and went out on the street to ask people passing by, to name any country on a map. It...
In the interest of doing something fun and educational, we went out on the street with a map of the United States that we blacked out so you couldn't see the shapes of the states, and we asked people walking by to name this country.
Jimmy Kimmel & Brad Paisley Welcome Immigrants to America https://youtu.be/nG6IcqMCVKQ
SUBSCRIBE to get the la...
girl thinks England is close to Jupiter .Don't make fun of her. She speaks fluent American... hello people wake up get educated this is what the world is coming to ...smh
JEUHEAIUEHAIUE
Stable Diffusio Online Demo. FREE forever. Create beautiful art using stable diffusion ONLINE
oh boy...
it gets easier once you get the hang of it
@tepid geode what IDE are you using?
if it's VS Code, you can develop on the remote server directly
VS Code remote is way easier, in my view
it just works
almost same for development inside docker containers
I think VS Code remote is pretty much the reason I switched from PyCharm
however much you hate microsoft, remember: oracle exists
like, you can just run docker compose up -d --build
without pain of connecting to remote docker host
H
Okay.
Is it no boilerplate
Wut?
I men is this your YouTube channel
Well, I'll say this much. You've been doing some sleuthing.
Actually i am not. I found this voice similar to opal so i asked
chess
The joining coincided with me having two creepers sneak up on me.
I got a hekkin startle.
I've relented and gone back to Forge.
Too many good mods.
Fabric has a lot going for it. Migration of all of what I want to play it does not.
If your iPython is broken, maybe it needs a patch.
Yarr.

Eyeballs?
"I forced a bot to watch x..."
yes, of course, it's XML
If you're having a really shitty day sorting out a serious problem with your domain name, do you tell people "ICANN complain"?
Calls demolition services.
"Okay. Office removed. What's next?"
@astral carbon 👋
@gaunt sundial 👋
even fonts now take bribes?
You print something for work and it's all just Zalgo.
eh
I didn't take the screenshot soon enough
it was showing something like
7 blunders
100% accuracy
what a disaster
wha
"I return."
Hemlock()```
Are refrigerators chilled friendly?
@stone musk 👋
@small trench 👋
Joins and leaves and what you see.
@fast cape hello
I can't do voice chatting currently, uh
yeah m, somewhere in GMT + 8hr , Taiwan
yah good guess, I just learn how to use nvim (a text eeditor) with a plugin called vimspector , do you use that ?
lot of ppl are using VScode (or Eclipse) for dev , I understand how convenient it is
I want to keep my IDE simple , and I don't mind learning vim commands (I learn that in my last job)
what food on daily basis ?
nvm,
meat eater ! lol
common in some South East Asian countries
it was primary source of protein there several decades ago . now ppl there eat meat like chicken beef pork , so eating insect is like part of the culture there.
yah , ok , bye
@misty sinew do you live in india thouhg?
nope
i figured
you dont sound indian

you were indian right?
i doubth it
🤣
😳
@white vine ....."14"... so you are 9
🤣
Howcan i be voice verified
instructions are in #voice-verification
Can anyone help me upgrade my openGL to 2.0
15
import getpass
def os_get_name():
os_name = getpass.getuser()
os_name_ask = ''
while os_name_ask not in ['Y', 'N']:
os_name_ask = input(f'Do you want {os_name} as your name? (y/n): ').upper()
if os_name_ask == 'Y':
return os_name
elif os_name_ask == 'N':
name = ''
while name == '':
name = input('What is your name? ')
return name
else:
print('Invalid input')
def main():
player_name = os_get_name()
print(f'Hello, {player_name}!')
if __name__ == '__main__':
main()
class Car:
brand = "Unknown"
color = "White"
def honk(self):
print("Beep beep!")
my_car = Car()
!e
class Car:
brand = "Unknown"
color = "White"
def honk(self):
print("Beep beep!")
my_car = Car()
print(my_car.brand)
print(my_car.color)
my_car.honk()
@umbral rose :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | Unknown
002 | White
003 | Beep beep!
__init__
!e
class Car:
def __init__(self, brand, color):
self.brand = brand
self.color = color
@staticmethod
def honk():
print(f"Beep beep!")
@staticmethod
def create_car():
brand = input("What is the brand? ")
color = input("What is the color? ")
return Car(brand, color)
my_car = Car.create_car()
print(my_car.brand)
print(my_car.color)
my_car.honk()
@umbral rose :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | Honda
002 | Red
003 | Beep beep! I am a Honda!
def data_gen(player_name, age1,player_gender,tutorial):
data = {
'player_info': {
'player_name': player_name,
'player_age': age1,
'player_gender': player_gender,
'Player_location':None
},'player_stats':{
},'player_invtory':{
},'player_spals':{
'spals_unlock':{},'spals_equped':{}
},'check_ponts':{
'tutorial': tutorial
}
}
data_dump(data)
def data_dump(data):
print ('saving')
file_path = '0.00.05/data/' + 'player_' + data['player_info']['player_name'] + '_save.json'
with open(file_path, 'w') as file:
json.dump(data, file)
print ('saving conpleat')
import chapter_1 as chapter_1
selected_Save = '0.00.05/data/' + 'player_' + data['player_info']['player_name'] + '_save.json'
chapter_1.load_json(selected_Save)```
!code
sup fam
!e
print(bool.from_bytes(b'\x00', 'little'))
print(bool.from_bytes(b'\x01', 'little'))
@delicate wren :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | False
002 | True
!e
pyprint("GOFEK TALK NOW")
@misty sinew :white_check_mark: Your 3.11 eval job has completed with return code 0.
GOFEK TALK NOW
@candid garnet :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | False
002 | True
in response to code above using staticmethod for factory methods instead of classmethod
if emoji in emoji_command_dict:
ctx = await client.get_context(reaction.message)
print(ctx)
command = client.get_command(str(emoji_command_dict[emoji]))
await ctx.invoke(command)
```
@commands.cooldown(1,3600, commands.BucketType.user)
@client.command()
async def ___cook(ctx):
user = ctx.author
print("1")```
Any idea why the cooldown doesn't trigger?
what library are you using?
import discord
from discord.ext import commands
@client.event
async def on_command_error(ctx, error):
if isinstance(error, commands.CommandOnCooldown):
msg = f'You have already been to the kitchen for this rush hour, please try again in {error.retry_after//3600} hours, {(error.retry_after%3600)//60} minutes, {error.retry_after%60:.0f} seconds'
await ctx.reply(msg)```
maybe it's the handler
wait, is it the same command as the one you put cooldown on?
(asking because ___cook and foodrush -- different names)
foodrush has no cooldown
___cook does
I'm trying to invoke cook within the foodrush command
why is everyone muted?
And trigger the cooldown
so, one command called from inside the other one?
Correct--
just calling await ___cook(ctx)?
smh... um
Let me see
Will that trigger the cooldown though
Would be awesome if it was that easy haven't bothered trying one sec
(I don't know how to properly call it)
emoji_command_dict = {
"🍳": ___cook,
"🍕": ___bake,
"🥪": ___prep,
"🌭": ___grill,
"🍔": ___flip,
"🦃": ___broil,
"🔒": ___LP,
}
while True:
reaction, user = await client.wait_for("reaction_add", check=check)
emoji = str(reaction.emoji)
if emoji in selected_options:
await chart_message.remove_reaction(emoji, user)
else:
selected_options.append(emoji)
if emoji in emoji_command_dict:
await ___cook(ctx)```
So I don't think there's a way to await it this way
emoji_command_dict[emoji]) is how I define the function I'm going to run
___cook seems to be (after decorators being applied) an instance of Command
so await ___cook(ctx) should work mostly fine
but I don't know whether it checks for timeout
Well it called the function
await ___cook.can_run(ctx)
But it didn't trigger cooldown
if await ___cook.can_run(ctx):
await ___cook(ctx)
check this one first
without emoji_command_dict yet
cooldown still not invoking
on which object?
what type does ___cook have?
<class 'discord.ext.commands.core.Command'>
you're using discord.py 2.0 or newer, right?
FYI if I use !___cook twice in the chat it calls the error for cooldown successfully
it's very strange that this would be missing
@delicate wren So I updated but still didn't invoke cooldown
Was having issues with a lot of code that was deprecated 😦
yo
can i get some quick help if u arent busy
im new to python and i wrote some code for
its a macro for a game
no
its a roblox game
mind if i post what ive got so far
he doesn't advise against it?
it isnt a competitve game
5. Do not provide or request help on projects that may violate terms of service, or that may be deemed inappropriate, malicious, or illegal.
If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
import time
import pyautogui
import keyboard
# Set coordinate of when to click and when to check
point1 = (961,895)
# Set the target color
target_color1 = (115, 199, 255)
target_color2 = (255, 255, 255)
# Create a loop to check the pixel colors
while True:
pixel1 = pyautogui.pixel(point1[0], point1[1])
# Check if any of the colors match target colors
if pixel1 == target_color1:
pyautogui.rightClick
if pixel1 == target_color2:
pyautogui.leftClick
# Check if the "q" key is pressed
if keyboard.is_pressed("k"):
break```
no,
no errors
its a horizontal slider where i a certain color is moving on the point
what does time.sleep do?
do you think the color is possibly moving to fast?
i added the method calls
its a relatively slow moving color
ill test it out
yeah i know
i just want it to right or left click when the respective colors meet a certain point on my scren
@delicate wren
He's talking about that
The dots move to the middle, but we're having issues trying to make it so the dots hit the middle.
would the code above work for something like that
@delicate wren ^
should i potentially change
the pixel point
i could have 2 points one towards the left and one towards the right of the center circle
from screenshoting my screen
i put the screenshot in paint
and took the RGB value from it
how
print(*objects, sep=' ', end='\n', file=None, flush=False)```
Print *objects* to the text stream *file*, separated by *sep* and followed by *end*. *sep*, *end*, *file*, and *flush*, if present, must be given as keyword arguments.
All non-keyword arguments are converted to strings like [`str()`](https://docs.python.org/3/library/stdtypes.html#str "str") does and written to the stream, separated by *sep* and followed by *end*. Both *sep* and *end* must be strings; they can also be `None`, which means to use the default values. If no *objects* are given, [`print()`](https://docs.python.org/3/library/functions.html#print "print") will just write *end*.
The *file* argument must be an object with a `write(string)` method; if it is not present or `None`, [`sys.stdout`](https://docs.python.org/3/library/sys.html#sys.stdout "sys.stdout") will be used. Since printed arguments are converted to text strings, [`print()`](https://docs.python.org/3/library/functions.html#print "print") cannot be used with binary mode file objects. For these, use `file.write(...)` instead.
is there a way i can just generalize "blue" to the code to look for
or is that impossible
and would use too much computing
i can talk
hi hezy
im dying actually
it's a joke
i need to finish my assignments at the uni
and i'm strugling a bit
how bout you?
what position? software dev?
do you need to know smth from program. langs.? i mean for this role
have you passed a certification for this or smth? for data analitics on python
i need to write 50 mess to speak with you
so
i am on my way
i m actually learning java
cs
yeap
but i was inveted
invited to a company as an aintern
and consequatly could not spend much time preparing for the assignments
oh
it's tough
but i suppose working exp is much more worth
i don't know where you are living but in Europe without edu it doesnt work at all
like you sad
said*
have you graduated?
oh it's a hard major
)))
but you can try to implement this knowledge
btw
two of my classmates
from highschool
are studying now in Cambridge for free
freom my class
it's tough i think
but they are doing math
oh
i wanted btw to ask you about your master
so you're up to doing it
but afterwards?
and do you have gradation like in sofftware in your profession
i mean jun middle and so on
like in programming
there are different levels
junior jev
middle dev senior dev
yep
wow it's really engaging
what direction would you choose in software: web android ios or smth else
ai
ml
omg i thought it would be easier
i was permitted to speak wait a sec i'll reconect
!d print
print(*objects, sep=' ', end='\n', file=None, flush=False)```
Print *objects* to the text stream *file*, separated by *sep* and followed by *end*. *sep*, *end*, *file*, and *flush*, if present, must be given as keyword arguments.
All non-keyword arguments are converted to strings like [`str()`](https://docs.python.org/3/library/stdtypes.html#str "str") does and written to the stream, separated by *sep* and followed by *end*. Both *sep* and *end* must be strings; they can also be `None`, which means to use the default values. If no *objects* are given, [`print()`](https://docs.python.org/3/library/functions.html#print "print") will just write *end*.
The *file* argument must be an object with a `write(string)` method; if it is not present or `None`, [`sys.stdout`](https://docs.python.org/3/library/sys.html#sys.stdout "sys.stdout") will be used. Since printed arguments are converted to text strings, [`print()`](https://docs.python.org/3/library/functions.html#print "print") cannot be used with binary mode file objects. For these, use `file.write(...)` instead.
!d sum
sum(iterable, /, start=0)```
Sums *start* and the items of an *iterable* from left to right and returns the total. The *iterable*’s items are normally numbers, and the start value is not allowed to be a string.
For some use cases, there are good alternatives to [`sum()`](https://docs.python.org/3/library/functions.html#sum "sum"). The preferred, fast way to concatenate a sequence of strings is by calling `''.join(sequence)`. To add floating point values with extended precision, see [`math.fsum()`](https://docs.python.org/3/library/math.html#math.fsum "math.fsum"). To concatenate a series of iterables, consider using [`itertools.chain()`](https://docs.python.org/3/library/itertools.html#itertools.chain "itertools.chain").
Changed in version 3.8: The *start* parameter can be specified as a keyword argument.
hi, @neon saffron
hi @misty sinew 
question, did that work?
i mean the verification
the voice verification
'cause i need that
if it DID work,
I would try it as well
so plz tell me
huh?
@neon saffron r u around?
@misty sinew yep you have to write 50 messages
!code
Hi I'm suppressed
Can’t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
@left spire 👋
@pseudo raven are you here?
@frozen gale 👋
...
How are you
...
1498
christopher columbus
hehe
Christopher Columbus (/kəˈlʌmbəs/; between 25 August and 31 October 1451 – 20 May 1506)
12
what r u doing , sir?
i not good at math
but i'm good at py
but i'm noob in thisserver
Christopher Columbus (; between 25 August and 31 October 1451 – 20 May 1506) was an Italian explorer and navigator from the Republic of Genoa who completed four voyages across the Atlantic Ocean sponsored by the Catholic Monarchs of Spain, opening the way for the widespread European exploration and European colonization of the Americas. His exp...
!e
code
!eval [python_version] <code, ...>
Can also use: e
Run Python code and get the results.
This command supports multiple lines of code, including formatted code blocks. Code can be re-evaluated by editing the original message within 10 seconds and clicking the reaction that subsequently appears.
The starting working directory /home, is a writeable temporary file system. Files created, excluding names with leading underscores, will be uploaded in the response.
If multiple codeblocks are in a message, all of them will be joined and evaluated, ignoring the text outside them.
By default, your code is run on Python 3.11. A python_version arg of 3.10 can also be specified.
We've done our best to make this sandboxed, but do let us know if you manage to find an issue with it!
!e ```py
print('Hello, world.')
print('Goodbye.')
@stuck bluff :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | Hello, world.
002 | Goodbye.
!eval [python_version] <code, print("hello")>
@frozen gale :x: Your 3.11 eval job has completed with return code 1.
001 | File "/home/main.py", line 1
002 | [python_version] <code, print("hello")>
003 | ^
004 | SyntaxError: invalid syntax
!e ```py
print('Hello, world.')
print('Goodbye.')
```
@frozen gale :white_check_mark: Your 3.11 eval job has completed with return code 0.
ty for that sir
!paste
If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
!e ```py
import time
time.sleep(1)
print("hello")
time.sleep(1)
print("hello")
time.sleep(1)
print("hello")
time.sleep(1)
print("ty")
time.sleep(1)
print("Bruh")
@frozen gale :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | hello
002 | hello
003 | hello
004 | ty
005 | Bruh
@grim agate 👋
!e ```py
rabdom code
hi = input(">>> ")
if hi == "dont care":
print("Bye :)")
elif hi == "uhhh":
print("OMG TY :)")
uhh
OMG TY SIRR
can i go sir?
OMG TY
Hi
"thank Fireship for its hype"
marketing appears good only at a first glance
people who do ML:
- highly rely on open-source
- know that Python relies on external libraries; benchmarking iteration in Python on simple numeric data is just moronic
Mojo is not open-source now
kkkkkkkkkkkkkkkk
and their simpler benchmark written in Python is at least 100 times slower than it should be
YOu can kill me but you have the time to do it
maybe it doesn't exist at all
?
I didn't try it, I can't know
Spooky
how many segfaults?
@ornate cobalt "just use #[bench]" (spoiler: requires nightly)
I don't want to change my channel
Dockerfile.Benchmark
FROM rustlang/rust:nightly
...
if there's any need
wmic path softwareLicensingService get OA3xOriginalProductKey
windows media tool might partially exist because of how windows delivers things
or used to, at least
I forgot why I have cygwin installed
why do I have a .5 GB MongoDB data directory if I've never written anything to it
heard the word
read the name of the company some time ago
forgot where
"look at the icon"
drive A:
good for privilege escalation exploits
you want to avoid ads => pay
if you want to argue ethics of banning APIs because you want to avoid ads, there is a contradiction in reasoning
understandable
Howdy!
import random
def roll(die=None, sided=None, dice_effect=None, advantage=None):
if dice_effect:
dice_effect = dice_effect.strip().upper()
if dice_effect[0] == 'D':
advantage = False
dice_parts = dice_effect[1:].split('D')
elif dice_effect[0] == 'A':
advantage = True
dice_parts = dice_effect[1:].split('D')
else:
advantage = None
dice_parts = dice_effect.split('D')
if len(dice_parts) != 2:
raise ValueError("Invalid dice format. Expected '1d6' format.")
die = dice_parts[0].strip()
sided = dice_parts[1].strip()
if not die.isdigit() or not sided.isdigit():
raise ValueError("Invalid dice format. Expected numeric values for die and sides.")
if not die or not sided:
raise ValueError("Missing die or sided value.")
rolls = []
for _ in range(int(die)):
rolls.append(random.randint(1, int(sided)))
if advantage is True:
result = max(rolls)
elif advantage is False:
result = min(rolls)
else:
result = sum(rolls)
return result
!e
import random
def roll(die=None, sided=None, dice_effect=None, advantage=None):
if dice_effect:
dice_effect = dice_effect.strip().upper()
if dice_effect[0] == 'D':
advantage = False
dice_parts = dice_effect[1:].split('D')
elif dice_effect[0] == 'A':
advantage = True
dice_parts = dice_effect[1:].split('D')
else:
advantage = None
dice_parts = dice_effect.split('D')
if len(dice_parts) != 2:
raise ValueError("Invalid dice format. Expected '1d6' format.")
die = dice_parts[0].strip()
sided = dice_parts[1].strip()
if not die.isdigit() or not sided.isdigit():
raise ValueError("Invalid dice format. Expected numeric values for die and sides.")
if not die or not sided:
raise ValueError("Missing die or sided value.")
rolls = []
for _ in range(int(die)):
rolls.append(random.randint(1, int(sided)))
if advantage is True:
result = max(rolls)
elif advantage is False:
result = min(rolls)
else:
result = sum(rolls)
return result
print(roll(3, 4))
@ornate cobalt :white_check_mark: Your 3.11 eval job has completed with return code 0.
7
@atomic bear #career-advice
Back in a sec
wha
I missed this daily and another one
https://leetcode.com/problems/snapshot-array/
I think, of BFS or DFS, one can be chosen only knowing the data to optimise for
@misty urchin there is a common trope that closing access to APIs is "unethical", "restricting freedom", which in most cases is not true
whoever was in VC thankfully wasn't making that point
the programmer version of "I thought this was 'Murica"
I think you could argue that the way they went about it is duplicitous and unethical
a thing that BFS protects against is binary trees which are effectively just linked lists
what we're trying to do is to find something as fast in possible in the graph
which is what DFS is good for, generally
but this specific case may place certain restrictions on its applicability
the solution itself, on the idea level, is order-independent
it's just a recursively defined AND expression
which can short circuit in either of its two subbranches or its extra check
!e
code
!eval [python_version] <code, ...>
Can also use: e
Run Python code and get the results.
This command supports multiple lines of code, including formatted code blocks. Code can be re-evaluated by editing the original message within 10 seconds and clicking the reaction that subsequently appears.
The starting working directory /home, is a writeable temporary file system. Files created, excluding names with leading underscores, will be uploaded in the response.
If multiple codeblocks are in a message, all of them will be joined and evaluated, ignoring the text outside them.
By default, your code is run on Python 3.11. A python_version arg of 3.10 can also be specified.
We've done our best to make this sandboxed, but do let us know if you manage to find an issue with it!
import random
def parse_dice_effect(dice_effect):
dice_effect = dice_effect.strip().upper()
if dice_effect[0] == 'D':
advantage = False
dice_parts = dice_effect[1:].split('D')
elif dice_effect[0] == 'A':
advantage = True
dice_parts = dice_effect[1:].split('D')
else:
advantage = None
dice_parts = dice_effect.split('D')
if len(dice_parts) != 2:
raise ValueError("Invalid dice format. Expected '1d6' format.")
die = dice_parts[0].strip()
sided = dice_parts[1].strip()
if not die.isdigit() or not sided.isdigit():
raise ValueError("Invalid dice format. Expected numeric values for die and sides.")
return die, sided, advantage
def apply_advantage(rolls, advantage):
if advantage is True:
return max(rolls)
elif advantage is False:
return min(rolls)
else:
return sum(rolls)
def roll(die=None, sided=None, dice_effect=None, display_result=True):
if not die and not sided and not dice_effect:
raise ValueError("No input provided. Please specify die and sided values or dice_effect.")
if dice_effect:
die, sided, advantage = parse_dice_effect(dice_effect)
else:
advantage = None
if not die or not sided:
raise ValueError("Missing die or sided value.")
rolls = []
for _ in range(int(die)):
rolls.append(random.randint(1, int(sided)))
result = apply_advantage(rolls, advantage)
if display_result:
print(result)
return result
@ornate cobalt they're checked with and
not with or
idk why
@ornate cobalt
what?
Yuu
@ornate cobalt what about without .iter()?
does it happen if you iter an array that's assigned to a variable?
@ornate cobalt sounds like you're re-evaluating the array for some reason
@atomic hinge what specific kind of web version of VS Code?
there's many
I can't read
Although I don't miss how absurd some of the attribute requirements were for some classes
I think it was either paladin or bard that were just crazy high
Also THAC0 was like eh
Not as tough as people made it out to be
I completed the daily tasks that I missed
I need to complete 7 more on time so I can "fix the timeline"
todays daily I already completed
correction: 5 more
no, easy
and, effectively, 4 because 1 day will be refunded
"6 days of extreme activity"
(1 commit each day)
but it shows as peak activity
in 2021, I almost exclusively used a private code hosting server
there it had 200~600 commits
but it got lost to time
current one
Gitea
peak all-time, as far as I know
my Rust commits mostly are only a couple of lines
or, like
2000
changing the fundamental abstraction that everything is based on
back when I was doing this in Python, I once rewrote 300~600 methods from sync to async
it had to be one commit because I had a policy against checking in broken code
time to load the commit page
scrollbar (bottom left green thing)
okay, that's less than I though it was
I've finally learned that this commit message is a trap
like, I don't know whether or not I just openly lied in that commit name
because sometimes it looks like this
now looking through those 82
the code base actually has informal conventions on what such cryptic commit names mean
`patch' is almost always referring to network bugs
reason being: fixes are quite obscure and there's basically no valid to explain it
does it pass tests?
sacrifices short-circuiting for readability
-1 means two different things in two different places, right?
class caracter:
__init__(self)
self.info.name = {}
self.info.age = {}
self.info.gender = {}
!e
class Character:
def __init__(self, name, age, gender):
self.name = name
self.age = age
self.gender = gender
class Player(Character):
def __init__(self, name, age, gender, money):
super().__init__(name, age, gender)
self.money = money
player = Player("Bob", 21, "Male", 12)
print(player.name, player.age, player.gender, player.money)
@ornate cobalt :white_check_mark: Your 3.11 eval job has completed with return code 0.
Bob 21 Male 12
@crystal aurora
recursive in Rust
I'm still not sure how I prefer to check for balanced-ness, so I just pick a random method each time
||```rust
fn node_height(node: &TreeNode) -> Result<usize, ()> {
let (hl, hr) = (tree_height(&node.left)?, tree_height(&node.right)?);
let (hmin, hmax) = (min(hl, hr), max(hl, hr));
if hmax - hmin > 1 {
Err(())
} else {
Ok(hmax + 1)
}
}
fn tree_height(tree: &Option<Rc<RefCell<TreeNode>>>) -> Result<usize, ()> {
match tree {
None => Ok(0),
Some(node) => node_height(&node.borrow()),
}
}
impl Solution {
pub fn is_balanced(root: Option<Rc<RefCell<TreeNode>>>) -> bool {
tree_height(&root).is_ok()
}
}
visits each node always
get height for left
check
get height for right
check
your solution can be re-arranged to get this result
I wonder what the optimal asymptotic for this one is
* asymptotics, plural
there are tradeoffs
@pale pivot precedence seems to make clone and to_owned clone the Rc instead of the underlying object
!paste
If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
those words dont make sense to me
sorry, still groggy brain
reading it 3 times clicked
rc.clone() resolves to Rc::clone(rc) instead of String::clone(rc.deref())
so, it's
Rust being strict
Deref being confusing
$ /home/codespace/.python/current/bin/python3 /workspaces/project-peacock-rpg/0.00.05/utilities/roll.py
10
4
Traceback (most recent call last):
File "/workspaces/project-peacock-rpg/0.00.05/utilities/roll.py", line 63, in <module>
roll(dice_effect='A1d6', proficiency_bonus=3)
File "/workspaces/project-peacock-rpg/0.00.05/utilities/roll.py", line 45, in roll
for _ in range(int(die)):
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'list'
if it's a number, it's a number
pass it as a number
not as a string, not as None
dice_effect logic should be a separate function
which does parsing
def roll(die: int, sided: int, advantage: str | None = None, display_result=True, proficiency_bonus=0):
rolls = []
for _ in range(die):
rolls.append(random.randint(1, sided))
result = apply_advantage(rolls, advantage)
result_with_proficiency = apply_proficiency(result, proficiency_bonus)
if display_result:
print(result_with_proficiency)
return result_with_proficiency
- I type hinted what I changed
- defaults don't need to be type hinted
if they're what they should be of type
that's how Pylance interprets them most of the time, at least
but, like, Pylance might interpret it as display_result: Literal[True] = True
def parse_with_advantage(dice_effect: str, advantage: str) -> tuple[str, str]:
parts = dice_effect.split(advantage)
if len(parts) == 1:
die, sided = parts[0].strip().split('d')
else:
die, sided = parts[0].strip().split('d'), parts[1].strip()
return die_sided
def parse_dice_effect(dice_effect: str) -> tuple[int, int, str | None]:
dice_effect = dice_effect.strip()
if 'A' in dice_effect:
advantage = 'A'
die, sided = parse_with_advantage(dice_effect, advantage)
elif 'D' in dice_effect:
advantage = 'D'
die, sided = parse_with_advantage(dice_effect, advantage)
else:
advantage = None
die, sided = dice_effect.strip().split('d')
return int(die), int(sided), advantage
!e
class thing:
def __init__(self):
self.s = 'thing()'
def __neg__(self):
self.s = '-' + self.s
return self
def __str__(self):
return self.s
print(--------thing())
@delicate wren :white_check_mark: Your 3.11 eval job has completed with return code 0.
--------thing()
if dice_effect:
dice_effect = dice_effect.strip() # Remove leading/trailing whitespace
if 'A' in dice_effect:
parts = dice_effect.split('A')
if len(parts) == 1:
die, sided = parts[1].strip().split('d')
else:
die, sided = parts[1].strip().split('d'), parts[1].strip()
advantage = 'A'
elif 'D' in dice_effect:
parts = dice_effect.split('D')
if len(parts) == 1:
die, sided = parts[1].strip().split('d')
else:
die, sided = parts[1].strip().split('d'), parts[1].strip()
advantage = 'D'
else:
die, sided = dice_effect.strip().split('d') # Strip whitespace from dice_effect
advantage = None
else:
advantage = advantage
if die is None or sided is None:
raise ValueError("Missing die or sided value.")
how to fix rustfmt
I very much prefer against having -1 as height
but that's preference rather than something more objective
@ornate cobalt time to invent sleep-deprivation-oriented object model?
s doom
def split_dice_effect(dice_effect):
dice_effect = dice_effect.strip() # Remove leading/trailing whitespace
if 'A' in dice_effect:
parts = dice_effect.split('A')
if len(parts) == 1:
die, sided = parts[1].strip().split('d')
else:
die, sided = parts[1].strip().split('d')[0], parts[1].strip()
advantage = 'A'
elif 'D' in dice_effect:
parts = dice_effect.split('D')
if len(parts) == 1:
die, sided = parts[1].strip().split('d')
else:
die, sided = parts[1].strip().split('d')[0], parts[1].strip()
advantage = 'D'
else:
die, sided = dice_effect.strip().split('d') # Strip whitespace from dice_effect
advantage = None
return die, sided, advantage
remove comments
if 'A' in dice_effect:
parts = dice_effect.split('A')
if len(parts) == 1:
die, sided = parts[1].strip().split('d')
else:
die, sided = parts[1].strip().split('d')[0], parts[1].strip()
needs to be
if 'A' in dice_effect:
parts = dice_effect.split('A')
die, sided = parts[1].strip().split('d')
A1d2
!d re
Source code: Lib/re/
This module provides regular expression matching operations similar to those found in Perl.
Both patterns and strings to be searched can be Unicode strings (str) as well as 8-bit strings (bytes). However, Unicode strings and 8-bit strings cannot be mixed: that is, you cannot match a Unicode string with a byte pattern or vice-versa; similarly, when asking for a substitution, the replacement string must be of the same type as both the pattern and the search string.
pub struct Height {
absolute: usize,
}
impl Height {
pub fn from_conventional(conventional: isize) -> Self {
Self::from_absolute((conventional + 1).try_into().unwrap())
}
pub fn from_absolute(absolute: usize) -> Self {
Self { absolute }
}
pub fn conventional(&self) -> isize {
(self.absolute() - 1).try_into().unwrap()
}
pub fn absolute(&self) -> usize {
self.absolute
}
pub fn increment(&self) -> Self {
Self {
absolute: self.absolute.checked_add(1).unwrap(),
}
}
}
// PartialEq, Eq, PartialOrd, Ord
should probably also implement increment
it's not traits
(mostly)
and difference
though
can probably just use .absolute()
die, sided = parts[1].strip().split('d')[0], parts[1].strip()
why brake😭
in what way does it fail?
side becam list not int