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
1865b55d
Commit
1865b55d
authored
Sep 05, 2008
by
willmcgugan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added depth first search for the walk method, added a number of docstrings.
parent
a797dfb3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
147 additions
and
54 deletions
+147
-54
fs/fs.py
+134
-44
fs/memoryfs.py
+2
-2
fs/mountfs.py
+1
-1
fs/multifs.py
+4
-5
fs/osfs.py
+6
-2
No files found.
fs/fs.py
View file @
1865b55d
This diff is collapsed.
Click to expand it.
fs/memoryfs.py
View file @
1865b55d
...
...
@@ -405,13 +405,13 @@ class MemoryFS(FS):
finally
:
self
.
_lock
.
release
()
def
listdir
(
self
,
path
=
"/"
,
wildcard
=
None
,
full
=
False
,
absolute
=
False
,
hidden
=
Fals
e
,
dirs_only
=
False
,
files_only
=
False
):
def
listdir
(
self
,
path
=
"/"
,
wildcard
=
None
,
full
=
False
,
absolute
=
False
,
hidden
=
Tru
e
,
dirs_only
=
False
,
files_only
=
False
):
self
.
_lock
.
acquire
()
try
:
dir_entry
=
self
.
_get_dir_entry
(
path
)
if
dir_entry
is
None
:
raise
ResourceNotFoundError
(
"NO_DIR"
,
path
)
paths
=
dir_entry
.
contents
.
keys
()
paths
=
dir_entry
.
contents
.
keys
()
return
self
.
_listdir_helper
(
path
,
paths
,
wildcard
,
full
,
absolute
,
hidden
,
dirs_only
,
files_only
)
finally
:
self
.
_lock
.
release
()
...
...
fs/mountfs.py
View file @
1865b55d
...
...
@@ -82,7 +82,7 @@ class MountFS(FS):
finally
:
self
.
_lock
.
release
()
def
listdir
(
self
,
path
=
"/"
,
wildcard
=
None
,
full
=
False
,
absolute
=
False
,
hidden
=
Fals
e
,
dirs_only
=
False
,
files_only
=
False
):
def
listdir
(
self
,
path
=
"/"
,
wildcard
=
None
,
full
=
False
,
absolute
=
False
,
hidden
=
Tru
e
,
dirs_only
=
False
,
files_only
=
False
):
self
.
_lock
.
acquire
()
try
:
...
...
fs/multifs.py
View file @
1865b55d
...
...
@@ -96,14 +96,13 @@ class MultiFS(FS):
finally
:
self
.
_lock
.
release
()
def
getsyspath
(
self
,
path
):
def
getsyspath
(
self
,
path
,
allow_none
=
False
):
self
.
_lock
.
acquire
()
try
:
fs
=
self
.
_delegate_search
(
path
)
if
fs
is
not
None
:
return
fs
.
getsyspath
(
path
)
raise
ResourceNotFoundError
(
"NO_FILE"
,
path
)
return
fs
.
getsyspath
(
path
,
allow_none
)
raise
ResourceNotFoundError
(
"NO_RESOURCE"
,
path
)
finally
:
self
.
_lock
.
release
()
...
...
@@ -111,7 +110,7 @@ class MultiFS(FS):
self
.
_lock
.
acquire
()
try
:
if
not
self
.
exists
(
path
):
raise
FS
Error
(
"NO_RESOURCE"
,
path
)
raise
ResourceNotFound
Error
(
"NO_RESOURCE"
,
path
)
name
,
fs
=
self
.
which
(
path
)
if
name
is
None
:
...
...
fs/osfs.py
View file @
1865b55d
...
...
@@ -19,7 +19,7 @@ class OSFS(FS):
def
__str__
(
self
):
return
"<OSFS
\"
%
s
\"
>"
%
self
.
root_path
def
getsyspath
(
self
,
path
,
default
=
Non
e
):
def
getsyspath
(
self
,
path
,
allow_none
=
Fals
e
):
sys_path
=
os
.
path
.
join
(
self
.
root_path
,
makerelative
(
self
.
_resolve
(
path
)))
return
sys_path
...
...
@@ -127,7 +127,6 @@ class OSFS(FS):
def
getsize
(
self
,
path
):
sys_path
=
self
.
getsyspath
(
path
)
try
:
stats
=
os
.
stat
(
sys_path
)
except
OSError
,
e
:
...
...
@@ -140,6 +139,11 @@ class OSFS(FS):
if
__name__
==
"__main__"
:
osfs
=
OSFS
(
"~/projects"
)
for
p
in
osfs
.
walk
(
"tagging-trunk"
,
search
=
'depth'
):
print
p
import
browsewin
browsewin
.
browse
(
osfs
)
...
...
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