Skip to content

Commit ec51136

Browse files
committed
It turned out the :note: docstring was not supported. Now all documentation is being generated
1 parent a51b65d commit ec51136

2 files changed

Lines changed: 36 additions & 27 deletions

File tree

doc/source/api.rst

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,33 @@
44
API Reference
55
#############
66

7-
****************
8-
smmap.mman
9-
****************
7+
***********************
8+
Mapped Memory Managers
9+
***********************
1010

1111
.. automodule:: smmap.mman
1212
:members:
1313
:undoc-members:
1414

15-
****************
16-
smmap.buf
17-
****************
15+
*******
16+
Buffers
17+
*******
1818

1919
.. automodule:: smmap.buf
2020
:members:
2121
:undoc-members:
2222

23-
****************
24-
smmap.exc
25-
****************
23+
**********
24+
Exceptions
25+
**********
2626

2727
.. automodule:: smmap.exc
2828
:members:
2929
:undoc-members:
3030

31-
****************
32-
smmap.util
33-
****************
31+
*********
32+
Utilities
33+
*********
3434

3535
.. automodule:: smmap.util
3636
:members:

smmap/mman.py

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,15 @@
1818

1919

2020
class WindowCursor(object):
21-
"""Pointer into the mapped region of the memory manager, keeping the map
21+
"""
22+
Pointer into the mapped region of the memory manager, keeping the map
2223
alive until it is destroyed and no other client uses it.
2324
2425
Cursors should not be created manually, but are instead returned by the SlidingWindowMapManager
25-
:note: The current implementation is suited for static and sliding window managers, but it also means
26-
that it must be suited for the somewhat quite different sliding manager. It could be improved, but
27-
I see no real need to do so."""
26+
27+
**Note**: The current implementation is suited for static and sliding window managers, but it also means
28+
that it must be suited for the somewhat quite different sliding manager. It could be improved, but
29+
I see no real need to do so."""
2830
__slots__ = (
2931
'_manager', # the manger keeping all file regions
3032
'_rlist', # a regions list with regions for our file
@@ -91,8 +93,9 @@ def use_region(self, offset = 0, size = 0, flags = 0):
9193
for mapping. Has no effect if a region can actually be reused.
9294
:return: this instance - it should be queried for whether it points to a valid memory region.
9395
This is not the case if the mapping failed becaues we reached the end of the file
94-
:note: The size actually mapped may be smaller than the given size. If that is the case,
95-
either the file has reached its end, or the map was created between two existing regions"""
96+
97+
**note**: The size actually mapped may be smaller than the given size. If that is the case,
98+
either the file has reached its end, or the map was created between two existing regions"""
9699
need_region = True
97100
man = self._manager
98101
fsize = self._rlist.file_size()
@@ -123,19 +126,22 @@ def use_region(self, offset = 0, size = 0, flags = 0):
123126

124127
def unuse_region(self):
125128
"""Unuse the ucrrent region. Does nothing if we have no current region
126-
:note: the cursor unuses the region automatically upon destruction. It is recommended
127-
to unuse the region once you are done reading from it in persistent cursors as it
128-
helps to free up resource more quickly"""
129+
130+
**note** the cursor unuses the region automatically upon destruction. It is recommended
131+
to unuse the region once you are done reading from it in persistent cursors as it
132+
helps to free up resource more quickly"""
129133
self._region = None
130134
# note: should reset ofs and size, but we spare that for performance. Its not
131135
# allowed to query information if we are not valid !
132136

133137
def buffer(self):
134138
"""Return a buffer object which allows access to our memory region from our offset
135139
to the window size. Please note that it might be smaller than you requested when calling use_region()
136-
:note: You can only obtain a buffer if this instance is_valid() !
137-
:note: buffers should not be cached passed the duration of your access as it will
138-
prevent resources from being freed even though they might not be accounted for anymore !"""
140+
141+
**note** You can only obtain a buffer if this instance is_valid() !
142+
143+
**note** buffers should not be cached passed the duration of your access as it will
144+
prevent resources from being freed even though they might not be accounted for anymore !"""
139145
return buffer(self._region.buffer(), self._ofs, self._size)
140146

141147
def map(self):
@@ -155,7 +161,8 @@ def is_associated(self):
155161

156162
def ofs_begin(self):
157163
""":return: offset to the first byte pointed to by our cursor
158-
:note: only if is_valid() is True"""
164+
165+
**note** only if is_valid() is True"""
159166
return self._region._b + self._ofs
160167

161168
def ofs_end(self):
@@ -177,7 +184,8 @@ def region_ref(self):
177184
def includes_ofs(self, ofs):
178185
""":return: True if the given absolute offset is contained in the cursors
179186
current region
180-
:note: cursor must be valid for this to work"""
187+
188+
**note** cursor must be valid for this to work"""
181189
# unroll methods
182190
return (self._region._b + self._ofs) <= ofs < (self._region._b + self._ofs + self._size)
183191

@@ -199,7 +207,8 @@ def path(self):
199207

200208
def fd(self):
201209
""":return: file descriptor used to create the underlying mapping.
202-
:note: it is not required to be valid anymore
210+
211+
**note** it is not required to be valid anymore
203212
:raise ValueError: if the mapping was not created by a file descriptor"""
204213
if isinstance(self._rlist.path_or_fd(), basestring):
205214
raise ValueError("File descriptor queried although mapping was generated from path")

0 commit comments

Comments
 (0)