<commit_before># -*- coding: utf-8 -*-
"""
    keepupwithscience.api
    ~~~~~~~~~~~~~

    keepupwithscience api application package
"""

from functools import wraps

from .. import factory
import flask.ext.restless
from ..models import *
from ..helpers import http_auth_func

def create_app(settings_override=None):
    """Returns the KeepUpWithScience API application instance"""

    app = factory.create_app(__name__, __path__, settings_override, register_security_blueprint=False)

    manager = flask.ext.restless.APIManager(app, flask_sqlalchemy_db=db)	

    manager.create_api(Journal, include_columns=['id', 'url', 'title', 'short_title', 'last_checked', 'categories', 'categories.id', 'categories.name'], preprocessors=dict(GET_SINGLE=[http_auth_func],GET_MANY=[http_auth_func]), url_prefix=None)
    manager.create_api(Category, include_columns=['id', 'name', 'description', 'journals', 'journals.id', 'journals.title', 'journals.url', 'journals.short_title', 'journals.last_checked'], preprocessors=dict(GET_SINGLE=[http_auth_func],GET_MANY=[http_auth_func]), url_prefix=None)
    manager.create_api(Paper, results_per_page=50, include_columns=['id', 'title', 'abstract', 'authors', 'url', 'doi', 'journal', 'journal.title'], preprocessors=dict(GET_SINGLE=[http_auth_func],GET_MANY=[http_auth_func]), url_prefix=None)
    
    return app<commit_msg>Added a common configuration dictionary to the API factory method<commit_after># -*- coding: utf-8 -*-
"""
    keepupwithscience.api
    ~~~~~~~~~~~~~

    keepupwithscience api application package
"""

from functools import wraps

from .. import factory
import flask.ext.restless
from ..models import *
from ..helpers import http_auth_func

def create_app(settings_override=None):
    """Returns the KeepUpWithScience API application instance"""

    app = factory.create_app(__name__, __path__, settings_override, register_security_blueprint=False)

    manager = flask.ext.restless.APIManager(app, flask_sqlalchemy_db=db)	

    common_configurations = dict(preprocessors=dict(GET_SINGLE=[http_auth_func],GET_MANY=[http_auth_func]), url_prefix=None)

    manager.create_api(Journal, include_columns=['id', 'url', 'title', 'short_title', 'last_checked', 'categories', 'categories.id', 'categories.name'], **common_configurations)
    manager.create_api(Category, include_columns=['id', 'name', 'description', 'journals', 'journals.id', 'journals.title', 'journals.url', 'journals.short_title', 'journals.last_checked'], **common_configurations)
    manager.create_api(Paper, results_per_page=50, include_columns=['id', 'title', 'abstract', 'authors', 'url', 'doi', 'journal', 'journal.title'], **common_configurations)
    
    return app
{'fraction_non_alphanumeric': 0.14920399851906702, 'fraction_numerical': 0.0022213994816734544, 'mean_word_length': 6.72, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '3212265', 'n_tokens_mistral': 844, 'n_tokens_neox': 810, 'n_words': 162}