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
e7b412f9
Commit
e7b412f9
authored
Sep 10, 2011
by
willmcgugan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed a circular reference issue
parent
c56e8ae6
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
19 deletions
+15
-19
ChangeLog
+1
-0
fs/__init__.py
+1
-1
fs/commands/runner.py
+1
-1
fs/mountfs.py
+1
-1
fs/opener.py
+11
-16
No files found.
ChangeLog
View file @
e7b412f9
...
...
@@ -80,3 +80,4 @@
* Added setcontents_async method to base
* Added `appdirfs` module to abstract per-user application directories
0.5:
fs/__init__.py
View file @
e7b412f9
...
...
@@ -15,7 +15,7 @@ implementations of this interface such as:
"""
__version__
=
"0.4.
0rc
"
__version__
=
"0.4.
1
"
__author__
=
"Will McGugan (will@willmcgugan.com)"
# No longer necessary - WM
...
...
fs/commands/runner.py
View file @
e7b412f9
...
...
@@ -82,7 +82,7 @@ class Command(object):
self
.
verbosity_level
=
0
self
.
terminal_colors
=
not
sys
.
platform
.
startswith
(
'win'
)
and
self
.
is_terminal
()
if
self
.
is_terminal
():
w
,
h
=
getTerminalSize
()
w
,
_
h
=
getTerminalSize
()
self
.
terminal_width
=
w
else
:
self
.
terminal_width
=
80
...
...
fs/mountfs.py
View file @
e7b412f9
...
...
@@ -19,7 +19,7 @@ For example, lets say we have two filesystems containing config files and resour
We can combine these filesystems in to a single filesystem with the following code::
from fs.mountfs import MountFS
combined_fs = MountFS
combined_fs = MountFS
()
combined_fs.mountdir('config', config_fs)
combined_fs.mountdir('resources', resources_fs)
...
...
fs/opener.py
View file @
e7b412f9
...
...
@@ -67,6 +67,7 @@ __all__ = ['OpenerError',
'HTTPOpener'
]
from
fs.path
import
pathsplit
,
join
,
iswildcard
,
normpath
from
fs.filelike
import
FileWrapper
from
os
import
getcwd
import
os.path
import
re
...
...
@@ -117,6 +118,14 @@ def _split_url_path(url):
url
=
'
%
s://
%
s'
%
(
scheme
,
netloc
)
return
url
,
path
class
_FSClosingFile
(
FileWrapper
):
"""A file like object that closes its parent FS when closed itself"""
def
close
(
self
):
fs
=
getattr
(
self
,
'_closefs'
,
None
)
ret
=
super
(
_FSClosingFile
)
.
close
()
if
fs
is
not
None
:
fs
.
close
return
ret
class
OpenerRegistry
(
object
):
...
...
@@ -255,22 +264,8 @@ class OpenerRegistry(object):
fs
,
path
=
self
.
parse
(
fs_url
,
writeable
=
writeable
)
file_object
=
fs
.
open
(
path
,
mode
)
from
fs.filelike
import
FileWrapper
file_object
=
FileWrapper
(
file_object
,
mode
)
# If we just return the file, then fs goes out of scope and closes,
# which may make the file unusable. To get around this, we store a
# reference in the file object to the FS, and patch the file's
# close method to also close the FS.
close
=
file_object
.
close
close_fs
=
fs
def
replace_close
():
ret
=
close
()
close_fs
.
close
()
return
ret
file_object
.
close
=
replace_close
file_object
=
_FSClosingFile
(
file_object
,
mode
)
file_object
.
fs
=
fs
return
file_object
def
getcontents
(
self
,
fs_url
):
...
...
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