<commit_before>"""Build_Cloudtrail_Table

Create the CloudTrail Logs table for Athena use.

See the AWS documentation for Athena here:
    http://docs.aws.amazon.com/athena/latest/ug/getting-started.html
"""


import os
import sys
import json
from datetime import datetime, timedelta
import logging
import boto3
from botocore.exceptions import ProfileNotFound
from time import sleep


# These parameters should remain static
TIME                = datetime.utcnow()
AMZ_DATE            = TIME.strftime('%Y%m%dT%H%M%SZ')
DATE_STAMP          = TIME.strftime('%Y%m%d')
PROFILE             = 'sandbox'
LOG_LEVEL           = logging.DEBUG
SUCCESS = "SUCCESS"
FAILED  = "FAILED"

try:
    SESSION = boto3.session.Session(
        profile_name=PROFILE,
        region_name='us-east-1'
    )
except ProfileNotFound as pnf:
    SESSION = boto3.session.Session()


try:
    from urllib import HTTPError, build_opener, HTTPHandler, Request
except ImportError:
    from urllib.error import HTTPError
    from urllib.request import build_opener, HTTPHandler, Request


def send(event, context, response_status, reason=None, response_data=None, physical_resource_id=None):
    response_data = response_data or {}
    response_body = json.dumps(
        {
            'Status': response_status,
            'Reason': reason or "See the details in CloudWatch Log Stream: " + context.log_stream_name,
            'PhysicalResourceId': physical_resource_id or context.log_stream_name,
            'StackId': event['StackId'],
            'RequestId': event['RequestId']
            'LogicalResourceId': event['LogicalResourceId'],
            'Data': {'ConfigJson': response_data}
        }
    )
    logging.debug("Sending Response to CloudFormation")<commit_msg>Added a comma<commit_after>"""Build_Cloudtrail_Table

Create the CloudTrail Logs table for Athena use.

See the AWS documentation for Athena here:
    http://docs.aws.amazon.com/athena/latest/ug/getting-started.html
"""


import os
import sys
import json
from datetime import datetime, timedelta
import logging
import boto3
from botocore.exceptions import ProfileNotFound
from time import sleep


# These parameters should remain static
TIME                = datetime.utcnow()
AMZ_DATE            = TIME.strftime('%Y%m%dT%H%M%SZ')
DATE_STAMP          = TIME.strftime('%Y%m%d')
PROFILE             = 'sandbox'
LOG_LEVEL           = logging.DEBUG
SUCCESS = "SUCCESS"
FAILED  = "FAILED"

try:
    SESSION = boto3.session.Session(
        profile_name=PROFILE,
        region_name='us-east-1'
    )
except ProfileNotFound as pnf:
    SESSION = boto3.session.Session()


try:
    from urllib import HTTPError, build_opener, HTTPHandler, Request
except ImportError:
    from urllib.error import HTTPError
    from urllib.request import build_opener, HTTPHandler, Request


def send(event, context, response_status, reason=None, response_data=None, physical_resource_id=None):
    response_data = response_data or {}
    response_body = json.dumps(
        {
            'Status': response_status,
            'Reason': reason or "See the details in CloudWatch Log Stream: " + context.log_stream_name,
            'PhysicalResourceId': physical_resource_id or context.log_stream_name,
            'StackId': event['StackId'],
            'RequestId': event['RequestId'],
            'LogicalResourceId': event['LogicalResourceId'],
            'Data': {'ConfigJson': response_data}
        }
    )
    logging.debug("Sending Response to CloudFormation")
{'fraction_non_alphanumeric': 0.09424233743912919, 'fraction_numerical': 0.0022916069894013177, 'mean_word_length': 3.2533495736906213, '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': '6686075', 'n_tokens_mistral': 1048, 'n_tokens_neox': 1024, 'n_words': 265}