Gently
2023-08-25
dejbug.github.ioGently
For
a dream
lies here
I'm rewriting known.py, the URI rewriter. It should be a bit slower by design but cleaner and a bit more powerful.
I've started using type annotations. The first type-checker I'm trying is mypy and already I've run into one or two of its bugs gh gh. I'm getting:
a dream
lies here
archive.py:58: error: "object" has no attribute "time" [attr-defined]
...
@property # type: ignore
def time(self):
return self.year * 100000 + self.month * 100 + self.day
...
key = cmp_to_key(lambda a, b: a.time - b.time)
return sorted(seq, key = key, reverse = reverse)
test: ignore comment as Guido suggested gh which does nothing. It doesn't look like they are going to do anything about it soon gh. So I probably need to move to another checker or, given that Guido himself seems to endorse this tool twitter.com, I stop using @property altogether. Decisions. It's like having an ingrown toenail and thinking it'll take care of itself. A couple months of living like that and your entire gait will change; the way you navigate around potential obstacles, the way you move through your environment. My wishful-thinking had transformed the most inoccuous things into potential sources of pain that are best to be avoided. Mypy looks like that, given what grander vision it had started with slideshare.net. Wishful-thinking-wise it was powerful enough to even stop another, earlier effort in that same direction alorelang.org.
Damn it. I just realized the problem with mypy. The ArchLinux package is outdated (1.3.0 < 1.5.1) and was flagged arch. Ok so the PKGBUILD didn't need any changing at all apart from the obvious version and checksum. The problem with gratuitous build-time deps gh is still being handled well by the maintainer's sed scripts. But when it runs through all its self-checks (which takes forever) mypy quits with 5 fails out of 1117.
=================================================== short test summary info ==================================================== FAILED mypy/test/meta/test_parse_data.py::ParseTestDataSuite::test_bad_eq_version_check - AssertionError: assert 'version==3.7 always false since minimum runtime version is (3, 8)' in '' FAILED mypy/test/meta/test_parse_data.py::ParseTestDataSuite::test_bad_ge_version_check - AssertionError: assert 'version>=3.8 always true since minimum runtime version is (3, 8)' in '' FAILED mypy/test/meta/test_parse_data.py::ParseTestDataSuite::test_parse_invalid_case - assert "Invalid testcase id 'foo-XFAIL'" in '' FAILED mypy/test/meta/test_parse_data.py::ParseTestDataSuite::test_parse_invalid_section - assert ".test:3: Invalid section header [unknownsection] in case 'abc'" in '' FAILED mypy/test/meta/test_update_data.py::UpdateDataSuite::test_update_data - assert '[case testCorrect]\ns: str = 42 # E: Incompatible types in assignment (expression has type "int", variable has typ... =============================== 5 failed, 1117 passed, 1 skipped, 2 xfailed in 775.86s (0:12:55) ===============================
test_bad_eq_version_check is the culprit gh. According to the comments it is a meta test, a test that tests the testers. I don't really need this. So:
$ diff PKGBUILD-1.3.0 PKGBUILD
6c6
< pkgver=1.3.0
---
> pkgver=1.5.1
21c21
< sha256sums=('e1f4d16e296f5135624b34e8fb741eb0eadedca90862405b1f1fde2040b9bd11')
---
> sha256sums=('b031b9601f1060bf1281feab89697324726ba0c0bae9d7cd7ab4b690940f0b92')
36,39c36,39
< check() {
< cd "$pkgname-$pkgver"
< pytest -vv -c /dev/null
< }
---
> # check() {
> # cd "$pkgname-$pkgver"
> # pytest -vv -c /dev/null
> # }
$ makepkg -s
$ pacman -R mypy
$ pacman -U mypy-1.5.1-1-any.pkg.tar.zst
def parseLine(line) -> list[tuple[str | None, str, str | None]]:
...
return [m.groups() for m in mm]
known.py:60: error: List comprehension has incompatible type ...
#version-1.3.0 List[Tuple[Union[str, Any], ...]]; expected List[Tuple[Optional[str], str, Optional[str]]] [misc]
#version-1.5.1 List[tuple[str | Any, ...]]; expected List[tuple[str | None, str, str | None]] [misc]
# return [tuple(m.groups()) for m in mm] # Not this.
# return [(*m.groups(), ) for m in mm] # Not this.
return [(m.group(1), m.group(2), m.group(3)) for m in mm] # This!
def parseLine(line) -> list[tuple[str | None, ...]]:
...
return [m.groups() for m in mm]
Git
This is so useful: So... Colors may also be given as numbers between 0 and 255 ... git
color.diff.<slot> ... is one of context (or plain), meta (metainformation), frag (hunk header), func (function in hunk header), old (removed lines), new (added lines), commit ... whitespace (highlighting whitespace errors), oldMoved (deleted lines), newMoved (added lines) ... git
Awesome Linksman
gh 🚀Art
A Blender script to procedurally generate 3D spaceshipsgh
A lossless video/GIF/image upscaler achieved with waifu2x, Anime4K, SRMD and RealSR. Started in Hack the Valley 2, 2018.gh
A Grammar of Graphics for Pythongh
Cracking
Reverse engineering framework in Pythongh
Exploit Development and Reverse Engineering with GDB Made Easygh
A swiss army knife for pentesting networksgh
Fast and powerful SSL/TLS scanning library.gh
Shadowsocks - Wikipediawiki
Crowd
The LBRY SDK for building decentralized, censorship resistant, monetized, digital content apps.gh
Golem is creating a global market for computing power.gh
Bittorrent software for catsgh
Dev
Data validation using Python type hintsgh
A static type analyzer for Python codegh
Never use print() to debug again.gh
Project documentation with Markdown.gh
Poetry helps you declare, manage and install dependencies of Python projects, ensuring you have the right stack everywhere.gh
Education
Simple PyTorch Tutorials Zero to ALL!gh
Tensorflow tutorial from basic to hardgh
Minimal and clean examples of machine learning algorithms implementationsgh
PEFT: State-of-the-art Parameter-Efficient Fine-Tuning.gh
Learning to See in the Dark. CVPR 2018gh
A free, online learning platform to make quality education accessible for all.gh
A tour in the wonderland of math with python.gh
A Python module for learning all major algorithmsgh
A collection of design patterns/idioms in Python]gh
Python Koans - Learn Python through TDDgh
Games
A retro game engine for Pythongh
Free (as in freedom) open source clone of the Age of Empires II enginegh
GUI
Open source UI framework written in Python, running on Windows, Linux, macOS, Android and iOSgh
A little Python library for making simple Electron-like HTML/JS GUI appsgh
Linux
Python-powered, cross-platform, Unix-gazing shell.gh
A full-featured, hackable tiling window manager written and configured in Python (X11 & Wayland)gh
Cross-platform, fast, feature-rich, GPU based terminalgh
Lisp
A dialect of Lisp that's embedded in Pythongh
A functional standard library for Python.gh
Simple, elegant, Pythonic functional programming.gh
ML
Computer Vision and Robotics Library for AIgh
The OpenAI Python library provides convenient access to the OpenAI API from applications written in the Python language.gh
Web
Brython (Browser Python) is an implementation of Python 3 running in the browsergh
Selenium-python but lighter: Helium is the best Python library for web automation.gh
A very fast and expressive template engine.gh
It's React, but in Python (6.7k stars)gh
Swagger/OpenAPI First framework for Python on top of Flask with automatic endpoint validation & OAuth2 supportgh
Create web-based user interfaces with Python. The nice way.gh
Low code web framework for real world applications, in Python and Javascriptgh
Python framework for building microservicesgh
A next generation HTTP client for Python.gh
An ASGI web server, for Python.gh
The little ASGI framework that shines.gh
Tornado is a Python web framework and asynchronous networking library, originally developed at FriendFeed.gh
The Web API toolkit.gh
Every web site provides APIs.gh
A fully tested, abstract interface to creating OAuth clients and servers.gh
REST API framework designed for human beingsgh
Typed (sigh) interaction with the GitHub APIgh