<commit_before># -*- coding: utf-8 -*-
"""
File Collector Bot

Requires Python >= 3.4

Regulary checks a Folder and reads a File from it

Copyright (C) 2016 by Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH

Parameters:
path: string
extension: string
delete_file: boolean
    default: True
"""

import sys
import io
import os
import fnmatch

from intelmq.lib.bot import Bot
from intelmq.lib.message import Report


class FileCollectorBot(Bot):

    def init(self):
        # Test if path can be accessed
        try:
            if not os.path.isdir(self.parameters.path):
                self.logger.error("The path does not lead to " \
                    "a directory")

        except:
            self.logger.error("The path is not accessible")
            raise exceptions.InvalidArgument('path', got=self.parameters.path)

    def process(self):
        self.logger.debug("Started looking for Files")

        if os.path.isdir(self.parameters.path):
            p = os.path.abspath(self.parameters.path)<commit_msg>Removed unused imports and added comments<commit_after># -*- coding: utf-8 -*-
"""
File Collector Bot

Regularly checks a directory and reads files matching an extension from it
It can delete the file if a delete switch was set.
The bot creates on report per file.

Copyright (C) 2016 by Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH

Parameters:
path: string
extension: string
delete_file: boolean
    default: True
"""

import sys
import os
import fnmatch

from intelmq.lib.bot import Bot
from intelmq.lib.message import Report


class FileCollectorBot(Bot):

    def init(self):
        # Test if path can be accessed
        try:
            if not os.path.isdir(self.parameters.path):
                self.logger.error("The path does not lead to " \
                    "a directory")

        except:
            self.logger.error("The path is not accessible")
            raise exceptions.InvalidArgument('path', got=self.parameters.path)

    def process(self):
        self.logger.debug("Started looking for Files")

        if os.path.isdir(self.parameters.path):
            p = os.path.abspath(self.parameters.path)
{'fraction_non_alphanumeric': 0.084375, 'fraction_numerical': 0.005357142857142857, 'mean_word_length': 2.76006711409396, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '3009350', 'n_tokens_mistral': 639, 'n_tokens_neox': 605, 'n_words': 219}