<commit_before>import os

from .las import LASHandler as las
from .ply import PLYHandler as ply

io_handlers = {
    'ply': ply,
    'las': las,
    'laz': las,
}


def get_io_handler(path, mode, format=None, overwrite=False):
    if format is None:
        format = os.path.splitext(path)[-1]
    format = format.lower()
    check_format(format)
    io_handler = io_handlers[format]
    return io_handler(path, mode, overwrite=overwrite)


def check_format(format):
    if format in io_handlers:
        pass
    else:
        raise NotImplementedError(
            "File format %s unknown. Implemented formats are: %s" % (format, ', '.join(io_handlers.keys())))<commit_msg>use formats without leading period<commit_after>from .las import LASHandler as las
from .ply import PLYHandler as ply

io_handlers = {
    'ply': ply,
    'las': las,
    'laz': las,
}


def get_io_handler(path, mode, format=None, overwrite=False):
    if format is None:
        format = path.split('.')[-1]
    format = format.lower()
    check_format(format)
    io_handler = io_handlers[format]
    return io_handler(path, mode, overwrite=overwrite)


def check_format(format):
    if format in io_handlers:
        pass
    else:
        raise NotImplementedError(
            "File format %s unknown. Implemented formats are: %s" % (format, ', '.join(io_handlers.keys())))
{'fraction_non_alphanumeric': 0.11529933481152993, 'fraction_numerical': 0.0014781966001478197, 'mean_word_length': 3.23125, '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': '2983398', 'n_tokens_mistral': 448, 'n_tokens_neox': 436, 'n_words': 123}