create a modified version of this path.
the following keyword arguments modify various path parts:
a:/some/path/to/a/file.ext
|| drive
|-------------| dirname
|------| basename
|--| purebasename
|--| ext
def new(self, **kw):
origin: path.local
where:
exceptions that might appear during execution:
function source:
def new(self, **kw):
""" create a modified version of this path.
the following keyword arguments modify various path parts:
a:/some/path/to/a/file.ext
|| drive
|-------------| dirname
|------| basename
|--| purebasename
|--| ext
"""
obj = object.__new__(self.__class__)
drive, dirname, basename, purebasename,ext = self._getbyspec(
"drive,dirname,basename,purebasename,ext")
if 'basename' in kw:
if 'purebasename' in kw or 'ext' in kw:
raise ValueError("invalid specification %r" % kw)
else:
pb = kw.setdefault('purebasename', purebasename)
try:
ext = kw['ext']
except KeyError:
pass
else:
if ext and not ext.startswith('.'):
ext = '.' + ext
kw['basename'] = pb + ext
kw.setdefault('drive', drive)
kw.setdefault('dirname', dirname)
kw.setdefault('sep', self.sep)
obj.strpath = os.path.normpath(
"%(drive)s%(dirname)s%(sep)s%(basename)s" % kw)
return obj
called in /home/johnny/projects/merlinux/py/dist/py/path/local/local.py
called in /home/johnny/projects/merlinux/py/dist/py/path/local/local.py
called in /home/johnny/projects/merlinux/py/dist/py/path/common.py
called in /home/johnny/projects/merlinux/py/dist/py/path/local/local.py
called in /home/johnny/projects/merlinux/py/dist/py/path/local/local.py
called in /home/johnny/projects/merlinux/py/dist/py/path/local/local.py
called in /home/johnny/projects/merlinux/py/dist/py/path/local/local.py
called in /home/johnny/projects/merlinux/py/dist/py/path/common.py
called in /home/johnny/projects/merlinux/py/dist/py/path/common.py
called in /home/johnny/projects/merlinux/py/dist/py/path/common.py
called in /home/johnny/projects/merlinux/py/dist/py/path/local/local.py
called in /home/johnny/projects/merlinux/py/dist/py/path/local/local.py
called in /home/johnny/projects/merlinux/py/dist/py/path/local/local.py
called in /home/johnny/projects/merlinux/py/dist/py/path/local/local.py
called in /home/johnny/projects/merlinux/py/dist/py/path/local/local.py
called in /home/johnny/projects/merlinux/py/dist/py/path/local/local.py
called in /home/johnny/projects/merlinux/py/dist/py/path/common.py
called in /home/johnny/projects/merlinux/py/dist/py/path/common.py
called in /home/johnny/projects/merlinux/py/dist/py/path/common.py
called in /home/johnny/projects/merlinux/py/dist/py/path/common.py
called in /home/johnny/projects/merlinux/py/dist/py/path/local/local.py