Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pyfs
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
pyfs
Commits
29a1ca1c
Commit
29a1ca1c
authored
Apr 20, 2009
by
rfkelly0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
utility method for S3FS: get_total_size
parent
991cf3e8
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
3 deletions
+7
-3
fs/s3fs.py
+5
-1
fs/tests.py
+2
-2
No files found.
fs/s3fs.py
View file @
29a1ca1c
...
@@ -65,7 +65,7 @@ class S3FS(FS):
...
@@ -65,7 +65,7 @@ class S3FS(FS):
# Normalise prefix to this form: path/to/files/
# Normalise prefix to this form: path/to/files/
while
prefix
.
startswith
(
separator
):
while
prefix
.
startswith
(
separator
):
prefix
=
prefix
[
1
:]
prefix
=
prefix
[
1
:]
if
not
prefix
.
endswith
(
separator
):
if
not
prefix
.
endswith
(
separator
)
and
prefix
!=
""
:
prefix
=
prefix
+
separator
prefix
=
prefix
+
separator
self
.
_prefix
=
prefix
self
.
_prefix
=
prefix
FS
.
__init__
(
self
,
thread_syncronize
=
thread_syncronize
)
FS
.
__init__
(
self
,
thread_syncronize
=
thread_syncronize
)
...
@@ -449,3 +449,7 @@ class S3FS(FS):
...
@@ -449,3 +449,7 @@ class S3FS(FS):
self
.
copy
(
src
,
dst
,
overwrite
=
overwrite
)
self
.
copy
(
src
,
dst
,
overwrite
=
overwrite
)
self
.
_s3bukt
.
delete_key
(
self
.
_s3path
(
src
))
self
.
_s3bukt
.
delete_key
(
self
.
_s3path
(
src
))
def
get_total_size
(
self
):
"""Get total size of all files in this FS."""
return
sum
(
k
.
size
for
k
in
self
.
_s3bukt
.
list
(
prefix
=
self
.
_prefix
))
fs/tests.py
View file @
29a1ca1c
...
@@ -711,7 +711,7 @@ class TestAppendZipFS(TestWriteZipFS):
...
@@ -711,7 +711,7 @@ class TestAppendZipFS(TestWriteZipFS):
import
s3fs
import
s3fs
class
TestS3FS
(
TestOSFS
):
class
TestS3FS
(
TestOSFS
):
bucket
=
"test-s3fs
-new
.rfk.id.au"
bucket
=
"test-s3fs.rfk.id.au"
def
setUp
(
self
):
def
setUp
(
self
):
self
.
fs
=
s3fs
.
S3FS
(
self
.
bucket
,
"/unittest/files"
)
self
.
fs
=
s3fs
.
S3FS
(
self
.
bucket
,
"/unittest/files"
)
...
@@ -728,7 +728,7 @@ class TestS3FS(TestOSFS):
...
@@ -728,7 +728,7 @@ class TestS3FS(TestOSFS):
self
.
_clear
()
self
.
_clear
()
for
k
in
self
.
fs
.
_s3bukt
.
list
():
for
k
in
self
.
fs
.
_s3bukt
.
list
():
self
.
fs
.
_s3bukt
.
delete_key
(
k
)
self
.
fs
.
_s3bukt
.
delete_key
(
k
)
#
self.fs._s3conn.delete_bucket(self.bucket)
self
.
fs
.
_s3conn
.
delete_bucket
(
self
.
bucket
)
def
check
(
self
,
p
):
def
check
(
self
,
p
):
return
self
.
fs
.
exists
(
p
)
return
self
.
fs
.
exists
(
p
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment