From a78ad64f9d786c1d172f76bcd156acdaa6af1799 Mon Sep 17 00:00:00 2001 From: guido Date: Sun, 4 Feb 2007 22:11:56 +0100 Subject: [PATCH] [svn r37927] Some docstrings. --HG-- branch : trunk --- py/path/common.py | 24 ++++++++++++++++++++++++ py/path/svn/wccommand.py | 6 ++++++ 2 files changed, 30 insertions(+) diff --git a/py/path/common.py b/py/path/common.py index d02b6e67a..3e9feb014 100644 --- a/py/path/common.py +++ b/py/path/common.py @@ -93,6 +93,18 @@ class PathBase(object): Checkers = Checkers def check(self, **kw): + """ check a path for existence, or query its properties + + without arguments, this returns True if the path exists (on the + filesystem), False if not + + with (keyword only) arguments, the object compares the value + of the argument with the value of a property with the same name + (if it has one, else it raises a TypeError) + + when for example the keyword argument 'ext' is '.py', this will + return True if self.ext == '.py', False otherwise + """ if kw: kw = kw.copy() if not checktype(self, kw): @@ -177,6 +189,18 @@ class PathBase(object): return repr(str(self)) def visit(self, fil=None, rec=None, ignore=_dummyclass): + """ yields all paths below the current one + + fil is a filter (glob pattern or callable), if not matching the + path will not be yielded, defaulting to None (everything is + returned) + + rec is a filter (glob pattern or callable) that controls whether + a node is descended, defaulting to None + + ignore is an Exception class that is ignoredwhen calling dirlist() + on any of the paths (by default, all exceptions are reported) + """ if isinstance(fil, str): fil = fnmatch(fil) if rec: diff --git a/py/path/svn/wccommand.py b/py/path/svn/wccommand.py index aee388b6f..ee09fc362 100644 --- a/py/path/svn/wccommand.py +++ b/py/path/svn/wccommand.py @@ -55,6 +55,7 @@ class SvnWCCommandPath(common.FSPathBase): return svncommon._escape_helper(cmd) def dump(self, obj): + """ pickle object into path location""" return self.localpath.dump(obj) def svnurl(self): @@ -162,6 +163,10 @@ class SvnWCCommandPath(common.FSPathBase): error_enhance(sys.exc_info()) def mkdir(self, *args): + """ create & return the directory joined with args. """ + p = self.join(*args) + self._callex(os.mkdir, str(p)) + return p if args: return self.join(*args).mkdir() else: @@ -169,6 +174,7 @@ class SvnWCCommandPath(common.FSPathBase): return self def add(self): + """ add ourself to svn """ self._svn('add') def remove(self, rec=1, force=1):