<commit_before>import os
import re

from google.appengine.api import users

import jinja2
import webapp2

import api


JINJA_ENVIRONMENT = jinja2.Environment(
    loader=jinja2.FileSystemLoader(os.path.dirname(__file__)),
    extensions=['jinja2.ext.autoescape'],
    )


class MainPage(webapp2.RequestHandler):

    def get(self):
        user = users.get_current_user()
        template = JINJA_ENVIRONMENT.get_template('index.html')
        env = {
            'user': user,
            'users': users,
        }
        self.response.write(template.render(env))
        # if user:
        #     greeting = ('Welcome, %s! (<a href="%s">sign out</a>)' %
        #                 (user.nickname(), users.create_logout_url('/')))
        # else:
        #     greeting = ('<a href="%s">Sign in or register</a>.' %
        #                 users.create_login_url('/'))

        # self.response.out.write('<html><body>%s</body></html>' % greeting)


class ApiHandler(webapp2.RequestHandler):

    def get(self):
        #api.get_oauth_user()  # just for authentication
        path = self.request.path
        if path.startswith('/api/card/'):
            # retrieve an individual card<commit_msg>login route<commit_after>import os
import re

from google.appengine.api import users

import jinja2
import webapp2

import api


JINJA_ENVIRONMENT = jinja2.Environment(
    loader=jinja2.FileSystemLoader(os.path.dirname(__file__)),
    extensions=['jinja2.ext.autoescape'],
    )


class MainPage(webapp2.RequestHandler):

    def get(self):
        path = self.request.path

        if path.startswith('/login'):
            return self.redirect(users.create_login_url('/'))
        else:
            user = users.get_current_user()
            template = JINJA_ENVIRONMENT.get_template('index.html')
            env = {
                'user': user,
                'users': users,
            }
            self.response.write(template.render(env))
            # if user:
            #     greeting = ('Welcome, %s! (<a href="%s">sign out</a>)' %
            #                 (user.nickname(), users.create_logout_url('/')))
            # else:
            #     greeting = ('<a href="%s">Sign in or register</a>.' %
            #                 users.create_login_url('/'))

            # self.response.out.write('<html><body>%s</body></html>' % greeting)


class ApiHandler(webapp2.RequestHandler):

    def get(self):
        #api.get_oauth_user()  # just for authentication
        path = self.request.path
        if path.startswith('/api/card/'):
            # retrieve an individual card
{'fraction_non_alphanumeric': 0.137904468412943, 'fraction_numerical': 0.00539291217257319, 'mean_word_length': 2.17481662591687, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, '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': '6836792', 'n_tokens_mistral': 815, 'n_tokens_neox': 793, 'n_words': 143}