<commit_before># pylint: disable=invalid-name
from collections import namedtuple
import os
from sanic import Sanic, response
from redis import StrictRedis

from randommap_model import RandomMapModel
import config


CONFIG = {
    'production': config.ProductionConfig,
    'development': config.DevelopmentConfig,
}


app = Sanic(__name__)
app.config.from_object(CONFIG[os.environ['APP_CONFIG']])

redis = StrictRedis.from_url(app.config['REDIS_URL'], decode_responses=True)
model = RandomMapModel(redis, app.config['MAP_TTL'])


# Routes

@app.route('/')
def index(_):
    return response.html('<h1>RandomMap Chrome Extension</h1>')


@app.route('/favicon.ico')
def favicon(_):
    return response.file('static/images/favicon.ico')


@app.route('/map')
def get_map(_):
    sat_map = model.request_map()
    headers = {
        'RandomMap-Latitude': sat_map.lat,
        'RandomMap-Longitude': sat_map.lon
    }
    return response.raw(sat_map.image, headers=headers,
            content_type='image/png')


if __name__ == '__main__':
    app.run(host='0.0.0.0', port=app.config['PORT'])<commit_msg>Add Randommap-Zoom header<commit_after># pylint: disable=invalid-name
from collections import namedtuple
import os
from sanic import Sanic, response
from redis import StrictRedis

from randommap_model import RandomMapModel
import config


CONFIG = {
    'production': config.ProductionConfig,
    'development': config.DevelopmentConfig,
}


app = Sanic(__name__)
app.config.from_object(CONFIG[os.environ['APP_CONFIG']])

redis = StrictRedis.from_url(app.config['REDIS_URL'], decode_responses=True)
model = RandomMapModel(redis, app.config['MAP_TTL'])


# Routes

@app.route('/')
def index(_):
    return response.html('<h1>RandomMap Chrome Extension</h1>')


@app.route('/favicon.ico')
def favicon(_):
    return response.file('static/images/favicon.ico')


@app.route('/map')
def get_map(_):
    sat_map = model.request_map()
    randommap_headers = {
        'Randommap-Latitude': sat_map.lat,
        'Randommap-Longitude': sat_map.lon,
        'Randommap-Zoom': sat_map.zoom
    }
    return response.raw(sat_map.image, headers=randommap_headers,
                        content_type='image/png')


if __name__ == '__main__':
    app.run(host='0.0.0.0', port=app.config['PORT'])
{'fraction_non_alphanumeric': 0.13891323400525854, 'fraction_numerical': 0.0052585451358457495, 'mean_word_length': 4.461722488038277, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3918025', 'n_tokens_mistral': 779, 'n_tokens_neox': 753, 'n_words': 143}