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
18abff95
Commit
18abff95
authored
Sep 19, 2008
by
willmcgugan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tweaks
parent
42856dfb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
7 deletions
+3
-7
fs/utils.py
+3
-7
No files found.
fs/utils.py
View file @
18abff95
...
@@ -4,7 +4,6 @@ import shutil
...
@@ -4,7 +4,6 @@ import shutil
from
mountfs
import
MountFS
from
mountfs
import
MountFS
def
copyfile
(
src_fs
,
src_path
,
dst_fs
,
dst_path
,
chunk_size
=
1024
*
16
):
def
copyfile
(
src_fs
,
src_path
,
dst_fs
,
dst_path
,
chunk_size
=
1024
*
16
):
"""Copy a file from one filesystem to another. Will use system copyfile, if both files have a syspath.
"""Copy a file from one filesystem to another. Will use system copyfile, if both files have a syspath.
Otherwise file will be copied a chunk at a time.
Otherwise file will be copied a chunk at a time.
...
@@ -15,7 +14,6 @@ def copyfile(src_fs, src_path, dst_fs, dst_path, chunk_size=1024*16):
...
@@ -15,7 +14,6 @@ def copyfile(src_fs, src_path, dst_fs, dst_path, chunk_size=1024*16):
chunk_size -- Size of chunks to move if system copyfile is not available (default 16K)
chunk_size -- Size of chunks to move if system copyfile is not available (default 16K)
"""
"""
src_syspath
=
src_fs
.
getsyspath
(
src_path
,
default
=
""
)
src_syspath
=
src_fs
.
getsyspath
(
src_path
,
default
=
""
)
dst_syspath
=
dst_fs
.
getsyspath
(
dst_path
,
default
=
""
)
dst_syspath
=
dst_fs
.
getsyspath
(
dst_path
,
default
=
""
)
...
@@ -100,7 +98,7 @@ def movedir(fs1, fs2, ignore_errors=False, chunk_size=16384):
...
@@ -100,7 +98,7 @@ def movedir(fs1, fs2, ignore_errors=False, chunk_size=16384):
fs1
=
fs1
.
opendir
(
dir1
)
fs1
=
fs1
.
opendir
(
dir1
)
if
isinstance
(
fs2
,
tuple
):
if
isinstance
(
fs2
,
tuple
):
fs2
,
dir2
=
fs2
fs2
,
dir2
=
fs2
fs2
=
fs
1
.
opendir
(
dir2
)
fs2
=
fs
2
.
opendir
(
dir2
)
mount_fs
=
MountFS
()
mount_fs
=
MountFS
()
mount_fs
.
mount
(
'dir1'
,
fs1
)
mount_fs
.
mount
(
'dir1'
,
fs1
)
...
@@ -121,7 +119,7 @@ def copydir(fs1, fs2, ignore_errors=False, chunk_size=16384):
...
@@ -121,7 +119,7 @@ def copydir(fs1, fs2, ignore_errors=False, chunk_size=16384):
fs1
=
fs1
.
opendir
(
dir1
)
fs1
=
fs1
.
opendir
(
dir1
)
if
isinstance
(
fs2
,
tuple
):
if
isinstance
(
fs2
,
tuple
):
fs2
,
dir2
=
fs2
fs2
,
dir2
=
fs2
fs2
=
fs
1
.
opendir
(
dir2
)
fs2
=
fs
2
.
opendir
(
dir2
)
mount_fs
=
MountFS
()
mount_fs
=
MountFS
()
mount_fs
.
mount
(
'dir1'
,
fs1
)
mount_fs
.
mount
(
'dir1'
,
fs1
)
...
@@ -129,11 +127,9 @@ def copydir(fs1, fs2, ignore_errors=False, chunk_size=16384):
...
@@ -129,11 +127,9 @@ def copydir(fs1, fs2, ignore_errors=False, chunk_size=16384):
mount_fs
.
movedir
(
'dir1'
,
'dir2'
,
ignore_errors
=
ignore_errors
,
chunk_size
=
chunk_size
)
mount_fs
.
movedir
(
'dir1'
,
'dir2'
,
ignore_errors
=
ignore_errors
,
chunk_size
=
chunk_size
)
def
countbytes
(
count_fs
):
def
countbytes
(
count_fs
):
"""Returns the total number of bytes contained within files in a filesystem.
"""Returns the total number of bytes contained within files in a filesystem.
count_fs -- A filesystem object
count_fs -- A filesystem object
"""
"""
total
=
sum
(
count_fs
.
getsize
(
f
)
for
f
in
count_fs
.
walkfiles
())
total
=
sum
(
count_fs
.
getsize
(
f
)
for
f
in
count_fs
.
walkfiles
(
absolute
=
True
))
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