<commit_before>import boto3
import json
import re
import collections
import datetime
import pytz

from params import Params


USERS_FOLDER = 'users/'
STATE_FOLDER = 'state/'


def getStateFilename(basename, ext, ord=None):
    name = ''.join((STATE_FOLDER, basename.lower(), '.', ext))
    if ord is not None:
        name = ''.join((name, '.', str(ord)))
    return name


def getUserFilename(user):
    return ''.join((USERS_FOLDER, user.lower()))


def getExpiryTime(max_age=None):
    return datetime.datetime.now(pytz.UTC) - \
        datetime.timedelta(
            seconds=Params.MAX_AGE if max_age is None else max_age)


def getFullHostname(host):
    return ''.join((host, '.', Params.DOMAIN_ROOT))


def getMaxErrors():
    return Params.MAX_ERRORS


def argToTuple(arg):
    if arg is None:
        return ()
    elif isinstance(arg, str):
        return (arg,)
    else:
        return tuple(arg)


def kickManager(session):
    if Params.DO_SNS:
        session.client('sns').publish(
            TopicArn=Params.SNS_TOPIC,
            Message='{"Event":"Change"}',
            )


'''
The tuple returned by S3Bucket.iterStateFiles()
<commit_msg>wrong param name used<commit_after>import boto3
import json
import re
import collections
import datetime
import pytz

from params import Params


USERS_FOLDER = 'users/'
STATE_FOLDER = 'state/'


def getStateFilename(basename, ext, ord=None):
    name = ''.join((STATE_FOLDER, basename.lower(), '.', ext))
    if ord is not None:
        name = ''.join((name, '.', str(ord)))
    return name


def getUserFilename(user):
    return ''.join((USERS_FOLDER, user.lower()))


def getExpiryTime(max_age=None):
    return datetime.datetime.now(pytz.UTC) - \
        datetime.timedelta(
            seconds=Params.MAX_AGE if max_age is None else max_age)


def getFullHostname(host):
    return ''.join((host, '.', Params.DOMAIN_ROOT))


def getMaxErrors():
    return Params.MAX_ERRORS


def argToTuple(arg):
    if arg is None:
        return ()
    elif isinstance(arg, str):
        return (arg,)
    else:
        return tuple(arg)


def kickManager(session):
    if Params.DO_SNS:
        session.client('sns').publish(
            TopicArn=Params.SNS_ARN,
            Message='{"Event":"Change"}',
            )


'''
The tuple returned by S3Bucket.iterStateFiles()

{'fraction_non_alphanumeric': 0.12811693895098883, 'fraction_numerical': 0.0017196904557179708, 'mean_word_length': 3.0259515570934257, 'pattern_counts': {'":': 2, '<': 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': '3147905', 'n_tokens_mistral': 781, 'n_tokens_neox': 756, 'n_words': 185}