<commit_before>#
# Copyright (C) 2012 - 2021 <NAME> <<EMAIL>>
# SPDX-License-Identifier: MIT
#
"""Utility funtions to process file and file paths.
"""
import functools
import operator
import os.path
import os
import re
import pathlib
import typing

from ..common import (
    GLOB_MARKER, IOInfo, PathOrIOInfoT
)
from .detectors import (
    is_file_stream, is_ioinfo, is_path_obj
)


def get_file_extension(file_path: str) -> str:
    """
    Get file extension from the path `file_path`.
    """
    default = ''

    if not file_path:
        return default

    _ext = os.path.splitext(file_path)[-1]
    if _ext:
        return _ext[1:] if _ext.startswith('.') else _ext

    return default
<commit_msg>fix: remove unused import of operator<commit_after>#
# Copyright (C) 2012 - 2021 <NAME> <<EMAIL>>
# SPDX-License-Identifier: MIT
#
"""Utility funtions to process file and file paths.
"""
import functools
import os.path
import os
import re
import pathlib
import typing

from ..common import (
    GLOB_MARKER, IOInfo, PathOrIOInfoT
)
from .detectors import (
    is_file_stream, is_ioinfo, is_path_obj
)


def get_file_extension(file_path: str) -> str:
    """
    Get file extension from the path `file_path`.
    """
    default = ''

    if not file_path:
        return default

    _ext = os.path.splitext(file_path)[-1]
    if _ext:
        return _ext[1:] if _ext.startswith('.') else _ext

    return default

{'fraction_non_alphanumeric': 0.10603932584269662, 'fraction_numerical': 0.014044943820224719, 'mean_word_length': 3.2921686746987953, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, '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': '1335061', 'n_tokens_mistral': 500, 'n_tokens_neox': 475, 'n_words': 147}