<commit_before># Copyright 2014 <NAME>, <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Database models and helper functions for the RouteMaster server.

Before using this module, one of the initialize_* methods needs to be
called. (Only the first initialize_* method called will have an effect,
so you can safely call them multiple times if you want to.)

After initializing, create an instance of Session to access the
database.
"""
import logging
import os.path

from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker

from . import models

logger = logging.getLogger("routemaster.db")
Session = sessionmaker()
engine = None

def _populate():
    """Insert some default objects into the database.

    This function will throw errors if the database has already been
    populated, so avoid calling it multiple times.
    """
    models.Base.metadata.create_all(engine)
    logger.info("Initalized database")
    db = Session()
    café_chan = models.Place(name="Café Chan",
                             latitude=29.65782,
                             longitude=-82.34215)
    einstein = models.Place(name="Einstein Bagels",
                            latitude=29.64814,
                            longitude=-82.34524)
    hermann = models.Account(name="<NAME>",
                          email="<EMAIL>")
    db.add(café_chan)
    db.add(einstein)<commit_msg>Use the correct name for Einstein place<commit_after># Copyright 2014 <NAME>, <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Database models and helper functions for the RouteMaster server.

Before using this module, one of the initialize_* methods needs to be
called. (Only the first initialize_* method called will have an effect,
so you can safely call them multiple times if you want to.)

After initializing, create an instance of Session to access the
database.
"""
import logging
import os.path

from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker

from . import models

logger = logging.getLogger("routemaster.db")
Session = sessionmaker()
engine = None

def _populate():
    """Insert some default objects into the database.

    This function will throw errors if the database has already been
    populated, so avoid calling it multiple times.
    """
    models.Base.metadata.create_all(engine)
    logger.info("Initalized database")
    db = Session()
    café_chan = models.Place(name="C<NAME>",
                             latitude=29.65782,
                             longitude=-82.34215)
    einstein = models.Place(name="Einstein Bros. Bagels",
                            latitude=29.64814,
                            longitude=-82.34524)
    hermann = models.Account(name="<NAME>",
                          email="<EMAIL>")
    db.add(café_chan)
    db.add(einstein)
{'fraction_non_alphanumeric': 0.0793193717277487, 'fraction_numerical': 0.018848167539267015, 'mean_word_length': 3.0822649572649574, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6509187', 'n_tokens_mistral': 1032, 'n_tokens_neox': 978, 'n_words': 417}