Przeglądaj źródła

More work.

tags/v1.0^2
Ben Kurtovic 10 lat temu
rodzic
commit
b5c22d3b4a
2 zmienionych plików z 33 dodań i 3 usunięć
  1. +24
    -2
      bitshift/query/__init__.py
  2. +9
    -1
      bitshift/query/tree.py

+ 24
- 2
bitshift/query/__init__.py Wyświetl plik

@@ -1,7 +1,12 @@
from .nodes import * ## TODO from .nodes import * ## TODO
from .tree import Tree from .tree import Tree


__all__ = ["parse_query"]
__all__ = ["QueryParseException", "parse_query"]

class QueryParseException(Exception):
"""Raised by parse_query when a query is invalid."""
pass



def parse_query(query): def parse_query(query):
""" """
@@ -16,8 +21,25 @@ def parse_query(query):


:return: A tree storing the data in the query. :return: A tree storing the data in the query.
:rtype: :py:class:`~.query.tree.Tree` :rtype: :py:class:`~.query.tree.Tree`

:raises: :py:class:`.QueryParseException`
""" """
pass
for term in query.split(" "):
pass

language:"Python"
lang:
l:

author:"Ben Kurtovic"

modified:before
modified:after
created:before
created:after:"Jaunary 4, 2014"

func:"foobar"
func:re|gex:"foo?b|car"


# "foo" -> Tree() # "foo" -> Tree()
# "foo bar" -> "foo bar" OR ("foo" or "bar") # "foo bar" -> "foo bar" OR ("foo" or "bar")


+ 9
- 1
bitshift/query/tree.py Wyświetl plik

@@ -6,5 +6,13 @@ class Tree(object):
def __init__(self, root): def __init__(self, root):
self._root = root self._root = root


def __repr__(self):
return "Tree({0})".format(self._root)

def serialize(self): def serialize(self):
pass
"""Create a string representation of the query for caching.

:return: Query string representation.
:rtype: str
"""
return repr(self)

Ładowanie…
Anuluj
Zapisz