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
62e77b6a
Commit
62e77b6a
authored
Jan 02, 2010
by
willmcgugan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimized FTP fs by caching directory structure
parent
72f3d49f
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
6 deletions
+45
-6
ChangeLog
+1
-1
fs/base.py
+43
-0
fs/browsewin.py
+1
-1
fs/ftpfs.py
+0
-0
fs/tests/test_ftpfs.py
+0
-4
No files found.
ChangeLog
View file @
62e77b6a
...
@@ -26,4 +26,4 @@
...
@@ -26,4 +26,4 @@
* New FS implementation:
* New FS implementation:
* FTPFS: access a plain old FTP server
* FTPFS: access a plain old FTP server
* ReadOnlyFS: a WrapFS that makes an fs read-only
* ReadOnlyFS: a WrapFS that makes an fs read-only
* Added cache_hint method to base.py
fs/base.py
View file @
62e77b6a
...
@@ -144,6 +144,16 @@ class FS(object):
...
@@ -144,6 +144,16 @@ class FS(object):
if
not
getattr
(
self
,
'closed'
,
True
):
if
not
getattr
(
self
,
'closed'
,
True
):
self
.
close
()
self
.
close
()
def
cache_hint
(
self
,
enabled
):
"""Recommends the use of caching. Implementations are free to use or
ignore this value.
:param enabled: If True the implementation is permitted to cache directory
structure / file info.
"""
pass
def
close
(
self
):
def
close
(
self
):
self
.
closed
=
True
self
.
closed
=
True
...
@@ -289,6 +299,39 @@ class FS(object):
...
@@ -289,6 +299,39 @@ class FS(object):
"""
"""
raise
UnsupportedError
(
"list directory"
)
raise
UnsupportedError
(
"list directory"
)
def
listdirinfo
(
self
,
path
=
"./"
,
wildcard
=
None
,
full
=
False
,
absolute
=
False
,
dirs_only
=
False
,
files_only
=
False
):
"""Retrieves an iterable of paths and path info (as returned by getinfo) under
a given path.
:param path: Root of the path to list
:param wildcard: Filter paths that mach this wildcard
:dirs_only: Return only directory paths
:files_only: Return only files
:raises ResourceNotFoundError: If the path is not found
:raises ResourceInvalidError: If the path exists, but is not a directory
"""
def
get_path
(
p
):
if
not
full
:
return
pathjoin
(
path
,
p
)
return
[(
p
,
self
.
getinfo
(
get_path
(
p
)))
for
p
in
self
.
_listdir
(
path
,
widcard
=
wildcard
,
full
=
full
,
absolute
=
absolute
,
dirs_only
=
dirs_only
,
files_only
=
files_only
)]
def
_listdir_helper
(
self
,
path
,
entries
,
def
_listdir_helper
(
self
,
path
,
entries
,
wildcard
=
None
,
wildcard
=
None
,
...
...
fs/browsewin.py
View file @
62e77b6a
...
@@ -35,7 +35,7 @@ class InfoFrame(wx.Frame):
...
@@ -35,7 +35,7 @@ class InfoFrame(wx.Frame):
self
.
list_ctrl
.
SetColumnWidth
(
1
,
300
)
self
.
list_ctrl
.
SetColumnWidth
(
1
,
300
)
for
key
in
keys
:
for
key
in
keys
:
self
.
list_ctrl
.
Append
((
key
,
rep
r
(
info
.
get
(
key
))))
self
.
list_ctrl
.
Append
((
key
,
st
r
(
info
.
get
(
key
))))
...
...
fs/ftpfs.py
View file @
62e77b6a
This diff is collapsed.
Click to expand it.
fs/tests/test_ftpfs.py
View file @
62e77b6a
...
@@ -72,7 +72,3 @@ if __name__ == "__main__":
...
@@ -72,7 +72,3 @@ if __name__ == "__main__":
ftpd
=
ftpserver
.
FTPServer
(
address
,
handler
)
ftpd
=
ftpserver
.
FTPServer
(
address
,
handler
)
ftpd
.
serve_forever
()
ftpd
.
serve_forever
()
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