def __init__(self, host, user, passwd, port=22, compress=False, timeout=10, keepalive=10): FS.__init__(self) self._user = user self._host = host self._port = port self._client = client = paramiko.SSHClient() self._locale = None try: client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) client.connect( socket.gethostbyname(host), port, user, passwd, compress=compress, timeout=timeout, allow_agent=False,look_for_keys=False ) if keepalive > 0: client.get_transport().set_keepalive(keepalive) self._sftp = client.open_sftp() self._platform = None except (paramiko.ssh_exception.SSHException, # protocol errors paramiko.ssh_exception.NoValidConnectionsError, # connexion errors socket.gaierror, socket.timeout) as e: # TCP errors message = "Unable to create filesystem: {}".format(e) raise errors.CreateFailed(message)
def __init__(self, base_fs: VersionView, synth_files: Optional[Dict[str, bytes]] = None) -> None: FS.__init__(self) self.base_fs = base_fs self.path_dict: Dict[str, _Entry] = {"/": _DirInfo()} self._populate_path_dict_from_base_fs() # Insert the synthetic files synth_files = dict() if synth_files is None else synth_files self._populate_path_dict_from_synth_files(synth_files)
def __init__(self, fs_prims: FSPrimitives) -> None: FS.__init__(self) self.prims = fs_prims _meta = self._meta = { "case_insensitive": os.path.normcase("Aa") != "aa", "network": False, "read_only": False, "supports_rename": False, "thread_safe": True, "unicode_paths": False, "virtual": False, "invalid_path_chars": "\0", }
def __init__( self, base_fs: FS, additions_fs: Optional[FS] = None, deletions_fs: Optional[FS] = None, ) -> None: FS.__init__(self) if additions_fs: self.additions_fs = additions_fs else: self.additions_fs = TempFS() if deletions_fs: _deletions_invariant(deletions_fs) self.deletions_fs = deletions_fs else: self.deletions_fs = TempFS() self.original_base_fs = base_fs self.base_fs = fs.wrap.read_only(base_fs) self.invariant()
def __init__(self, file: Union[BinaryIO, Text], encoding: Text = "utf-8"): """ The interface of rarfile "is made as zipfile-like as possible" see - https://rarfile.readthedocs.io/api.html Thus this init code is a 'copy of' ReadZipFS.__init__ that initilizes self._zip as self._zip = rarfile.RarFile(file) instead self._zip = zipfile.ZipFile(file, "r") The rest of ReadZipFS can be re-used Don't forget to install the 'unrar' utility the RarFile impl rely on """ # skip ReadZipFS.init() by calling FS.__init__ explicitely FS.__init__(self) self._file = file self.encoding = encoding self._zip = RarFile(file) self._directory_fs = None # type: Optional[MemoryFS]
def __init__(self): FS.__init__(self, thread_synchronize=True) self.fs_sequence = [] self.fs_lookup = {}