Skip to content

Commit bac63be

Browse files
committed
Add intersphinx documentation with corresponding python functions from the std lib
1 parent 5ec78dd commit bac63be

2 files changed

Lines changed: 51 additions & 1 deletion

File tree

‎docs/conf.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,6 @@
1414
source_suffix = '.rst'
1515
master_doc = 'index'
1616

17-
extensions = ['sphinx.ext.autodoc']
17+
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx']
18+
19+
intersphinx_mapping = {'python': ('http://docs.python.org/3.3', None)}

‎path.py‎

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,27 +220,35 @@ def getcwd(cls):
220220
# --- Operations on path strings.
221221

222222
def abspath(self):
223+
""" See :func:`os.path.abspath`. """
223224
return self._next_class(self.module.abspath(self))
224225

225226
def normcase(self):
227+
""" See :func:`os.path.normcase`. """
226228
return self._next_class(self.module.normcase(self))
227229

228230
def normpath(self):
231+
""" See :func:`os.path.normpath`. """
229232
return self._next_class(self.module.normpath(self))
230233

231234
def realpath(self):
235+
""" See :func:`os.path.realpath`. """
232236
return self._next_class(self.module.realpath(self))
233237

234238
def expanduser(self):
239+
""" See :func:`os.path.expanduser`. """
235240
return self._next_class(self.module.expanduser(self))
236241

237242
def expandvars(self):
243+
""" See :func:`os.path.expandvars`. """
238244
return self._next_class(self.module.expandvars(self))
239245

240246
def dirname(self):
247+
""" See :func:`os.path.dirname`. """
241248
return self._next_class(self.module.dirname(self))
242249

243250
def basename(self):
251+
""" See :func:`os.path.basename`. """
244252
return self._next_class(self.module.basename(self))
245253

246254
def expand(self):
@@ -328,6 +336,7 @@ def stripext(self):
328336
return self.splitext()[0]
329337

330338
def splitunc(self):
339+
""" See :func:`os.path.splitunc`. """
331340
unc, rest = self.module.splitunc(self)
332341
return self._next_class(unc), rest
333342

@@ -909,48 +918,59 @@ def read_hexhash(self, hash_name):
909918
# bound. Playing it safe and wrapping them all in method calls.
910919

911920
def isabs(self):
921+
""" See :func:`os.path.isabs`. """
912922
return self.module.isabs(self)
913923

914924
def exists(self):
925+
""" See :func:`os.path.exists`. """
915926
return self.module.exists(self)
916927

917928
def isdir(self):
929+
""" See :func:`os.path.isdir`. """
918930
return self.module.isdir(self)
919931

920932
def isfile(self):
933+
""" See :func:`os.path.isfile`. """
921934
return self.module.isfile(self)
922935

923936
def islink(self):
937+
""" See :func:`os.path.islink`. """
924938
return self.module.islink(self)
925939

926940
def ismount(self):
941+
""" See :func:`os.path.ismount`. """
927942
return self.module.ismount(self)
928943

929944
def samefile(self, other):
945+
""" See :func:`os.path.samefile`. """
930946
return self.module.samefile(self, other)
931947

932948
def getatime(self):
949+
""" See :func:`os.path.getatime`. """
933950
return self.module.getatime(self)
934951

935952
atime = property(
936953
getatime, None, None,
937954
""" Last access time of the file. """)
938955

939956
def getmtime(self):
957+
""" See :func:`os.path.getmtime`. """
940958
return self.module.getmtime(self)
941959

942960
mtime = property(
943961
getmtime, None, None,
944962
""" Last-modified time of the file. """)
945963

946964
def getctime(self):
965+
""" See :func:`os.path.getctime`. """
947966
return self.module.getctime(self)
948967

949968
ctime = property(
950969
getctime, None, None,
951970
""" Creation time of the file. """)
952971

953972
def getsize(self):
973+
""" See :func:`os.path.getsize`. """
954974
return self.module.getsize(self)
955975

956976
size = property(
@@ -1015,6 +1035,7 @@ def statvfs(self):
10151035

10161036
if hasattr(os, 'pathconf'):
10171037
def pathconf(self, name):
1038+
""" See :func:`os.pathconf`. """
10181039
return os.pathconf(self, name)
10191040

10201041
#
@@ -1026,30 +1047,37 @@ def utime(self, times):
10261047
return self
10271048

10281049
def chmod(self, mode):
1050+
""" See :func:`os.chmod`. """
10291051
os.chmod(self, mode)
10301052
return self
10311053

10321054
if hasattr(os, 'chown'):
10331055
def chown(self, uid=-1, gid=-1):
1056+
""" See :func:`os.chown`. """
10341057
os.chown(self, uid, gid)
10351058
return self
10361059

10371060
def rename(self, new):
1061+
""" See :func:`os.rename`. """
10381062
os.rename(self, new)
10391063
return self._next_class(new)
10401064

10411065
def renames(self, new):
1066+
""" See :func:`os.renames`. """
10421067
os.renames(self, new)
10431068
return self._next_class(new)
10441069

10451070
#
10461071
# --- Create/delete operations on directories
10471072

10481073
def mkdir(self, mode=o777):
1074+
""" See :func:`os.mkdir`. """
10491075
os.mkdir(self, mode)
10501076
return self
10511077

10521078
def mkdir_p(self, mode=o777):
1079+
""" Like :meth:`mkdir`, but does not raise an exception if the
1080+
directory already exists. """
10531081
try:
10541082
self.mkdir(mode)
10551083
except OSError:
@@ -1059,10 +1087,13 @@ def mkdir_p(self, mode=o777):
10591087
return self
10601088

10611089
def makedirs(self, mode=o777):
1090+
""" See :func:`os.makedirs`. """
10621091
os.makedirs(self, mode)
10631092
return self
10641093

10651094
def makedirs_p(self, mode=o777):
1095+
""" Like :meth:`makedirs`, but does not raise an exception if the
1096+
directory already exists. """
10661097
try:
10671098
self.makedirs(mode)
10681099
except OSError:
@@ -1072,10 +1103,13 @@ def makedirs_p(self, mode=o777):
10721103
return self
10731104

10741105
def rmdir(self):
1106+
""" See :func:`os.rmdir`. """
10751107
os.rmdir(self)
10761108
return self
10771109

10781110
def rmdir_p(self):
1111+
""" Like :meth:`rmdir`, but does not raise an exception if the
1112+
directory is not empty or does not exist. """
10791113
try:
10801114
self.rmdir()
10811115
except OSError:
@@ -1085,10 +1119,13 @@ def rmdir_p(self):
10851119
return self
10861120

10871121
def removedirs(self):
1122+
""" See :func:`os.removedirs`. """
10881123
os.removedirs(self)
10891124
return self
10901125

10911126
def removedirs_p(self):
1127+
""" Like :meth:`removedirs`, but does not raise an exception if the
1128+
directory is not empty or does not exist. """
10921129
try:
10931130
self.removedirs()
10941131
except OSError:
@@ -1109,10 +1146,13 @@ def touch(self):
11091146
return self
11101147

11111148
def remove(self):
1149+
""" See :func:`os.remove`. """
11121150
os.remove(self)
11131151
return self
11141152

11151153
def remove_p(self):
1154+
""" Like :meth:`remove`, but does not raise an exception if the
1155+
file does not exist. """
11161156
try:
11171157
self.unlink()
11181158
except OSError:
@@ -1122,10 +1162,13 @@ def remove_p(self):
11221162
return self
11231163

11241164
def unlink(self):
1165+
""" See :func:`os.unlink`. """
11251166
os.unlink(self)
11261167
return self
11271168

11281169
def unlink_p(self):
1170+
""" Like :meth:`unlink`, but does not raise an exception if the
1171+
file does not exist. """
11291172
self.remove_p()
11301173
return self
11311174

@@ -1176,6 +1219,8 @@ def readlinkabs(self):
11761219
rmtree = shutil.rmtree
11771220

11781221
def rmtree_p(self):
1222+
""" Like :meth:`rmtree`, but does not raise an exception if the
1223+
directory does not exist. """
11791224
try:
11801225
self.rmtree()
11811226
except OSError:
@@ -1185,6 +1230,7 @@ def rmtree_p(self):
11851230
return self
11861231

11871232
def chdir(self):
1233+
""" See :func:`os.chdir`. """
11881234
os.chdir(self)
11891235

11901236
cd = chdir
@@ -1194,10 +1240,12 @@ def chdir(self):
11941240

11951241
if hasattr(os, 'chroot'):
11961242
def chroot(self):
1243+
""" See :func:`os.chroot`. """
11971244
os.chroot(self)
11981245

11991246
if hasattr(os, 'startfile'):
12001247
def startfile(self):
1248+
""" See :func:`os.startfile`. """
12011249
os.startfile(self)
12021250
return self
12031251

0 commit comments

Comments
 (0)