Skip to content

Instantly share code, notes, and snippets.

@josh-howes
josh-howes / abstract_decorated.py
Last active November 13, 2015 22:45
Add Decorating of Abstract Class Methods
from abc import ABCMeta, abstractmethod
import types
import time
from functools import wraps
def with_timing(f):
@wraps(f)
def wrapper(*args, **kwds):
time_start = time.time()
@josh-howes
josh-howes / fp_tree.py
Created November 17, 2015 20:53
Han, Pei and Yin's novel frequent pattern tree (FP-tree) structure
"""Mining Frequent Patterns without Candidate Generation.
Naive implementation of the data structures in the following paper <http://hanj.cs.illinois.edu/pdf/sigmod00.pdf>
"""
class HeaderTable(dict):
"""Header Table.
To facilitate tree traversal, an item header table is built in which each item points to its
occurrence in the tree via a head of node-link. Nodes with the same item-name are linked in
"""
https://jupyter.readthedocs.io/en/latest/architecture/how_jupyter_ipython_work.html
http://www.tornadoweb.org/en/stable/
https://jupyter-notebook.readthedocs.io/en/stable/extending/handlers.html
"""
from IPython import get_ipython
from IPython.core.magic import register_cell_magic
from tornado import ioloop
from functools import partial