<commit_before># -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# pylint: disable=superfluous-parens
# pylint: disable=too-many-arguments
# pylint: disable=too-many-locals

import re
import os


def valid_ip_prefix(ip_prefix):
    """Returns true if input is a valid IP Prefix otherwhise False."""

    pattern = re.compile(r'''
        ^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}  # 1-3 octets
        (?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)            # 4th octet
        (\/([0-9]|[1-2][0-9]|3[0-2]))$                      # prefixlen
        ''', re.VERBOSE)

    if pattern.match(ip_prefix):
        return True
    else:
        return False


def touch(file_path):
    """Touch a file in the same way as touch tool does"""

    try:
        with open(file_path, 'a') as fh:
            os.utime(file_path, None)
    except (OSError, IOError) as error:
        print("Failed to touch file:{fh} error:{err}".format(fh=file_path,
                                                             err=error))
        return False
    else:
        fh.close()
        return True<commit_msg>don't print filename as it is mentioned in exception message<commit_after># -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# pylint: disable=superfluous-parens
# pylint: disable=too-many-arguments
# pylint: disable=too-many-locals

import re
import os


def valid_ip_prefix(ip_prefix):
    """Returns true if input is a valid IP Prefix otherwhise False."""

    pattern = re.compile(r'''
        ^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}  # 1-3 octets
        (?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)            # 4th octet
        (\/([0-9]|[1-2][0-9]|3[0-2]))$                      # prefixlen
        ''', re.VERBOSE)

    if pattern.match(ip_prefix):
        return True
    else:
        return False


def touch(file_path):
    """Touch a file in the same way as touch tool does"""

    try:
        with open(file_path, 'a') as fh:
            os.utime(file_path, None)
    except (OSError, IOError) as error:
        print("Failed to touch file with error:{err}".format(err=error))
        return False
    else:
        fh.close()
        return True
{'fraction_non_alphanumeric': 0.17100371747211895, 'fraction_numerical': 0.041821561338289966, 'mean_word_length': 2.170839469808542, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '99158', 'n_tokens_mistral': 815, 'n_tokens_neox': 775, 'n_words': 174}