|
21 | 21 | #}END utilities
|
22 | 22 |
|
23 | 23 |
|
24 |
| -def managed_mmaps(check_entered=True): |
25 |
| - """Makes a memory-map context-manager instance for the correct python-version. |
26 |
| -
|
27 |
| - :param bool check_entered: |
28 |
| - whether to scream if not used as context-manager (`with` block) |
29 |
| - :return: |
30 |
| - either :class:`SlidingWindowMapManager` or :class:`StaticWindowMapManager` (if PY2) |
31 |
| -
|
32 |
| - If you want to change other default parameters of these classes, use them directly. |
33 |
| -
|
34 |
| - .. Tip:: |
35 |
| - Use it in a ``with ...:`` block, to free cached (and unused) resources. |
36 |
| -
|
37 |
| - """ |
38 |
| - mman = SlidingWindowMapManager if PY3 else StaticWindowMapManager |
39 |
| - |
40 |
| - return mman(check_entered=check_entered) |
41 |
| - |
42 |
| - |
43 | 24 | class WindowCursor(object):
|
44 | 25 |
|
45 | 26 | """
|
@@ -263,6 +244,25 @@ def fd(self):
|
263 | 244 | #} END interface
|
264 | 245 |
|
265 | 246 |
|
| 247 | +def managed_mmaps(check_entered=True): |
| 248 | + """Makes a memory-map context-manager instance for the correct python-version. |
| 249 | +
|
| 250 | + :param bool check_entered: |
| 251 | + whether to scream if not used as context-manager (`with` block) |
| 252 | + :return: |
| 253 | + either :class:`SlidingWindowMapManager` or :class:`StaticWindowMapManager` (if PY2) |
| 254 | +
|
| 255 | + If you want to change other default parameters of these classes, use them directly. |
| 256 | +
|
| 257 | + .. Tip:: |
| 258 | + Use it in a ``with ...:`` block, to free cached (and unused) resources. |
| 259 | +
|
| 260 | + """ |
| 261 | + mman = SlidingWindowMapManager if PY3 else StaticWindowMapManager |
| 262 | + |
| 263 | + return mman(check_entered=check_entered) |
| 264 | + |
| 265 | + |
266 | 266 | class StaticWindowMapManager(object):
|
267 | 267 |
|
268 | 268 | """Provides a manager which will produce single size cursors that are allowed
|
|
0 commit comments