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
39ef2b67
Commit
39ef2b67
authored
Jan 11, 2012
by
willmcgugan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed DeleteRootError to RemoveRootError for consistency
parent
60da3d53
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
16 additions
and
16 deletions
+16
-16
fs/errors.py
+3
-3
fs/ftpfs.py
+1
-1
fs/memoryfs.py
+3
-3
fs/mountfs.py
+1
-1
fs/multifs.py
+1
-1
fs/osfs/__init__.py
+1
-1
fs/osfs/watch_win32.py
+0
-0
fs/s3fs.py
+1
-1
fs/sftpfs.py
+1
-1
fs/tests/__init__.py
+1
-1
fs/utils.py
+2
-2
fs/wrapfs/subfs.py
+1
-1
No files found.
fs/errors.py
View file @
39ef2b67
...
@@ -18,7 +18,7 @@ __all__ = ['FSError',
...
@@ -18,7 +18,7 @@ __all__ = ['FSError',
'PermissionDeniedError'
,
'PermissionDeniedError'
,
'FSClosedError'
,
'FSClosedError'
,
'OperationTimeoutError'
,
'OperationTimeoutError'
,
'
Delet
eRootError'
,
'
Remov
eRootError'
,
'ResourceError'
,
'ResourceError'
,
'NoSysPathError'
,
'NoSysPathError'
,
'NoMetaError'
,
'NoMetaError'
,
...
@@ -120,8 +120,8 @@ class OperationTimeoutError(OperationFailedError):
...
@@ -120,8 +120,8 @@ class OperationTimeoutError(OperationFailedError):
default_message
=
"Unable to
%(opname)
s: operation timed out"
default_message
=
"Unable to
%(opname)
s: operation timed out"
class
Delet
eRootError
(
OperationFailedError
):
class
Remov
eRootError
(
OperationFailedError
):
default_message
=
"Can't
delet
e root dir"
default_message
=
"Can't
remov
e root dir"
class
ResourceError
(
FSError
):
class
ResourceError
(
FSError
):
...
...
fs/ftpfs.py
View file @
39ef2b67
...
@@ -1300,7 +1300,7 @@ class FTPFS(FS):
...
@@ -1300,7 +1300,7 @@ class FTPFS(FS):
if
self
.
isfile
(
path
):
if
self
.
isfile
(
path
):
raise
ResourceInvalidError
(
path
)
raise
ResourceInvalidError
(
path
)
if
normpath
(
path
)
in
(
''
,
'/'
):
if
normpath
(
path
)
in
(
''
,
'/'
):
raise
Delet
eRootError
(
path
)
raise
Remov
eRootError
(
path
)
if
not
force
:
if
not
force
:
for
_checkpath
in
self
.
listdir
(
path
):
for
_checkpath
in
self
.
listdir
(
path
):
...
...
fs/memoryfs.py
View file @
39ef2b67
...
@@ -452,7 +452,7 @@ class MemoryFS(FS):
...
@@ -452,7 +452,7 @@ class MemoryFS(FS):
def
removedir
(
self
,
path
,
recursive
=
False
,
force
=
False
):
def
removedir
(
self
,
path
,
recursive
=
False
,
force
=
False
):
path
=
normpath
(
path
)
path
=
normpath
(
path
)
if
path
in
(
''
,
'/'
):
if
path
in
(
''
,
'/'
):
raise
Delet
eRootError
(
path
)
raise
Remov
eRootError
(
path
)
dir_entry
=
self
.
_get_dir_entry
(
path
)
dir_entry
=
self
.
_get_dir_entry
(
path
)
if
dir_entry
is
None
:
if
dir_entry
is
None
:
...
@@ -469,13 +469,13 @@ class MemoryFS(FS):
...
@@ -469,13 +469,13 @@ class MemoryFS(FS):
rpathname
,
dirname
=
pathsplit
(
rpathname
)
rpathname
,
dirname
=
pathsplit
(
rpathname
)
parent_dir
=
self
.
_get_dir_entry
(
rpathname
)
parent_dir
=
self
.
_get_dir_entry
(
rpathname
)
if
not
dirname
:
if
not
dirname
:
raise
Delet
eRootError
(
path
)
raise
Remov
eRootError
(
path
)
del
parent_dir
.
contents
[
dirname
]
del
parent_dir
.
contents
[
dirname
]
else
:
else
:
pathname
,
dirname
=
pathsplit
(
path
)
pathname
,
dirname
=
pathsplit
(
path
)
parent_dir
=
self
.
_get_dir_entry
(
pathname
)
parent_dir
=
self
.
_get_dir_entry
(
pathname
)
if
not
dirname
:
if
not
dirname
:
raise
Delet
eRootError
(
path
)
raise
Remov
eRootError
(
path
)
del
parent_dir
.
contents
[
dirname
]
del
parent_dir
.
contents
[
dirname
]
@synchronize
@synchronize
...
...
fs/mountfs.py
View file @
39ef2b67
...
@@ -332,7 +332,7 @@ class MountFS(FS):
...
@@ -332,7 +332,7 @@ class MountFS(FS):
def
removedir
(
self
,
path
,
recursive
=
False
,
force
=
False
):
def
removedir
(
self
,
path
,
recursive
=
False
,
force
=
False
):
path
=
normpath
(
path
)
path
=
normpath
(
path
)
if
path
in
(
''
,
'/'
):
if
path
in
(
''
,
'/'
):
raise
Delet
eRootError
(
path
)
raise
Remov
eRootError
(
path
)
fs
,
_mount_path
,
delegate_path
=
self
.
_delegate
(
path
)
fs
,
_mount_path
,
delegate_path
=
self
.
_delegate
(
path
)
if
fs
is
self
or
fs
is
None
:
if
fs
is
self
or
fs
is
None
:
raise
ResourceInvalidError
(
path
,
msg
=
"Can not removedir for an un-mounted path"
)
raise
ResourceInvalidError
(
path
,
msg
=
"Can not removedir for an un-mounted path"
)
...
...
fs/multifs.py
View file @
39ef2b67
...
@@ -294,7 +294,7 @@ class MultiFS(FS):
...
@@ -294,7 +294,7 @@ class MultiFS(FS):
if
self
.
writefs
is
None
:
if
self
.
writefs
is
None
:
raise
OperationFailedError
(
'removedir'
,
path
=
path
,
msg
=
"No writeable FS set"
)
raise
OperationFailedError
(
'removedir'
,
path
=
path
,
msg
=
"No writeable FS set"
)
if
normpath
(
path
)
in
(
''
,
'/'
):
if
normpath
(
path
)
in
(
''
,
'/'
):
raise
Delet
eRootError
(
path
)
raise
Remov
eRootError
(
path
)
self
.
writefs
.
removedir
(
path
,
recursive
=
recursive
,
force
=
force
)
self
.
writefs
.
removedir
(
path
,
recursive
=
recursive
,
force
=
force
)
@synchronize
@synchronize
...
...
fs/osfs/__init__.py
View file @
39ef2b67
...
@@ -287,7 +287,7 @@ class OSFS(OSFSXAttrMixin, OSFSWatchMixin, FS):
...
@@ -287,7 +287,7 @@ class OSFS(OSFSXAttrMixin, OSFSWatchMixin, FS):
pass
pass
# Don't remove the root directory of this FS
# Don't remove the root directory of this FS
if
path
in
(
''
,
'/'
):
if
path
in
(
''
,
'/'
):
raise
Delet
eRootError
(
path
)
raise
Remov
eRootError
(
path
)
os
.
rmdir
(
sys_path
)
os
.
rmdir
(
sys_path
)
# Using os.removedirs() for this can result in dirs being
# Using os.removedirs() for this can result in dirs being
# removed outside the root of this FS, so we recurse manually.
# removed outside the root of this FS, so we recurse manually.
...
...
fs/osfs/watch_win32.py
View file @
39ef2b67
fs/s3fs.py
View file @
39ef2b67
...
@@ -497,7 +497,7 @@ class S3FS(FS):
...
@@ -497,7 +497,7 @@ class S3FS(FS):
def
removedir
(
self
,
path
,
recursive
=
False
,
force
=
False
):
def
removedir
(
self
,
path
,
recursive
=
False
,
force
=
False
):
"""Remove the directory at the given path."""
"""Remove the directory at the given path."""
if
normpath
(
path
)
in
(
''
,
'/'
):
if
normpath
(
path
)
in
(
''
,
'/'
):
raise
Delet
eRootError
(
path
)
raise
Remov
eRootError
(
path
)
s3path
=
self
.
_s3path
(
path
)
s3path
=
self
.
_s3path
(
path
)
if
s3path
!=
self
.
_prefix
:
if
s3path
!=
self
.
_prefix
:
s3path
=
s3path
+
self
.
_separator
s3path
=
s3path
+
self
.
_separator
...
...
fs/sftpfs.py
View file @
39ef2b67
...
@@ -476,7 +476,7 @@ class SFTPFS(FS):
...
@@ -476,7 +476,7 @@ class SFTPFS(FS):
def
removedir
(
self
,
path
,
recursive
=
False
,
force
=
False
):
def
removedir
(
self
,
path
,
recursive
=
False
,
force
=
False
):
npath
=
self
.
_normpath
(
path
)
npath
=
self
.
_normpath
(
path
)
if
normpath
(
path
)
in
(
''
,
'/'
):
if
normpath
(
path
)
in
(
''
,
'/'
):
raise
Delet
eRootError
(
path
)
raise
Remov
eRootError
(
path
)
if
force
:
if
force
:
for
path2
in
self
.
listdir
(
path
,
absolute
=
True
):
for
path2
in
self
.
listdir
(
path
,
absolute
=
True
):
try
:
try
:
...
...
fs/tests/__init__.py
View file @
39ef2b67
...
@@ -841,7 +841,7 @@ class FSTestCases(object):
...
@@ -841,7 +841,7 @@ class FSTestCases(object):
self
.
assertTrue
(
cmp_datetimes
(
d2
,
info
[
'modified_time'
]))
self
.
assertTrue
(
cmp_datetimes
(
d2
,
info
[
'modified_time'
]))
def
test_removeroot
(
self
):
def
test_removeroot
(
self
):
self
.
assertRaises
(
Delet
eRootError
,
self
.
fs
.
removedir
,
"/"
)
self
.
assertRaises
(
Remov
eRootError
,
self
.
fs
.
removedir
,
"/"
)
# May be disabled - see end of file
# May be disabled - see end of file
class
ThreadingTestCases
(
object
):
class
ThreadingTestCases
(
object
):
...
...
fs/utils.py
View file @
39ef2b67
...
@@ -20,7 +20,7 @@ import stat
...
@@ -20,7 +20,7 @@ import stat
from
fs.mountfs
import
MountFS
from
fs.mountfs
import
MountFS
from
fs.path
import
pathjoin
from
fs.path
import
pathjoin
from
fs.errors
import
DestinationExistsError
,
Delet
eRootError
from
fs.errors
import
DestinationExistsError
,
Remov
eRootError
from
fs.base
import
FS
from
fs.base
import
FS
def
copyfile
(
src_fs
,
src_path
,
dst_fs
,
dst_path
,
overwrite
=
True
,
chunk_size
=
64
*
1024
):
def
copyfile
(
src_fs
,
src_path
,
dst_fs
,
dst_path
,
overwrite
=
True
,
chunk_size
=
64
*
1024
):
...
@@ -206,7 +206,7 @@ def movedir(fs1, fs2, create_destination=True, ignore_errors=False, chunk_size=6
...
@@ -206,7 +206,7 @@ def movedir(fs1, fs2, create_destination=True, ignore_errors=False, chunk_size=6
print
fs1
print
fs1
if
parent_dir1
in
(
''
,
'/'
):
if
parent_dir1
in
(
''
,
'/'
):
raise
Delet
eRootError
(
dir1
)
raise
Remov
eRootError
(
dir1
)
if
isinstance
(
fs2
,
tuple
):
if
isinstance
(
fs2
,
tuple
):
fs2
,
dir2
=
fs2
fs2
,
dir2
=
fs2
...
...
fs/wrapfs/subfs.py
View file @
39ef2b67
...
@@ -61,7 +61,7 @@ class SubFS(WrapFS):
...
@@ -61,7 +61,7 @@ class SubFS(WrapFS):
# Careful not to recurse outside the subdir
# Careful not to recurse outside the subdir
path
=
normpath
(
path
)
path
=
normpath
(
path
)
if
path
in
(
''
,
'/'
):
if
path
in
(
''
,
'/'
):
raise
Delet
eRootError
(
path
)
raise
Remov
eRootError
(
path
)
super
(
SubFS
,
self
)
.
removedir
(
path
,
force
=
force
)
super
(
SubFS
,
self
)
.
removedir
(
path
,
force
=
force
)
if
recursive
:
if
recursive
:
try
:
try
:
...
...
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