<commit_before>package main

import (
	"bytes"
	"fmt"
	"net/http"
	"os"
	"strconv"

	"github.com/kr/pretty"

	"golang.org/x/net/websocket"
)

var socket *websocket.Conn

// Start the sftp connection with the received JSON credentials
func sftpConnect(id int, data map[string]string) {
	if initClients(id, data) {
		printDirectory(id, getHomeDir(id))
	}
}

func fetchFiles(id int, data map[string]string) {
	fmt.Println("--> fetching files")
	printDirectory(id, data["path"])
}

func downloadFile(id int, data map[string]string) {
	fmt.Println("--> downloading file")
	fmt.Printf("%# v\n", pretty.Formatter(data))
	printFile(id, data["filename"], data["path"])
}

func transferFile(id int, data map[string]string) {
	fmt.Println("--> transferring file")
	src, _ := strconv.Atoi(data["src"])
	dest, _ := strconv.Atoi(data["dest"])

	fmt.Println(src, "--> to -->", dest)
	MoveFile(data["srcpath"], data["destpath"], src, dest)
}

func transferDirectory(id int, data map[string]string) {
	fmt.Println("--> transferring directory")
	src, _ := strconv.Atoi(data["src"])
	dest, _ := strconv.Atoi(data["dest"])

	fmt.Println(src, "--> to -->", dest)
	MoveDirectory(data["srcpath"], data["destpath"], src, dest)
}

// Map of functions to determine ui actions
var fxns = map[string]func(id int, data map[string]string){
	"LOGIN_REQUEST":           sftpConnect,
	"FETCH_FILES_REQUEST":     fetchFiles,
	"FILE_DOWNLOAD_REQUEST":   downloadFile,
	"FILE_TRANSFER_REQUEST":   transferFile,
	"FILE_TRANSFER_DIRECTORY": transferDirectory,
}

// Main handler upon client web connection to the server
func handler(sock *websocket.Conn) {
	fmt.Println("- - - - - - - - - - - - - - - - - -")
	fmt.Println("Client has connected to the server!")
<commit_msg>Renamed directory transfer action key<commit_after>package main

import (
	"bytes"
	"fmt"
	"net/http"
	"os"
	"strconv"

	"github.com/kr/pretty"

	"golang.org/x/net/websocket"
)

var socket *websocket.Conn

// Start the sftp connection with the received JSON credentials
func sftpConnect(id int, data map[string]string) {
	if initClients(id, data) {
		printDirectory(id, getHomeDir(id))
	}
}

func fetchFiles(id int, data map[string]string) {
	fmt.Println("--> fetching files")
	printDirectory(id, data["path"])
}

func downloadFile(id int, data map[string]string) {
	fmt.Println("--> downloading file")
	fmt.Printf("%# v\n", pretty.Formatter(data))
	printFile(id, data["filename"], data["path"])
}

func transferFile(id int, data map[string]string) {
	fmt.Println("--> transferring file")
	src, _ := strconv.Atoi(data["src"])
	dest, _ := strconv.Atoi(data["dest"])

	fmt.Println(src, "--> to -->", dest)
	MoveFile(data["srcpath"], data["destpath"], src, dest)
}

func transferDirectory(id int, data map[string]string) {
	fmt.Println("--> transferring directory")
	src, _ := strconv.Atoi(data["src"])
	dest, _ := strconv.Atoi(data["dest"])

	fmt.Println(src, "--> to -->", dest)
	MoveDirectory(data["srcpath"], data["destpath"], src, dest)
}

// Map of functions to determine ui actions
var fxns = map[string]func(id int, data map[string]string){
	"LOGIN_REQUEST":              sftpConnect,
	"FETCH_FILES_REQUEST":        fetchFiles,
	"FILE_DOWNLOAD_REQUEST":      downloadFile,
	"FILE_TRANSFER_REQUEST":      transferFile,
	"DIRECTORY_TRANSFER_REQUEST": transferDirectory,
}

// Main handler upon client web connection to the server
func handler(sock *websocket.Conn) {
	fmt.Println("- - - - - - - - - - - - - - - - - -")
	fmt.Println("Client has connected to the server!")

{'fraction_non_alphanumeric': 0.17041892277001994, 'fraction_numerical': 0.0, 'mean_word_length': 4.441860465116279, 'pattern_counts': {'":': 10, '<': 3, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4471916', 'n_tokens_mistral': 1261, 'n_tokens_neox': 1229, 'n_words': 276}