<commit_before>import os
from datetime import datetime
import yaml

import itertools
from ooni import log

class Report:
    """This is the ooni-probe reporting mechanism. It allows
    reporting to multiple destinations and file formats.

    :scp the string of <host>:<port> of an ssh server

    :yaml the filename of a the yaml file to write

    :file the filename of a simple txt file to write

    :tcp the <host>:<port> of a TCP server that will just listen for
         inbound connection and accept a stream of data (think of it
         as a `nc -l -p <port> > filename.txt`)
    """
    def __init__(self, file="test.report",
                 scp=None,
                 tcp=None):

        self.file = file
        self.tcp = tcp
        self.scp = scp
        #self.config = ooni.config.report

        #if self.config.timestamp:
        #    tmp = self.file.split('.')
        #    self.file = '.'.join(tmp[:-1]) + "-" + \
        #                datetime.now().isoformat('-') + '.' + \
        #                tmp[-1]
        #    print self.file

        try:
            import paramiko
        except:
            self.scp = None
            log.err("Could not import paramiko. SCP will not be disabled")

    def __call__(self, data):
        """
        This should be invoked every time you wish to write some
        data to the reporting system
        """
        #print "Writing report(s)"
        #dump = '--- \n'
        dump = yaml.dump([data])
        #dump += yaml.dump(data)
        reports = []

        if self.file:
            reports.append("file")

        if self.tcp:<commit_msg>Remove unnecessary import of paramiko<commit_after>import os
from datetime import datetime
import yaml

import itertools
from ooni import log

class Report:
    """This is the ooni-probe reporting mechanism. It allows
    reporting to multiple destinations and file formats.

    :scp the string of <host>:<port> of an ssh server

    :yaml the filename of a the yaml file to write

    :file the filename of a simple txt file to write

    :tcp the <host>:<port> of a TCP server that will just listen for
         inbound connection and accept a stream of data (think of it
         as a `nc -l -p <port> > filename.txt`)
    """
    def __init__(self, file="test.report",
                 scp=None,
                 tcp=None):

        self.file = file
        self.tcp = tcp
        self.scp = scp
        #self.config = ooni.config.report

        #if self.config.timestamp:
        #    tmp = self.file.split('.')
        #    self.file = '.'.join(tmp[:-1]) + "-" + \
        #                datetime.now().isoformat('-') + '.' + \
        #                tmp[-1]
        #    print self.file

        self.scp = None

    def __call__(self, data):
        """
        This should be invoked every time you wish to write some
        data to the reporting system
        """
        #print "Writing report(s)"
        #dump = '--- \n'
        dump = yaml.dump([data])
        #dump += yaml.dump(data)
        reports = []

        if self.file:
            reports.append("file")

        if self.tcp:
{'fraction_non_alphanumeric': 0.10677749360613811, 'fraction_numerical': 0.0012787723785166241, 'mean_word_length': 1.7067474048442905, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, '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': '6502181', 'n_tokens_mistral': 904, 'n_tokens_neox': 869, 'n_words': 314}