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
{ | |
"type": "doc", | |
"content": [ | |
{ | |
"type": "paragraph", | |
"content": [ | |
{ | |
"type": "text", | |
"text": "Here is an example of simple formatted text" | |
} |
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 json | |
def convert_any(node): | |
typ = node.get('type', '') | |
print('node type: ', typ) | |
if typ == 'doc': | |
out = convert_doc(node) | |
elif typ == 'paragraph': | |
out = convert_paragraph(node) |
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 json | |
from dataclasses import dataclass, field | |
from typing import List | |
from inspect import isclass | |
renderers = {} | |
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 dataclasses import dataclass | |
@dataclass | |
class Query: | |
db: object = None | |
def sql(self): | |
raise NotImplementedError |
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 datetime | |
import os | |
import string | |
from random import randrange | |
from peewee import Model, PostgresqlDatabase | |
from peewee import BooleanField, TextField, CharField | |
from playhouse.postgres_ext import ArrayField, BinaryJSONField | |
NO_OF_DBS = 500 |
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 datetime | |
import os | |
import string | |
from random import randrange | |
from peewee import Model, DatabaseProxy, PostgresqlDatabase | |
from peewee import ForeignKeyField, BooleanField, TextField, IntegerField, CharField | |
NO_OF_DBS = 800 | |
NO_OF_POSTS = 50 |
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 | |
from dataclasses import dataclass | |
NO_OF_DOORS = 3 | |
@dataclass | |
class Door: |
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
# - hug version: 2.4.7 | |
# - marshmallow: 3.0.0rc4 | |
# - Python: 3.6.7 on Ubuntu 18.10 | |
import hug | |
from marshmallow import Schema, fields | |
class ItemSchema(Schema): | |
name = fields.Str() | |
id = fields.Int() |
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 fastapi import FastAPI | |
from pydantic import BaseModel | |
class Item(BaseModel): | |
name: str | |
class CreateSignature(BaseModel): | |
id: int |
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 json | |
import pickle | |
import msgpack | |
TEST_REDIS = False | |
if TEST_REDIS: | |
import redis | |
rconn = redis.StrictRedis() | |
dataset = [(('key:%d' % i), {'a': 1, 'b': list(range(100)), 'c': ('z' * 25)}) for i in range(1000000)] |
NewerOlder