<commit_before>package main

import (
	"os"

	"github.com/diyan/assimilator/template"
	"github.com/diyan/assimilator/web"

	"strings"

	"github.com/Sirupsen/logrus"
	"github.com/diyan/echox/log"
	mwx "github.com/diyan/echox/middleware"
	"github.com/echo-contrib/pongor"
	"github.com/labstack/echo"
	mw "github.com/labstack/echo/middleware"
	_ "github.com/lib/pq"
	logrusfmt "github.com/x-cray/logrus-prefixed-formatter"
)

// TODO keep main.go small, move everything to the web/server.go
func init() {
	template.RegisterTags()
	template.RegisterFilters()
}

func main() {
	e := echo.New()
	e.Debug = true
	e.Logger = log.Logrus()
	// Register default error handler
	e.HTTPErrorHandler = web.HTTPErrorHandler
	e.Renderer = pongor.GetRenderer()
	// TODO ForceColors only if codegangsta/gin detected
	logrus.SetFormatter(&logrusfmt.TextFormatter{ShortTimestamp: true, ForceColors: true})
	// Register access log logger
	e.Use(mwx.LogrusLogger(nil))
	e.Use(web.RecoverMiddleware())
	// TODO setup route to serve static files
	e.Static("/_static", "_static")
	e.Pre(mw.AddTrailingSlashWithConfig(mw.TrailingSlashConfig{
		Skipper: func(c echo.Context) bool {
			uri := c.Request().URL.String()
			// TODO consider check suffixes .xml .ico .txt .json .js .svg .png .gif .html .eot .woff .css .ttf .woff2
			if strings.HasPrefix(uri, "/_static/") ||
				strings.HasSuffix(uri, "/robots.txt") ||
				strings.HasSuffix(uri, "/favicon.ico") ||
				strings.HasSuffix(uri, "/crossdomain.xml") {
				return true
			}
			return false
		}}))

	web.RegisterRoutes(e)
	port := os.Getenv("PORT")
	if port == "" {
		port = ":3000"
	} else {
		port = ":" + port
	}
	e.Logger.Fatal(e.Start(port))
}
<commit_msg>Disable cache for pongo2 templates<commit_after>package main

import (
	"os"

	"github.com/diyan/assimilator/template"
	"github.com/diyan/assimilator/web"

	"strings"

	"github.com/Sirupsen/logrus"
	"github.com/diyan/echox/log"
	mwx "github.com/diyan/echox/middleware"
	"github.com/echo-contrib/pongor"
	"github.com/labstack/echo"
	mw "github.com/labstack/echo/middleware"
	_ "github.com/lib/pq"
	logrusfmt "github.com/x-cray/logrus-prefixed-formatter"
)

// TODO keep main.go small, move everything to the web/server.go
func init() {
	template.RegisterTags()
	template.RegisterFilters()
}

func main() {
	e := echo.New()
	e.Debug = true
	e.Logger = log.Logrus()
	// Register default error handler
	e.HTTPErrorHandler = web.HTTPErrorHandler
	e.Renderer = pongor.GetRenderer(pongor.PongorOption{Reload: true})
	// TODO ForceColors only if codegangsta/gin detected
	logrus.SetFormatter(&logrusfmt.TextFormatter{ShortTimestamp: true, ForceColors: true})
	// Register access log logger
	e.Use(mwx.LogrusLogger(nil))
	e.Use(web.RecoverMiddleware())
	// TODO setup route to serve static files
	e.Static("/_static", "_static")
	e.Pre(mw.AddTrailingSlashWithConfig(mw.TrailingSlashConfig{
		Skipper: func(c echo.Context) bool {
			uri := c.Request().URL.String()
			// TODO consider check suffixes .xml .ico .txt .json .js .svg .png .gif .html .eot .woff .css .ttf .woff2
			if strings.HasPrefix(uri, "/_static/") ||
				strings.HasSuffix(uri, "/robots.txt") ||
				strings.HasSuffix(uri, "/favicon.ico") ||
				strings.HasSuffix(uri, "/crossdomain.xml") {
				return true
			}
			return false
		}}))

	web.RegisterRoutes(e)
	port := os.Getenv("PORT")
	if port == "" {
		port = ":3000"
	} else {
		port = ":" + port
	}
	e.Logger.Fatal(e.Start(port))
}

{'fraction_non_alphanumeric': 0.1537565521258008, 'fraction_numerical': 0.00320326150262085, 'mean_word_length': 3.872340425531915, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, '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': '6823289', 'n_tokens_mistral': 1349, 'n_tokens_neox': 1290, 'n_words': 247}