





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 	_UpperCAmelCase						( _lowercase       ):
					__A        = "mock"




					def __init__(    self     ,   *__lowerCAmelCase     ,   __lowerCAmelCase     ,   **__lowerCAmelCase							)    ->	List[Any]:
							super().__init__()
							UpperCamelCase__								=						LocalFileSystem(*__lowerCAmelCase     ,   **__lowerCAmelCase							)
							UpperCamelCase__								=						Path(__lowerCAmelCase							).resolve().as_posix() + """/"""




					def 						snake_case_		(    self     ,   __lowerCAmelCase     ,   *__lowerCAmelCase     ,   **__lowerCAmelCase							)    ->	Optional[int]:
							UpperCamelCase__								=						posixpath.join(self.local_root_dir     ,   self._strip_protocol(__lowerCAmelCase							)							)
							return self._fs.mkdir(__lowerCAmelCase     ,   *__lowerCAmelCase     ,   **__lowerCAmelCase							)




					def 						snake_case_		(    self     ,   __lowerCAmelCase     ,   *__lowerCAmelCase     ,   **__lowerCAmelCase							)    ->	Dict:
							UpperCamelCase__								=						posixpath.join(self.local_root_dir     ,   self._strip_protocol(__lowerCAmelCase							)							)
							return self._fs.makedirs(__lowerCAmelCase     ,   *__lowerCAmelCase     ,   **__lowerCAmelCase							)




					def 						snake_case_		(    self     ,   __lowerCAmelCase							)    ->	Optional[int]:
							UpperCamelCase__								=						posixpath.join(self.local_root_dir     ,   self._strip_protocol(__lowerCAmelCase							)							)
							return self._fs.rmdir(__lowerCAmelCase							)




					def 						snake_case_		(    self     ,   __lowerCAmelCase     ,   __lowerCAmelCase=True     ,   *__lowerCAmelCase     ,   **__lowerCAmelCase							)    ->	int:
							UpperCamelCase__								=						posixpath.join(self.local_root_dir     ,   self._strip_protocol(__lowerCAmelCase							)							)
							UpperCamelCase__								=						self._fs.ls(__lowerCAmelCase     ,   detail=__lowerCAmelCase     ,   *__lowerCAmelCase     ,   **__lowerCAmelCase							)
							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 						snake_case_		(    self     ,   __lowerCAmelCase     ,   *__lowerCAmelCase     ,   **__lowerCAmelCase							)    ->	Tuple:
							UpperCamelCase__								=						posixpath.join(self.local_root_dir     ,   self._strip_protocol(__lowerCAmelCase							)							)
							UpperCamelCase__								=						dict(self._fs.info(__lowerCAmelCase     ,   *__lowerCAmelCase     ,   **__lowerCAmelCase							)							)
							UpperCamelCase__								=						out["""name"""][len(self.local_root_dir							) :]
							return out




					def 						snake_case_		(    self     ,   __lowerCAmelCase     ,   __lowerCAmelCase     ,   *__lowerCAmelCase     ,   **__lowerCAmelCase							)    ->	Tuple:
							UpperCamelCase__								=						posixpath.join(self.local_root_dir     ,   self._strip_protocol(__lowerCAmelCase							)							)
							UpperCamelCase__								=						posixpath.join(self.local_root_dir     ,   self._strip_protocol(__lowerCAmelCase							)							)
							return self._fs.cp_file(__lowerCAmelCase     ,   __lowerCAmelCase     ,   *__lowerCAmelCase     ,   **__lowerCAmelCase							)




					def 						snake_case_		(    self     ,   __lowerCAmelCase     ,   *__lowerCAmelCase     ,   **__lowerCAmelCase							)    ->	str:
							UpperCamelCase__								=						posixpath.join(self.local_root_dir     ,   self._strip_protocol(__lowerCAmelCase							)							)
							return self._fs.rm_file(__lowerCAmelCase     ,   *__lowerCAmelCase     ,   **__lowerCAmelCase							)




					def 						snake_case_		(    self     ,   __lowerCAmelCase     ,   *__lowerCAmelCase     ,   **__lowerCAmelCase							)    ->	List[str]:
							UpperCamelCase__								=						posixpath.join(self.local_root_dir     ,   self._strip_protocol(__lowerCAmelCase							)							)
							return self._fs.rm(__lowerCAmelCase     ,   *__lowerCAmelCase     ,   **__lowerCAmelCase							)




					def 						snake_case_		(    self     ,   __lowerCAmelCase     ,   *__lowerCAmelCase     ,   **__lowerCAmelCase							)    ->	Tuple:
							UpperCamelCase__								=						posixpath.join(self.local_root_dir     ,   self._strip_protocol(__lowerCAmelCase							)							)
							return self._fs._open(__lowerCAmelCase     ,   *__lowerCAmelCase     ,   **__lowerCAmelCase							)




					def 						snake_case_		(    self     ,   __lowerCAmelCase							)    ->	Dict:
							UpperCamelCase__								=						posixpath.join(self.local_root_dir     ,   self._strip_protocol(__lowerCAmelCase							)							)
							return self._fs.created(__lowerCAmelCase							)




					def 						snake_case_		(    self     ,   __lowerCAmelCase							)    ->	Tuple:
							UpperCamelCase__								=						posixpath.join(self.local_root_dir     ,   self._strip_protocol(__lowerCAmelCase							)							)
							return self._fs.modified(__lowerCAmelCase							)




					@classmethod
					def 						snake_case_		(    cls     ,   __lowerCAmelCase							)    ->	int:
							UpperCamelCase__								=						stringify_path(__lowerCAmelCase							)
							if path.startswith("""mock://"""							):
									UpperCamelCase__								=						path[7:]
							return path




class 	_UpperCAmelCase						( _lowercase       ):
					__A        = "tmp"
					__A        = None




					def __init__(    self     ,   *__lowerCAmelCase     ,   **__lowerCAmelCase							)    ->	int:
							assert self.tmp_dir is not None, "TmpDirFileSystem.tmp_dir is not set"
							super().__init__(*__lowerCAmelCase     ,   **__lowerCAmelCase     ,   local_root_dir=self.tmp_dir     ,   auto_mkdir=__lowerCAmelCase							)




					@classmethod
					def 						snake_case_		(    cls     ,   __lowerCAmelCase							)    ->	Tuple:
							UpperCamelCase__								=						stringify_path(__lowerCAmelCase							)
							if path.startswith("""tmp://"""							):
									UpperCamelCase__								=						path[6:]
							return path



@pytest.fixture
def      a    (   )  ->Tuple:
		UpperCamelCase__								=						MockFileSystem
		UpperCamelCase__								=						TmpDirFileSystem
		yield
		del _fsspec_registry["mock"]
		del _fsspec_registry["tmp"]

@pytest.fixture
def      a    (   _lowercase :  str			,    _lowercase :  Optional[int]							)  ->Any:
		UpperCamelCase__								=						tmp_path_factory.mktemp("""mockfs"""							)
		return MockFileSystem(local_root_dir=_lowercase			,    auto_mkdir=_lowercase							)

@pytest.fixture
def      a    (   _lowercase :  List[str]			,    _lowercase :  Tuple							)  ->Any:
		UpperCamelCase__								=						tmp_path_factory.mktemp("""tmpfs"""							)
		with patch.object(_lowercase			,    """tmp_dir"""			,    _lowercase							):
				yield TmpDirFileSystem()












def      a    (   _lowercase :  Dict			,    _lowercase :  List[str]							)  ->List[Any]:
		if len(str(_lowercase							)							) == 1 or len(str(_lowercase							)							) == 1:
				return a * b

		UpperCamelCase__								=						max(len(str(_lowercase							)							)			,    len(str(_lowercase							)							)							)
		UpperCamelCase__								=						ma // 2

		UpperCamelCase__	,      UpperCamelCase__								=						divmod(_lowercase			,    1_0**ma							)
		UpperCamelCase__	,      UpperCamelCase__								=						divmod(_lowercase			,    1_0**ma							)

		UpperCamelCase__								=						karatsuba(_lowercase			,    _lowercase							)
		UpperCamelCase__								=						karatsuba((aa + aa)			,    (ba + ba)							)
		UpperCamelCase__								=						karatsuba(_lowercase			,    _lowercase							)

		return (z * 1_0 ** (2 * ma)) + ((y - z - x) * 1_0 ** (ma)) + (x)

def      a    (   )  ->List[Any]:
		print(karatsuba(1_5_4_6_3			,    2_3_4_8_9							)							)


if __name__ == "__main__":
				main()





