This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def classify(fn): | |
class Wrapper: | |
def __init__(self, *args, **kwargs): | |
self.args = args | |
self.kwargs = kwargs | |
def __iter__(self): | |
yield from fn(*self.args, **self.kwargs) | |
return Wrapper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ast | |
import math | |
from types import MappingProxyType | |
_empty_map = MappingProxyType({}) | |
math_locals = MappingProxyType( | |
{name: value for (name, value) in vars(math).items() if not name.startswith('_')} | | |
{"abs": abs, "complex": complex, "min": min, "max": max, "pow": pow, "round": round} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
parentheses in `struct` format strings for substructures | |
`pathlib.Path.read_lines` and `pathlib.Path.write_lines` | |
lazy version of str.splitlines | |
easier way to manage range objects | |
method that returns (start, stop, step) as a tuple | |
methods that take return modified copies | |
ChainSet | |
OrderedSet | |
read-only proxies for lists and sets | |
collections.abc classes should have useful reprs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; small AHK script to copy a filename to the clipboard | |
; defaults to ctrl + shift + c | |
^+c:: | |
clipboard := Explorer_GetSelection_Basename() | |
return | |
Explorer_GetSelection_Basename(hwnd="") { | |
fullname := Explorer_GetSelection(hwnd) | |
SplitPath fullname, ToReturn |