<commit_before>// Copyright 2021 Google LLC
//
// 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.

// Implements go/functions_framework buildpack.
// The functions_framework buildpack converts a functionn into an application and sets up the execution environment.
package main

import (
	"encoding/json"
	"fmt"
	"os"
	"path/filepath"
	"strings"
	"text/template"

	"github.com/GoogleCloudPlatform/buildpacks/pkg/env"
	gcp "github.com/GoogleCloudPlatform/buildpacks/pkg/gcpbuildpack"
	"github.com/GoogleCloudPlatform/buildpacks/pkg/golang"
	"github.com/Masterminds/semver"
)

const (
	layerName                          = "functions-framework"
	gopathLayerName                    = "gopath"
	functionsFrameworkModule           = "github.com/GoogleCloudPlatform/functions-framework-go"
	functionsFrameworkPackage          = functionsFrameworkModule + "/funcframework"
	functionsFrameworkFunctionsPackage = functionsFrameworkModule + "/functions"
	functionsFrameworkVersion          = "v1.5.2"
	appModule                          = "functions.local/app"
	fnSourceDir                        = "serverless_function_source_code"
)

var (
	googleDirs      = []string{fnSourceDir, ".googlebuild", ".googleconfig"}
	tmplV0          = template.Must(template.New("mainV0").Parse(mainTextTemplateV0))
	tmplV1_1        = template.Must(template.New("mainV1_1").Parse(mainTextTemplateV1_1))
	tmplDeclarative = template.Must(template.New("main_declarative").Parse(mainTextTemplateDeclarative))
)

type fnInfo struct {
	Source  string
	Target  string
	Package string
	Imports map[string]struct{}
}

type parsedPackage struct {
	Name    string              `json:"name"`
	Imports map[string]struct{} `json:"imports"`
}<commit_msg>Update to latest functions framework go release<commit_after>// Copyright 2021 Google LLC
//
// 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.

// Implements go/functions_framework buildpack.
// The functions_framework buildpack converts a functionn into an application and sets up the execution environment.
package main

import (
	"encoding/json"
	"fmt"
	"os"
	"path/filepath"
	"strings"
	"text/template"

	"github.com/GoogleCloudPlatform/buildpacks/pkg/env"
	gcp "github.com/GoogleCloudPlatform/buildpacks/pkg/gcpbuildpack"
	"github.com/GoogleCloudPlatform/buildpacks/pkg/golang"
	"github.com/Masterminds/semver"
)

const (
	layerName                          = "functions-framework"
	gopathLayerName                    = "gopath"
	functionsFrameworkModule           = "github.com/GoogleCloudPlatform/functions-framework-go"
	functionsFrameworkPackage          = functionsFrameworkModule + "/funcframework"
	functionsFrameworkFunctionsPackage = functionsFrameworkModule + "/functions"
	functionsFrameworkVersion          = "v1.5.3"
	appModule                          = "functions.local/app"
	fnSourceDir                        = "serverless_function_source_code"
)

var (
	googleDirs      = []string{fnSourceDir, ".googlebuild", ".googleconfig"}
	tmplV0          = template.Must(template.New("mainV0").Parse(mainTextTemplateV0))
	tmplV1_1        = template.Must(template.New("mainV1_1").Parse(mainTextTemplateV1_1))
	tmplDeclarative = template.Must(template.New("main_declarative").Parse(mainTextTemplateDeclarative))
)

type fnInfo struct {
	Source  string
	Target  string
	Package string
	Imports map[string]struct{}
}

type parsedPackage struct {
	Name    string              `json:"name"`
	Imports map[string]struct{} `json:"imports"`
}
{'fraction_non_alphanumeric': 0.096730855351545, 'fraction_numerical': 0.008956560680698611, 'mean_word_length': 3.525835866261398, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5196788', 'n_tokens_mistral': 1265, 'n_tokens_neox': 1241, 'n_words': 336}