<commit_before>##
## network.bash for shfw
## by lenormf
##

function networkConnect {
	eval "exec ${1}<>/dev/tcp/${2}/${3}"
}

function networkSend {
	local fd="$1"

	shift
	eval "echo \"$@\" >&${fd}"
}

function networkRead {
	eval "read l <&${1}"

	echo "$l"
}

function networkReadAll {
	local fd="$1"

	shift
	eval "while read l; do $@ \"$l\" done <&${fd}"
}

function networkDisconnect {
	eval "exec ${1}<&-; exec ${1}>&-"<commit_msg>Added a read function with a timeout option<commit_after>##
## network.bash for shfw
## by lenormf
##

function networkConnect {
	eval "exec ${1}<>/dev/tcp/${2}/${3}"
}

function networkSend {
	local fd="$1"

	shift
	eval "echo -en \"$@\" >&${fd}"
}

function networkRead {
	eval "read l <&${1}"

	echo "$l"
}

function networkReadTimeout {
	local fd="$1"

	shift
	eval "read -t \"$@\" l <&${fd}"

	echo "$l"
}

function networkReadAll {
	local fd="$1"

	shift
	eval "while read l; do $@ \"$l\" done <&${fd}"
}

function networkDisconnect {
	eval "exec ${1}<&-; exec ${1}>&-"
{'fraction_non_alphanumeric': 0.2187192118226601, 'fraction_numerical': 0.016748768472906402, 'mean_word_length': 3.7699530516431925, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 9, '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': '4348695', 'n_tokens_mistral': 412, 'n_tokens_neox': 393, 'n_words': 113}