"""simple docstring"""






import importlib
import shutil
import threading
import warnings
from typing import List

import fsspec
import fsspec.asyn

from . import compression
from .hffilesystem import HfFileSystem


lowerCAmelCase__  :  Optional[int]						     =	importlib.util.find_spec('s3fs') is not None

if _has_safs:
						from .safilesystem import SaFileSystem  # noqa: F401

lowerCAmelCase__  :  List[compression.BaseCompressedFileFileSystem]						     =	[
    compression.BzaFileSystem,
    compression.GzipFileSystem,
    compression.LzaFileSystem,
    compression.XzFileSystem,
    compression.ZstdFileSystem,
]

# Register custom filesystems
for fs_class in COMPRESSION_FILESYSTEMS + [HfFileSystem]:
						if fs_class.protocol in fsspec.registry and fsspec.registry[fs_class.protocol] is not fs_class:
												warnings.warn(F"""A filesystem protocol was already set for {fs_class.protocol} and will be overwritten.""")
						fsspec.register_implementation(fs_class.protocol, fs_class, clobber=True)



def   a_						(					lowerCamelCase       ):
				if "://" in dataset_path:
								UpperCAmelCase__             =							dataset_path.split('://'       )[1]
				return dataset_path



def   a_						(					lowerCamelCase       ):
				if fs is not None and fs.protocol != "file":
								return True
				else:
								return False



def   a_						(					lowerCamelCase					,			lowerCamelCase					,			lowerCamelCase       ):
				UpperCAmelCase__             =							not is_remote_filesystem(lowerCamelCase       )
				if is_local:
								# LocalFileSystem.mv does copy + rm, it is more efficient to simply move a local directory
								shutil.move(fs._strip_protocol(lowerCamelCase       )					,			fs._strip_protocol(lowerCamelCase       )       )
				else:
								fs.mv(lowerCamelCase					,			lowerCamelCase					,			recursive=lowerCamelCase       )







def   a_						(					):
				if hasattr(fsspec.asyn					,			'reset_lock'       ):
								# for future fsspec>2022.05.0
								fsspec.asyn.reset_lock()
				else:
								UpperCAmelCase__             =							None
								UpperCAmelCase__             =							None
								UpperCAmelCase__             =							threading.Lock()




"""simple docstring"""






from typing import TYPE_CHECKING

from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


lowerCAmelCase__  :  str						     =	{
    'configuration_mctct': ['MCTCT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MCTCTConfig'],
    'feature_extraction_mctct': ['MCTCTFeatureExtractor'],
    'processing_mctct': ['MCTCTProcessor'],
}


try:
						if not is_torch_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						lowerCAmelCase__  :  Any						     =	[
						    'MCTCT_PRETRAINED_MODEL_ARCHIVE_LIST',
						    'MCTCTForCTC',
						    'MCTCTModel',
						    'MCTCTPreTrainedModel',
						]


if TYPE_CHECKING:
						from .configuration_mctct import MCTCT_PRETRAINED_CONFIG_ARCHIVE_MAP, MCTCTConfig
						from .feature_extraction_mctct import MCTCTFeatureExtractor
						from .processing_mctct import MCTCTProcessor

						try:
												if not is_torch_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_mctct import MCTCT_PRETRAINED_MODEL_ARCHIVE_LIST, MCTCTForCTC, MCTCTModel, MCTCTPreTrainedModel

else:
						import sys

						lowerCAmelCase__  :  Any						     =	_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)



