Max Woerner Chase

17 Followers
15 Following
207 Posts
Does... does Instagram want context-free screenshots of pathological Python code?
Contemplating my messed-up Python code...

A few weeks ago, I finally had enough of "Snap" Firefox, and switched it to the PPA.

It just hit me that this means I don't need to worry about Firefox telling another application a nonsense path when I'm dealing with "system" directories...

Hello... old friend. It's been so long. I'd missed you. We're going to have such fun together.

🤔
@eevee What is happening #bombe
I can be trusted to write normal Python code.

The premise here is that a single repository can contain multiple "projects" that should be tested separately. This separation is accomplished by taking a selection of the PACKAGE_LABEL label.
This is fed into package_adaptor, because we want to have results for different projects in different places. (They can later be aggregated. That is a piece of functionality not relevant to this rambling monologue.)

The first two functions in the screenshot are somewhat instructive for how this is all meant to be used. There are two kinds of class that expose a "value" property ("Parametric" and "MappedSelection"), and both are usable by the "adaptive" decorator. The point of the "value" property is to, in a hopefully controlled way, subvert the type system. To Mypy*, it presents itself as a value of the type that the class is parametrized over; at runtime, it is a wrapper that is read by the decorator in order to construct a new parametric value.

*This code base can't work with other type checkers.

So, let's start off by interrogating the decorator. Currently, it's only used once, which... ehhh... But anyway.

There are some immediate problems here, such as the fact that the decorated function has its name from when seemingly a quarter of the things in MOTR were called "adaptors". Ultimately, the function should be renamed to reflect what the MappedSelection class becomes.

So, we have a label, a conversion function, and those get put together to make a *something*.
I'm not feeling too much pull towards "a better way" in this setup, so let's try shaking things up...

Ars Technica fixed the text that Google excerpts, because I guess fixing the way Google scrapes Ars's articles is somehow Ars's responsibility???

Why is this command-line app sending its output through something that's looking for emoji shortcodes?

(I don't *think* it's my shell or my terminal. `echo ":100:"` gave normal-looking output.)