from collections import OrderedDict
import re

ANCHOR_BIGQUERY = None


def get_anchor(question):
    return question.lower().replace(" ", "-").replace("?", "").replace("'", "")


def load_faq():
    global FAQ
    global ANCHOR_BIGQUERY
    global anchors

    with open("docs/faq.md") as faq_file:
        FAQ = faq_file.read()

        # Any heading-level markdown (#, ##, etc) is assumed to be a question.
        questions = re.findall(r"^[#]+\s*(.*)", FAQ, flags=re.MULTILINE)
        anchors = OrderedDict(
            (question, get_anchor(question)) for question in questions
        )
        ANCHOR_BIGQUERY = find_anchor("BigQuery")


# Finds the first anchor whose question contains a given string.
def find_anchor(query):
    global anchors
    questions = [question for question in anchors if query.lower() in question.lower()]
    if len(questions):
        return anchors.get(questions[0])
    return None  # pragma: no cover


load_faq()

80c0cca505493c4f16b0507ac43789e000860027
<mask token>


def get_anchor(question):
    return question.lower().replace(' ', '-').replace('?', '').replace("'", '')


def load_faq():
    global FAQ
    global ANCHOR_BIGQUERY
    global anchors
    with open('docs/faq.md') as faq_file:
        FAQ = faq_file.read()
        questions = re.findall('^[#]+\\s*(.*)', FAQ, flags=re.MULTILINE)
        anchors = OrderedDict((question, get_anchor(question)) for question in
            questions)
        ANCHOR_BIGQUERY = find_anchor('BigQuery')


def find_anchor(query):
    global anchors
    questions = [question for question in anchors if query.lower() in
        question.lower()]
    if len(questions):
        return anchors.get(questions[0])
    return None


<mask token>

<mask token>


def get_anchor(question):
    return question.lower().replace(' ', '-').replace('?', '').replace("'", '')


def load_faq():
    global FAQ
    global ANCHOR_BIGQUERY
    global anchors
    with open('docs/faq.md') as faq_file:
        FAQ = faq_file.read()
        questions = re.findall('^[#]+\\s*(.*)', FAQ, flags=re.MULTILINE)
        anchors = OrderedDict((question, get_anchor(question)) for question in
            questions)
        ANCHOR_BIGQUERY = find_anchor('BigQuery')


def find_anchor(query):
    global anchors
    questions = [question for question in anchors if query.lower() in
        question.lower()]
    if len(questions):
        return anchors.get(questions[0])
    return None


load_faq()

<mask token>
ANCHOR_BIGQUERY = None


def get_anchor(question):
    return question.lower().replace(' ', '-').replace('?', '').replace("'", '')


def load_faq():
    global FAQ
    global ANCHOR_BIGQUERY
    global anchors
    with open('docs/faq.md') as faq_file:
        FAQ = faq_file.read()
        questions = re.findall('^[#]+\\s*(.*)', FAQ, flags=re.MULTILINE)
        anchors = OrderedDict((question, get_anchor(question)) for question in
            questions)
        ANCHOR_BIGQUERY = find_anchor('BigQuery')


def find_anchor(query):
    global anchors
    questions = [question for question in anchors if query.lower() in
        question.lower()]
    if len(questions):
        return anchors.get(questions[0])
    return None


load_faq()

from collections import OrderedDict
import re
ANCHOR_BIGQUERY = None


def get_anchor(question):
    return question.lower().replace(' ', '-').replace('?', '').replace("'", '')


def load_faq():
    global FAQ
    global ANCHOR_BIGQUERY
    global anchors
    with open('docs/faq.md') as faq_file:
        FAQ = faq_file.read()
        questions = re.findall('^[#]+\\s*(.*)', FAQ, flags=re.MULTILINE)
        anchors = OrderedDict((question, get_anchor(question)) for question in
            questions)
        ANCHOR_BIGQUERY = find_anchor('BigQuery')


def find_anchor(query):
    global anchors
    questions = [question for question in anchors if query.lower() in
        question.lower()]
    if len(questions):
        return anchors.get(questions[0])
    return None


load_faq()

from collections import OrderedDict
import re

ANCHOR_BIGQUERY = None


def get_anchor(question):
    return question.lower().replace(" ", "-").replace("?", "").replace("'", "")


def load_faq():
    global FAQ
    global ANCHOR_BIGQUERY
    global anchors

    with open("docs/faq.md") as faq_file:
        FAQ = faq_file.read()

        # Any heading-level markdown (#, ##, etc) is assumed to be a question.
        questions = re.findall(r"^[#]+\s*(.*)", FAQ, flags=re.MULTILINE)
        anchors = OrderedDict(
            (question, get_anchor(question)) for question in questions
        )
        ANCHOR_BIGQUERY = find_anchor("BigQuery")


# Finds the first anchor whose question contains a given string.
def find_anchor(query):
    global anchors
    questions = [question for question in anchors if query.lower() in question.lower()]
    if len(questions):
        return anchors.get(questions[0])
    return None  # pragma: no cover


load_faq()
