Skip to content

Commit 948a927

Browse files
committed
Fixed a few typos and major linter errors
1 parent 977e666 commit 948a927

12 files changed

Lines changed: 45 additions & 43 deletions

File tree

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
language: python
22
python:
3-
- 2.4
4-
- 2.5
3+
# These versions are unsupported by travis, even though smmap claims to still support these outdated versions
4+
# - 2.4
5+
# - 2.5
56
- 2.6
67
- 2.7
78
- 3.3

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,9 @@ The package was tested on all of the previously mentioned configurations.
3737

3838
## Installing smmap
3939

40-
Its easiest to install smmap using the *easy_install* or *pip* program, which is part of the [setuptools](http://peak.telecommunity.com/DevCenter/setuptools) or [pip](http://www.pip-installer.org/en/latest) respectively:
40+
Its easiest to install smmap using the [pip](http://www.pip-installer.org/en/latest) program:
4141

4242
```bash
43-
$ easy_install smmap
44-
# or
4543
$ pip install smmap
4644
```
4745

doc/source/changes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Changelog
33
#########
44

55
**********
6-
v0.8.2
6+
v0.8.3
77
**********
88
- Cleaned up code and assured it works sufficiently well with python 3
99

doc/source/intro.rst

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ For performance critical 64 bit applications, a simplified version of memory map
2222
#############
2323
Prerequisites
2424
#############
25-
* Python 2.4, 2.5 or 2.6
25+
* Python 2.4, 2.5, 2.6, 2.7 or 3.3
2626
* OSX, Windows or Linux
2727

2828
The package was tested on all of the previously mentioned configurations.
@@ -32,15 +32,12 @@ Limitations
3232
###########
3333
* The memory access is read-only by design.
3434
* In python below 2.6, memory maps will be created in compatibility mode which works, but creates inefficient memory mappings as they always start at offset 0.
35-
* It wasn't tested on python 2.7 and 3.x.
3635

3736
################
3837
Installing smmap
3938
################
40-
Its easiest to install smmap using the *easy_install* or *pip* program, which is part of the `setuptools`_ or `pip`_ respectively::
39+
Its easiest to install smmap using the *pip* program::
4140
42-
$ easy_install smmap
43-
# or
4441
$ pip install smmap
4542
4643
As the command will install smmap in your respective python distribution, you will most likely need root permissions to authorize the required changes.
@@ -75,5 +72,4 @@ License Information
7572
###################
7673
*smmap* is licensed under the New BSD License.
7774

78-
.. _setuptools: http://peak.telecommunity.com/DevCenter/setuptools
7975
.. _pip: http://www.pip-installer.org/en/latest/

setup.py

100644100755
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010

1111
import smmap
1212

13-
if os.path.exists("README.rst"):
14-
long_description = codecs.open('README.rst', "r", "utf-8").read()
13+
if os.path.exists("README.md"):
14+
long_description = codecs.open('README.md', "r", "utf-8").read()
1515
else:
16-
long_description = "See http://github.com/nvie/smmap/tree/master"
16+
long_description = "See http://github.com/Byron/smmap"
1717

1818
setup(
1919
name="smmap",
@@ -32,8 +32,8 @@
3232
#"Development Status :: 1 - Planning",
3333
#"Development Status :: 2 - Pre-Alpha",
3434
#"Development Status :: 3 - Alpha",
35-
"Development Status :: 4 - Beta",
36-
#"Development Status :: 5 - Production/Stable",
35+
# "Development Status :: 4 - Beta",
36+
"Development Status :: 5 - Production/Stable",
3737
#"Development Status :: 6 - Mature",
3838
#"Development Status :: 7 - Inactive",
3939
"Environment :: Console",

smmap/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
__author__ = "Sebastian Thiel"
44
__contact__ = "byronimo@gmail.com"
55
__homepage__ = "https://github.com/Byron/smmap"
6-
version_info = (0, 8, 2)
6+
version_info = (0, 8, 3)
77
__version__ = '.'.join(str(i) for i in version_info)
88

99
# make everything available in root package for convenience

smmap/buf.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
"""Module with a simple buffer implementation using the memory manager"""
2-
from .mman import WindowCursor
3-
42
import sys
53

64
__all__ = ["SlidingWindowMapBuffer"]

smmap/mman.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def use_region(self, offset = 0, size = 0, flags = 0):
101101
:param flags: additional flags to be given to os.open in case a file handle is initially opened
102102
for mapping. Has no effect if a region can actually be reused.
103103
:return: this instance - it should be queried for whether it points to a valid memory region.
104-
This is not the case if the mapping failed becaues we reached the end of the file
104+
This is not the case if the mapping failed because we reached the end of the file
105105
106106
**Note:**: The size actually mapped may be smaller than the given size. If that is the case,
107107
either the file has reached its end, or the map was created between two existing regions"""
@@ -137,7 +137,7 @@ def unuse_region(self):
137137
"""Unuse the ucrrent region. Does nothing if we have no current region
138138
139139
**Note:** the cursor unuses the region automatically upon destruction. It is recommended
140-
to unuse the region once you are done reading from it in persistent cursors as it
140+
to un-use the region once you are done reading from it in persistent cursors as it
141141
helps to free up resource more quickly"""
142142
self._region = None
143143
# note: should reset ofs and size, but we spare that for performance. Its not
@@ -203,7 +203,7 @@ def file_size(self):
203203
return self._rlist.file_size()
204204

205205
def path_or_fd(self):
206-
""":return: path or file decriptor of the underlying mapped file"""
206+
""":return: path or file descriptor of the underlying mapped file"""
207207
return self._rlist.path_or_fd()
208208

209209
def path(self):
@@ -237,12 +237,12 @@ class StaticWindowMapManager(object):
237237
These clients would have to use a SlidingWindowMapBuffer to hide this fact.
238238
239239
This type will always use a maximum window size, and optimize certain methods to
240-
acomodate this fact"""
240+
accommodate this fact"""
241241

242242
__slots__ = [
243243
'_fdict', # mapping of path -> StorageHelper (of some kind
244244
'_window_size', # maximum size of a window
245-
'_max_memory_size', # maximum amount ofmemory we may allocate
245+
'_max_memory_size', # maximum amount of memory we may allocate
246246
'_max_handle_count', # maximum amount of handles to keep open
247247
'_memory_size', # currently allocated memory size
248248
'_handle_count', # amount of currently allocated file handles
@@ -264,7 +264,7 @@ def __init__(self, window_size = 0, max_memory_size = 0, max_open_handles = sys.
264264
If 0, the window may have any size, which basically results in mapping the whole file at one
265265
:param max_memory_size: maximum amount of memory we may map at once before releasing mapped regions.
266266
If 0, a viable default will be set depending on the system's architecture.
267-
It is a soft limit that is tried to be kept, but nothing bad happens if we have to overallocate
267+
It is a soft limit that is tried to be kept, but nothing bad happens if we have to over-allocate
268268
:param max_open_handles: if not maxint, limit the amount of open file handles to the given number.
269269
Otherwise the amount is only limited by the system itself. If a system or soft limit is hit,
270270
the manager will free as many handles as possible"""
@@ -350,8 +350,6 @@ def _obtain_region(self, a, offset, size, flags, is_recursive):
350350
# As many more operations are likely to fail in that condition (
351351
# like reading a file from disk, etc) we free up as much as possible
352352
# As this invalidates our insert position, we have to recurse here
353-
# NOTE: The c++ version uses a linked list to curcumvent this, but
354-
# using that in python is probably too slow anyway
355353
if is_recursive:
356354
# we already tried this, and still have no success in obtaining
357355
# a mapping. This is an exception, so we propagate it
@@ -562,8 +560,6 @@ def _obtain_region(self, a, offset, size, flags, is_recursive):
562560
# As many more operations are likely to fail in that condition (
563561
# like reading a file from disk, etc) we free up as much as possible
564562
# As this invalidates our insert position, we have to recurse here
565-
# NOTE: The c++ version uses a linked list to curcumvent this, but
566-
# using that in python is probably too slow anyway
567563
if is_recursive:
568564
# we already tried this, and still have no success in obtaining
569565
# a mapping. This is an exception, so we propagate it

smmap/test/test_buf.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1-
from __future__ import with_statement, print_function
1+
from __future__ import print_function
22

33
from .lib import TestBase, FileCreator
44

5-
from smmap.mman import SlidingWindowMapManager, StaticWindowMapManager
6-
from smmap.buf import *
5+
from smmap.mman import (
6+
SlidingWindowMapManager,
7+
StaticWindowMapManager
8+
)
9+
from smmap.buf import SlidingWindowMapBuffer
710

811
from random import randint
912
from time import time
1013
import sys
1114
import os
15+
import logging
1216

1317

1418
man_optimal = SlidingWindowMapManager()
@@ -71,8 +75,8 @@ def test_basics(self):
7175
assert man_optimal.num_file_handles() == 1
7276

7377
# PERFORMANCE
74-
# blast away with rnadom access and a full mapping - we don't want to
75-
# exagerate the manager's overhead, but measure the buffer overhead
78+
# blast away with random access and a full mapping - we don't want to
79+
# exaggerate the manager's overhead, but measure the buffer overhead
7680
# We do it once with an optimal setting, and with a worse manager which
7781
# will produce small mappings only !
7882
max_num_accesses = 100

smmap/test/test_mman.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
from __future__ import with_statement, print_function
1+
from __future__ import print_function
22

33
from .lib import TestBase, FileCreator
44

5-
from smmap.mman import *
6-
from smmap.mman import WindowCursor
5+
from smmap.mman import (
6+
WindowCursor,
7+
SlidingWindowMapManager,
8+
StaticWindowMapManager
9+
)
710
from smmap.util import align_to_mmap
8-
from smmap.exc import RegionCollectionError
911

1012
from random import randint
1113
from time import time
@@ -67,7 +69,7 @@ def test_memory_manager(self):
6769
# doesn't raise if we are within the limit
6870
man._collect_lru_region(10)
6971

70-
# doesn't fail if we overallocate
72+
# doesn't fail if we over-allocate
7173
assert man._collect_lru_region(sys.maxsize) == 0
7274

7375
# use a region, verify most basic functionality

0 commit comments

Comments
 (0)