diff --git a/app.py b/app.py index a7508c4..c4083c9 100644 --- a/app.py +++ b/app.py @@ -5,7 +5,7 @@ Module to contain all the project's Flask server plumbing. from flask import Flask from flask import render_template, session -from bitshift import * +from bitshift.query import parse_query app = Flask(__name__) app.config.from_object("bitshift.config") @@ -18,5 +18,11 @@ app_env.globals.update(assets = assets) def index(): return render_template("index.html") +@app.route("/search/") +def search(query): + ## tree = parse_query(query) + ## database.search(tree) + pass + if __name__ == "__main__": app.run() diff --git a/bitshift/codelet.py b/bitshift/codelet.py new file mode 100644 index 0000000..df81294 --- /dev/null +++ b/bitshift/codelet.py @@ -0,0 +1,13 @@ +__all__ = ["Codelet"] + +class Codelet(object): + ## object to store the following (it doesn't need to do anything with it): + ## author name, URL, date created/modified, language, source code itself + ## for VCS: project name, file in project + ## also: list of functions, etc (associations data) + + ## DICTIONARY MAPPING STRINGS REPRESENTING ASSOCIATION TYPE WITH DICTIONARIES + ## MAPPING ASSOCIATION NAMES WITH TUPLES REPRESENTING THEIR PLACE IN THE FILE + ## STORED AS TWO INTEGERS REPRESENTING THE ROW AND THE COLUMN + + ## {"functions": {"foo": (12, 13), "bar": (53, 3)}} diff --git a/bitshift/database.py b/bitshift/database.py new file mode 100644 index 0000000..b8995ee --- /dev/null +++ b/bitshift/database.py @@ -0,0 +1,18 @@ +""" +Module with classes and functions to handle communication with the MySQL +database backend, which manages the search index. +""" + +import oursql + +class Database(object): + """Represents the MySQL database.""" + + def __init__(self): + pass + + def _connect(self): + pass + + def _create(self): + pass diff --git a/bitshift/parser/__init__.py b/bitshift/parser/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/bitshift/query/__init__.py b/bitshift/query/__init__.py new file mode 100644 index 0000000..7d6e0d5 --- /dev/null +++ b/bitshift/query/__init__.py @@ -0,0 +1,9 @@ +from .association import Association +from .node import Node +from .tree import Tree + +__all__ = ["parse_query"] + +def parse_query(query): + # gets a string, returns a Tree + pass