def get_namespace_from_filepath(filename):
    namespace = os.path.dirname(filename).strip(os.sep).replace(os.sep, config.get('namespace_delimiter'))
    if '{namespace}' in config.get('filename_format'):
        try:
            splitted_filename = os.path.basename(filename).split('.')
            if namespace:
                namespace += config.get('namespace_delimiter')
            namespace += splitted_filename[config.get('filename_format').index('{namespace}')]
        except __HOLE__:
            raise I18nFileLoadError("incorrect file format.")
    return namespace
dataset/ETHPy150Open tuvistavie/python-i18n/i18n/resource_loader.py/get_namespace_from_filepath