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 os | |
import subprocess | |
import tempfile | |
import contextlib | |
import secrets | |
import glob | |
import shutil | |
import time | |
from argparse import ArgumentParser | |
from functools import partial |
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
Query: | |
FunctionDef(body=[*..., Return(Call())]) | |
AST: | |
Match( | |
name="FunctionDef", | |
filters={ | |
"body": List( | |
items=[ | |
Expand, |
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
from __future__ import annotations | |
import uuid | |
import copy | |
from contextlib import contextmanager | |
from dataclasses import dataclass, field | |
from enum import IntEnum, auto | |
def restore(originals, frozens): | |
for original, frozen in zip(originals, frozens): |
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
# Problem: | |
# Balance all boxes with the minimum number of moves. Each | |
# move is the operation of taking N from one box and distributing | |
# it to other boxes equally. | |
# 30, 50, 45, 40, 35 | |
# | |
# 1st move: take 12 from third box [45], and give other boxes +3 | |
# 33, 53, 33, 43, 38 | |
# |
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 | |
tree = ast.parse(""" | |
1 | |
""") | |
import redis | |
from redisgraph import Node, Edge, Graph, Path |
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
expr_ty _PyPegen_produce_string(Parser *p, expr_ty a) { | |
int start = -1, end = -1, length = 0, seen_walrus = 0, mark; | |
for (mark = p->mark; start == -1; --mark) { | |
Token* token = p->tokens[mark]; | |
if (token->end_lineno == a->end_lineno | |
&& token->end_col_offset == a->end_col_offset) | |
{ | |
end = mark; | |
} | |
if (token->lineno == a->lineno |
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 random | |
@object.__new__ | |
class Maybe: | |
def __bool__(self): | |
return random.choice((True, False)) | |
print(bool(Maybe), bool(Maybe), bool(Maybe)) | |
print(Maybe is Maybe) |
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
html{ | |
background-image:url('https://user-images.githubusercontent.com/47358913/83976033-0a87fd80-a900-11ea-8de7-1def45a939ed.png'); | |
padding: 10rem; | |
} | |
body { | |
/* background-color: none..class{ */ | |
background:rgba(0,0,0); | |
/* background: #000065; */ | |
color: white; | |
font-size: 2em; |
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 inspect | |
import json | |
import re | |
import socket | |
import time | |
from collections import UserString | |
from dataclasses import asdict, dataclass, field | |
from typing import Any, Callable, Set, Tuple | |
TRUSTED = frozenset(("beginbotbot", "isidentical")) |
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 re | |
import json | |
import socket | |
from dataclasses import dataclass, field, asdict | |
from collections import UserString | |
from typing import Set | |
TRUSTED = frozenset(("beginbotbot", "isidentical")) | |
COMMAND_RE = re.compile(r"(?P<command>![a-z]*)+") | |
ECONOMY_RE = re.compile(r"Mana: (?P<mana>\d+) \| Street Cred: (?P<credit>\d+) \| Cool Points: (?P<points>\d+)") |
NewerOlder