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
147a2b67
Commit
147a2b67
authored
Jan 31, 2011
by
rfkelly0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow uniform use of logging throughout the module
parent
7ca85974
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
38 additions
and
15 deletions
+38
-15
fs/__init__.py
+13
-0
fs/commands/fsserve.py
+0
-0
fs/contrib/davfs/__init__.py
+5
-5
fs/contrib/tahoefs/__init__.py
+2
-1
fs/expose/dokan/__init__.py
+5
-0
fs/mountfs.py
+5
-2
fs/path.py
+4
-0
fs/remote.py
+0
-5
fs/wrapfs/__init__.py
+2
-1
fs/wrapfs/debugfs.py
+2
-1
No files found.
fs/__init__.py
View file @
147a2b67
...
@@ -45,3 +45,16 @@ import os
...
@@ -45,3 +45,16 @@ import os
SEEK_CUR
=
os
.
SEEK_CUR
SEEK_CUR
=
os
.
SEEK_CUR
SEEK_END
=
os
.
SEEK_END
SEEK_END
=
os
.
SEEK_END
SEEK_SET
=
os
.
SEEK_SET
SEEK_SET
=
os
.
SEEK_SET
# Allow clean use of logging throughout the lib
import
logging
as
_logging
class
_NullHandler
(
_logging
.
Handler
):
def
emit
(
self
,
record
):
pass
_logging
.
getLogger
(
"fs"
)
.
addHandler
(
_NullHandler
())
def
getLogger
(
name
):
"""Get a logger object for use within the pyfilesystem library."""
assert
name
.
startswith
(
"fs."
)
return
_logging
.
getLogger
(
name
)
fs/commands/fsserve.py
View file @
147a2b67
fs/contrib/davfs/__init__.py
View file @
147a2b67
...
@@ -31,6 +31,7 @@ import cookielib
...
@@ -31,6 +31,7 @@ import cookielib
import
fnmatch
import
fnmatch
import
xml.dom.pulldom
import
xml.dom.pulldom
import
fs
from
fs.base
import
*
from
fs.base
import
*
from
fs.path
import
*
from
fs.path
import
*
from
fs.errors
import
*
from
fs.errors
import
*
...
@@ -40,8 +41,7 @@ from fs.contrib.davfs.util import *
...
@@ -40,8 +41,7 @@ from fs.contrib.davfs.util import *
from
fs.contrib.davfs
import
xmlobj
from
fs.contrib.davfs
import
xmlobj
from
fs.contrib.davfs.xmlobj
import
*
from
fs.contrib.davfs.xmlobj
import
*
import
logging
logger
=
fs
.
getLogger
(
"fs.contrib.davfs"
)
logger
=
logging
.
getLogger
(
"fs.contrib.davfs"
)
import
errno
import
errno
_RETRYABLE_ERRORS
=
[
errno
.
EADDRINUSE
]
_RETRYABLE_ERRORS
=
[
errno
.
EADDRINUSE
]
...
@@ -236,7 +236,7 @@ class DAVFS(FS):
...
@@ -236,7 +236,7 @@ class DAVFS(FS):
except
KeyError
:
except
KeyError
:
msg
=
"unsupported protocol: '
%
s'"
%
(
url
.
scheme
,)
msg
=
"unsupported protocol: '
%
s'"
%
(
url
.
scheme
,)
raise
RemoteConnectionError
(
msg
=
msg
)
raise
RemoteConnectionError
(
msg
=
msg
)
#
logger.debug("DAVFS >REQ %s %s/%s",method,url.hostname,url.path)
logger
.
debug
(
"DAVFS >REQ
%
s
%
s/
%
s"
,
method
,
url
.
hostname
,
url
.
path
)
con
=
ConClass
(
url
.
hostname
,
url
.
port
,
timeout
=
self
.
timeout
)
con
=
ConClass
(
url
.
hostname
,
url
.
port
,
timeout
=
self
.
timeout
)
self
.
_add_connection
(
con
)
self
.
_add_connection
(
con
)
try
:
try
:
...
@@ -257,11 +257,11 @@ class DAVFS(FS):
...
@@ -257,11 +257,11 @@ class DAVFS(FS):
resp
=
con
.
getresponse
()
resp
=
con
.
getresponse
()
self
.
_cookiejar
.
extract_cookies
(
FakeResp
(
resp
),
FakeReq
(
con
,
url
.
scheme
,
url
.
path
))
self
.
_cookiejar
.
extract_cookies
(
FakeResp
(
resp
),
FakeReq
(
con
,
url
.
scheme
,
url
.
path
))
except
Exception
,
e
:
except
Exception
,
e
:
#
logger.exception("DAVFS <ERR %s %s/%s",method,url.hostname,url.path)
logger
.
exception
(
"DAVFS <ERR
%
s
%
s/
%
s"
,
method
,
url
.
hostname
,
url
.
path
)
self
.
_del_connection
(
con
)
self
.
_del_connection
(
con
)
raise
raise
else
:
else
:
#
logger.debug("DAVFS <RESP %s %s %s/%s",resp.status,method,url.hostname,url.path)
logger
.
debug
(
"DAVFS <RESP
%
s
%
s
%
s/
%
s"
,
resp
.
status
,
method
,
url
.
hostname
,
url
.
path
)
old_close
=
resp
.
close
old_close
=
resp
.
close
def
new_close
():
def
new_close
():
old_close
()
old_close
()
...
...
fs/contrib/tahoefs/__init__.py
View file @
147a2b67
...
@@ -54,6 +54,7 @@ import stat as statinfo
...
@@ -54,6 +54,7 @@ import stat as statinfo
import
logging
import
logging
from
logging
import
DEBUG
,
INFO
,
ERROR
,
CRITICAL
from
logging
import
DEBUG
,
INFO
,
ERROR
,
CRITICAL
import
fs
import
fs.errors
as
errors
import
fs.errors
as
errors
from
fs.path
import
abspath
,
relpath
,
normpath
,
dirname
,
pathjoin
from
fs.path
import
abspath
,
relpath
,
normpath
,
dirname
,
pathjoin
from
fs
import
FS
,
NullFile
,
_thread_synchronize_default
,
SEEK_END
from
fs
import
FS
,
NullFile
,
_thread_synchronize_default
,
SEEK_END
...
@@ -63,7 +64,7 @@ from fs.base import fnmatch, NoDefaultMeta
...
@@ -63,7 +64,7 @@ from fs.base import fnmatch, NoDefaultMeta
from
util
import
TahoeUtil
from
util
import
TahoeUtil
from
connection
import
Connection
from
connection
import
Connection
logger
=
logging
.
getLogger
(
'fs.tahoefs'
)
logger
=
fs
.
getLogger
(
'fs.tahoefs'
)
def
_fix_path
(
func
):
def
_fix_path
(
func
):
"""Method decorator for automatically normalising paths."""
"""Method decorator for automatically normalising paths."""
...
...
fs/expose/dokan/__init__.py
View file @
147a2b67
...
@@ -83,6 +83,10 @@ else:
...
@@ -83,6 +83,10 @@ else:
from
ctypes.wintypes
import
LPCWSTR
,
WCHAR
from
ctypes.wintypes
import
LPCWSTR
,
WCHAR
kernel32
=
ctypes
.
windll
.
kernel32
kernel32
=
ctypes
.
windll
.
kernel32
import
logging
logger
=
logging
.
getLogger
(
"fs.expose.dokan"
)
# Options controlling the behaiour of the Dokan filesystem
# Options controlling the behaiour of the Dokan filesystem
DOKAN_OPTION_DEBUG
=
1
DOKAN_OPTION_DEBUG
=
1
DOKAN_OPTION_STDERR
=
2
DOKAN_OPTION_STDERR
=
2
...
@@ -139,6 +143,7 @@ FILETIME_UNIX_EPOCH = 116444736000000000
...
@@ -139,6 +143,7 @@ FILETIME_UNIX_EPOCH = 116444736000000000
def
_debug
(
*
args
):
def
_debug
(
*
args
):
#print >>sys.stderr, args; sys.stderr.flush()
#print >>sys.stderr, args; sys.stderr.flush()
#logger.debug(map(str,args))
pass
pass
...
...
fs/mountfs.py
View file @
147a2b67
...
@@ -54,7 +54,10 @@ class DirMount(object):
...
@@ -54,7 +54,10 @@ class DirMount(object):
self
.
fs
=
fs
self
.
fs
=
fs
def
__str__
(
self
):
def
__str__
(
self
):
return
"Mount point:
%
s"
%
self
.
path
return
"Mount point: <
%
s,
%
s>"
%
(
self
.
path
,
self
.
fs
,)
__repr__
=
__str__
def
__unicode__
(
self
):
return
unicode
(
str
(
self
))
class
FileMount
(
object
):
class
FileMount
(
object
):
...
@@ -83,7 +86,7 @@ class MountFS(FS):
...
@@ -83,7 +86,7 @@ class MountFS(FS):
self
.
mount_tree
=
PathMap
()
self
.
mount_tree
=
PathMap
()
def
__str__
(
self
):
def
__str__
(
self
):
return
"<
MountFS>"
return
"<
%
s [
%
s]>"
%
(
self
.
__class__
.
__name__
,
self
.
mount_tree
.
items
(),)
__repr__
=
__str__
__repr__
=
__str__
...
...
fs/path.py
View file @
147a2b67
...
@@ -496,6 +496,9 @@ class PathMap(object):
...
@@ -496,6 +496,9 @@ class PathMap(object):
for
subk
in
self
.
iterkeys
(
k
,
subm
):
for
subk
in
self
.
iterkeys
(
k
,
subm
):
yield
subk
yield
subk
def
__iter__
(
self
):
return
self
.
iterkeys
()
def
keys
(
self
,
root
=
"/"
):
def
keys
(
self
,
root
=
"/"
):
return
list
(
self
.
iterkeys
(
root
))
return
list
(
self
.
iterkeys
(
root
))
...
@@ -558,6 +561,7 @@ class PathMap(object):
...
@@ -558,6 +561,7 @@ class PathMap(object):
def
names
(
self
,
root
=
"/"
):
def
names
(
self
,
root
=
"/"
):
return
list
(
self
.
iternames
(
root
))
return
list
(
self
.
iternames
(
root
))
_wild_chars
=
frozenset
(
'*?[]!{}'
)
_wild_chars
=
frozenset
(
'*?[]!{}'
)
def
iswildcard
(
path
):
def
iswildcard
(
path
):
"""Check if a path ends with a wildcard
"""Check if a path ends with a wildcard
...
...
fs/remote.py
View file @
147a2b67
...
@@ -39,9 +39,6 @@ from fs.local_functools import wraps
...
@@ -39,9 +39,6 @@ from fs.local_functools import wraps
from
fs.filelike
import
StringIO
,
SpooledTemporaryFile
,
FileWrapper
from
fs.filelike
import
StringIO
,
SpooledTemporaryFile
,
FileWrapper
from
fs
import
SEEK_SET
,
SEEK_CUR
,
SEEK_END
from
fs
import
SEEK_SET
,
SEEK_CUR
,
SEEK_END
import
logging
logger
=
logging
.
getLogger
(
"fs.remote"
)
_SENTINAL
=
object
()
_SENTINAL
=
object
()
...
@@ -595,9 +592,7 @@ class CacheFSMixin(WrapFS):
...
@@ -595,9 +592,7 @@ class CacheFSMixin(WrapFS):
if
not
ci
.
has_full_info
:
if
not
ci
.
has_full_info
:
raise
KeyError
raise
KeyError
info
=
ci
.
info
info
=
ci
.
info
logger
.
debug
(
"GOT INFO FROM CACHE:
%
r"
,
path
)
except
KeyError
:
except
KeyError
:
logger
.
debug
(
"INFO WASN'T IN CACHE:
%
r"
,
path
)
info
=
super
(
CacheFSMixin
,
self
)
.
getinfo
(
path
)
info
=
super
(
CacheFSMixin
,
self
)
.
getinfo
(
path
)
self
.
__set_cached_info
(
path
,
CachedInfo
(
info
))
self
.
__set_cached_info
(
path
,
CachedInfo
(
info
))
return
info
return
info
...
...
fs/wrapfs/__init__.py
View file @
147a2b67
...
@@ -466,6 +466,7 @@ def wrap_fs_methods(decorator, cls=None, exclude=[]):
...
@@ -466,6 +466,7 @@ def wrap_fs_methods(decorator, cls=None, exclude=[]):
wrap_fs_methods
.
method_names
=
[
"open"
,
"exists"
,
"isdir"
,
"isfile"
,
"listdir"
,
wrap_fs_methods
.
method_names
=
[
"open"
,
"exists"
,
"isdir"
,
"isfile"
,
"listdir"
,
"makedir"
,
"remove"
,
"setcontents"
,
"removedir"
,
"rename"
,
"getinfo"
,
"copy"
,
"makedir"
,
"remove"
,
"setcontents"
,
"removedir"
,
"rename"
,
"getinfo"
,
"copy"
,
"move"
,
"copydir"
,
"movedir"
,
"close"
,
"getxattr"
,
"setxattr"
,
"delxattr"
,
"move"
,
"copydir"
,
"movedir"
,
"close"
,
"getxattr"
,
"setxattr"
,
"delxattr"
,
"listxattrs"
,
"getsyspath"
,
"createfile"
,
"hasmeta"
,
"getmeta"
]
"listxattrs"
,
"getsyspath"
,
"createfile"
,
"hasmeta"
,
"getmeta"
,
"listdirinfo"
,
"ilistdir"
,
"ilistdirinfo"
]
fs/wrapfs/debugfs.py
View file @
147a2b67
...
@@ -38,9 +38,10 @@ import logging
...
@@ -38,9 +38,10 @@ import logging
from
logging
import
DEBUG
,
INFO
,
ERROR
,
CRITICAL
from
logging
import
DEBUG
,
INFO
,
ERROR
,
CRITICAL
import
sys
import
sys
import
fs
from
fs.errors
import
FSError
from
fs.errors
import
FSError
logger
=
logging
.
getLogger
(
'fs.debugfs'
)
logger
=
fs
.
getLogger
(
'fs.debugfs'
)
logger
.
setLevel
(
logging
.
DEBUG
)
logger
.
setLevel
(
logging
.
DEBUG
)
logger
.
addHandler
(
logging
.
StreamHandler
())
logger
.
addHandler
(
logging
.
StreamHandler
())
...
...
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