File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ def patch_open():
32
32
CloudPath .open ,
33
33
)
34
34
builtins .open = patched
35
+ CloudPath .__fspath__ = lambda x : x # turn off `fspath`
35
36
return patched
36
37
37
38
Original file line number Diff line number Diff line change
1
+ import os
2
+ from cloudpathlib import CloudPath , patch_open , patch_os_functions
3
+
4
+
5
+ def hello (cp ):
6
+ with open (cp , "a" ) as f :
7
+ f .write (" written" )
8
+
9
+
10
+ if __name__ == "__main__" :
11
+ patch_open ()
12
+
13
+ cp = CloudPath ("s3://cloudpathlib-test-bucket/manual/text_file.txt" )
14
+ cp .write_text ("yah" )
15
+
16
+ hello (cp )
17
+
18
+ print (cp .read_text ())
19
+ cp .unlink ()
20
+
21
+ patch_os_functions ()
22
+
23
+ print (list (os .walk ("." )))
24
+ print (list (cp .parent .client ._list_dir (cp .parent , recursive = True )))
25
+ print (list (os .walk (cp .parent )))
You can’t perform that action at this time.
0 commit comments