pydu/docs/path.rst

29 lines
704 B
ReStructuredText
Raw Normal View History

2017-12-14 12:22:15 +00:00
Path
----
.. py:function:: pydu.path.cd(path)
Context manager for cd the given path.
>>> from pydu.path import cd
>>> with cd('test'):
... pass
2018-01-14 05:05:59 +00:00
.. py:function:: pydu.path.is_super_path(path1, path2)
Whether ``path1`` is the super path of ``path2``.
Note that if ``path1`` is same as ``path2``, it's also regarded as
the super path os ``path2``.
For instance "/opt" is the super path of "/opt/test",
While "/opt/t" is the super path of "/opt/test"
>>> from pydu.path import is_super_path
>>> is_super_path('/aa/bb/cc', '/aa/bb/cc')
True
>>> is_super_path('/aa/bb', '/aa/bb/cc')
True
>>> is_super_path('/aa/b', '/aa/bb/cc')
False