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
d9e83470
Commit
d9e83470
authored
Jun 20, 2010
by
willmcgugan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed a few issues that had accumulated in Google Code, bumped the version up to 0.3.0
parent
4b8eb685
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
17 additions
and
21 deletions
+17
-21
fs/__init__.py
+1
-1
fs/base.py
+5
-4
fs/errors.py
+1
-6
fs/ftpfs.py
+4
-1
fs/memoryfs.py
+2
-5
fs/mountfs.py
+1
-0
fs/multifs.py
+1
-0
fs/tests/__init__.py
+1
-2
fs/zipfs.py
+1
-2
No files found.
fs/__init__.py
View file @
d9e83470
...
@@ -15,7 +15,7 @@ implementations of this interface such as:
...
@@ -15,7 +15,7 @@ implementations of this interface such as:
"""
"""
__version__
=
"0.
2.0a12
"
__version__
=
"0.
3.0
"
__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 @
d9e83470
...
@@ -108,7 +108,7 @@ class NullFile(object):
...
@@ -108,7 +108,7 @@ class NullFile(object):
try
:
try
:
from
functools
import
wraps
from
functools
import
wraps
except
ImportError
:
except
ImportError
:
wraps
=
lambda
f
:
f
wraps
=
lambda
f
:
lambda
f
:
f
def
synchronize
(
func
):
def
synchronize
(
func
):
...
@@ -618,12 +618,12 @@ class FS(object):
...
@@ -618,12 +618,12 @@ class FS(object):
"""Returns the size (in bytes) of a resource.
"""Returns the size (in bytes) of a resource.
:param path: a path to the resource
:param path: a path to the resource
:rtype:integer
:rtype:
integer
:returns: the size of the file
:returns: the size of the file
"""
"""
info
=
self
.
getinfo
(
path
)
info
=
self
.
getinfo
(
path
)
size
=
info
.
get
(
'size'
,
None
)
size
=
info
.
get
(
'size'
,
None
)
if
'size'
is
None
:
if
size
is
None
:
raise
OperationFailedError
(
"get size of resource"
,
path
)
raise
OperationFailedError
(
"get size of resource"
,
path
)
return
size
return
size
...
@@ -843,7 +843,7 @@ class FS(object):
...
@@ -843,7 +843,7 @@ class FS(object):
dir_fs
=
self
.
opendir
(
path
)
dir_fs
=
self
.
opendir
(
path
)
return
dir_fs
return
dir_fs
def
tree
(
self
,
max_levels
=
5
):
def
print
tree
(
self
,
max_levels
=
5
):
"""Prints a tree structure of the FS object to the console
"""Prints a tree structure of the FS object to the console
:param max_levels: The maximum sub-directories to display, defaults to
:param max_levels: The maximum sub-directories to display, defaults to
...
@@ -852,6 +852,7 @@ class FS(object):
...
@@ -852,6 +852,7 @@ class FS(object):
"""
"""
from
fs.utils
import
print_fs
from
fs.utils
import
print_fs
print_fs
(
self
,
max_levels
=
max_levels
)
print_fs
(
self
,
max_levels
=
max_levels
)
tree
=
printtree
def
browse
(
self
):
def
browse
(
self
):
"""Displays the FS tree in a graphical window (requires wxWidgets)"""
"""Displays the FS tree in a graphical window (requires wxWidgets)"""
...
...
fs/errors.py
View file @
d9e83470
...
@@ -13,12 +13,7 @@ from fs.path import *
...
@@ -13,12 +13,7 @@ from fs.path import *
try
:
try
:
from
functools
import
wraps
from
functools
import
wraps
except
ImportError
:
except
ImportError
:
def
wraps
(
func
):
wraps
=
lambda
f
:
lambda
f
:
f
def
decorator
(
wfunc
):
wfunc
.
__name__
==
func
.
__name__
wfunc
.
__doc__
==
func
.
__doc__
wfunc
.
__module__
==
func
.
__module__
return
decorator
class
FSError
(
Exception
):
class
FSError
(
Exception
):
...
...
fs/ftpfs.py
View file @
d9e83470
...
@@ -26,7 +26,10 @@ from time import sleep
...
@@ -26,7 +26,10 @@ from time import sleep
import
datetime
import
datetime
import
re
import
re
from
socket
import
error
as
socket_error
from
socket
import
error
as
socket_error
from
functools
import
wraps
try
:
from
functools
import
wraps
except
ImportError
:
wraps
=
lambda
f
:
lambda
f
:
f
try
:
try
:
from
cStringIO
import
StringIO
from
cStringIO
import
StringIO
...
...
fs/memoryfs.py
View file @
d9e83470
...
@@ -151,7 +151,6 @@ class DirEntry(object):
...
@@ -151,7 +151,6 @@ class DirEntry(object):
self
.
created_time
=
datetime
.
datetime
.
now
()
self
.
created_time
=
datetime
.
datetime
.
now
()
self
.
modified_time
=
self
.
created_time
self
.
modified_time
=
self
.
created_time
self
.
accessed_time
=
self
.
created_time
self
.
accessed_time
=
self
.
created_time
self
.
st_mode
=
0700
self
.
xattrs
=
{}
self
.
xattrs
=
{}
...
@@ -459,8 +458,7 @@ class MemoryFS(FS):
...
@@ -459,8 +458,7 @@ class MemoryFS(FS):
@synchronize
@synchronize
def
_on_close_memory_file
(
self
,
open_file
,
path
,
value
):
def
_on_close_memory_file
(
self
,
open_file
,
path
,
value
):
filepath
,
filename
=
pathsplit
(
path
)
dir_entry
=
self
.
_get_dir_entry
(
path
)
dir_entry
=
self
.
_get_dir_entry
(
path
)
if
dir_entry
is
not
None
and
value
is
not
None
:
if
dir_entry
is
not
None
and
value
is
not
None
:
dir_entry
.
data
=
value
dir_entry
.
data
=
value
...
@@ -468,8 +466,7 @@ class MemoryFS(FS):
...
@@ -468,8 +466,7 @@ class MemoryFS(FS):
self
.
_unlock_dir_entry
(
path
)
self
.
_unlock_dir_entry
(
path
)
@synchronize
@synchronize
def
_on_flush_memory_file
(
self
,
path
,
value
):
def
_on_flush_memory_file
(
self
,
path
,
value
):
filepath
,
filename
=
pathsplit
(
path
)
dir_entry
=
self
.
_get_dir_entry
(
path
)
dir_entry
=
self
.
_get_dir_entry
(
path
)
dir_entry
.
data
=
value
dir_entry
.
data
=
value
...
...
fs/mountfs.py
View file @
d9e83470
...
@@ -334,6 +334,7 @@ class MountFS(FS):
...
@@ -334,6 +334,7 @@ class MountFS(FS):
path
=
normpath
(
path
)
path
=
normpath
(
path
)
del
self
.
mount_tree
[
path
]
del
self
.
mount_tree
[
path
]
@synchronize
def
settimes
(
self
,
path
,
accessed_time
=
None
,
modified_time
=
None
):
def
settimes
(
self
,
path
,
accessed_time
=
None
,
modified_time
=
None
):
path
=
normpath
(
path
)
path
=
normpath
(
path
)
fs
,
mount_path
,
delegate_path
=
self
.
_delegate
(
path
)
fs
,
mount_path
,
delegate_path
=
self
.
_delegate
(
path
)
...
...
fs/multifs.py
View file @
d9e83470
...
@@ -55,6 +55,7 @@ directories::
...
@@ -55,6 +55,7 @@ directories::
from
fs.base
import
FS
,
FSError
,
synchronize
from
fs.base
import
FS
,
FSError
,
synchronize
from
fs.path
import
*
from
fs.path
import
*
from
fs
import
_thread_synchronize_default
from
fs
import
_thread_synchronize_default
from
fs.errors
import
ResourceNotFoundError
class
MultiFS
(
FS
):
class
MultiFS
(
FS
):
...
...
fs/tests/__init__.py
View file @
d9e83470
...
@@ -533,7 +533,6 @@ class FSTestCases(object):
...
@@ -533,7 +533,6 @@ class FSTestCases(object):
fs3
=
pickle
.
loads
(
pickle
.
dumps
(
self
.
fs
,
-
1
))
fs3
=
pickle
.
loads
(
pickle
.
dumps
(
self
.
fs
,
-
1
))
self
.
assert_
(
fs3
.
isfile
(
"test1"
))
self
.
assert_
(
fs3
.
isfile
(
"test1"
))
def
test_big_file
(
self
):
def
test_big_file
(
self
):
chunk_size
=
1024
*
256
chunk_size
=
1024
*
256
num_chunks
=
4
num_chunks
=
4
...
@@ -567,7 +566,7 @@ class FSTestCases(object):
...
@@ -567,7 +566,7 @@ class FSTestCases(object):
"""Test datetime objects are the same to within the timestamp accuracy"""
"""Test datetime objects are the same to within the timestamp accuracy"""
dts1
=
time
.
mktime
(
d1
.
timetuple
())
dts1
=
time
.
mktime
(
d1
.
timetuple
())
dts2
=
time
.
mktime
(
d2
.
timetuple
())
dts2
=
time
.
mktime
(
d2
.
timetuple
())
return
dts1
==
dts2
return
int
(
dts1
)
==
int
(
dts2
)
d1
=
datetime
.
datetime
(
2010
,
6
,
20
,
11
,
0
,
9
,
987699
)
d1
=
datetime
.
datetime
(
2010
,
6
,
20
,
11
,
0
,
9
,
987699
)
d2
=
datetime
.
datetime
(
2010
,
7
,
5
,
11
,
0
,
9
,
500000
)
d2
=
datetime
.
datetime
(
2010
,
7
,
5
,
11
,
0
,
9
,
500000
)
self
.
fs
.
createfile
(
'/dates.txt'
,
'check dates'
)
self
.
fs
.
createfile
(
'/dates.txt'
,
'check dates'
)
...
...
fs/zipfs.py
View file @
d9e83470
...
@@ -126,8 +126,7 @@ class ZipFS(FS):
...
@@ -126,8 +126,7 @@ class ZipFS(FS):
@synchronize
@synchronize
def
open
(
self
,
path
,
mode
=
"r"
,
**
kwargs
):
def
open
(
self
,
path
,
mode
=
"r"
,
**
kwargs
):
path
=
normpath
(
relpath
(
path
))
path
=
normpath
(
relpath
(
path
))
self
.
zip_path
=
path
if
'r'
in
mode
:
if
'r'
in
mode
:
if
self
.
zip_mode
not
in
'ra'
:
if
self
.
zip_mode
not
in
'ra'
:
...
...
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