« first day (4107 days earlier)      last day (838 days later) » 

12:01 AM
A.f would be equivalent to f.__get__(None, A)
@blanket
def me():
rbrb
 
12:38 AM
"we have updated (as of 2022-01-12) the recently deleted questions/answers pages to show all deleted questions and answers". meta.stackexchange.com/a/374184/334566
 
 
4 hours later…
4:17 AM
cbg
Is there a way to reverse the gaussian blur I applied with PIL.ImageFilter.GaussianBlur?
Nothing on the internet says anything about doing with python
 
IIRC that's the point of gaussian blurs to not be able to go backwards... but
suggests that I may be correct
if you want to be able to undo, you're going to want to save a copy of the image before you apply the filter
 
I do have the original picture though
I got your point
What I was doing was trying to fade the blur, so I was looping through the different blur amounts and then appending it. I wanted to similarly fade out the blur too
So then I just realized all I have to do is loop through the reverse list in the same way
 
4:40 AM
if you're showing the image? Yeah, that'd do it :)
 
Yup, for a GUI it was
 
 
1 hour later…
5:58 AM
Yo, anyone know how to substitute all variables in Python code snippet?
First you'd have to identify all variables...
I want to take a string representing runnable Python code, then somehow determine all substrings of that string that equal a variable name
 
@AndrasDeak Did someone say PERL?
@PenAndPaperMathematics You should be able to piece together something like this using the ast module. There are also some third-party modules that offer more powerful source code inspection.
 
6:21 AM
@Aran-Fey Might be interesting RE the special method lookup: special method lookup: how much do we care?. TLDR: Python doesn't know how to do it either.
There's a builtin C _PyObject_LookupSpecial but it's not accessible from Python.
 
 
2 hours later…
8:40 AM
> This almost completely consistent now, and I've been working on patching up a few incorrect cases.
This dude would weep if he saw the current stdlib
 
8:51 AM
There's probably something like Python Traumatic Stress Disorder at play here.
You spend weeks mumbling Special cases aren't special enough to break the rules before giving up an writing Although practicality beats purity all over the walls.
 
9:50 AM
@Oliver You probably want to take a look at the chat formatting guide
 
Nah, stupid return key decided it wanted to send it on anyway
No need to finish typing
 
@Oliver You also tried using code fences, so please read the guide
It's easier to copy a whole code block here (unless it's too long) and format it
 
10:07 AM
class ManagerBase:
    pass

class MyManager:
    A = 20

class ConsumerBase:
    def __init__(self, manager: ManagerBase):
        self.manager = manager

class MyConsumer(ConsumerBase):
    def __init__(self, manager: MyManager):
        super().__init__(manager=manager)
        print(self.manager.A)
^ Problem I have with type hinting, in MyConsumer annotation thinks manager should be a ManagerBase instance so shows error when I access self.manager.A
I tried annotating the variable in MyConsumer like this: self.manager: MyManager but it didn't make a difference
I want python to accept that since MyManager is a subclass of ManagerBase, its an acceptable input and should overwrite the existing manager hint
okay sorry typo, it should be
class MyManager(ManagerBase):
 
That's not how type hints work.
Python knows that MyManager is acceptable as a ManagerBase, but it still only knows that self.manager contains something that is acceptable as a ManagerBase.
You need a TypeVar if you want to parameterise the type of self.manager (based on inheritance).
 
Why doesn't adding self.manager: MyManager work though?
Shouldn't it overwrite the existing hint?
 
from typing import TypeVar, Generic

M = TypeVar("M", bound="ManagerBase")

class ManagerBase: pass

class MyManager(ManagerBase):
    A = 20

class ConsumerBase(Generic[M]):
    def __init__(self, manager: M):
        self.manager = manager

class MyConsumer(ConsumerBase[MyManager]):
    def __init__(self, manager: MyManager):
        super().__init__(manager=manager)
        print(self.manager.A)
 
It works great, just trying to understand it
 
@Oliver How did you try it? It works for me with the current MyPy.
See the plaground mypy-play.net/…
Note that your initial code has class MyManager: instead of class MyManager(ManagerBase):
 
10:22 AM
yea sorry thats a typo
When I say it works, I throw it into PyCharm and it autocompletes the A var correctly and doesn't give warnings
But reading through, I understand now we're making the hint for manger variable with Generic[M] and when you subclass ConsumerBase you have to specific what you want to hint manager as
Still don't understand why you can't just overwrite the hint with self.manager: MyManager
Ah, apparently you can overwrite it but it needs to go directly under the class not in __init__
class MyConsumer(ConsumerBase):
    manager: MyManager
    def __init__(self, manager: MyManager):
        super().__init__(manager=manager)
        print(self.manager.A)
 
 
7 hours later…
X-(
 
hello
 
cbg, all
 
cbg
 
And then?
 
5:50 PM
recbg :P
 
And then?
 
IndexError: list index out of range :(
 
Someone just tried to completely rewrite one of my answers on Ask Ubuntu. Their edit comment? "I am a software engineer"
 
At least they left... six words intact!
 
6:26 PM
"Six months ago I couldn't even spell 'software engineer,' now I are one."
9
 
Generic computers question. I own two laptops that are always connected to my wifi router. What's the easiest way to move files between them, without using the Internet or physical devices?
I looked at FTP solutions, but it seems like FTP clients are easy and FTP servers are not so easy
 
"Internet" including LAN?
I guess you need LAN for FTP. So in that case SSH?
SSH server (I assume they exist on windows) and winscp or whatever that you like as a client
 
What's the perceived difficulty in FTP servers?
 
Doesn't windows also do shared folders or whatever?
 
I did encounter winscp in my search, but I couldn't tell if it fit my needs. I will look again.
 
6:32 PM
I start up a Python http server in the file directory using python -m http.server, and then use wget from the destination box.
 
@Kevin If you can fire up an SSH server then winscp will work. It can give you a window like that of total commander, split screen with your stuff on one side and the server's stuff on the other.
It seems winscp is also a client option for FTP.
@Kevin just watch out no matter what option you choose that your server is not visible from outside. Just yesterday or so I realised that I had inadvertently left an ssh server running on my laptop, and my laptop is visible from outside when connected to university LAN. Found a handful of entry attempts in my logs.
 
My perceived difficulty in FTP servers is, my first page of google hits were all companies offering FTP hosting on the cloud for only $$$ per fiscal quarter
 
normally you are automatically hidden behind a router, you have to go out of your way (for instance with port forwarding) to make yourself vulnerable
 
... But now that I google again, I see some free-ish hobbyist level solutions. Curious.
Windows ostensibly does shared folders. I can open the properties window of a directory and tick the "share on the local network" box. This has no apparent effect. Probably I have to enable the feature on the OS level, and maybe tell my router not to block it
 
WinSCP is ridiculously easy, but I've only ever used it for drag-n-drop. To set up your own FTP server should be free and easy
 
6:39 PM
@roganjosh winscp is a client as far as I know
 
Maybe look at paramiko, especially if you're on a local network
@AndrasDeak everything that goes to/from my website is WinSCP
 
I used WinSCP about three jobs ago, fairly regularly. Once I brush off the dust, I don't expect any trouble on the client end. It's the server that I'm fretting over, mostly
 
@roganjosh I don't know what to make of that statement
 
It means that, from Windows, I have access to move stuff between both file systems are though they were directories on a single system. I can't do it programatically but it might as well be a single filesystem
Unless I'm misunderstanding the question itself, that's ideal here?
 
Are you aware that you need an SSH server for SSH to work? That might be the crux of the problem.
 
6:43 PM
I'm lost. I don't think Kevin ever said that generating keys was an issue?
Only that setting up an FTP server seemed difficult
 
FTP needs a server, and SSH also needs a server. My recommendation was SSH because I regularly use it, and it's as simple as running a server. I don't know FTP. Once Kevin has a server (FTP or SSH) running on one machine, he can use winscp (a client) on the other machine to connect to said server and do the clicky things.
 
I think the point of confusion is, Andras said "winscp is a client [but not a server, so you'll probably need other software for that] as far as I know", and your reply did not directly address whether you've used winscp as a server, whether it be ftp or ssh or etc
 
I checked winscp's website when I first mentioned it and it specifically talks about being a client.
So until someone says "I for one know with certainty that winscp can act as a server" I won't change my priors :P
 
Ok, fair enough. I use WinSCP to move files between my box that hosts my website and my own Windows system. Equally, I could open an FTP server in a couple of lines of code with paramiko and... I'll have to check for the library name I use in another case)
huh, ftplib. Does what it says on the tin. You just have to open the port on the host machine
 
I'll keep ftplib in my back pocket for when I need programmatic access. For the time being I will be satisfied by a human-piloted gui
Winscp sounds like a strong bet at this point, so I'll download that. Now let me read up on paramiko...
 
6:51 PM
If you want a GUI, it almost certainly is WinSCP. I don't want to sound like a fanboi but it really is basically a connected filesystem when I was used to just working with Windows
(Windows plus a linux box I'm paying for)
 
the one that comes with openssh-server
 
7:08 PM
Decided to write my first post on medium about the transition from chef to full-stack developer ^^ kieron-spearing.medium.com/… would love some critic
 
Sounds neat, I'll take a look in a bit
 
Took me 5 minutes to realise that "chef" was not some kind of programming role
 
My brain tells me it's impossible to become a full-stack dev in 1 year, but after reading that, my heart has overruled my brain and is rooting for you
 
good timing for that career change
 
Yeah it was lucky to be honest to end up in the situation as the pandemic hit
 
7:19 PM
days 1 through 349: master the subtle art of googling.
days 350 through 356: brief overview of full stack dev principles.
day 357: ready to work.
4
 
I'm surprised to hear this was only a year, I would've guessed that you've been around for longer
 
@Kevin Hahaha you forgot the essential point: When lost ask Kevin
6
 
Paradoxically, I'm the only person that doesn't do that
 
@Kwsswart I hope you don't have to get around captchas in your current job :P Kudos on the journey so far
 
Hahaha Thank you mate and nope I am now working more on APIs and the data that is collected by those spiders ^^
 
 
1 hour later…
8:51 PM
So, does @dataclass generate a str member?
 
@Kwsswart This will inspire some for sure, well done!!
 
okay nevermind figured out the issue...
 

« first day (4107 days earlier)      last day (838 days later) »