<commit_before>package cron

import (
	"encoding/json"
	"io/ioutil"
	"time"

	log "github.com/Sirupsen/logrus"

	"github.com/parnurzeal/gorequest"
	"github.com/robfig/cron"
	"github.com/spf13/viper"
	"github.com/yroffin/jarvis-go-ext/server/types"
	"github.com/yroffin/jarvis-go-ext/server/utils/logger"
)

// handler : handler for connector register
func handler() {

	// define default value for this connector
	m := &types.Connector{
		Name:       "go-dio",
		Icon:       "settings_input_antenna",
		Adress:     "http://" + viper.GetString("jarvis.module.interface") + ":" + viper.GetString("jarvis.module.port"),
		IsRenderer: true,
		IsSensor:   false,
		CanAnswer:  false,
	}

	mJSON, _ := json.Marshal(m)

	request := gorequest.New().Timeout(2 * time.Second)
	resp, _, errs := request.
		Post(viper.GetString("jarvis.server.url") + "/api/connectors/*?task=register").
		Send(string(mJSON)).
		End()
	if errs != nil {
		logger.NewLogger().WithFields(log.Fields{
			"errors": errs,
		}).Info("CRON")
	}

	if b, err := ioutil.ReadAll(resp.Body); err == nil {
		logger.NewLogger().WithFields(log.Fields{
			"body":   string(b),
			"status": resp.Status,
		}).Info("CRON")
	}
}

// Init : init cron service
func Init(cr string) int {<commit_msg>Correction, continue quand le serveur est eteint<commit_after>package cron

import (
	"encoding/json"
	"io/ioutil"
	"time"

	log "github.com/Sirupsen/logrus"

	"github.com/parnurzeal/gorequest"
	"github.com/robfig/cron"
	"github.com/spf13/viper"
	"github.com/yroffin/jarvis-go-ext/server/types"
	"github.com/yroffin/jarvis-go-ext/server/utils/logger"
)

// handler : handler for connector register
func handler() {

	// define default value for this connector
	m := &types.Connector{
		Name:       "go-dio",
		Icon:       "settings_input_antenna",
		Adress:     "http://" + viper.GetString("jarvis.module.interface") + ":" + viper.GetString("jarvis.module.port"),
		IsRenderer: true,
		IsSensor:   false,
		CanAnswer:  false,
	}

	mJSON, _ := json.Marshal(m)

	request := gorequest.New().Timeout(2 * time.Second)
	resp, _, errs := request.
		Post(viper.GetString("jarvis.server.url") + "/api/connectors/*?task=register").
		Send(string(mJSON)).
		End()
	if errs != nil {
		logger.NewLogger().WithFields(log.Fields{
			"errors": errs,
		}).Info("CRON")
		return
	}

	if b, err := ioutil.ReadAll(resp.Body); err == nil {
		logger.NewLogger().WithFields(log.Fields{
			"body":   string(b),
			"status": resp.Status,
		}).Info("CRON")
	} else {
		logger.NewLogger().WithFields(log.Fields{
			"body":   string(b),
			"status": resp.Status,
		}).Info("WARN")
	}
}

// Init : init cron service
func Init(cr string) int {
{'fraction_non_alphanumeric': 0.17669172932330826, 'fraction_numerical': 0.002255639097744361, 'mean_word_length': 3.7264653641207817, 'pattern_counts': {'":': 10, '<': 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': '2941628', 'n_tokens_mistral': 1075, 'n_tokens_neox': 1015, 'n_words': 176}