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
396d635e
Commit
396d635e
authored
Sep 28, 2009
by
rfkelly0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more adjustments for new "close" method
parent
d74ba1ec
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
7 deletions
+13
-7
fs/__init__.py
+1
-1
fs/base.py
+1
-0
fs/rpcfs.py
+1
-0
fs/tests/test_remote.py
+8
-4
fs/tests/test_s3fs.py
+2
-2
No files found.
fs/__init__.py
View file @
396d635e
...
@@ -15,7 +15,7 @@ implementations of this interface such as:
...
@@ -15,7 +15,7 @@ implementations of this interface such as:
"""
"""
__version__
=
"0.2.0a
5
"
__version__
=
"0.2.0a
6
"
__author__
=
"Will McGugan (will@willmcgugan.com)"
__author__
=
"Will McGugan (will@willmcgugan.com)"
# 'base' imports * from 'path' and 'errors', so their
# 'base' imports * from 'path' and 'errors', so their
...
...
fs/base.py
View file @
396d635e
...
@@ -701,6 +701,7 @@ class SubFS(FS):
...
@@ -701,6 +701,7 @@ class SubFS(FS):
def
__init__
(
self
,
parent
,
sub_dir
):
def
__init__
(
self
,
parent
,
sub_dir
):
self
.
parent
=
parent
self
.
parent
=
parent
self
.
sub_dir
=
abspath
(
normpath
(
sub_dir
))
self
.
sub_dir
=
abspath
(
normpath
(
sub_dir
))
FS
.
__init__
(
self
,
thread_synchronize
=
False
)
def
__str__
(
self
):
def
__str__
(
self
):
return
"<SubFS:
%
s in
%
s>"
%
(
self
.
sub_dir
,
self
.
parent
)
return
"<SubFS:
%
s in
%
s>"
%
(
self
.
sub_dir
,
self
.
parent
)
...
...
fs/rpcfs.py
View file @
396d635e
...
@@ -106,6 +106,7 @@ class RPCFS(FS):
...
@@ -106,6 +106,7 @@ class RPCFS(FS):
self
.
uri
=
uri
self
.
uri
=
uri
self
.
_transport
=
transport
self
.
_transport
=
transport
self
.
proxy
=
self
.
_make_proxy
()
self
.
proxy
=
self
.
_make_proxy
()
FS
.
__init__
(
self
,
thread_synchronize
=
False
)
def
_make_proxy
(
self
):
def
_make_proxy
(
self
):
kwds
=
dict
(
allow_none
=
True
)
kwds
=
dict
(
allow_none
=
True
)
...
...
fs/tests/test_remote.py
View file @
396d635e
...
@@ -46,13 +46,13 @@ class DisconnectingFS(WrapFS):
...
@@ -46,13 +46,13 @@ class DisconnectingFS(WrapFS):
def
__init__
(
self
,
fs
=
None
):
def
__init__
(
self
,
fs
=
None
):
if
fs
is
None
:
if
fs
is
None
:
fs
=
TempFS
()
fs
=
TempFS
()
super
(
DisconnectingFS
,
self
)
.
__init__
(
fs
)
self
.
_connected
=
True
self
.
_connected
=
random
.
choice
([
True
,
False
])
if
not
self
.
_connected
:
raise
RemoteConnectionError
(
""
)
self
.
_continue
=
True
self
.
_continue
=
True
self
.
_bounce_thread
=
threading
.
Thread
(
target
=
self
.
_bounce
)
self
.
_bounce_thread
=
threading
.
Thread
(
target
=
self
.
_bounce
)
self
.
_bounce_thread
.
start
()
self
.
_bounce_thread
.
start
()
super
(
DisconnectingFS
,
self
)
.
__init__
(
fs
)
if
random
.
choice
([
True
,
False
]):
raise
RemoteConnectionError
(
""
)
def
__getstate__
(
self
):
def
__getstate__
(
self
):
state
=
super
(
DisconnectingFS
,
self
)
.
__getstate__
()
state
=
super
(
DisconnectingFS
,
self
)
.
__getstate__
()
...
@@ -70,13 +70,17 @@ class DisconnectingFS(WrapFS):
...
@@ -70,13 +70,17 @@ class DisconnectingFS(WrapFS):
self
.
_connected
=
not
self
.
_connected
self
.
_connected
=
not
self
.
_connected
def
close
(
self
):
def
close
(
self
):
if
not
self
.
closed
:
self
.
_continue
=
False
self
.
_continue
=
False
self
.
_bounce_thread
.
join
()
self
.
_bounce_thread
.
join
()
self
.
_connected
=
True
self
.
_connected
=
True
self
.
wrapped_fs
.
close
()
self
.
wrapped_fs
.
close
()
super
(
DisconnectingFS
,
self
)
.
close
()
def
disconnecting_wrapper
(
func
):
def
disconnecting_wrapper
(
func
):
"""Method wrapper to raise RemoteConnectionError if not connected."""
"""Method wrapper to raise RemoteConnectionError if not connected."""
if
func
.
__name__
==
"close"
:
return
func
@wraps
(
func
)
@wraps
(
func
)
def
wrapper
(
self
,
*
args
,
**
kwds
):
def
wrapper
(
self
,
*
args
,
**
kwds
):
if
not
self
.
_connected
:
if
not
self
.
_connected
:
...
...
fs/tests/test_s3fs.py
View file @
396d635e
...
@@ -27,11 +27,11 @@ class TestS3FS(unittest.TestCase,FSTestCases,ThreadingTestCases):
...
@@ -27,11 +27,11 @@ class TestS3FS(unittest.TestCase,FSTestCases,ThreadingTestCases):
self
.
fs
.
_s3bukt
.
delete_key
(
k
)
self
.
fs
.
_s3bukt
.
delete_key
(
k
)
def
test_concurrent_copydir
(
self
):
def
test_concurrent_copydir
(
self
):
# makdir() on S3FS is currently not atomic
# mak
e
dir() on S3FS is currently not atomic
pass
pass
def
test_makedir_winner
(
self
):
def
test_makedir_winner
(
self
):
# makdir() on S3FS is currently not atomic
# mak
e
dir() on S3FS is currently not atomic
pass
pass
def
test_multiple_overwrite
(
self
):
def
test_multiple_overwrite
(
self
):
...
...
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