<commit_before><commit_msg>Another example of a simple pipeline. This was used during the creation of a simple network carousel based server. However it is a simple example of a quick useful adhoc tool. It also allows us to 'retire' the sketch:    * /Sketches/filereading/ClientStreamToFile.py<commit_after>#!/usr/bin/env python
#
# (C) 2005 British Broadcasting Corporation and Kamaelia Contributors(1)
#     All Rights Reserved.
#
# You may only modify and redistribute this under the terms of any of the
# following licenses(2): Mozilla Public License, V1.1, GNU General
# Public License, V2.0, GNU Lesser General Public License, V2.1
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
#     http://kamaelia.sourceforge.net/AUTHORS - please extend this file,
#     not this notice.
# (2) Reproduced in the COPYING file, and at:
#     http://kamaelia.sourceforge.net/COPYING
# Under section 3.5 of the MPL, we are using this text since we deem the MPL
# notice inappropriate for this file. As per MPL/GPL/LGPL removal of this
# notice is prohibited.
#
# Please contact us via: <EMAIL>
# to discuss alternative licensing.
# -------------------------------------------------------------------------
#
# Simple network client for grabbing data from a TCP server on a given
# port and storing the resulting data to a file.
#
# Originally a sketch used when working on a network server carousel,
# which was located in /Sketches/filereading/ClientStreamToFile.py
#

from Kamaelia.Internet.TCPClient import TCPClient
from Kamaelia.Util.PipelineComponent import pipeline
from WriteFileAdapter import WriteFileAdapter

outputfile = "/tmp/received.raw"
clientServerTestPort=1500

pipeline(TCPClient("127.0.0.1",clientServerTestPort),
         WriteFileAdapter(outputfile)
        ).run()

{'fraction_non_alphanumeric': 0.11234705228031146, 'fraction_numerical': 0.014460511679644048, 'mean_word_length': 3.520100502512563, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, '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': '6991407', 'n_tokens_mistral': 513, 'n_tokens_neox': 482, 'n_words': 206}