# Path: pytablereader/_constant.py
# class Default:
#     ENCODING = "utf-8"
# 
# Path: pytablereader/error.py
# class InvalidFilePathError(PathError):
#     """
#     Exception raised when invalid file path used.
# 
#     TODO: rename the error class
#     """


import os.path
import posixpath
import pathvalidate
import typepy
    import simplejson as json
    import json  # type: ignore # noqa
from urllib.parse import urlparse
from ._constant import Default
from .error import InvalidFilePathError
    from mbstrdecoder import detect_file_encoding
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""





try:
except ImportError:


def get_file_encoding(file_path, encoding):

    if encoding:
        return encoding

    encoding = detect_file_encoding(file_path)
    if not encoding:
        return Default.ENCODING

    return encoding


def get_extension(file_path):
    if typepy.is_null_string(file_path):

# Path: pytablereader/_constant.py
# class Default:
#     ENCODING = "utf-8"
# 
# Path: pytablereader/error.py
# class InvalidFilePathError(PathError):
#     """
#     Exception raised when invalid file path used.
# 
#     TODO: rename the error class
#     """


# Path: pytablereader/_common.py
import os.path
import posixpath
import pathvalidate
import typepy
    import simplejson as json
    import json  # type: ignore # noqa
from urllib.parse import urlparse
from ._constant import Default
from .error import InvalidFilePathError
    from mbstrdecoder import detect_file_encoding

"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""





try:
except ImportError:


def get_file_encoding(file_path, encoding):

    if encoding:
        return encoding

    encoding = detect_file_encoding(file_path)
    if not encoding:
        return Default.ENCODING

    return encoding


def get_extension(file_path):
    if typepy.is_null_string(file_path):

        raise InvalidFilePathError("file path is empty")