- Interactivity
- Direct manipulation
- Intuition
- See the data, see the changes
===============================================================================
"""Generate a report about the meta information of a pckage. | |
This includes its children modules, | |
functions, classes, arg/kwarg count, etc. | |
""" | |
import ast | |
import inspect | |
import os | |
import pkgutil | |
import sys |
from random import choice | |
types = ['sporophyte', 'gametophyte'] | |
class Plant(object): | |
def __init__(self, type=None): | |
self.type = type or choice(types) |
from contextlib import contextmanager | |
def to_mgr(fn): | |
fn.__converted__ = True | |
@contextmanager | |
def fn2(*args, **kwargs): | |
try: | |
fn(*args, **kwargs) |
# -*- coding: UTF-8 -*- | |
"""Scientific branches.""" | |
from itertools import permutations | |
from random import choice | |
branches = { | |
"Acarology": "study of mites", | |
"Aceology": "science of remedies, or of therapeutics; iamatology.", | |
"Acology": "study of medical remedies", |
"""FSM abstraction in python for flask. | |
========================== | |
Requirements: | |
1. Transition from/to steps | |
2. Only allow certain transitions | |
3. Reset FSM once in a certain position (stopping state) | |
E.g. a form that may then save to a DB and then |
"""Tokenize bookmark titles and create an inverted index.""" | |
import re | |
import os | |
import sys | |
from pprint import pprint as ppr | |
from collections import Counter, defaultdict | |
from pyquery import PyQuery as pq |
""" | |
Exploring some ideas around customizable decorators that derive default | |
values from a config or instance. | |
""" | |
from functools import wraps | |
# Simple customizable decorator. | |
from pprint import pprint as ppr | |
from collections import defaultdict | |
from datetime import datetime as dt | |
class Db(object): | |
def default_obj(self): | |
return dict( | |
last_modified=None, |
print('-' * 80) | |
for x in range(10): | |
print('{num}: {:.>{pad1}d} {:.>{pad2}d} {:.>{pad3}d} {:.>{pad4}d}'.format(x ** 2, x ** 3, x ** 4, x ** 5, num=x, pad1=10, pad2=20, pad3=30, pad4=40)) | |
class Kaboom(object): | |
def __format__(self, format): | |
if format == 'explode': | |
return '*' * 80 |