<commit_before>__author__ = 'f.zesch'

MALICIOUS_EXPRESSIONS = ["DROP", "TABLE"]

# logic for adding numbers to database

def is_valid_number(number, pattern, min_len=0, max_len=99):
    """
    Checks, whether a number is in a valid format for a pattern given for a location
    To be run before insertion into db
    :param number: number to be checked
    :param pattern: regular expression
    :return: boolean
    """

    return False


def is_ok_with_db(number):
    """
    Checks, that a number to be inserted is no attack on database
    :param number:
    :return: boolean
    """

    # TODO: Very basic security check, please enhance, maybe with library
    if sum([1 for e in MALICIOUS_EXPRESSIONS if e in number])>0:
        return False
    else:
        return True

def is_valid_user(username, location, db_con):
    """
    Checks whether a user is entitled for writing to the database
    :param username: username to be validated
    :param location: location where user wants to write to
    :param db_con: database connection for passing SQL command
    :return:
    """
    return False<commit_msg>changed user validation to "always true" for initial deployment until user management is enabled<commit_after>__author__ = 'f.zesch'

MALICIOUS_EXPRESSIONS = ["DROP", "TABLE", "DELETE"]

# logic for adding numbers to database

def is_valid_number(number, pattern, min_len=0, max_len=99):
    """
    Checks, whether a number is in a valid format for a pattern given for a location
    To be run before insertion into db
    :param number: number to be checked
    :param pattern: regular expression
    :return: boolean
    """

    return False


def is_ok_with_db(number):
    """
    Checks, that a number to be inserted is generally no attack on database
    :param number:
    :return: boolean
    """

    # TODO: Very basic security check, please enhance, maybe with library
    if sum([1 for e in MALICIOUS_EXPRESSIONS if e in number])>0:
        return False
    else:
        return True

def is_valid_user(username, location, db_con):
    """
    Checks whether a user is entitled for writing to the database
    :param username: username to be validated
    :param location: location where user wants to write to
    :param db_con: database connection for passing SQL command
    :return:
    """

    #TODO: Implement user management to validate this. For now, always return true.
    return True
{'fraction_non_alphanumeric': 0.07075277663512958, 'fraction_numerical': 0.004113533525298231, 'mean_word_length': 3.274165202108963, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '5731647', 'n_tokens_mistral': 693, 'n_tokens_neox': 674, 'n_words': 300}