<commit_before>import os
import time
import random

import yaml

from twisted.internet import defer
from twisted.internet import reactor

from ooni import config

from ooni.reporter import OONIBReporter, YAMLReporter, OONIBReportError

from ooni.inputunit import InputUnitFactory

from ooni.utils import log
from ooni.utils import Storage

class InvalidResumeFile(Exception):
    pass

class noResumeSession(Exception):
    pass

def loadResumeFile():
    """
    Sets the singleton stateDict object to the content of the resume file.
    If the file is empty then it will create an empty one.

    Raises:

        :class:ooni.runner.InvalidResumeFile if the resume file is not valid

    """
    if not config.stateDict:
        try:
            with open(config.resume_filename) as f:
                config.stateDict = yaml.safe_load(f)
        except:
            log.err("Error loading YAML file")
            raise InvalidResumeFile

        if not config.stateDict:
            with open(config.resume_filename, 'w+') as f:
                yaml.safe_dump(dict(), f)
            config.stateDict = dict()
<commit_msg>Remove now unused and dead code<commit_after>import os
import time
import random

import yaml

from twisted.internet import defer
from twisted.internet import reactor

from ooni import config
from ooni.reporter import OONIBReporter, YAMLReporter, OONIBReportError
from ooni.inputunit import InputUnitFactory
from ooni.nettest import NetTestCase, NoPostProcessor
from ooni.utils import log, checkForRoot, pushFilenameStack
from ooni.utils import NotRootError, Storage
from ooni.utils.net import randomFreePort

class InvalidResumeFile(Exception):
    pass

class noResumeSession(Exception):
    pass

def loadResumeFile():
    """
    Sets the singleton stateDict object to the content of the resume file.
    If the file is empty then it will create an empty one.

    Raises:

        :class:ooni.runner.InvalidResumeFile if the resume file is not valid

    """
    if not config.stateDict:
        try:
            with open(config.resume_filename) as f:
                config.stateDict = yaml.safe_load(f)
        except:
            log.err("Error loading YAML file")
            raise InvalidResumeFile

        if not config.stateDict:
            with open(config.resume_filename, 'w+') as f:
                yaml.safe_dump(dict(), f)
            config.stateDict = dict()

{'fraction_non_alphanumeric': 0.06192851205320033, 'fraction_numerical': 0.0, 'mean_word_length': 2.894822006472492, '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': '7436329', 'n_tokens_mistral': 687, 'n_tokens_neox': 662, 'n_words': 233}