




"""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		( _UpperCAmelCase				):
   lowercase       :  List[Any]      =				'mock'







   def __init__(							self    ,      *SCREAMING_SNAKE_CASE_    ,      SCREAMING_SNAKE_CASE_    ,      **SCREAMING_SNAKE_CASE_ ):
       super().__init__()
       UpperCamelCase				:   int          =							LocalFileSystem(*SCREAMING_SNAKE_CASE_    ,      **SCREAMING_SNAKE_CASE_ )
       UpperCamelCase				:   List[Any]          =							Path(SCREAMING_SNAKE_CASE_ ).resolve().as_posix() + """/"""







   def       a_							(							self    ,      SCREAMING_SNAKE_CASE_    ,      *SCREAMING_SNAKE_CASE_    ,      **SCREAMING_SNAKE_CASE_ ):
       UpperCamelCase				:   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       a_							(							self    ,      SCREAMING_SNAKE_CASE_    ,      *SCREAMING_SNAKE_CASE_    ,      **SCREAMING_SNAKE_CASE_ ):
       UpperCamelCase				:   Dict          =							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       a_							(							self    ,      SCREAMING_SNAKE_CASE_ ):
       UpperCamelCase				:   int          =							posixpath.join(self.local_root_dir    ,      self._strip_protocol(SCREAMING_SNAKE_CASE_ ) )
       return self._fs.rmdir(SCREAMING_SNAKE_CASE_ )







   def       a_							(							self    ,      SCREAMING_SNAKE_CASE_    ,      SCREAMING_SNAKE_CASE_=True    ,      *SCREAMING_SNAKE_CASE_    ,      **SCREAMING_SNAKE_CASE_ ):
       UpperCamelCase				:   Tuple          =							posixpath.join(self.local_root_dir    ,      self._strip_protocol(SCREAMING_SNAKE_CASE_ ) )
       UpperCamelCase				:   Union[str, 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       a_							(							self    ,      SCREAMING_SNAKE_CASE_    ,      *SCREAMING_SNAKE_CASE_    ,      **SCREAMING_SNAKE_CASE_ ):
       UpperCamelCase				:   Optional[Any]          =							posixpath.join(self.local_root_dir    ,      self._strip_protocol(SCREAMING_SNAKE_CASE_ ) )
       UpperCamelCase				:   Any          =							dict(self._fs.info(SCREAMING_SNAKE_CASE_    ,      *SCREAMING_SNAKE_CASE_    ,      **SCREAMING_SNAKE_CASE_ ) )
       UpperCamelCase				:   str          =							out["""name"""][len(self.local_root_dir ) :]
       return out







   def       a_							(							self    ,      SCREAMING_SNAKE_CASE_    ,      SCREAMING_SNAKE_CASE_    ,      *SCREAMING_SNAKE_CASE_    ,      **SCREAMING_SNAKE_CASE_ ):
       UpperCamelCase				:   Optional[int]          =							posixpath.join(self.local_root_dir    ,      self._strip_protocol(SCREAMING_SNAKE_CASE_ ) )
       UpperCamelCase				:   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       a_							(							self    ,      SCREAMING_SNAKE_CASE_    ,      *SCREAMING_SNAKE_CASE_    ,      **SCREAMING_SNAKE_CASE_ ):
       UpperCamelCase				:   Any          =							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       a_							(							self    ,      SCREAMING_SNAKE_CASE_    ,      *SCREAMING_SNAKE_CASE_    ,      **SCREAMING_SNAKE_CASE_ ):
       UpperCamelCase				:   str          =							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       a_							(							self    ,      SCREAMING_SNAKE_CASE_    ,      *SCREAMING_SNAKE_CASE_    ,      **SCREAMING_SNAKE_CASE_ ):
       UpperCamelCase				:   List[Any]          =							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       a_							(							self    ,      SCREAMING_SNAKE_CASE_ ):
       UpperCamelCase				:   List[str]          =							posixpath.join(self.local_root_dir    ,      self._strip_protocol(SCREAMING_SNAKE_CASE_ ) )
       return self._fs.created(SCREAMING_SNAKE_CASE_ )







   def       a_							(							self    ,      SCREAMING_SNAKE_CASE_ ):
       UpperCamelCase				:   Dict          =							posixpath.join(self.local_root_dir    ,      self._strip_protocol(SCREAMING_SNAKE_CASE_ ) )
       return self._fs.modified(SCREAMING_SNAKE_CASE_ )







   @classmethod
   def       a_							(							cls    ,      SCREAMING_SNAKE_CASE_ ):
       UpperCamelCase				:   Optional[Any]          =							stringify_path(SCREAMING_SNAKE_CASE_ )
       if path.startswith("""mock://""" ):
           UpperCamelCase				:   Dict          =							path[7:]
       return path







class 							lowerCamelCase		( _UpperCAmelCase				):
   lowercase       :  int      =				'tmp'
   lowercase       :  List[str]      =				None







   def __init__(							self    ,      *SCREAMING_SNAKE_CASE_    ,      **SCREAMING_SNAKE_CASE_ ):
       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       a_							(							cls    ,      SCREAMING_SNAKE_CASE_ ):
       UpperCamelCase				:   int          =							stringify_path(SCREAMING_SNAKE_CASE_ )
       if path.startswith("""tmp://""" ):
           UpperCamelCase				:   Tuple          =							path[6:]
       return path







@pytest.fixture
def 					A_			(		):







    '''simple docstring'''
    UpperCamelCase				:   Tuple          =							MockFileSystem
    UpperCamelCase				:   str          =							TmpDirFileSystem
    yield
    del _fsspec_registry["mock"]
    del _fsspec_registry["tmp"]
@pytest.fixture
def 					A_			(		snake_case_     :       Union[str, Any]						,snake_case_     :       List[Any]    ):







    '''simple docstring'''
    UpperCamelCase				:   List[str]          =							tmp_path_factory.mktemp("""mockfs"""    )
    return MockFileSystem(local_root_dir=snake_case_						,auto_mkdir=snake_case_    )


@pytest.fixture
def 					A_			(		snake_case_     :       Optional[int]						,snake_case_     :       str    ):







    '''simple docstring'''
    UpperCamelCase				:   Tuple          =							tmp_path_factory.mktemp("""tmpfs"""    )
    with patch.object(snake_case_						,"""tmp_dir"""						,snake_case_    ):
        yield TmpDirFileSystem()










"""simple docstring"""




from ...utils import is_transformers_available
from .pipeline_latent_diffusion_superresolution import LDMSuperResolutionPipeline


if is_transformers_available():
  from .pipeline_latent_diffusion import LDMBertModel, LDMTextToImagePipeline




