When run as
python -m mainthe expected output is
[abu] patched dolly
[main] Abu
That's because we are patching the dolly module and the Dolly class is now the Abu class.
| CXXFLAGS := \ | |
| -O0 -g -Wall \ | |
| -march=native -mtune=native \ | |
| -I/usr/local/opt/libunwind-headers/include | |
| ifeq ($(shell uname), Linux) | |
| LDFLAGS := -lunwind | |
| endif | |
| TARGETS := \ |
| class Map(dict): | |
| """Element of a free module over a ring.""" | |
| def __add__(self, other): | |
| m = Map(self) | |
| for k, v in other.items(): | |
| n = m.setdefault(k, v.__class__()) + v | |
| if not n and k in m: | |
| del m[k] | |
| continue |
When run as
python -m mainthe expected output is
[abu] patched dolly
[main] Abu
That's because we are patching the dolly module and the Dolly class is now the Abu class.
| # Use as | |
| # | |
| # import deps | |
| # | |
| # deps.install(dict(requests="2.28.1")) | |
| # | |
| import json | |
| import os | |
| import site |
| import typing as _t | |
| from collections import defaultdict | |
| from enum import Enum | |
| from random import choice | |
| class TileColor(Enum): | |
| GRAY = 0 | |
| YELLOW = 1 | |
| GREEN = 2 |
| #!/bin/bash | |
| set -e | |
| sudo apt-get -y install libsecret-1-0 libsecret-1-dev libglib2.0-dev | |
| sudo make --directory=/usr/share/doc/git/contrib/credential/libsecret | |
| git config --global credential.helper /usr/share/doc/git/contrib/credential/libsecret/git-credential-libsecret |
| TRUE = lambda x: lambda y: x | |
| FALSE = lambda x: lambda y: y | |
| PAIR = lambda a: lambda b: lambda f: f(a)(b) | |
| D = lambda x: PAIR(x)(x) | |
| FIRST = lambda p: p(TRUE) | |
| SECOND = lambda p: p(FALSE) |
| from threading import Thread, Event | |
| class WakeSignal(Thread): | |
| def __init__(self, interval, rising=None, falling=None): | |
| super().__init__() | |
| self._interval = interval | |
| self._stopped = False | |
| self._awake = False |
| class FiniteAutomaton: | |
| def __init__(self): | |
| self._states = {} | |
| self._initial = None | |
| self._current = None | |
| def add_state(self, name, handler, initial=False): | |
| if initial: | |
| if self._initial: | |
| raise RuntimeError("Initial state already added!") |
| from multiprocessing import Pool, Queue, Manager, cpu_count | |
| from multiprocessing.queues import Empty | |
| from threading import Thread | |
| from tqdm import tqdm | |
| def parallelize(func: callable, iterable: list, processes: int = None) -> list: | |
| """Parallelize the execution of a function over a list. | |
| This method runs a given function over chunks of the given list in |