path.local API [rev. 57595]

class LocalPath(FSPathBase, PosixMixin):

Local path implementation offering access/modification methods similar to os.path.

class attributes and properties:

basename: <property object (dynamically calculated value)>
ext: <property object (dynamically calculated value)>
purebasename: <property object (dynamically calculated value)>
sep: /

methods:

def atime(self):

return last access time of the path.

def chdir(self):

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

def chmod(self, mode, rec=0):

change permissions to the given mode. If mode is an integer it directly encodes the os-specific modes. if rec is True perform recursively. (xxx if mode is a string then it specifies access rights in '/bin/chmod' style, e.g. a+r).

def chown(self, user, group, rec=0):

change ownership to the given user and group. user and group may be specified by a number or by a name. if rec is True change ownership recursively.

def common(self, other):

return the common part shared with the other path or None if there is no common part.

def computehash(self, hashtype='md5', chunksize=524288):

return hexdigest of hashvalue for this file.

def copy(self, target, archive=False):

copy path to target.

def dirpath(self, *args, **kwargs):

return the directory Path of the current Path joined with any given path arguments.

def dump(self, obj, bin=1):

pickle object into path location

def ensure(self, *args, **kwargs):

ensure that an args-joined path exists (by default as a file). if you specify a keyword argument 'dir=True' then the path is forced to be a directory path.

def get_temproot(cls):

return the system's temporary directory (where tempfiles are usually created in)

def group(self):

return group name of file.

def join(self, *args, **kwargs):

return a new path by appending all 'args' as path components. if abs=1 is used restart from root if any of the args is an absolute path.

def listdir(self, fil=None, sort=None):

list directory contents, possibly filter by the given fil func and possibly sorted.

def load(self):

return object unpickled from self.read()

def lstat(self):

Return an os.lstat() tuple.

def make_numbered_dir(cls, prefix='session-', rootdir=None, keep=3, lock_timeout=172800):

return unique directory with a number greater than the current maximum one. The number is assumed to start directly after prefix. if keep is true directories with a number less than (maxnum-keep) will be removed.