<commit_before>package image

import (
	"bytes"
	"errors"
	"fmt"
	"github.com/disintegration/imaging"
	"github.com/franela/goreq"
	"image"
	"mime"
	"net/http"
)

type ImageResponse struct {
	Image       image.Image
	ContentType string
	Key         string
	Header      map[string]string
}

func ImageResponseFromURL(url string) (*ImageResponse, error) {
	content, err := goreq.Request{Uri: url}.Do()

	if err != nil {
		return nil, err
	}

	if content.StatusCode != http.StatusOK {
		return nil, errors.New(fmt.Sprint("%s [status: %d]", url, content.StatusCode))
	}

	dest, err := imaging.Decode(content.Body)

	if err != nil {
		return nil, err
	}

	var headers = make(map[string]string)

	for _, key := range HeaderKeys {
		if value, ok := content.Header[key]; ok && len(value) > 0 {
			fmt.Println(value)
			headers[key] = value[0]
		}
	}

	var contentType = mime.TypeByExtension(url)<commit_msg>Remove useless Println<commit_after>package image

import (
	"bytes"
	"errors"
	"fmt"
	"github.com/disintegration/imaging"
	"github.com/franela/goreq"
	"image"
	"mime"
	"net/http"
)

type ImageResponse struct {
	Image       image.Image
	ContentType string
	Key         string
	Header      map[string]string
}

func ImageResponseFromURL(url string) (*ImageResponse, error) {
	content, err := goreq.Request{Uri: url}.Do()

	if err != nil {
		return nil, err
	}

	if content.StatusCode != http.StatusOK {
		return nil, errors.New(fmt.Sprint("%s [status: %d]", url, content.StatusCode))
	}

	dest, err := imaging.Decode(content.Body)

	if err != nil {
		return nil, err
	}

	var headers = make(map[string]string)

	for _, key := range HeaderKeys {
		if value, ok := content.Header[key]; ok && len(value) > 0 {
			headers[key] = value[0]
		}
	}

	var contentType = mime.TypeByExtension(url)
{'fraction_non_alphanumeric': 0.13965227145260797, 'fraction_numerical': 0.002243409983174425, 'mean_word_length': 3.670157068062827, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '7274055', 'n_tokens_mistral': 675, 'n_tokens_neox': 637, 'n_words': 152}