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
cf088572
Commit
cf088572
authored
Oct 04, 2010
by
rfkelly0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
custom listdirinfo() method for WrapFS
parent
6d6533d4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
0 deletions
+23
-0
fs/wrapfs/__init__.py
+23
-0
No files found.
fs/wrapfs/__init__.py
View file @
cf088572
...
...
@@ -167,6 +167,29 @@ class WrapFS(FS):
return
entries
@rewrite_errors
def
listdirinfo
(
self
,
path
=
""
,
**
kwds
):
full
=
kwds
.
pop
(
"full"
,
False
)
absolute
=
kwds
.
pop
(
"absolute"
,
False
)
wildcard
=
kwds
.
pop
(
"wildcard"
,
"*"
)
if
wildcard
is
None
:
wildcard
=
lambda
fn
:
True
elif
not
callable
(
wildcard
):
wildcard_re
=
re
.
compile
(
fnmatch
.
translate
(
wildcard
))
wildcard
=
lambda
fn
:
bool
(
wildcard_re
.
match
(
fn
))
entries
=
[]
enc_path
=
self
.
_encode
(
path
)
for
(
nm
,
info
)
in
self
.
wrapped_fs
.
listdirinfo
(
enc_path
,
**
kwds
):
nm
=
basename
(
self
.
_decode
(
pathjoin
(
enc_path
,
nm
)))
if
not
wildcard
(
nm
):
continue
if
full
:
nm
=
pathjoin
(
path
,
nm
)
elif
absolute
:
nm
=
abspath
(
pathjoin
(
path
,
nm
))
entries
.
append
((
nm
,
info
))
return
entries
@rewrite_errors
def
makedir
(
self
,
path
,
*
args
,
**
kwds
):
return
self
.
wrapped_fs
.
makedir
(
self
.
_encode
(
path
),
*
args
,
**
kwds
)
...
...
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