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
1fd5453a
Commit
1fd5453a
authored
Sep 16, 2008
by
willmcgugan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added optimized getcontents method
parent
6aac4de5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
2 deletions
+16
-2
fs/zipfs.py
+16
-2
No files found.
fs/zipfs.py
View file @
1fd5453a
...
@@ -44,8 +44,8 @@ class _ExceptionProxy(object):
...
@@ -44,8 +44,8 @@ class _ExceptionProxy(object):
class
ZipFS
(
FS
):
class
ZipFS
(
FS
):
def
__init__
(
self
,
zip_file
,
mode
=
"r"
,
compression
=
"deflated"
,
allowZip64
=
False
):
def
__init__
(
self
,
zip_file
,
mode
=
"r"
,
compression
=
"deflated"
,
allowZip64
=
False
,
thread_syncronize
=
True
):
FS
.
__init__
(
self
,
thread_syncronize
=
Tru
e
)
FS
.
__init__
(
self
,
thread_syncronize
=
thread_syncroniz
e
)
if
compression
==
"deflated"
:
if
compression
==
"deflated"
:
compression_type
=
ZIP_DEFLATED
compression_type
=
ZIP_DEFLATED
elif
compression
==
"stored"
:
elif
compression
==
"stored"
:
...
@@ -134,6 +134,20 @@ class ZipFS(FS):
...
@@ -134,6 +134,20 @@ class ZipFS(FS):
finally
:
finally
:
self
.
_lock
.
release
()
self
.
_lock
.
release
()
def
getcontents
(
self
,
path
):
self
.
_lock
.
acquire
()
try
:
if
not
exists
(
path
):
raise
ResourceNotFoundError
(
"NO_FILE"
,
path
)
path
=
normpath
(
path
)
try
:
contents
=
self
.
zf
.
read
(
path
)
except
KeyError
:
raise
ResourceNotFoundError
(
"NO_FILE"
,
path
)
return
contents
finally
:
self
.
_lock
.
release
()
def
_on_write_close
(
self
,
filename
):
def
_on_write_close
(
self
,
filename
):
self
.
_lock
.
acquire
()
self
.
_lock
.
acquire
()
try
:
try
:
...
...
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