<commit_before>import logging


class Browser:
    def __init__(self, actors, subreddit, db, cursor):
        self.actors = actors
        self.subreddit = subreddit
        self.db = db
        self.cursor = cursor

    def check_command(self, command, mod, post):
        for actor in self.actors:
            actor.parse(command, mod, post)

    def scan_reports(self):
        try:
            for post in self.subreddit.mod.reports(limit=None):
                for mod_report in post.mod_reports:
                    yield (str(mod_report[0]), mod_report[1], post)
        except Exception as e:
            logging.error("Error fetching reports: {err}".format(err=e))

    def run(self):
        for command, mod, post in self.scan_reports():
            self.check_command(command, mod, post)
        for actor in self.actors:
            actor.after()
<commit_msg>Add docstrings to browser.py<commit_after>import logging


class Browser:
    "A class to fetch reports and dispatch to actors."
    def __init__(self, actors, subreddit, db, cursor):
        self.actors = actors
        self.subreddit = subreddit
        self.db = db
        self.cursor = cursor

    def check_command(self, command, mod, post):
        "Check if any actor matches this report."
        for actor in self.actors:
            actor.parse(command, mod, post)

    def scan_reports(self):
        """Generator for mod reports in a subreddit.

        Yields tuple of report, mod name, and target.

        """
        try:
            for post in self.subreddit.mod.reports(limit=None):
                for mod_report in post.mod_reports:
                    yield (str(mod_report[0]), mod_report[1], post)
        except Exception as e:
            logging.error("Error fetching reports: {err}".format(err=e))

    def run(self):
        for command, mod, post in self.scan_reports():
        "Fetch reports and dispatch to actors."
            self.check_command(command, mod, post)
        for actor in self.actors:
            actor.after()

{'fraction_non_alphanumeric': 0.0954254795868175, 'fraction_numerical': 0.001967535661583866, 'mean_word_length': 2.129230769230769, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2439123', 'n_tokens_mistral': 585, 'n_tokens_neox': 563, 'n_words': 178}