<commit_before>__author__ = 'sravi'

from jsonschema import validate, ValidationError

sendhub_schema = {
    "title": "SendHub Challenge Schema",
    "type": "object",
    "properties": {
        "message": {
            "type": "string"
        },
        "recipients": {
            "type": "array",
            "minItems": 1,
            "items": {
                "type": "string"
            },
            "uniqueItems": True
        }
    },
    "required": [
        "message",
        "recipients"
    ]
}


def is_valid(data, schema):
    try:
        validate(data, schema)
        return True
    except ValidationError as e:
        return False<commit_msg>regex for 10-digit us phone number validation<commit_after>__author__ = 'sravi'

from jsonschema import validate, ValidationError

sendhub_schema = {
    "title": "SendHub Challenge Schema",
    "type": "object",
    "properties": {
        "message": {
            "type": "string"
        },
        "recipients": {
            "type": "array",
            "minItems": 1,
            "items": {
                "type": "string",
                "pattern": "^\(?\d{3}\)?[\s.-]\d{3}[\s.-]\d{4}$"
            },
            "uniqueItems": True
        }
    },
    "required": [
        "message",
        "recipients"
    ]
}


def is_valid(data, schema):
    try:
        validate(data, schema)
        return True
    except ValidationError as e:
        return False
{'fraction_non_alphanumeric': 0.14444444444444443, 'fraction_numerical': 0.004861111111111111, 'mean_word_length': 1.6440366972477065, 'pattern_counts': {'":': 25, '<': 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': '5179099', 'n_tokens_mistral': 441, 'n_tokens_neox': 424, 'n_words': 97}