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 | |
from typing import TYPE_CHECKING | |
import pydantic.dataclasses | |
from sqlalchemy import Column | |
from sqlalchemy import create_engine | |
from sqlalchemy import ForeignKey | |
from sqlalchemy import Integer |
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
#!/usr/bin/env bash | |
# notes: | |
# tuning camera: gtk-v4l package, v4l2-ctl | |
# we also have: | |
# ffmpeg, mpg123 | |
# linux | |
#RESOLUTION="640x480" |
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 threading | |
def one(obj): | |
while True: | |
skip = set() | |
try: | |
{k: v for k, v in obj.__dict__.items() if k not in skip} | |
except RuntimeError as err: | |
print("%s" % err) |
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
# taken from https://code.activestate.com/recipes/577504/ **plus** | |
# the comment at https://code.activestate.com/recipes/577504/#c5 | |
from sys import getsizeof, stderr | |
from itertools import chain | |
from collections import deque | |
from reprlib import repr | |
def total_size(o, handlers={}, verbose=False): |
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 sqlalchemy import Column | |
from sqlalchemy import create_engine | |
from sqlalchemy import inspect | |
from sqlalchemy import Integer | |
from sqlalchemy import MetaData | |
from sqlalchemy import select | |
from sqlalchemy import String | |
from sqlalchemy import Table | |
from sqlalchemy.orm import aliased | |
from sqlalchemy.orm import declarative_base |
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 sqlalchemy import Column | |
from sqlalchemy import create_engine | |
from sqlalchemy import Integer | |
from sqlalchemy import MetaData | |
from sqlalchemy import select | |
from sqlalchemy import String | |
from sqlalchemy import Table | |
from sqlalchemy.orm import aliased | |
from sqlalchemy.orm import declarative_base | |
from sqlalchemy.orm import Session |
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 greenlet | |
import sqlite3 | |
class _ErrorContainer(object): | |
error = None | |
def _expect_raises_fn(fn): | |
ec = _ErrorContainer() |
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
"""this is getting close but SQLAlchemy is still not instrumenting __init__ such | |
that it can intercept Pydantic's operations, in particular that list coming | |
in which it wants to convert to instrumented list. | |
this probably could be made to work with some more effort but it will | |
be quite hacky in the end, not really worth it unless there was | |
some explicit support in pydantic. | |
""" |
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 asyncio | |
import contextlib | |
import random | |
import yappi | |
# install sqlalchemy from github master: | |
# pip install git+https://github.com/sqlalchemy/sqlalchemy/ | |
from sqlalchemy import cast | |
from sqlalchemy import Column |
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 asyncio | |
import contextlib | |
import cProfile | |
import io | |
import pstats | |
import random | |
from sqlalchemy import cast | |
from sqlalchemy import Column | |
from sqlalchemy import Integer |
NewerOlder