<commit_before>package main

import (
	"encoding/json"
	"github.com/heroku/docker-registry-client/registry"
	"log"
	"net/http"
)

type Config struct {
	Url      string
	Username string
	Password string
}

const CONTENT_TYPE  = "application/json"

func (config *Config) Auth() (*registry.Registry, error) {
	hub, err := registry.New(config.Url, config.Username, config.Password)
	if err != nil {
		panic(err.Error())
	}

	return hub, nil
}

func (config *Config) GetRepositories(w http.ResponseWriter, r *http.Request) {
	log.Printf("%s request to %s\n", r.Method, r.RequestURI)

	hub, err := config.Auth()
	if err != nil {
		panic(err)
	}

	repositories, err := hub.Repositories()
	if err != nil {
		panic(err)
	}

	response, err := json.Marshal(repositories)

	w.Header().Set("Content-Type", CONTENT_TYPE)
	w.Write(response)
}

func main() {
	config := &Config{
		Url:      "",
		Username: "",
		Password: "",
	}

	http.HandleFunc("/catalog", config.GetRepositories)
	log.Fatal("ListenAndServe: ", http.ListenAndServe(":8080", nil))
}<commit_msg>Adding tags entrypoint<commit_after>package main

import (
	"encoding/json"
	"github.com/gorilla/mux"
	"github.com/heroku/docker-registry-client/registry"
	"log"
	"net/http"
	"sort"
)

type Config struct {
	Url      string
	Username string
	Password string
}

const CONTENT_TYPE = "application/json"

func (config *Config) Auth() (*registry.Registry, error) {
	hub, err := registry.New(config.Url, config.Username, config.Password)
	if err != nil {
		log.Panic(err)
	}

	return hub, nil
}

func (config *Config) GetRepositories(w http.ResponseWriter, r *http.Request) {
	log.Printf("%s request to %s\n", r.Method, r.RequestURI)

	hub, err := config.Auth()
	if err != nil {
		log.Panic(err)
	}

	repositories, err := hub.Repositories()
	if err != nil {
		log.Panic(err)
	}

	response, err := json.Marshal(repositories)

	w.Header().Set("Content-Type", CONTENT_TYPE)
	w.Write(response)
}

func (config *Config) GetTags(w http.ResponseWriter, r *http.Request) {
	log.Printf("%s request to %s \n", r.Method, r.RequestURI)

	vars := mux.Vars(r)
	name := vars["name"]

	hub, err := config.Auth()
	if err != nil {
		panic(err)
	}

	tags, err := hub.Tags(name)
	if err != nil {
		panic(err)
	}

	sort.Strings(tags)
	response, err := json.Marshal(tags)

	w.Header().Set("Content-Type", CONTENT_TYPE)
	w.Write(response)
}

func main() {
	config := &Config{
		Url:      "",
		Username: "",
		Password: "",
	}

	router := mux.NewRouter().StrictSlash(true)

	router.HandleFunc("/catalog", config.GetRepositories)
	router.HandleFunc("/tags/{name}", config.GetTags).Methods("GET")
	log.Fatal("ListenAndServe: ", http.ListenAndServe(":8080", router))
}
{'fraction_non_alphanumeric': 0.1673499813641446, 'fraction_numerical': 0.002981736861721953, 'mean_word_length': 4.122137404580153, 'pattern_counts': {'":': 2, '<': 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': '6968001', 'n_tokens_mistral': 1027, 'n_tokens_neox': 979, 'n_words': 211}