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
ca009f83
Commit
ca009f83
authored
Mar 07, 2011
by
willmcgugan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made base FS a context manager that closes itself
parent
2b6f9424
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
fs/base.py
+11
-3
No files found.
fs/base.py
View file @
ca009f83
...
...
@@ -160,8 +160,14 @@ class FS(object):
def
__del__
(
self
):
if
not
getattr
(
self
,
'closed'
,
True
):
self
.
close
()
def
__enter__
(
self
):
return
self
def
__exit__
(
self
,
type
,
value
,
traceback
):
self
.
close
()
def
cache
_
hint
(
self
,
enabled
):
def
cachehint
(
self
,
enabled
):
"""Recommends the use of caching. Implementations are free to use or
ignore this value.
...
...
@@ -172,6 +178,8 @@ class FS(object):
"""
pass
# Depricating cache_hint in favour of no underscore version, for consistency
cache_hint
=
cachehint
def
close
(
self
):
"""Close the filesystem. This will perform any shutdown related
...
...
@@ -783,8 +791,8 @@ class FS(object):
"""
if
path
in
(
''
,
'/'
):
return
self
#
if path in ('', '/'):
#
return self
from
fs.wrapfs.subfs
import
SubFS
if
not
self
.
exists
(
path
):
raise
ResourceNotFoundError
(
path
)
...
...
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