#python-discussion
1 messages Ā· Page 61 of 1
but if you made it in an app, and your coding skills is that good then yeah
since i kinda have an image of how i want my app to look like, but i dont want to code that for days then it ends up looking like garbage
Are you talking about the layout or the actual visual design?
I don't remmeber the guy that sent me the python turtle docs, but it helped so much thank you.
there was a guy in here earlier building a game w/ a turtle module as the intro to the ui, i wonder how often the turtle module comes up
they teach it in schools and uni
not often really
"for me"
both
people tend to gravitate toward tkinter/pyside or pygame
So did you found out solution ?
I think you should write in bit detail
well no one replied in the 3 servers i sent this msg to, except 1
just told me "make the UI normally" then if you feel like improving "improve"
What was the problem?
no problem except that my UI looks shit, my program is almost complete i just got to make Boiler plate UI and let an API do all the work for me
There is something called Tkinters
but i cannot reach the 2nd step unless if the 1st step is good, and if there was no way i can properly design my UI then i might lose the possibility for bonus points
draw it out on paper
am using kivy, i know about this so the code it gives wont run
i just want somewhere i can design my UI with graphical stuff, sure i can block stuff out but that's not what i want
i still dont understand what you want
Use chatgpt,
I do havego version. If you want to get answers, give me your prompt detail. Chatgpt can design UI
doesnt the ui program change based on if you are developing for ios/android/windows?
Why don't you ask in Figma server or UI community?
look, what i need is an app/website that allows me to design my apps so that:
- i can block out ui [as in see where each block of text/image go]
- make the most perfect UI reperesentation so that when i code i know exactly what to research and google to make that effect work
- doing that on paper wont let me hit step 1 and 2
not gonna let chatGPT outsource artistic creativity, i can for sure design something better than ChatGPT. i had extensive experience doing Game-Dev UI except i actually was able to design all the UI by hand not by scripts. and since am designing everything in scripts my hands are tied to what potential i could bring
sounds like figma then
!rules chatgpt
My bad
!rules 6
kind of a rule 6?
ok let me delete it
anyway, since you're asking what we're tired of...
i struggle to think of a piece of code that i rewrote
!rules
The rules and guidelines that apply to this community can be found on our rules page. We expect all members of the community to have read and understood these.
So, how to advertise something?
It's good to forget
like any platform or somewhere else?
reddit maybe
somewhere else
depends
tkinter I believe tries to keep the "native" feel, so it looks different depending on the os, however stuff you did specify like the layouts should be relatively the same
as in, you don't rewrite code?
What channel if you know any?
DRY
sorry , i dont
dunno what that means but I think I'm missing some context
Cool thanks
people keep saying that LLMs are good for boilerplate code
i just havent found a case where i couldn't abstract it out into its own function
im sure it's useful for some people

Sometimes it's not a matter of whether you can break out an abstraction, it's a matter of whether you should.
Abstractions tend to increase code complexity.
And that can make it harder to maintain and extend.
I think it is useful for just to create a layout for the type of code you want but in the end you have to make some changes on your own. How correct am I?
Fairly correct.
Bootstrapping a draft to work from is one of the major things I use LLMs for.
my english is not really good enough to understand what bootstrapping means in the context of a draft
It might not be the most accurate use of the term, but I mean to automatically create a starting point.
i just use uv init && uv venv
I mean the code itself.
I find that it's often mentally easier to change something that exists than to create something from a blank slate.
personally it's the opposite for me
Not worried about your grey matter though?
Not to question your intellectual capacity but I find that LLMs sort of trigger auto-pilot
you can just turn off llm auto complete no? if you're worried about that
Can you please See this, about selecting course
@visual juniper
Microsoft python developer professional certificate:
https://coursera.org/professional-certificates/microsoft-python-developer
University of Michigan, Python for everybody
https://coursera.org/specializations/python
Python3
Hi
Hey
ofc, I don't use it in a professional capacity so it doesn't ever make sense for me to use it. In that setting, I wonder if the there would be long term consequences though.
Hay is for horses and me
Can anyone suggest me which course to do?
!res In general, we recommend CS50
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
I can imagine that it could be a problem in theory. But I don't experience it as a problem in practice. I always use it to produce code I could have written myself, just faster. I never commit anything I don't understand. Maybe it requires a lot of discipline for some people. But it seems to not be a problem for me.
But i have Coursera and linkedin learning subscriptions
i think it's also the fact that i enjoy writing code
for me since (un?)fortunately the models I use aren't really top tier so I don't trust them that much, (and also to cheap out and save tokens), I have autocomplete off
I trigger one manually when I think they can work, or usually I use them to make a usable skeleton and edit it
If the LLM introduces a concept I'm unfamiliar with, I read about it from a 3rd party source before I use it, sort of as if I had found it through googling, which I frequently did in pre-LLM eras.
out of the 3 , the microsoft one looks good , not only do you get a familiarity for python , they also show you some usage in different fields which is pretty nice imo
the other two just feel like just another python course
Okay
yes you spammed very very bad stuff
damn sorry bro š
Change your password
already did
one was in new york one was in German
how tf
Also use 2fa if you can
just did
2FA should be mandatory in 2025
i didn't noticed that 2fa is disabled š
Agree
Idk why everyone whose account has been compromised always has 2FA turned off
For hecking, a token is needed which 2FA cannot protect so how does it work?
Uh... What token is needed for hacking?
I mean to get control of someone's account, a token is what is needed, right?
Password?
And even if 2FA is enabled, having the token cannot save it
You mean like discord and stealing a token? That's different approach to attack than actually cracking a password or checking reused passwords from leaks from other sites
2FA means , you have to authenticate yourself an additional time , usually with a different thing apart from your regular password
In that case, how do they umm forge the "click the link in email to get access" thing
Token stealing on discord is akin to stealing cookies for a website. The attacker already has to be on your machine and the site/app has to have little protections (e.g. some invalidate a session if useragent is different or you use different ip)
Like when I don't have 2FA enabled, I get an email something like "New Location detected"
i think you are mixing up tons of different things
Forge what? Attackers use that email to just take your login + password, no tokens
2FA means , even after you enter your password for login , it wont log you in untill you authenticate yourself in some other way
this "other method" can be anything , an app or an SMS or whatever
š Yeahā¦
It's either email + password + 2fa or email + password + click the verify ip ("new location detected") link in email, right?
Or getting a malicious program running on your computer.
Or tricking you too scanning a malicious qr code using the discord app
I donāt use 2FA
ok
The qr thing is new, I'll ask about that later
But in the former case having 2FA should not matter, no?
Thanks for letting me join the conversation, I guess?
its a public channel anyone can join or leave š¤·
isnt steam using qr?
I was saying I feel treated like Iām an annoyance
if you feel like you have been mistreated by someone , i think you can DM modmail about it
So, I have to admit that there are some things some companies refuse to protect. Discord and user token reuse is an attack vector Discord refuses to do anything about (trust me, Iāve tried to get them to care).
Logging in to Discord: That said in order to login to Discord (as any random user), username + password with optional 2FA is one way. They also have the QR code thing (donāt scan random QR codes and approve sign ins that way).
Creating malicious emails: If you see an @discord.com email in the from, youāre probably fine. Go ahead and click that link. However, if you see something unfamiliar there, maybe donāt click that link. Instead, send that over to junk/spam. Emails are basically glorified MS Word documents. They can have links, they can have images, they can even contain JavaScript. Email, by far, is one of the worst things to exist when it comes to securityā¦and yet we use it every day like itās normal. 
print(__file__)
``` this prints out `c:\Users\User\Desktop\python\real programs\test.py`, how do i make it print out `c:\Users\User\Desktop\python\real programs` no matter where the file is located?
Uh, no. You're mixing a lot of stuff.
Email is a kind of second factor. It may show up additional info like ip and location, but the code sent is still a kind of second factor.
You said "forge" email with that link before - this is not forging the "click here to login/click to verify ip", it's always forging emails like "someone tried to login to your account, we blocked it, now log in via this link so you can see more info" - and that link is normal fake login page, where they steal your username+pass (phishing).
That forged email is not connected to 2fa AT ALL.
And that's the case of attackers stealing password (not "token") where 2fa actually saves your arse - because unless the attackers are already checking your password at this same moment, they can't ask you for 2fa code.
And some second factors only work for given website (physical keys like yubikey, for some protocols used in second factor) or show that additional info like ip/location so it also saves your arse.
That's why 2fa is good. Going around 2fa or somehow getting the user to give the attacker that second factor is usually hard
you can get the directory of a file using os.path.dirname
import os
file_root = os.path.dirname(__file__)
oh okay that's good, tysm
i was switching database from local db.sqllite3 to postgreesql how do i import those data in postgree sql?
You can use pathlib.Path to turn such string into an object you can easily manipulate.
So import pathlib and then SCRIPT_DIR = pathlib.Path(__file__).resolve().parent - I use resolve to make sure it's absolute path, then take parent to get the directory
Then files in the same directory will be SCRIPT_DIR / "filename.jpg" etc. Path objects work anywhere where you'd normally pass a string path, so you don't need to modify anything else
what are your thoughts about this:
def find_numbers(text):
return list(map(float, re.findall(r"[-+]?(?:\d*\.*\d+)", text)))
How long-lived are Discord session tokens?
!e I wonder if you can..
!e ```py
from pathlib import Path
print(Path(file) / "test.txt")
:white_check_mark: Your 3.14 eval job has completed with return code 0.
/home/main.py/test.txt
User session tokens: supposed to be reset about once every 24h
User session refresh tokens: idk, last time I checked, you can refresh even after these no longer work usually
A long time. I want to say permanent, because there's a regular refresh you can do with them
TLDR
if the discord client itself doesn't log you out, the token lasted that long
because there's no difference between what the client can do and what someone who has hacked your client can do
But if a token is stolen, is the refresh token typically stolen as well?
and I don't recall being logged out of my discord because of expiration forever
It comes when you make a refresh query to the API, so sometimes?
Your old refresh tokens get invalidated once someone clicks that ālog out of all sessionsā button
^?
It's still a bunch of admin work
Literally doesnāt work if Discord doesnāt properly secure their endpoint. Itās one more thing in the mix that introduces more security vectors
Are you talking about automating the password change?
I would guess Discord uses captcha to prevent setting passwords automatically
I'm pretty sure the standard discord token for users doesn't need refreshing
But I know they changed it in the last few years, splitting out MFA and stuff. MFA tokens are structured differently now
regardless, it doesn't really matter, because discord doesn't do anything fancy like store your refresh token in the TPM. It's just in the JS like everything else.
If they have it, they're you. The only way out is a password reset. Which is deliberately not automateable via cloudflare
Practically speaking this is a pointless security boundary. Nobody is intercepting discord requests between you and their server, and if they are, then you're already fucked because they can MITM TLS and serve you whatever javascript they want anyway.
Which boundary?
Protecting tokens
"What kind of encryption protects me if someone has a knife to my throat" it's pointless
Treat this like itās 2003. Nobody uses SSL certificates for their banking website. Cāmon everybody just uses the ATM. You log in to a site on your laptop using public WiFi (rare but it existed). You think nothing of it, and log out then head to work. You canāt stop thinking that someone was looking over your shoulder while you type that password in and decide to log in once you get to work to be certain. Now, you couldāve sworn the savings account showed $49,000 but for some reason that looks like $47,000. So, youāre a bit confused and call the bank to confirm. They say itās at $47,000 so you ask them to freeze your account until you can change your password and visit them in-person to have a new card issued.
What do you do in this instance? You know that;
- Your bank put your account on freeze for the day to retain you as a customer
- Either your credentials online were stolen, or the credit card was stolen
- as the only thing you can recall doing that day was logging in to your bank on public WiFi, was it that WiFi networkās fault? Was it the banks fault? Who wouldāve known that this could have been an issue?
Iām asking you to go along with it. Itās designed to act as a way for me to be able to explain something in terms of security, this isnāt what weāre discussing either but a literary device to bridge a communication gap.
Then I think rule 5 applies
It is considered against Discord TOS. It would be breaking rule 5.
if i understand tokens correctly, once they expire you use it to refresh the token and get another one, but there is a time limit before which you have to refresh the token otherwise you will have to login
The TLDR of security boundaries is you must have, at some point, a token that represents the user and can do anything the user can do. Any restrictions applied to said token also apply to that user. This is why there's things like session resets and security logging, because you can apply those to users and they won't be upset.
A refresh token enforces persistence. You can have a token with the restriction "must regularly check in" by changing the user representation token to a refresh token, and only allowing the temporary token for some time. Akin to badging in at an office. But the same principle applies: once someone has the refresh token, they have full access. And the user must regularly expose and refresh said token
The reason we have auth tokens at all is because passwords get shared
auth tokens do not
people would share auth tokens if they could
this allows you to reset an auth token or use an auth token that isn't by chance shared with other services or reused beyond what you want. It also allows you to force a user to "log in" to authenticate with their "I am me" proof (password).
Well, Discordās implementation creates a refresh token and bearer token on each sign in. Refresh tokens are a cookie that you can use to get new bearer tokens in their case..
People do anyway. We have a friggin filter for it, thankfully not triggered as much these days, but back when dpy vaguely supported userbotting every single day we had someone posting their user token asking for help with their userbot
Iāll move to DMs, I have a fun one for ya
And of course if you were userbotting you could just use regex to tokenscrape and hijack all of those accounts in realtime
i've now done it like this:
def find_numbers(text, accept_int=True, accept_float=True):
# global text_numbers # not changing its value
current_result = []
if accept_int is True:
if accept_float is True:
current_result.extend(
(
float(number)
if '.' in number
else int(number)
)
for number in re.findall(r"[+-]?\d+(?:\.\d+)?", text)
)
else:
current_result.extend(map(int, filter(text_numbers.__contains__, text)))
elif accept_float is True:
current_result.extend(map(float, re.findall(r"[+-]?\d+\.\d+", text)))
return current_result
We didn't need to because we had a real bot do it
the amount of ceo's/executives that request to remove themselves from mfa or request bypass because they are too important is astronomically hilarious (and also a reason during security breaches that insurance companies who provide cyberinsurance will ask for the 2fa/mfa logs to prove they were secured at time of breach, otherwise no payout)
Something that comes to mind is findall() doesn't do overlapping matches
i dont want overlapping matches
like 5.2 to give both 5 and 2 as ints also?
Looks fine, assuming you just want 5.2 and +5 and -5 and 5 cases
if an error is "raised", can the program still run? i'm for the program to try to detect a darkmode button in an app, and if it fails, locate a lightmode button
but rn when it fails to locate the darkmode one, it just kinda gives up? im not sure as i still dont fully understand the "raising" thing
Other random thoughts are handling of 5e10 or 5,000 or 5_000
or the weird standard some contries use of 5.000,00 for 5000
actually i should strip the plus at the beginning when parsing
But otherwise it looks good
if an error is raised from a function, the function will stop performing, but it won't stop the entire program
Can you show your code?
u mean 5,000?
Anyone got any ideas on a dc bot i can make
some people use periods as the thousands separator
and I swear some location doesn't do sets of threes either
wait so i dont need an if statement that does something when the thing fails, i can just continue?
localization? hell
š
Itās all one big property list on iOS 
Get weather info from some API and display that for specific city that the user requests @fresh sentinel
Sorry wrong reply, mobile is a bit wonky
!e print(int("²"))
it entirely depends on what you're trying to do. You shouldn't really ever rely on your program failing to handle some logic (other than some situations where try/except is handy)
uhhhhhhhhh i deleted it cuz i made a reeeaaall mumbo jumbo that didnt work in like 50 ways so i wanted to rewrite it
Can't really help if we can't see what you tried
\d+ matches it?
NordHomeButtUnclicked = pyautogui.locateOnScreen(f"{file_root}\\PyAutoGuiLOCATEIMAGES\\NORDVPN darkmode home unclicked.png")
``` soo what do i do if it fails?
ill rewrite it and if it still doesnt work ill come back in a moment
Alr bett
!E ```py
print(int("ą„¬"))
:white_check_mark: Your 3.14 eval job has completed with return code 0.
6
!e ```py
import re
print(re.match("\d", "ą„¬"))
:white_check_mark: Your 3.14 eval job has completed with return code 0.
001 | /home/main.py:2: SyntaxWarning: "\d" is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\\d"? A raw string is also an option.
002 | print(re.match("\d", "ą„¬"))
003 | <re.Match object; span=(0, 1), match='ą„¬'>
ok in this case it does raise an exception if it isn't found, so this would be a good time to use try/except
if i ask how the try/except thing works is it a simple explanation or a whole lesson..?
you could wrap the whole thing in a function and have it return None on fail
it's basically an if/else that checks to see if a program would error in a situation
!e
try:
print(x)
print("Inside Try")
except NameError as e:
print(e)
print("After try/except")
:white_check_mark: Your 3.14 eval job has completed with return code 0.
001 | name 'x' is not defined
002 | After try/except
you can see here the program continues after the try/except block
i dont fully understand it so i'll look into it, tysm!
I'm trying to print x which doesn't exist, so the program would error
instead of erroring though, it goes into the except block (which is just printing out what the error message would have been)
so the except is preventing the program from crashing?
yes
try is where you put the code that could potentially error
except is what to do if the code inside try errors
but you could see I specifically had except NameError because I only want to handle NameErrors. If any other time of error were to occur, I would still want to know
and if it succedees, it just does it?
yes
import pyautogui
try:
pyautogui.locateOnScreen(...)
except pyautogui.ImageNotFoundException as e:
...
so for you, you would set it up like this
obviously fill in the ... with the actual details
so basically look for all the , and remove them later? basically they dont effect anything?
wait... 5.000,00 means 5000? the hell
Catching a single exception in the same function is pretty simple, but there is more to it than that. To fully explain it is more like a whole lesson.
But you can use the former without understanding the latter.
i'll use this one so far, i'll be improving the program later
Japanese & Chinese currencies both use a comma+dot for the thousands/decimal. I think there's more, to google i go
lets just pretend that doesn't exist
btw what's e? im guessing it stands for error and if it does, can i use it multiple times or do i need to make a new variable every time?
it's a variable so you can use whatever name you want, but e is commonly used here. It lets you access information about the error that would have occurred
that makes sense, but if no error occurs i can use it again right?
yeah
wait nevermind i just realized its not a good idea
it will just overwrite the previous one which is fine
oh
it's no different from reusing loop variable names
okay thats good then
it doesn't matter if the code has already moved on
You can always reuse any name in Python.
don't overwrite names that you still need to access
for i in range(5):
print(i)
for i in range(5):
print(i * 2)
is that a bad habit to avoid? or is it just sometimes needed?
it's perfectly fine to reuse i here because I've already moved on from the first loop. Unless I really need a reason to access the last iteration of the first loop
nah it's super common, and usually you're dealing with different scopes anyways so it doesn't matter
It's a balancing act between keeping sane names and accidentally using the wrong variable
for loops and other common stuff reuse clearly wins
but for "I have a name in the module and one in my function" it gets sketchier
It'd similarly be insane to use i1 to i100 because you were afraid to reuse a loop variable
just throw an underscore in front
well... what about this:
def find_numbers(text, accept_int=True, accept_float=True):
current_result = []
if accept_int or accept_float:
for number in re.findall(r"[+-]?\d[\d,]*(?:\.\d+)?", text):
current_number = number.replace(",", "")
if '.' in current_number:
if accept_float:
current_result.append(float(current_number))
else:
if accept_int:
current_result.append(int(current_number))
return current_result
tbh I just avoid having names in my module namespace
Opinions differ a bit about this. Some people will tell you never to reuse any names in the same scope, others think it's fine if it's clear from the context what each name is referring to at that point in the code.
maybe i should do not in and check accept_int first, not important though
The unfortunate gotcha:
how do you tell between (15,120) and (15120)
zzzzzzzzzzzzzzzzz
I generally avoid it for standard variable assignment, but it's a free for all when it comes to loop naming
ok, a parameter
selected = []
for item in editor:
if item.is_checked():
selected.append(item)
for item in selected:
item.do_something()
i dont know
I do something like this often (pseudocode-ish)
š”
You can't unfortunately
i can include some paramter that decides the approach
Yeah thereās rules about this
https://docs.astral.sh/ruff/rules/redefined-loop-name/
Yeah. Localization functiosn typically have thousands_seps="," and stuff like that
š¢
@sweet bobcat please don't use us for advertisement
Okay
Look, language is ass
Did you read or have you read? Are you lead or are you the lead?
Thatās okay
The only thing you canāt do is this
Everything else is fair game
https://docs.astral.sh/ruff/rules/loop-iterator-mutation/
makes me wanna go cry in the corner
Reed read the reed read as Leed led from the lead with a lead lead.
oh yeah, definitely not
š«
I'm pretty bad at always using f for opening files. I'm starting to use f_in for reading and f_out for writing
I did that on accident way too many times back when I was a young pupper
The trick is to just quietly whisper "it's out of scope" whenever it comes to localization
That all belongs in the template
I like if and of
But then.. wouldn't that
examines own brain
uhhhhhhh
i_f and o_f
:x: Your 3.14 eval job has completed with return code 1.
001 | File [35m"/home/main.py"[0m, line [35m1[0m
002 | with open("main.py") as [1;31mif[0m:
003 | [1;31m^^[0m
004 | [1;35mSyntaxError[0m: [35minvalid syntax[0m
Yeah I thought so so why do I remember that
doing the regex for every third being , is bullshit
Oh Iāve stopped using open for the most part
I tend to have all the text I want ready by the time I get to the IO, so I just Path().write_text() in a single concise function call
a lot of it is json but I guess I could use json.dumps/loads more
That's what I would do
char for char in text if char in string.ascii_digits
Just discard everything that isnāt a digit
can you normalize the data by replacing it with . ? this way its in a format you prefer? (apologies if already answered)
Yall, i have a question, can somebody suggest some innovative and complex projects i can make for a competition? I have 2 month deadline(20th of february) i can try to do in C/C++/C#/Python or Html/css/js. Competition allows web or desktop application and there is no theme.
(sounded like you had financial data but if its just something else, total nvm)
!projects
The Kindling projects page contains a list of projects and ideas programmers can tackle to build their skills and knowledge.
def find_numbers(text, accept_int=True, accept_float=True):
current_result = []
if accept_int or accept_float:
for number in re.findall(r"[+-]?\d+(?:\.\d+)?", text):
if '.' not in number:
if accept_int:
current_result.append(int(number))
else:
if accept_float:
current_result.append(float(number))
return current_result
alright no comma handling anymore
no
Guys is it just me, or Error Handling makes about 60% of your code?
then looks good to me š
fuck .5
kinda
or 5.
5,
in a real world scenario you are assuming your user is stupid
š”
and in many scenarios they are stupid
or any more bullshit!
ok 5. and .5 are actually python valid makes me wanna do it, me mad now
Like, check if it's str, .strip().lower(), now check if it's valid, now handle all those possible scenarios...
PEBKAC exists for a reason in IT
not just in IT
Yeah!
lets try handling .5 and 5.
not sure if this is a python question, but i can't install opencv? pip install opencv-python gives out an error, i'd look at the log but it doesnt exist
Btw another Rustacean in the Python community? Cool!
imho that is expected in python
that's uhhh
not just a nother
can you add --verbose or -v to see if it gives the log path or additional details?
i think that:
r"[+-]?(?:\d+(?:\.\d*)?|\.\d+)"
Yhh
erases white board
0 days since Rust mentioned in pydis
"We almost made it to one"
are you installing globally?
Link requires a different Python (3.14.0 not in: '>=3.7,<3.11') is it really worth downgrading..?
uhhhh i dont know what that means
are you running install as a superuser or admin?
Guess that's just how it is then
nvm
Hey Can I ask u a question
should i run try it as admin?
that is strange: the pypi says 3.13 is supported
i've got 3.14
try 3.13
if you are in a position to run it as admin i would attempt so in case its writing or hitting files that require admin/super user
there are a bunch of libraries that havent been updated to support 3.14 yet
Nothing much
lol
it'd match empty strings, not good
how do i do that? will i need to reinstall any libraries or do whatever with vsc?
Just wanna know if you've developed any web app or anything
are you using a virtual environment?
why...?
is that for example vscode?
if so then yes
vs code is not directly related to your python venv
virtual environment lets you handle separate python installs/projects/modules without overlapping with others
you can open your code in another code editor and it will still work fine
If you've... then probably you've gone live and have a payment gateway integrated already. And with payment gateway, atm , I've got issues with that
nope, no experience with payment
wait so i didn't actually need to install a library before using it in vscode? š
Freelancer ?
yes, you always need to install a library before you can use it
you can install a library globally to your python, or to a specific venv
i think that's good
oh btw, if i have a library and everything works all well, and i compile it into an exe, the person running it doesnt also need the library right?
actually i dont like it, i'll just remove the option to find .5 and 5.
def find_numbers(text, accept_int=True, accept_float=True):
current_result = []
if accept_int or accept_float:
for number in re.findall(r"[+-]?\d+(?:\.\d+)?", text):
if '.' not in number:
if accept_int:
current_result.append(int(number))
else:
if accept_float:
current_result.append(float(number))
return current_result
thats it
Yes, but I've never really played around with turning python programs into exe
wouldn't it be a pretty commom thing?
people normally just the release it along with the source and instructions
in some cases package the interpreter along (iirc sublime does that)
Not necessarily. 99% of the code I write is executed through the console of animation software
So anyone with my code + the software can run it
makes sense
guys can someone gimme feedback https://pypi.org/project/brliant-calc/
where can i learn about linked list and operations
Halo
Wikipedia is always a good starting point
guys
can sm1 please chekc this and give me feedback https://pypi.org/project/brliant-calc/
it has the repo link too
uhh any feedback
well... the option to make aliases is great, but just use the bcalc as the default name, its short and easy to type
the included spec file for whomever whants to run pyinstaller locally is great. though i dont really see the need when you made such a good entrypoint
Nah, she's a snek in the crab community
okay well thats fine but bascially how useful is it and how good is it?
shell completion is essential if anyone would ever want to use this as a shell command
look how uv does it, its a good example on how to make multi shell support for auto completion
bcalc matrix mul "[[1,2],[3,4]]" --m2 "[[5,6],[7,8]]" i dont know what this syntax mean
It's not necessarily bad, but would you ever use your program over a regular calculator?
I mean, I maybe can see some rare applications for the matrices and vector stuff, where I wouldn't know of an easy website to perform those, but the rest .
But yeah, the actual code is very simple, except for the alias manager, and I personally don't really like it when some scripts are trying to execute commands with sudo
uhhh its for changealiases, since it requires elevated permissions
its safe ofc u can check
i use numr in my terminal, but this would be very nice as a one off quick calculation
i would, i hate the normal calcualtor
i often just use python -c
same
well once u get used to it, its like rlly speedy
does it support convolutions @wary terrace ?
well it multiplies two matrices, --m2 means matrix 2
no its simpel i gotta add that stuff
what is why am lookin for feedback
ā ļø
if platform.system() == "Windows":
result = subprocess.run(['sudo', 'cmd', '/c', 'del', str(alias_path)], capture_output=True)
else:
https://github.com/aaravmaloo/brliant_calc/blob/master/brliant_calc/alias_manager.py
oh i see.. is it required to add the keyword ? or would it also work by possition?
uhhh?
well ig u could try
but i always specify
i will š
is there smth wrong with this?
this project is raising some red flags for me, a lot of the implementation seems very simplistic with just some wrapper stuff for sympy and whatnot, but a lot of code devoted to creating binaries in .local/bin and various sudo permission stuff
its safe
just at a quick glance
u can try it on a vm or smth
yeah, exactly my point. It seems safe at a first glance, but yeah, it's a weird focus for a calculator
aliases does not work in my shell
def setup_logger(
name: str = None,
log_file: str = None,
level: int = logging.INFO,
to_stdout: bool = True,
) -> logging.Logger:
color_map = {
"black": "\033[30m",
"red": "\033[31m",
"green": "\033[32m",
"yellow": "\033[33m",
"blue": "\033[34m",
"magenta": "\033[35m",
"cyan": "\033[36m",
"white": "\033[37m",
"reset": "\033[0m",
}
class ColorFormatter(logging.Formatter):
def format(self, record):
color = getattr(record, "color", None)
msg = super().format(record)
if color and color in color_map:
return f"{color_map[color]}{msg}{color_map['reset']}"
return msg
if name is None:
name = os.path.splitext(os.path.basename(__file__))[0]
# Create folder for log file
os.makedirs(os.path.dirname(log_file), exist_ok=True)
log_path = os.path.join(log_file)
# Base logger
logger = logging.getLogger(name)
logger.setLevel(level)
logger.propagate = False
logger.handlers.clear()
# Standard non-colored formatter for file logs
file_formatter = logging.Formatter(
'{asctime} [{levelname}] [{className}] {message}',
style='{'
)
# Colored formatter for terminal
color_formatter = ColorFormatter(
'{asctime} [{levelname}] [{className}] {message}',
style='{'
)
# File handler (no color)
file_handler = logging.FileHandler(log_path, encoding="utf-8")
file_handler.setFormatter(file_formatter)
logger.addHandler(file_handler)
# Console handler (with color)
if to_stdout:
stream_handler = logging.StreamHandler(sys.stdout)
stream_handler.setFormatter(color_formatter)
logger.addHandler(stream_handler)
return logging.LoggerAdapter(logger, {"className": name})```
well i think the linux version i havent tested it yet.
multiple shell support and tab complete for commands will make it useable
if __name__ == '__main__':
logger = setup_logger(log_file="logs/app.log")
logger.info("This is a normal info log")
logger.info("This should be green!", extra={"color": "green"})
logger.warning("This should be yellow!", extra={"color": "yellow"})
logger.error("This should be red!", extra={"color": "red"})```
Also this line in plotting.py: https://github.com/aaravmaloo/brliant_calc/blob/master/brliant_calc/plotting.py#L21
brliant_calc/plotting.py line 21
y = eval(func_str, {"__builtins__": None}, context)```
hey guys
powershell bash zsh fish and maybe some of the other nushell or whats it called
but the four first is a miniumum imho
r u talkin to me
whats wrong in this?
allows for arbitrary code execution
no, but did you have a question?
||xonsh is not supported by anything and that makes me sad||
^ @inland karma
not even uv?
ummm.... well am new to this stuff but its completely safe. trust me. you can check the entire library and everything.
eval is not safe
you're running your own input. its as unsafe as a python repl
if that calculator was an online service, sure, that would be bad. but it isn't
<SHELL> The shell to generate the completion script for [possible values: bash, elvish, fish, nushell, powershell, zsh]
use a real terminal, dont test inside pycharm
you're running your own input.
Well. For now.
Imagine this was something on a server that clients would interact with
"imagine"
okay everyone
Its the same in command prompt
rlly thx for ur feed back
you have gotten a lot of input! š
Are you really defending eval?
no cmd is a shell
idk this project really giving me red flag vibes lol
yes, why are you attacking it? there is no actual problem here, you're attacking an imaginary scenario that is not happening in practice
you could atleast explain when is it bad instead of not allowing to use it anywhere
on windows you have the old ancient cmd, windows powershell and powershell
you should be useing powershell imho
my idea is basically like vim but with calculator, get used to it... and then it becomes rlly fast to calcualte using that
but the terminal is the app that runs the shell @neat pawn use Windows Terminal
and open the new Powershell and test using it
have you tested the one i use ? numr ?
There is almost always a better way to do it Very dangerous and insecure Makes debugging difficult Slow
cant seem to find it
i am fed up of mugging up
i dont run windows anymore, but try to install it with scoop scoop install numr
but if not, install it from source cargo install --path crates/numr-tui
cargo????
okay
the "better way" involves implementing a programming language
the dangerous point does not make sense in this case as i already explained
the debugging is just fine, same as debugging a python expression
and doing that in python will be slower than just using python
rust mention !1!!1!1!1!1!1!1111!!
No result found for 'numr' from Official buckets. Try modifying the filters for possible manifests
still the same,
I mean... he is implementing a calculator. I would've expected him to... well.. write the calculator stuff
yes, if you want to install rust source code i think cargo is the way to go
I wanted it pycharm, pycharm does have emulate terminal option
now you know.. tell me more about what you are trying
it's a joke #python-discussion message
yeah, but you cant trust it, its not a real terminal emulator, it cheats alot
except when beginners say "i am developing a calculator" they really do not mean that, just a bunch of random math operations. for some reason they also progress in the amount of operations rather than making a language with proper expression parsing
oh i see... i dont get jokes like that! š
I have pasted the code above, I just want colorful logs
well what shall i do then?
which operations shall i implement? and what shall i use except of eval?
pydis is never beating the rust-dis clone allegation
oh no
i would argue we all use a bunch of tools, and picking the right one is a key part of this job š
i just said clone unironically
okay, so you kind of do agree with me, but just aren't for the technicality that "they didn't mean to actually write a calculator, despite saying so"
its not self evident when eval is a good tool and when it is a bad tool
well tell me what operations shall i implement and what shall i use instead of eval?
parse your user input and map it to a dictionary with operators
well tell me what operations shall i implement
That's already the wrong approach. You don't want to look at "what else can I do", but you really should look at: "How can I do stuff"
do you want me to write a short example using a few operators?
uhh can u tell me the operations i shall implement?
no man i dont want to i want tl just do it my self š
Are you trolling me rn?
when you use python, you just write x + (y * z), right? that is much easier than
$ bcalc mul y z
(get a response, say, R)
$ bcalc add x R
no?
all the basics one and all the numpy and scipy ones
you can do that because it supports the natural way of doing math expressions: operators, and nesting them
to do that, you need to parse the expression
by using eval you run the user input as a python expression, so, you get simple stuff working, but, whats the fun in that? you didnt learn how to parse expressions by doing that. you also cant add custom operators when you do that
I literally said in the message you reacted to:
"""
well tell me what operations shall i implement
That's already the wrong approach.
"""
and you respond with:
"""
can u tell me the operations i shall implement?
"""
It really doesn't appear as if you read my message
you can also search here in chat from messages from me, where i do from operator import
uhh id ont understand what do u mean by that?
sorry
!e
from operator import add, sub, mul, truediv
op = {
'+': add,
'-': sub,
'*': mul,
'/': truediv,
}
def calculator(a, b, operator):
return op[operator](a, b)
print(calculator(1, 2, '+'))
:white_check_mark: Your 3.14 eval job has completed with return code 0.
3
expanding the list of operations while the tool itself fundamentally has a bad user experience is not what you should focus on
^ And also a bad implementation
have you tried actually using it for any calculation?
yes many times
eval("sys.exit()")
where can I start learning DSA
and all those commands that do a single operation seemed fine? and not having variables?
wouldn't it be much better to have nested expressions and variables? like a python REPL, basically, but math specific
leetcode
well ill implement that too. thx
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
!res
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
looking at that person's project, I'm just kinda weirded out by the disparity between the simplicity of the code implementing an actual calculator, e.g.:
https://github.com/aaravmaloo/brliant_calc/blob/master/brliant_calc/vectors.py
..vs
https://github.com/aaravmaloo/brliant_calc/blob/master/brliant_calc/alias_manager.py
why all this convoluted functionality to go out of your way to write executable scripts (trying to run subprocesses with sudo and whatnot) for every platform etc. for something that is a very simple project otherwise
does that really not set off some red flags?
try:
# Create a temporary Python script to write the file
temp_script = Path.home() / f".brliant_calc_temp_{alias_name}.py"
script_content = f'''import sys
from pathlib import Path
alias_path = Path(r"{alias_path}")
wrapper_content = "@echo off\\nbrliant_calc %*\\n"
try:
with open(alias_path, 'w') as f:
f.write(wrapper_content)
print("Alias created successfully!")
except Exception as e:
print(f"Error: {{e}}")
sys.exit(1)
'''
with open(temp_script, 'w', encoding='utf-8') as f:
f.write(script_content)
# Run with sudo
result = subprocess.run(
['sudo', 'python', str(temp_script)],
capture_output=True,
text=True
)
thank you
its probally gpt-ed and gpt itself copied it from some open source scripts
does that really not set off some red flags?
Yes, yes it did
- 2nd part of #python-discussion message
- #python-discussion message
Wait, I was quoting you to yourself. Lmao
@wary terrace Do you know what complex numbers are?
alias_path = Path(r"{alias_path}")
does this work
yeah?
the {} are for the f-string that this is written in (script_content)
oh r is for rawstring
so intending to be malicious (by updating the strings in a future update or something) at worst or AI hot garbage at best, great contribution to pypi : (
i need the best course out there to learn AI (LLM, Agent AI, Langchain)
i already made a mentalhealth chatbot that i trained it with pdf files and i used langchain, i saw my friend make an agent and i found it intresting
im originaly a backend developer
i know AI is big thing
i wanna know what field suits me and a recommendation to a good course i can take
Do you have the math background to actually understand everything? If not you'll just be developing prompts (in English) without any real programming
im a computer science graduate
so i took lots of math courses
Bachelor or Master?
bachelor
okay, so you know most math basics, just might need to take 1 additional course or so specifically tailored for AI.
But that's good, you actually "have a chance", as opposed to many, MANY others inquiring about becoming an AI developer in this chat
making agentic stuff is just normal software development. it's not actually AI development.
why don't others have a chanc
It's developing with AI, not developing AI
you're basically making a flowchart for an existing LLM to follow. you don't need to know anything about model development to do this.
idk im a fresh graduate idk much or what field i should deepen
oh, I thought, especially when he was just saying "LLM" on its own (in the LLM, Agent AI, Langchain list), that he was interested in how LLMs work/building an LLM (from scratch)
most people who think they're interested in AI these days are actually interested in agents, so that's what I figured.
what field do u think suits me the most?
thats a hard question for us
ok what does an ai developer and a developer who use ai does
Do you really think this guy had a chance? #python-discussion message
yeah atleast he know what he wants to be ig
I want to be a trillionaire
my name is layan (:
well goodluck lol
you can't become that wealthy without exploiting people and getting obscenely lucky
im just asking to explore things i didnt ask u to teach me anything
so you did not had a ML course in your uni?
no
You can, if you adjust the currency š
oh we have those as electives
The Lebanese Pound (LBP) .
LBP/USD = 0.000011
i think if you like programming and problem solving. you could choose both
or what you like
and ofc i have a chance u dont decide that someone doesnt have a chance @dry yacht
My advice: Avoid words like "best" when looking for courses / learning... pick a topic in the field you don't know anything about, and learn / do a project in that.
huh? Was I rerferring or talking to you at that point?
CS50 for AI, for instance, is great at the fundamental ideas... but is just a taste of the field.
i was working on my python LLM project and accidentally deleted a whole folder with a lot of data in it. is there a recycle bin in linux enviroments
yeah, it's called "Trash"
Doing a MNIST digit recognition project is a good project too
yea did you shift delete?
how do i go to it
thanks
have you tried using the search option in the menu ?
or opening file explorere and seeing around for a bin symbol
always backup your data and code
imagine tomorrow you turn your laptop on and turns out your SSD got corrupted
GG
git to the rescue
that depends on how you deleted things and whether it's enabled
( i wanted to say more like data backup in general but sure)
there is no Trash in my bin
how did you delete it?
you probably did shift delete
what OS are you on ? can you show an image of it in OT ?
if you were holding shift while deleting , it may have gotten permenantly deleted
some command, or using the UI of some app (of so which app)?
UnitedStates = Nation(
name="United States",
economy = 4,
military = 4,
diplomacy = 2
)
def roll(country:Nation,stat:str) -> int:
stat = stat.upper()
if stat in ["ECONOMY","MILITARY","DIPLOMACY"]:
rolled = randint(1, 20) + country.stat
else:
print(f'{stat} is not a valid stat')
return 0
return rolled
print(roll(UnitedStates,"economy"))
Is there a way to make the equivalent of country.stat work
They said linux, so I'm assuming "rm"
how do i check my VM version
(they are in ot0 channel)
So if I say roll(Whateverville, "military") it will use Whateverville.military as the atribute to look at
uname -r
getattr(country, stat)
6.14.11-4-pve
Thank you!
do you want it to look for any attributes of "country" that are numbers?
Or do you want stat to become an alias for military? nvm š
got confused by the dot
?
it might make more sense for nation to store the attributes as a dictionary and then you just access the dict
getattr is on the weird metaprogramming side which you shouldn't need in normal code
Yeah that sounds like a good idea
what is that command that brings few nice resources for beginners please
Have you ever made state or sequence diagram?
!res
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
!res
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
tyvm!
Yoo
Do you plan on using this with other instances of Nation aswell?
sup
im actually losing my mind after day 1 of aoc
what did you struggle with?
part 2 is hell
we try not to say that around here
whats aoc
sorry
Please be polite
Advent of Code
Advent of Code, a yearly bunch of christmas-themed programming puzzles https://adventofcode.com/
what the hell am i reading dawg
i suppose this is meant for more polished programmers
Not really
its an entire article vro
New programmers can also do AoC. Helps exercise problem solving
It's actually on the lighter end of programming puzzle competitions
nope, the earlier days can be quite good for beginners
Dont worry about it. You'll get there
I mean, you solved one yesterday
its not that idk how t osolve it i odnt understand it at all
If you found it challenging already on day 1, but managed to solve it, you are growing. Keep it up š¦¾
no im still trying to do part 2 lol
What part don't you understand?
⨠progress āØ
no, you just weren't familiar with modulo
it's hard to qualify things like "beginner" anyways because people come in new to programming with all sorts of different backgrounds
You solved one part, that's very significant
especially if you are doing it in a different programming language
If you bet that I would do it in Rust, I would struggle too
suprisingly its harder to point out what hard
anything specific you're struggling with?
Is there not a AOC channel for this?
Several
#aoc-solution-hints kind of
#1444916008325349478 spoils whole solutions
i understood what its saying, if dial does this and that
just idk what its asking me to do with such info
huh... I don't see it
yeah but nobody responded and i just wanna get this done š«
by that you don't mean something like right?
"Military": lambda x: x.military,
"Economy": lambda x: x.economy, ...
It says in the puzzle "What's the actual password to open the door?", so it's asking you to enter the password.
no i dont
what framework is adventofcode.com made with?
I'm guessing best way to do it is just make a function in class?
Are you asking how the site creator made the website?
yas
Then why did you mention dictionary can't this be js done by a tuple?
right , how
i will jsut not worry about it
i cant code a calculator independently yet
It says in the puzzle how to compute the password
I don't think the website source is open
imho it doesnāt use a framework
probally some funny perl scripts on the backend and vanilla js
If you're curious about how Advent of Code works, it's running on some custom
Perl code. Other than a few integrations (auth, analytics, social media), I
built the whole thing myself, including the design, animations, prose, and all
of the puzzles.```
From a comment in the html source
I'm guessing u mean
self.stat = {
"Military": int,
...
}
if x in self.stat: randint(..) + self.stat[x]...
yes
imho the creator gave a presentation on how he made it which u can find on youtube
you probally mean iirc not imho, thats not an "opinion", thats just something you remember
it's my new ragebait tic
does the advent of code thing let me submit incorrect answers?
it will tell you that its incorrect
You do get a cooldown if you get it wrong too often
Bruteforcing the answer can't be the answer obviously
if the answer was a bool though.. just try twice at worst
Bruteforcing d1p2 worked fine for me š
š I guess it works sometimes
So gettattr(self, str) is bad?
self.military = int
self.economy = int
self ... = int
if x in ("military", "economy"..):
return randint(..) + gettattr(self, x)
print(..)
return 0
I think it depends if the Len(stat) is too big then you might wanna use a collection?
getattr is unusual to see in normal code, if you have control over the structure of the data its easy and not weird to just use a dict if the primary way you access it is through a dynamic key
like ... what's not normal code?
metaprogramming, e.g. the implementation of dataclass
@rigid sapphire it's also used in frameworks like django. basically the way to access a DB or generate html forms is made by a metaprogramming layer
because it let's user define a lot of custom information and rules
but back to your point usually a class is a known set of public information and methods (its interface). and you use that certainty to access that information with '.' (that's another way to say what @gleaming knoll said)
as a beginner to python - what editor/tools should I use that is used in the real job world? I would like to be consistent in what I learn on and what I would potentially using in real life. I would like to dabble in data analysis/science/engineering and web app/software development
VS Code is a common choice
vscode
well, vscodium
here is a good guide to getting started with it via Python https://code.visualstudio.com/docs/python/python-tutorial
what if u had something like this bro
class NationBase:
name: str
economy: int
military: int
...
class Nation(NationBase):
pass
class NationSpec(NationBase):
def roll() -> Nation;
usa_spec = NationSpec(
name='United States of America',
economy=4,
military=4,
...
)
usa: Nation = usa_spec.roll()
(imo)
seems that vscode and vscodium are two different things - is there a particular difference or I should be using vscodium?
vscode is popular in the industry because it's very easy to ssh into a private server instance to develop, while keeping the company code in a private instance
vscodium has no AI feature or microsoft spying on you
vscodium is a fork that removes Microsoft's branding and telemetry, but you don't have to use it at first
..
you can start with VS Code and gravitate out from there
it's a compiled binary of the same source code without the microsoft stuff
you're assuming that teaming up with random people without even seeing if you have shared interests is a good idea
uhm
for me i just went with
spammer = either reckless or scammer
and u dont wanna code with either
brh
discord's automod is like rolling a die
tru
this is slut shaming š
has anyone manage to team up with someone online and get a nice project out of it ?
everytime i tried, we stopped at the 'fantasize' stage
OSS
it's uhhhhhhh a bit different from your average hobby project though
@pallid garden i mean with someone a bit random and starting from scratch (not contributing to something already rolling)
just curious
I don't want to work with people I don't already know well
well they all start from somewhere
if I have an OSS project, and a regular stable of contributors prove themselves to be dependable and clued-in, then I might consider taking them on board more directly. but the idea of just hooking up at random with people and saying "let's make something" is likely to be as off-putting to them as it is to me.
if she pair programs before the third date she's not ur wife bro she's for the streets
we really don't need this kind of talk here
completely agree
so are you going to stop...?
i had a brilliant counter joke but i cant share it here... sad
every project I've kept a sustained pace of development on has been something that I had a personal investment in, and where I managed the pace of my own work on it so that it balanced other things.
i only said what others were insinuating (imo). personally i disagree with the sentiment wholeheartedly. i think openness to engaging in collaborative programming is an admirable trait
you are mistaken
okay so I guess I'll use vscodium. thanks - was deciding between that and pycharm.. now I also understand I should have some portfolio or get used to some other tools like git/github/jupyter/etc that kind of stuff - is there another industry standard here? I want to be comfortable using the same tools as industry
why vscodium and not vs code?
git is extremely common! start with that and GitHub
because vs code is the industryy standard, as much as I might have some issue with taht
no it's not
Above they were saying it doesn't have the microsoft stuff
ah! true, if that's important to you that's all good
it might not be standard but its very widely used , which is what they were trying to imply i think
for me to be open to collaboration i need to atleast know what im getting into
the only thing i know about this person is they're marked on discord as a spammer, they didn't tell what project they want to work on, i have no clue what kind of person they are to work with
but bee aware you won't be able to use pylance, the most popular python LSP
well I'm new so I don't know if it's important or not haha
but there are some good altenrativse, pyrefly is new but has been prety good IME
ruff is a good lsp
it only does type checkign and linting, right?
also pyrefly is a type checker
does it also do definition lookup, etc?
i mean less spying is good
but like , i personally think we are getting spied on from everywhere so like š¤·
me too but i wouldn't disqualify someone who is more outgoing than myself as "reckless"
it's blazingly fast š„š because it's written in rust
~~ 20 ~~ 0 minutes without a rust mention
^ that is true, it's hard to express how mcuh better the astral tools are in terms of sheer speed than what we had before
morning y'all
spying in what sense? I thought a project of mine can be to pull info from my bank accounts - I don't want anyone knowing my personal stuff hehe
most of the telemetry is pretty abstracted IIRC, but what people object to chiefly is the principle of the thing
more importantly is you dont get a trillion dollar company trying to sell you coding with autocomplete-on-steroid
The pylance extension doesn't load in vscodium?
you have to download the vsix in vscode and install it in vscodium
or become based
or become blazingly fast š„š
I can't complete it
def looper():
from folder_watcher import watch, already_ragified
while True:
global ragifying
folders = watch("./DandD/")
to_ragify_folders = [f for f in folders if not already_ragified(f)]
ragified_folders = [f for f in folders if already_ragified(f)]
if ragified_folders:
for folder in ragified_folders:
add_to_storage(folder.name, Status.RAGIFIED)
for folder in to_ragify_folders:
add_to_storage(folder.name, Status.RAGIFYING)
Ragify(edition=folder.name).run()
ragifying = True
if ragifying:
ragifying = False
else:
time.sleep(10)
```i feel like i could and should simplify this
not going to be very fast š
imo vscode is not an killer tool at all..?
it's not
Its just an editor with nothing special... Except LSPs. Which started with vscode.
it's just an industry standard for ssh-ing into a dev box
that is one nice thing about python... itdoesn't lock u in IDE like java/c# where u are severely handicapped if u dont use the ordained slopware
thanks, and these were team projects or single person projects ?
Is pycharm's remote development still locked to a professional license?
idk actually
i have never used pycharm
no no nothing like that
i dont even know what microsoft sends as telemetry when i use vscode
yeah
bro
telemetry can be innocuous things like "how many times do you open vscode" or errors, but it can also be intrusive things such as your keystrokes
we have Live Share at home...
This is why microsoft is winning
altho the telemetry can be disabled in settings afaik , i remember doing smth like that
single person, to be fair
(I have the VS Code telemetry turned off user-wide)
now what about other things used in conjunction with the editor like notebooks, etc? I github the way to go?
yeah , if you turn it off, i dont really see any point in using codium tbh
there is
codium's logo is a lot cooler
tbf i think the extensibility of vscode (and the ease of developing extensions) is why they're winning
ok. behind my question, there's a curiosity about team dynamics. how to make projects / groups that are lively fun and creative
HUGE REASON btw
$ ssh me@dev.box
$ tmux a -t collab
(imho)
So many extensions that haven't been updated in 8 years that kind of still work
tho there still is a big advantage to guaranteeing the user doesn't have to think about if they need to pay for a feature or not xd
you know whats cooler
removing the logo using custom css
can i make it a cat photo
You only have to worry about if a feature provided by a microsoft extension will work on your fork of vscode.
vscode and vscodium have the logo in the corner
i remove it using css
.window-appicon, .window-title, .titlebar-container {
display: none;
}
in /opt/visual-studio-code/resources/app/out/vs/workbench/workbench.desktop.main.css
or better, a cat gif ?
i have native(xfce) titlebar turned on
that's really a community curation question, and not so much a project question. how would you bring together a group of people for any common purpose to enjoy doing things? you'd start with a shared interest, but you'd want to also ensure everyone is mutually respectful, responsible (they show up consistently), etc. in other words it's not an easy issue. think of how hard it can be just to get a group of four friends to decide where to go to eat on a night out!
does this need to be changed back when it updates
the way i did it - putting it into the vscode files itself: yeah
all the custom css extensions suck (are not stable) thats why i decided to do that instead of using them
my update command does it
yeah, and maybe seasoned people too, those who've seen how project go stale for stupid reasons
well, sure. but I do feel the main thing is to gather and maintain a group of people who have mutual respect and interest, and to keep that group curated. you have to be willing to drop people who are talented but difficult, because that just means everyone else's talents (and tolerances) are getting shortchanged.
yeah I just wanted to practice version control, etc.. not that anyone would be collaborating with me, but just getting familiar with the steps/processes/etc because on the job you would
agreed
you don't need a huge project to practice that - anything where there's some kind of incremental improvement or new features will do nicely.
@ivory flicker in case you never saw them, there are few websites to simulate the usual git operations and get the basics mastered
there is something beautiful about
he/him
and
i dont believe in pronouns
discussing mutual respect and shared interests in software communities š
https://learngitbranching.js.org/ mentioned
is there a way to instantly write a TextIOWrapper or do i have to do file.write()
For practice you should try to create a few pull requests, as that's basically the main way to get new code into a project. A pull request is basically a "combination of commits" that you want the project maintainer to pull (usually into the main (or master) branch, where the actual code that's being used for production builds resides).
what
how would you write without writing
that's disrespectful for my disbelief
'/s just in case
it's not that they don't want to write, they just want to do it instantly
i think they are asking if something like file.instant_write() exists
Easy. You just buy a hard drive where someone else has already written that file's content for you
sorry maybe i shouldve given more content with gradio i get demo = gr.Interface(fn=process_file, inputs="file", outputs="text") which gives a path i want to get that file into ./x/y/z cant i use like fs cp instead of open(new_path).write(open(given_path).read())
So, you already have the file but just want to move it?
yes since gradio put it in the /tmp folder
/tmp/gradio/74b40ed4803bf1bfe5e53b994290f2c109edf80654bfdeb3e5f5332daeabfab1/5esrd.md
as an example
os.rename(),os.replace(), orshutil.move()
outdated imo
aah shutil
the modern way is Path
pathlib is sweet
Hi
im using python 3.10
use 3.14 imo
But this performs a copy, not a move, no?
can't
who cares ? but yea there is move. and move_into as well imo
Well. OP obviously cares because that was the crux of his entire question.
Moving a file without needing to copy it
def process_file(file):
filepath = pathlib.Path(file.name)
shutil.move(filepath, pathlib.Path("./test/") / "testfile.md")
return True
```did it like this, where ./test/ and test_file.md will be changed ty @dry yacht for reminding me abt shutil
Also I have no clue what that "in my opinion" does there. There is Path.move and Path.move_into, yeah. That's not an opinion though
If it works it works, yeah, but since you're already using a pathlib.Path, you might as well just use the Path.move or Path.move_into functions
3.10 has .hardlink_to('./test/testfile.md')
Path.move or Path.move_into is 3.14 im on 3.10
Oh, I didn't check the versions and didn't understand the "use 3.14 imo" (#python-discussion message) because that sounded like a suggestion due to the "in my opinion".
but anyways it works so case closed :D
š
every time i see move i think of move semantics
guys why my code won't work
compudtinth-term n;
iffsect := set( = set n)
current :f / n^ add l)
(factles := fir=^2_(ad 0)
cprodtect: if feir rand^(* 2);
cproduct := for == n" _*) 1;
current = f(nt "n lb;
cartet = prrent - facd))
curtet = current * / and);
retult = prrent - factor;
citett current:;_producct; +- walelt;
( result; )
this doesnt look like python?
exactly..
this is not py
lol, what language did u write that in
none..
i mean out of existing ones
someday, someone will find this code snippet and make a language for it
llol
No they won't
given enough time.. they will
based
If u won't make it, then no one else will
given enough time.. as there will be nothing else they can possibly do
it will never happen
š
space is infinite, and so somewhere in the universe, vacuum fluctuation has caused a pc to appear instantaneous in space containing a compiler that will successfully your code
right now
boltzmann-infinitecat compiler
Isn't it bold to assume space is infinite?
It's at least 75% infinite.
if it's not, whatever contains it must be, and if that is not infinite...

it is unlimited.. i'm unsure about infinite tho
Infinite or finite
One of the unanswered questions about the universe is whether it is infinite or finite in extent. For intuition, it can be understood that a finite universe has a finite volume that, for example, could be in theory filled with a finite amount of material, while an infinite universe is unbounded and no numerical volume could possibly fill it. Mathematically, the question of whether the universe is infinite or finite is referred to as boundedness. An infinite universe (unbounded metric space) means that there are points arbitrarily far apart: for any distance d, there are points that are of a distance at least d apart. A finite universe is a bounded metric space, where there is some distance d such that all points are within distance d of each other. The smallest such d is called the diameter of the universe, in which case the universe has a well-defined "volume" or "scale".
I do know the storage space on my harddrives is, unfortunately, very finite :C
uh.. why am i restricted off the reactions
Reactions are hard to moderate so we restrict reacting in #python-discussion to staff
Uh... Moderating reactions.. what are staff even on
who exactly needs reactions to be moderated
i don't like this logic, but most discord servers allow reactions
people can write all sortsa stuff with emojis :p most rules have history behind them
We had a lot of incidents where people would abuse reactions and break rules via reactions
then punish them
Other channels in this server have reactions turned on
then these angry rulebreakers will go break the rules by reacting in there
We did, but it's also difficult to moderate. There's not a log of reactions added to old messages and it can be very computationally and request expensive to have a bot track it
We find they normally don't. Trolls don't have that much energy
This is a busy channel so we like to make it not difficult to moderate this channel
so what.. you look like control freaks.. why want to catch every reaction in existence.. let peoples be.. they are not robots
Uh.. no it's not
it's busy because i'm yapping in here
Welcome to the server.
I'm not sure why you're having such a strong reaction to having reactions off in a single channel. But we won't be changing how we operate because of your particular feedback since it seems to be mostly motivated on charged emotions.
it's basically just in this channel why are you making this out like a whole thing š
well this server is not dead but it's not active enough for that to be real
because it's nonsensical and has absurd goals
We have found it to be effective and you just joined so....
if somebody reacts with wrong reactions on ancient messages.. Who gets hurt from that
the person that gets notified about the reaction
i made my first pygame. game
we don't like reaction spam in a very heavily trafficked channel
@kind elm I don't think we're going to agree on this. can we just talk about python?
Nice! What type of game?
what??
discord notifies people about reactions to their messages
its a simple game where you collect coins nothing special
only if it's gc or a private server with wrong settings
Heh, even a simple game is pretty cool when you haven't made one before.
that is not true
where peopels get pinged for each messages sent
yeah
it would make sense if you'd only restrict it to low level people
do you have anything python related you want to discuss?
Iāve done one of those actually it was quite easy and didnāt take a lot of time
What could I do to further progress in my programming skills?
have you done the advent of code thing?
just keep making stuff that encorporates stuff you haven't already used.
No what is that
Yeah Iām quite a beginner
get experience
if you have a lot of experience in something it means you went further
The trick is to keep programming. Just build things that interest you. Silly things, tricky things. Anything that you don't already know how to build will improve your skills.
for example you can try to make an encryption algorithm
or a hash function, it's far more simple
Or a compiler for InfiniteCat's horrible programming language.
accurate
err... I would disagree with the hash function part.
Sure, you can relatively easily develop a hash function, but odds are like 99.99999% that it'll be a (very) bad hash function.
As for the encryption algorithm:
I 100% agree that implementing one is very good practice, but developing a secure encryption algorithm requires knowing "advanced" (i.e. above school level) math
doesn't have to be a secure one
Hash is far simpler because you can put anything and you don't have to care if it will be reversable or no
but yeah encryption requires advanced knowledge
here is a random prime number 8709234423033500272170260657444400773
almost 10**37
If it's not secure then it's not an encryption algorithm.
Something similar, basically the same, which I believe would be far more suitable, also for learning how to think like a programmer, is a compression algorithm.
I think a compression algorithm would be much better than the hash function (for reasons I explained), and better than the encryption algorithm because you can actually develop it on your own with relatively little previous knowledge and it provides so many more layers to go from simple to harder things, like e.g. you could start with purely text-compression, i.e. techniques you could use to shorten sentences/words on paper, but later go on to encrypting things as individual bits.
It's a little obscure without having somewhat of an understanding what hashes really are and where and how they're used
a control sum
you take an input of large length and produce a semi-unique fixed-size output for it
Yeah, but that doesn't really tell a beginner anything.
For me hashes/control sums only really started to make sense after I've seen a few real world uses for them
the most important use is whe nyou send a data you append its hash to it, so if a single bit was corrupted during transferring, it's easy to see
I worked for one company that stored a hash of the exe in the database, and the program started by hashing its own exe, and then comparing it to the hash value. If they matched, the program started, if they didn't, the system restarted into a maintenance mode.
yea, a bad hash and a good hash both look like random output. It's not a good task for being able to visualize your work.
that's nice
That was an interesting use case.
if it looks like random output then it already can be used for some things
