def __init__(self, *args, **kwargs): """Abstract initialization of `FTPHost` object.""" # store arguments for later operations self._args = args self._kwargs = kwargs # make a session according to these arguments self._session = self._make_session() # simulate os.path self.path = ftp_path._Path(self) # lstat, stat, listdir services self._stat = ftp_stat._Stat(self) self.stat_cache = self._stat._lstat_cache self.stat_cache.enable() # save (cache) current directory self._current_dir = ftp_error._try_with_oserror(self._session.pwd) # associated `FTPHost` objects for data transfer self._children = [] # now opened self.closed = False # set curdir, pardir etc. for the remote host; RFC 959 states # that this is, strictly spoken, dependent on the server OS # but it seems to work at least with Unix and Windows # servers self.curdir, self.pardir, self.sep = '.', '..', '/' # set default time shift (used in `upload_if_newer` and # `download_if_newer`) self.set_time_shift(0.0)
def __init__(self, *args, **kwargs): """Abstract initialization of `FTPHost` object.""" # Store arguments for later operations. self._args = args self._kwargs = kwargs #XXX Maybe put the following in a `reset` method. # The time shift setting shouldn't be reset though. # Make a session according to these arguments. self._session = self._make_session() # Simulate `os.path`. self.path = ftp_path._Path(self) # lstat, stat, listdir services. self._stat = ftp_stat._Stat(self) self.stat_cache = self._stat._lstat_cache self.stat_cache.enable() self._cached_current_dir = \ ftp_error._try_with_oserror(self._session.pwd) # Associated `FTPHost` objects for data transfer. self._children = [] # This is only set to something else than `None` if this instance # represents an `_FTPFile`. self._file = None # Now opened. self.closed = False # Set curdir, pardir etc. for the remote host. RFC 959 states # that this is, strictly speaking, dependent on the server OS # but it seems to work at least with Unix and Windows # servers. self.curdir, self.pardir, self.sep = '.', '..', '/' # Set default time shift (used in `upload_if_newer` and # `download_if_newer`). self.set_time_shift(0.0)
def __init__(self, *args, **kwargs): """Abstract initialization of `FTPHost` object.""" # Store arguments for later operations self._args = args self._kwargs = kwargs #XXX Maybe put the following in a `reset` method. # The time shift setting shouldn't be reset though. # Make a session according to these arguments self._session = self._make_session() # Simulate os.path self.path = ftp_path._Path(self) # lstat, stat, listdir services self._stat = ftp_stat._Stat(self) self.stat_cache = self._stat._lstat_cache self.stat_cache.enable() self._cached_current_dir = \ ftp_error._try_with_oserror(self._session.pwd) # Associated `FTPHost` objects for data transfer self._children = [] # This is only set to something else than `None` if this instance # represents an `_FTPFile`. self._file = None # Now opened self.closed = False # Set curdir, pardir etc. for the remote host. RFC 959 states # that this is, strictly speaking, dependent on the server OS # but it seems to work at least with Unix and Windows # servers. self.curdir, self.pardir, self.sep = '.', '..', '/' # Set default time shift (used in `upload_if_newer` and # `download_if_newer`). self.set_time_shift(0.0)
def test_stat(): host = test_base.ftp_host_factory() stat = ftp_stat._Stat(host) # use Unix format parser explicitly stat._parser = ftp_stat.UnixParser() return stat