Commits

Matt Hickford committed 90f3890

move has_keys_with_prefix method up to base class

Comments (0)

Files changed (2)

-.tox/
 MANIFEST
-build/
+src/*.html
+
+*.py[cod]
+
+# C extensions
+*.so
+
+# Packages
+*.egg
+*.egg-info
+dist
+build
+eggs
+parts
+bin
+var
+sdist
+develop-eggs
+.installed.cfg
+lib
+lib64
+__pycache__
+
+# Installer logs
+pip-log.txt
+
+# Unit test / coverage reports
+.coverage
+.tox
+nosetests.xml
+

src/marisa_trie.pyx

         return res
 
 
+    def has_keys_with_prefix(self, unicode prefix=""):
+        """
+        Returns True if any key in the trie begins with ``prefix``.
+        """
+        cdef agent.Agent ag
+        cdef bytes b_prefix = prefix.encode('utf8')
+        ag.set_query(b_prefix)
+        return self._trie.predictive_search(ag)
+
+
+
 cdef class Trie(_Trie):
      """
      This trie stores unicode keys and assigns an unque ID to each key.
          while self._trie.predictive_search(ag):
              yield (ag.key().ptr()[:ag.key().length()]).decode('utf8')
 
-     def has_keys_with_prefix(self, unicode prefix=""):
-         """
-         Returns True if any key in the trie begins with ``prefix``.
-         """
-         cdef agent.Agent ag
-         cdef bytes b_prefix = prefix.encode('utf8')
-         ag.set_query(b_prefix)
-
-         return self._trie.predictive_search(ag):
-
 
 # This symbol is not allowed in utf8 so it is safe to use
 # as a separator between utf8-encoded string and binary payload.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.