Skip to content

Instantly share code, notes, and snippets.

@sherzberg
sherzberg / conftest.py
Last active August 29, 2015 14:14 — forked from alexmic/conftest.py
import os
import pytest
from alembic.command import upgrade
from alembic.config import Config
from project.factory import create_app
from project.database import db as _db
@sherzberg
sherzberg / tupperware.py
Last active September 28, 2019 08:29 — forked from floer32/tupperware.py
from UserDict import IterableUserDict
import collections
def tupperware(mapping):
""" Convert mappings to 'tupperwares' recursively.
Lets you use dicts like they're JavaScript Object Literals (~=JSON)...
It recursively turns mappings (dictionaries) into namedtuples.
Thus, you can cheaply create an object whose attributes are accessible