Skip to content

Commit cf297b7

Browse files
committed
Removed possibly invalid documentation tags
1 parent f097bd6 commit cf297b7

3 files changed

Lines changed: 35 additions & 27 deletions

File tree

smmap/buf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ class SlidingWindowMapBuffer(object):
1212
The buffer is relative, that is if you map an offset, index 0 will map to the
1313
first byte at the offset you used during initialization or begin_access
1414
15-
:note: Although this type effectively hides the fact that there are mapped windows
16-
underneath, it can unfortunately not be used in any non-pure python method which
17-
needs a buffer or string"""
15+
**Note:** Although this type effectively hides the fact that there are mapped windows
16+
underneath, it can unfortunately not be used in any non-pure python method which
17+
needs a buffer or string"""
1818
__slots__ = (
1919
'_c', # our cursor
2020
'_size', # our supposed size

smmap/mman.py

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class WindowCursor(object):
2424
2525
Cursors should not be created manually, but are instead returned by the SlidingWindowMapManager
2626
27-
**Note**: The current implementation is suited for static and sliding window managers, but it also means
27+
**Note:**: The current implementation is suited for static and sliding window managers, but it also means
2828
that it must be suited for the somewhat quite different sliding manager. It could be improved, but
2929
I see no real need to do so."""
3030
__slots__ = (
@@ -94,7 +94,7 @@ def use_region(self, offset = 0, size = 0, flags = 0):
9494
:return: this instance - it should be queried for whether it points to a valid memory region.
9595
This is not the case if the mapping failed becaues we reached the end of the file
9696
97-
**note**: The size actually mapped may be smaller than the given size. If that is the case,
97+
**Note:**: The size actually mapped may be smaller than the given size. If that is the case,
9898
either the file has reached its end, or the map was created between two existing regions"""
9999
need_region = True
100100
man = self._manager
@@ -127,7 +127,7 @@ def use_region(self, offset = 0, size = 0, flags = 0):
127127
def unuse_region(self):
128128
"""Unuse the ucrrent region. Does nothing if we have no current region
129129
130-
**note** the cursor unuses the region automatically upon destruction. It is recommended
130+
**Note:** the cursor unuses the region automatically upon destruction. It is recommended
131131
to unuse the region once you are done reading from it in persistent cursors as it
132132
helps to free up resource more quickly"""
133133
self._region = None
@@ -138,9 +138,9 @@ def buffer(self):
138138
"""Return a buffer object which allows access to our memory region from our offset
139139
to the window size. Please note that it might be smaller than you requested when calling use_region()
140140
141-
**note** You can only obtain a buffer if this instance is_valid() !
141+
**Note:** You can only obtain a buffer if this instance is_valid() !
142142
143-
**note** buffers should not be cached passed the duration of your access as it will
143+
**Note:** buffers should not be cached passed the duration of your access as it will
144144
prevent resources from being freed even though they might not be accounted for anymore !"""
145145
return buffer(self._region.buffer(), self._ofs, self._size)
146146

@@ -162,7 +162,7 @@ def is_associated(self):
162162
def ofs_begin(self):
163163
""":return: offset to the first byte pointed to by our cursor
164164
165-
**note** only if is_valid() is True"""
165+
**Note:** only if is_valid() is True"""
166166
return self._region._b + self._ofs
167167

168168
def ofs_end(self):
@@ -185,7 +185,7 @@ def includes_ofs(self, ofs):
185185
""":return: True if the given absolute offset is contained in the cursors
186186
current region
187187
188-
**note** cursor must be valid for this to work"""
188+
**Note:** cursor must be valid for this to work"""
189189
# unroll methods
190190
return (self._region._b + self._ofs) <= ofs < (self._region._b + self._ofs + self._size)
191191

@@ -208,7 +208,7 @@ def path(self):
208208
def fd(self):
209209
""":return: file descriptor used to create the underlying mapping.
210210
211-
**note** it is not required to be valid anymore
211+
**Note:** it is not required to be valid anymore
212212
:raise ValueError: if the mapping was not created by a file descriptor"""
213213
if isinstance(self._rlist.path_or_fd(), basestring):
214214
raise ValueError("File descriptor queried although mapping was generated from path")
@@ -289,9 +289,11 @@ def _collect_lru_region(self, size):
289289
:param size: size of the region we want to map next (assuming its not already mapped partially or full
290290
if 0, we try to free any available region
291291
:return: Amount of freed regions
292-
:note: We don't raise exceptions anymore, in order to keep the system working, allowing temporary overallocation.
293-
If the system runs out of memory, it will tell.
294-
:todo: implement a case where all unusued regions are discarded efficiently. Currently its only brute force"""
292+
293+
**Note:** We don't raise exceptions anymore, in order to keep the system working, allowing temporary overallocation.
294+
If the system runs out of memory, it will tell.
295+
296+
**todo:** implement a case where all unusued regions are discarded efficiently. Currently its only brute force"""
295297
num_found = 0
296298
while (size == 0) or (self._memory_size + size > self._max_memory_size):
297299
lru_region = None
@@ -366,15 +368,18 @@ def make_cursor(self, path_or_fd):
366368
"""
367369
:return: a cursor pointing to the given path or file descriptor.
368370
It can be used to map new regions of the file into memory
369-
:note: if a file descriptor is given, it is assumed to be open and valid,
370-
but may be closed afterwards. To refer to the same file, you may reuse
371-
your existing file descriptor, but keep in mind that new windows can only
372-
be mapped as long as it stays valid. This is why the using actual file paths
373-
are preferred unless you plan to keep the file descriptor open.
374-
:note: file descriptors are problematic as they are not necessarily unique, as two
375-
different files opened and closed in succession might have the same file descriptor id.
376-
:note: Using file descriptors directly is faster once new windows are mapped as it
377-
prevents the file to be opened again just for the purpose of mapping it."""
371+
372+
**Note:** if a file descriptor is given, it is assumed to be open and valid,
373+
but may be closed afterwards. To refer to the same file, you may reuse
374+
your existing file descriptor, but keep in mind that new windows can only
375+
be mapped as long as it stays valid. This is why the using actual file paths
376+
are preferred unless you plan to keep the file descriptor open.
377+
378+
**Note:** file descriptors are problematic as they are not necessarily unique, as two
379+
different files opened and closed in succession might have the same file descriptor id.
380+
381+
**Note:** Using file descriptors directly is faster once new windows are mapped as it
382+
prevents the file to be opened again just for the purpose of mapping it."""
378383
regions = self._fdict.get(path_or_fd)
379384
if regions is None:
380385
regions = self.MapRegionListCls(path_or_fd)
@@ -426,7 +431,8 @@ def force_map_handle_removal_win(self, base_path):
426431
This really may only be used if you know that the items which keep
427432
the cursors alive will not be using it anymore. They need to be recreated !
428433
:return: Amount of closed handles
429-
:note: does nothing on non-windows platforms"""
434+
435+
**Note:** does nothing on non-windows platforms"""
430436
if sys.platform != 'win32':
431437
return
432438
#END early bailout
@@ -451,8 +457,9 @@ class SlidingWindowMapManager(StaticWindowMapManager):
451457
which result from each mmap call, the least recently used, and currently unused mapped regions
452458
are unloaded automatically.
453459
454-
:note: currently not thread-safe !
455-
:note: in the current implementation, we will automatically unload windows if we either cannot
460+
**Note:** currently not thread-safe !
461+
462+
**Note:** in the current implementation, we will automatically unload windows if we either cannot
456463
create more memory maps (as the open file handles limit is hit) or if we have allocated more than
457464
a safe amount of memory already, which would possibly cause memory allocations to fail as our address
458465
space is full."""

smmap/util.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ def extend_right_to(self, window, max_size):
8888

8989
class MapRegion(object):
9090
"""Defines a mapped region of memory, aligned to pagesizes
91-
:note: deallocates used region automatically on destruction"""
91+
92+
**Note:** deallocates used region automatically on destruction"""
9293
__slots__ = [
9394
'_b' , # beginning of mapping
9495
'_mf', # mapped memory chunk (as returned by mmap)

0 commit comments

Comments
 (0)