Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update Python sample code

  • Loading branch information...
commit 4f32df2f9ef47e65d32e4d0de505c6ecda7ae0cf 1 parent 38f96ca
@jjwhitney authored
Showing with 15 additions and 13 deletions.
  1. +15 −0 test/py_bindings.py
  2. +0 −13 test/python.py
View
15 test/py_bindings.py
@@ -0,0 +1,15 @@
+from bdelta import BDelta
+
+a = u"The quick brown fox jumped over the lazy dog"
+b = u"The quick drowned fox jumped over the lazy dog"
+
+b = BDelta(a, b)
+
+b.b_pass(13, 27, 0) # Find all matches that are at least 27 chars long
+print list(b.matches()) # [(15, 17, 29)])
+
+b.b_pass(3, 5, 0) # Find all matches that are at least 5 chars long
+print list(b.matches()) # [(0, 0, 10), (15, 17, 29)]
+
+b.b_pass(2, 3, 0) # Find all matches that are at least 3 chars long
+print list(b.matches()) # [(0, 0, 10), (11, 11, 4), (15, 17, 29)]
View
13 test/python.py
@@ -1,13 +0,0 @@
-import sys
-sys.path.append("../src")
-
-from bdelta_python import bdelta_SimpleString
-
-a = "abcdefghijklmnopqrstuvwxyz"
-b = "abcdefghi1jklmnopqrstuvwxyz"
-
-print bdelta_SimpleString(unicode(a), unicode(b), 8)
-
-print bdelta_SimpleString(u"abcdefghijklmnopqrstuvwxyz", u"AbcdefghijklmnqrstuvwxyZ", 4)
-print bdelta_SimpleString(u"abcdefghijklmnopqrstuvwxyz", u"abcdefghijklmnopqrstuvwxyz", 4)
-
Please sign in to comment.
Something went wrong with that request. Please try again.