




"""simple docstring"""

import posixpath
from pathlib import Path
from unittest.mock import patch

import pytest
from fsspec.implementations.local import AbstractFileSystem, LocalFileSystem, stringify_path
from fsspec.registry import _registry as _fsspec_registry
class      lowerCamelCase__      (					lowerCamelCase_     ):
			a__	: List[Any]        =       """mock"""


			def __init__(       self			,	*SCREAMING_SNAKE_CASE			,	SCREAMING_SNAKE_CASE			,	**SCREAMING_SNAKE_CASE							):



					"""simple docstring"""







					super().__init__()
					snake_case						:  Optional[int]        =			LocalFileSystem(*SCREAMING_SNAKE_CASE			,	**SCREAMING_SNAKE_CASE							)
					snake_case						:  Optional[Any]        =			Path(SCREAMING_SNAKE_CASE							).resolve().as_posix() + "/"


			def 							lowerCamelCase_			(       self			,	SCREAMING_SNAKE_CASE			,	*SCREAMING_SNAKE_CASE			,	**SCREAMING_SNAKE_CASE							):



					"""simple docstring"""







					snake_case						:  Union[str, Any]        =			posixpath.join(self.local_root_dir			,	self._strip_protocol(SCREAMING_SNAKE_CASE							)							)
					return self._fs.mkdir(SCREAMING_SNAKE_CASE			,	*SCREAMING_SNAKE_CASE			,	**SCREAMING_SNAKE_CASE							)


			def 							lowerCamelCase_			(       self			,	SCREAMING_SNAKE_CASE			,	*SCREAMING_SNAKE_CASE			,	**SCREAMING_SNAKE_CASE							):



					"""simple docstring"""







					snake_case						:  str        =			posixpath.join(self.local_root_dir			,	self._strip_protocol(SCREAMING_SNAKE_CASE							)							)
					return self._fs.makedirs(SCREAMING_SNAKE_CASE			,	*SCREAMING_SNAKE_CASE			,	**SCREAMING_SNAKE_CASE							)


			def 							lowerCamelCase_			(       self			,	SCREAMING_SNAKE_CASE							):



					"""simple docstring"""







					snake_case						:  int        =			posixpath.join(self.local_root_dir			,	self._strip_protocol(SCREAMING_SNAKE_CASE							)							)
					return self._fs.rmdir(SCREAMING_SNAKE_CASE							)


			def 							lowerCamelCase_			(       self			,	SCREAMING_SNAKE_CASE			,	SCREAMING_SNAKE_CASE=True			,	*SCREAMING_SNAKE_CASE			,	**SCREAMING_SNAKE_CASE							):



					"""simple docstring"""







					snake_case						:  Optional[Any]        =			posixpath.join(self.local_root_dir			,	self._strip_protocol(SCREAMING_SNAKE_CASE							)							)
					snake_case						:  Any        =			self._fs.ls(SCREAMING_SNAKE_CASE			,	detail=SCREAMING_SNAKE_CASE			,	*SCREAMING_SNAKE_CASE			,	**SCREAMING_SNAKE_CASE							)
					if detail:
							return [{**info, "name": info["name"][len(self.local_root_dir							) :]} for info in out]
					else:
							return [name[len(self.local_root_dir							) :] for name in out]


			def 							lowerCamelCase_			(       self			,	SCREAMING_SNAKE_CASE			,	*SCREAMING_SNAKE_CASE			,	**SCREAMING_SNAKE_CASE							):



					"""simple docstring"""







					snake_case						:  Optional[int]        =			posixpath.join(self.local_root_dir			,	self._strip_protocol(SCREAMING_SNAKE_CASE							)							)
					snake_case						:  Union[str, Any]        =			dict(self._fs.info(SCREAMING_SNAKE_CASE			,	*SCREAMING_SNAKE_CASE			,	**SCREAMING_SNAKE_CASE							)							)
					snake_case						:  List[Any]        =			out["name"][len(self.local_root_dir							) :]
					return out


			def 							lowerCamelCase_			(       self			,	SCREAMING_SNAKE_CASE			,	SCREAMING_SNAKE_CASE			,	*SCREAMING_SNAKE_CASE			,	**SCREAMING_SNAKE_CASE							):



					"""simple docstring"""







					snake_case						:  Optional[Any]        =			posixpath.join(self.local_root_dir			,	self._strip_protocol(SCREAMING_SNAKE_CASE							)							)
					snake_case						:  Optional[Any]        =			posixpath.join(self.local_root_dir			,	self._strip_protocol(SCREAMING_SNAKE_CASE							)							)
					return self._fs.cp_file(SCREAMING_SNAKE_CASE			,	SCREAMING_SNAKE_CASE			,	*SCREAMING_SNAKE_CASE			,	**SCREAMING_SNAKE_CASE							)


			def 							lowerCamelCase_			(       self			,	SCREAMING_SNAKE_CASE			,	*SCREAMING_SNAKE_CASE			,	**SCREAMING_SNAKE_CASE							):



					"""simple docstring"""







					snake_case						:  Tuple        =			posixpath.join(self.local_root_dir			,	self._strip_protocol(SCREAMING_SNAKE_CASE							)							)
					return self._fs.rm_file(SCREAMING_SNAKE_CASE			,	*SCREAMING_SNAKE_CASE			,	**SCREAMING_SNAKE_CASE							)


			def 							lowerCamelCase_			(       self			,	SCREAMING_SNAKE_CASE			,	*SCREAMING_SNAKE_CASE			,	**SCREAMING_SNAKE_CASE							):



					"""simple docstring"""







					snake_case						:  Dict        =			posixpath.join(self.local_root_dir			,	self._strip_protocol(SCREAMING_SNAKE_CASE							)							)
					return self._fs.rm(SCREAMING_SNAKE_CASE			,	*SCREAMING_SNAKE_CASE			,	**SCREAMING_SNAKE_CASE							)


			def 							lowerCamelCase_			(       self			,	SCREAMING_SNAKE_CASE			,	*SCREAMING_SNAKE_CASE			,	**SCREAMING_SNAKE_CASE							):



					"""simple docstring"""







					snake_case						:  Tuple        =			posixpath.join(self.local_root_dir			,	self._strip_protocol(SCREAMING_SNAKE_CASE							)							)
					return self._fs._open(SCREAMING_SNAKE_CASE			,	*SCREAMING_SNAKE_CASE			,	**SCREAMING_SNAKE_CASE							)


			def 							lowerCamelCase_			(       self			,	SCREAMING_SNAKE_CASE							):



					"""simple docstring"""







					snake_case						:  List[str]        =			posixpath.join(self.local_root_dir			,	self._strip_protocol(SCREAMING_SNAKE_CASE							)							)
					return self._fs.created(SCREAMING_SNAKE_CASE							)


			def 							lowerCamelCase_			(       self			,	SCREAMING_SNAKE_CASE							):



					"""simple docstring"""







					snake_case						:  Optional[int]        =			posixpath.join(self.local_root_dir			,	self._strip_protocol(SCREAMING_SNAKE_CASE							)							)
					return self._fs.modified(SCREAMING_SNAKE_CASE							)



			@classmethod
			def 							lowerCamelCase_			(       cls			,	SCREAMING_SNAKE_CASE							):



					"""simple docstring"""







					snake_case						:  Optional[Any]        =			stringify_path(SCREAMING_SNAKE_CASE							)
					if path.startswith("mock://"							):
							snake_case						:  str        =			path[7:]
					return path







class      lowerCamelCase__      (					lowerCamelCase_     ):
			a__	: List[str]        =       """tmp"""
			a__	: Optional[int]        =       None


			def __init__(       self			,	*SCREAMING_SNAKE_CASE			,	**SCREAMING_SNAKE_CASE							):



					"""simple docstring"""







					assert self.tmp_dir is not None, "TmpDirFileSystem.tmp_dir is not set"
					super().__init__(*SCREAMING_SNAKE_CASE			,	**SCREAMING_SNAKE_CASE			,	local_root_dir=self.tmp_dir			,	auto_mkdir=SCREAMING_SNAKE_CASE							)



			@classmethod
			def 							lowerCamelCase_			(       cls			,	SCREAMING_SNAKE_CASE							):



					"""simple docstring"""







					snake_case						:  List[Any]        =			stringify_path(SCREAMING_SNAKE_CASE							)
					if path.startswith("tmp://"							):
							snake_case						:  Tuple        =			path[6:]
					return path







@pytest.fixture
def 					UpperCamelCase__       (						):
		snake_case						:  Any        =			MockFileSystem
		snake_case						:  Dict        =			TmpDirFileSystem
		yield
		del _fsspec_registry["mock"]
		del _fsspec_registry["tmp"]



@pytest.fixture
def 					UpperCamelCase__       (						lowercase__					:       Union[str, Any]    ,       lowercase__					:       Any				):
		snake_case						:  Any        =			tmp_path_factory.mktemp("mockfs"				)
		return MockFileSystem(local_root_dir=lowercase__    ,       auto_mkdir=lowercase__				)



@pytest.fixture
def 					UpperCamelCase__       (						lowercase__					:       List[Any]    ,       lowercase__					:       List[Any]				):
		snake_case						:  Optional[Any]        =			tmp_path_factory.mktemp("tmpfs"				)
		with patch.object(lowercase__    ,       "tmp_dir"    ,       lowercase__				):
				yield TmpDirFileSystem()







"""simple docstring"""

from typing import TYPE_CHECKING

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


__A							=     {
    "configuration_flava": [
        "FLAVA_PRETRAINED_CONFIG_ARCHIVE_MAP",
        "FlavaConfig",
        "FlavaImageCodebookConfig",
        "FlavaImageConfig",
        "FlavaMultimodalConfig",
        "FlavaTextConfig",
    ],
}

try:
							if not is_vision_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							__A							=     ["FlavaFeatureExtractor"]
							__A							=     ["FlavaImageProcessor"]
							__A							=     ["FlavaProcessor"]

try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							__A							=     [
							    "FLAVA_PRETRAINED_MODEL_ARCHIVE_LIST",
							    "FlavaForPreTraining",
							    "FlavaImageCodebook",
							    "FlavaImageModel",
							    "FlavaModel",
							    "FlavaMultimodalModel",
							    "FlavaPreTrainedModel",
							    "FlavaTextModel",
							]

if TYPE_CHECKING:
							from .configuration_flava import (
							    FLAVA_PRETRAINED_CONFIG_ARCHIVE_MAP,
							    FlavaConfig,
							    FlavaImageCodebookConfig,
							    FlavaImageConfig,
							    FlavaMultimodalConfig,
							    FlavaTextConfig,
							)

							try:
														if not is_vision_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .feature_extraction_flava import FlavaFeatureExtractor
														from .image_processing_flava import FlavaImageProcessor
														from .processing_flava import FlavaProcessor

							try:
														if not is_torch_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_flava import (
														    FLAVA_PRETRAINED_MODEL_ARCHIVE_LIST,
														    FlavaForPreTraining,
														    FlavaImageCodebook,
														    FlavaImageModel,
														    FlavaModel,
														    FlavaMultimodalModel,
														    FlavaPreTrainedModel,
														    FlavaTextModel,
														)

else:
							import sys

							__A							=     _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)

