Skip to content

Instantly share code, notes, and snippets.

import string
class UnionFind(object):
def __init__(self, size):
# not enough
alpha = iter(string.ascii_lowercase)
self.weights = [alpha.next() for _ in xrange(size)]
def union(self, a, b):
# Add top-left rule
from sys import stdin
from itertools import count
TRIE = {}
def insert_to_trie(trie, part):
if len(part) < 1:
return
first, last = part[0], part[1:]
import nltk
from collections import defaultdict
from itertools import count
from heapq import heapify, heappop, heappush
def huffman(seq, frq):
num = count()
trees = list(zip(frq, num, seq)) # ex (22, 2, 'a',)
package main
import "fmt"
type Node struct {
Key int
Value int
Left *Node
Right *Node
Level int
import argparse
import re
import unittest
import datetime
from collections import defaultdict
from itertools import cycle
from functools import partial
from pymongo import MongoClient
def dan_closestpair(P, current_winner=None):
if len(P) <= 2:
return current_winner
# Set a default
if current_winner is None:
current_winner = (P[0], P[1], distance(P[0], P[1]))
# sort by X
OPENCV_LIBS = `pkg-config --libs opencv --cflags`
PYTHON_PATH = /usr/local/Cellar/python/2.7.8_1/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib
all: compile generate
generate:
swig -c++ -python lorem.i
compile: generate
g++ -O2 -fPIC -c lorem.cpp
diff --git a/docs/ref/models/meta.txt b/docs/ref/models/meta.txt
index 6526ca3..c00888c 100644
--- a/docs/ref/models/meta.txt
+++ b/docs/ref/models/meta.txt
@@ -164,14 +164,14 @@ These old APIs can be replicated by either:
<model-field-attributes>` that describe (or retrieve, in the case of
``_with_model`` variants) the properties of the desired fields.
-Assuming you have a model named ``MyModel``, the following substitutions
-can be made to convert your code to the new API.
diff --git a/docs/ref/models/meta.txt b/docs/ref/models/meta.txt
index 6526ca3..dc03b9c 100644
--- a/docs/ref/models/meta.txt
+++ b/docs/ref/models/meta.txt
@@ -164,15 +164,15 @@ These old APIs can be replicated by either:
<model-field-attributes>` that describe (or retrieve, in the case of
``_with_model`` variants) the properties of the desired fields.
-Assuming you have a model named ``MyModel``, the following substitutions
-can be made to convert your code to the new API.
diff --git a/docs/ref/models/meta.txt b/docs/ref/models/meta.txt
index d728714..6526ca3 100644
--- a/docs/ref/models/meta.txt
+++ b/docs/ref/models/meta.txt
@@ -165,7 +165,13 @@ These old APIs can be replicated by either:
``_with_model`` variants) the properties of the desired fields.
Assuming you have a model named ``MyModel``, the following substitutions
-can be made to convert your code to the new API:
+can be made to convert your code to the new API.