Skip to content

Instantly share code, notes, and snippets.

View pohlt's full-sized avatar

Tom Pohl pohlt

View GitHub Profile
@pohlt
pohlt / match.py
Created January 18, 2024 19:25
Python pattern matching of self-made classes
class C:
__match_args__ = ("__match_self_prop__",)
def __init__(self, x, y=42):
self.x = x
self.y = y
@property
def __match_self_prop__(self):
return self
@pohlt
pohlt / chrome_policies.md
Last active February 13, 2023 08:11
Chrome policies to block / allow URLs
@pohlt
pohlt / download.py
Created November 2, 2021 04:16
Basic download script
import argparse
import sys
# as seen in https://github.com/python/cpython/pull/29217
def download():
parser = argparse.ArgumentParser(
description="Download the provided URL (FTP/HTTP/HTTPS supported) "
@pohlt
pohlt / .pre-commit-config.yaml
Last active November 3, 2021 18:39
Starting point for a Python-centric pre-commit
default_language_version:
python: python3.9
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 'v4.0.1'
hooks:
- id: mixed-line-ending
args: [ '--fix=lf' ]
- id: trailing-whitespace
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.