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
"""python scripts/sample_openapi_spec.py openapi.json title version""" | |
import json | |
import sys | |
import fastapi | |
from fastapi import Body | |
from fastapi import Depends | |
from fastapi import Query | |
from fastapi.openapi.utils import get_openapi | |
from fastapi.security import APIKeyHeader |
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
""" | |
sqlalchemy discussion: https://github.com/sqlalchemy/sqlalchemy/discussions/10841 | |
""" | |
def dump_dict(v): | |
"""recursively dump dict into rust style, which no quotes for key""" | |
match v: | |
case str(): | |
return f'"{v}"' | |
case int(): | |
return f'{v}' |
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 numpy as np | |
ids = [1, 5, 7, 12] | |
bitmaps = np.zeros(max(ids) + 1, dtype=np.bool) | |
bitmaps[ids] = True | |
bitmaps = np.packbits(bitmaps).tostring() | |
print(bitmaps) | |
# b'E\x08' | |
# could be use as a binary field to be stored in database |
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
# devpi server | |
# install package | |
pip install --trusted-host pypi.douban.com -i http://pypi.douban.com/simple devpi | |
# initialize the server directory | |
devpi-server --init | |
# create the supervisord devpi.ini or start the server directly, if not root user, provide the --serverdir | |
devpi-server --host 0.0.0.0 --port 3141 --serverdir ~/.devpi/server | |
# after the server is running | |
# point to registry |