# Path: pyke/knowledge_engine.py
#     class chain(object):
# class CanNotProve(StandardError):
# class engine(object):
#         def __new__(cls, *args):
#         def from_iterable(i):
#     def __init__(self, *search_paths, **kws):
#     def _create_target_pkg(self, path, target_pkgs):
#     def get_ask_module(self):
#     def reset(self):
#     def get_kb(self, kb_name, _new_class = None):
#     def get_rb(self, rb_name):
#     def get_create(self, rb_name, parent = None, exclude_list = ()):
#     def get_ke(self, kb_name, entity_name):
#     def add_universal_fact(self, kb_name, fact_name, args):
#     def add_case_specific_fact(self, kb_name, fact_name, args):
#     def assert_(self, kb_name, entity_name, args):
#     def activate(self, *rb_names):
#     def lookup(self, kb_name, entity_name, pat_context, patterns):
#     def prove_goal(self, goal_str, **args):
#     def prove_1_goal(self, goal_str, **args):
#     def prove(self, kb_name, entity_name, pat_context, patterns):
#     def prove_n(self, kb_name, entity_name, fixed_args = (), num_returns = 0):
#         def gen():
#     def prove_1(self, kb_name, entity_name, fixed_args = (), num_returns = 0):
#     def print_stats(self, f = sys.stdout):
#     def trace(self, rb_name, rule_name):
#     def untrace(self, rb_name, rule_name):
# def _get_target_pkg(target_name):
# def _pythonify_path(path):
# def _is_package_dir(path):
# def in_sys_path(path):
# 
# Path: pyke/krb_traceback.py
# def print_tb(traceback, limit=None, file=None):
# def print_exception(type, value, traceback, limit=None, file=None):
# def print_exc(limit=None, file=None):
# def format_exc(limit=None):
# def print_last(limit=None, file=None):
# def print_stack(f=None, limit=None, file=None):
# def extract_tb(tb, limit=None):
# def extract_stack(f=None, limit=None):
# def format_exception(type, value, traceback, limit=None):
# def format_tb(tb, limit=None):
# def format_stack(f=None, limit=None):
# def convert_lineno(module, lineno):
# def convert_tb(extracted_tb):


import sys
import os, os.path
import sqlgen
from pyke import knowledge_engine, krb_traceback
        sys.stderr.write(command + '\n')
        if parameters: sys.stderr.write("with: %s\n" % str(parameters))
        return self.cursor.execute(command, parameters)
    def __getattr__(self, attr):
        return getattr(self.cursor, attr)

def init(db_connection, trace_sql=False):
    global Engine, Db_connection, Db_cursor
    Engine = knowledge_engine.engine(sqlgen, __file__)
    Db_connection = db_connection
    Db_cursor = db_connection.cursor()
    if trace_sql: Db_cursor = trace_cursor(Db_cursor)
    return Engine

Debug = 0

Web_framework_dir = os.path.dirname(__file__)

def gen_plan(environ, starting_tables, template_name):
    Engine.reset()

    def add_fact(fb_name, env_var):
        fact_name = env_var.split('.')[-1].lower()
        value = environ.get(env_var)
        if value is not None and value != '':
            if Debug:
                print "asserting %s.%s(%s) from %s" % \
                      (fb_name, fact_name, value, env_var)
            Engine.add_case_specific_fact(fb_name, fact_name, (value,))
        elif Debug:

# Path: pyke/knowledge_engine.py
#     class chain(object):
# class CanNotProve(StandardError):
# class engine(object):
#         def __new__(cls, *args):
#         def from_iterable(i):
#     def __init__(self, *search_paths, **kws):
#     def _create_target_pkg(self, path, target_pkgs):
#     def get_ask_module(self):
#     def reset(self):
#     def get_kb(self, kb_name, _new_class = None):
#     def get_rb(self, rb_name):
#     def get_create(self, rb_name, parent = None, exclude_list = ()):
#     def get_ke(self, kb_name, entity_name):
#     def add_universal_fact(self, kb_name, fact_name, args):
#     def add_case_specific_fact(self, kb_name, fact_name, args):
#     def assert_(self, kb_name, entity_name, args):
#     def activate(self, *rb_names):
#     def lookup(self, kb_name, entity_name, pat_context, patterns):
#     def prove_goal(self, goal_str, **args):
#     def prove_1_goal(self, goal_str, **args):
#     def prove(self, kb_name, entity_name, pat_context, patterns):
#     def prove_n(self, kb_name, entity_name, fixed_args = (), num_returns = 0):
#         def gen():
#     def prove_1(self, kb_name, entity_name, fixed_args = (), num_returns = 0):
#     def print_stats(self, f = sys.stdout):
#     def trace(self, rb_name, rule_name):
#     def untrace(self, rb_name, rule_name):
# def _get_target_pkg(target_name):
# def _pythonify_path(path):
# def _is_package_dir(path):
# def in_sys_path(path):
# 
# Path: pyke/krb_traceback.py
# def print_tb(traceback, limit=None, file=None):
# def print_exception(type, value, traceback, limit=None, file=None):
# def print_exc(limit=None, file=None):
# def format_exc(limit=None):
# def print_last(limit=None, file=None):
# def print_stack(f=None, limit=None, file=None):
# def extract_tb(tb, limit=None):
# def extract_stack(f=None, limit=None):
# def format_exception(type, value, traceback, limit=None):
# def format_tb(tb, limit=None):
# def format_stack(f=None, limit=None):
# def convert_lineno(module, lineno):
# def convert_tb(extracted_tb):


# Path: examples/web_framework/wsgi_app.py
import sys
import os, os.path
import sqlgen
from pyke import knowledge_engine, krb_traceback

        sys.stderr.write(command + '\n')
        if parameters: sys.stderr.write("with: %s\n" % str(parameters))
        return self.cursor.execute(command, parameters)
    def __getattr__(self, attr):
        return getattr(self.cursor, attr)

def init(db_connection, trace_sql=False):
    global Engine, Db_connection, Db_cursor
    Engine = knowledge_engine.engine(sqlgen, __file__)
    Db_connection = db_connection
    Db_cursor = db_connection.cursor()
    if trace_sql: Db_cursor = trace_cursor(Db_cursor)
    return Engine

Debug = 0

Web_framework_dir = os.path.dirname(__file__)

def gen_plan(environ, starting_tables, template_name):
    Engine.reset()

    def add_fact(fb_name, env_var):
        fact_name = env_var.split('.')[-1].lower()
        value = environ.get(env_var)
        if value is not None and value != '':
            if Debug:
                print "asserting %s.%s(%s) from %s" % \
                      (fb_name, fact_name, value, env_var)
            Engine.add_case_specific_fact(fb_name, fact_name, (value,))
        elif Debug:

            print "skipping %s.%s: got %s from %s" % \