File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -71,6 +71,28 @@ def __str__(self):
7171
7272 def close (self ):
7373 # type: () -> None
74+ """Close the filesystem and release any resources.
75+
76+ It is important to call this method when you have finished
77+ working with the filesystem. Some filesystems may not finalize
78+ changes until they are closed (archives for example). You may
79+ call this method explicitly (it is safe to call close multiple
80+ times), or you can use the filesystem as a context manager to
81+ automatically close.
82+
83+ Hint:
84+ Depending on the value of ``auto_clean`` passed when creating
85+ the `TempFS`, the underlying temporary folder may be removed
86+ or not.
87+
88+ Example:
89+ >>> tmp_fs = TempFS(auto_clean=False)
90+ >>> syspath = tmp_fs.getsyspath("/")
91+ >>> tmp_fs.close()
92+ >>> os.path.exists(syspath)
93+ True
94+
95+ """
7496 if self ._auto_clean :
7597 self .clean ()
7698 super (TempFS , self ).close ()
You can’t perform that action at this time.
0 commit comments