Browse Source

Docstrings for Database methods; oursql dependency.

tags/v1.0^2
Ben Kurtovic 10 years ago
parent
commit
962dd9aef5
3 changed files with 28 additions and 4 deletions
  1. +6
    -3
      app.py
  2. +21
    -0
      bitshift/database.py
  3. +1
    -1
      setup.py

+ 6
- 3
app.py View File

@@ -5,6 +5,7 @@ Module to contain all the project's Flask server plumbing.
from flask import Flask
from flask import render_template, session

from bitshift.database import Database
from bitshift.query import parse_query

app = Flask(__name__)
@@ -12,7 +13,9 @@ app.config.from_object("bitshift.config")

app_env = app.jinja_env
app_env.line_statement_prefix = "="
app_env.globals.update(assets = assets)
app_env.globals.update(assets=assets)

database = Database()

@app.route("/")
def index():
@@ -20,8 +23,8 @@ def index():

@app.route("/search/<query>")
def search(query):
## tree = parse_query(query)
## database.search(tree)
tree = parse_query(query)
database.search(tree)
pass

if __name__ == "__main__":


+ 21
- 0
bitshift/database.py View File

@@ -16,3 +16,24 @@ class Database(object):

def _create(self):
pass

def search(self, query):
"""
Search the database.

:param query: The query to search for.
:type query: :py:class:`~.query.tree.Tree`

:return: A list of search results.
:rtype: list of :py:class:`.Codelet`\ s
"""
pass

def insert(self, codelet):
"""
Insert a codelet into the database.

:param codelet: The codelet to insert.
:type codelet: :py:class:`.Codelet`
"""
pass

+ 1
- 1
setup.py View File

@@ -5,7 +5,7 @@ setup(
version = "0.1",
packages = find_packages(),
install_requires = ["Flask>=0.10.1", "pygments>=1.6", "requests>=2.2.0",
"BeautifulSoup>=3.2.1"],
"BeautifulSoup>=3.2.1", "oursql>=0.9.3.1"],
author = "Benjamin Attal, Ben Kurtovic, Severyn Kozak",
license = "MIT",
url = "https://github.com/earwig/bitshift"


Loading…
Cancel
Save