Skip to content

Commit

Permalink
v0.5.8 release
Browse files Browse the repository at this point in the history
  • Loading branch information
shyuep committed Oct 6, 2014
1 parent 674c81a commit a7206c3
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
4 changes: 4 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ Monty is tested to work on Python 2.7 and 3.x.
Latest Change Log
=================

v0.5.8
------
1. Fix reverse read file for gzipped files.:

v0.5.7
------
1. Added a reverse_readfile method in monty.io, which is faster than
Expand Down
2 changes: 1 addition & 1 deletion monty/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

__author__ = 'Shyue Ping Ong'
__copyright__ = 'Copyright 2014, The Materials Virtual Lab'
__version__ = '0.5.7'
__version__ = '0.5.8'
__maintainer__ = 'Shyue Ping Ong'
__email__ = '[email protected]'
__date__ = 'Oct 5 2014'
16 changes: 10 additions & 6 deletions monty/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,18 @@ def reverse_readfile(filename):
"""
try:
with zopen(filename, "r+b") as f:
fm = mmap.mmap(f.fileno(), 0)
if isinstance(f, gzip.GzipFile):
for l in reversed(f.readlines()):
yield l.rstrip()
else:
fm = mmap.mmap(f.fileno(), 0)
n = len(fm)
while n > 0:
i = fm.rfind("\n", 0, n)
yield fm[i + 1:n].strip("\n")
n = i
except ValueError:
return
n = len(fm)
while n != -1:
i = fm.rfind("\n", 0, n)
yield fm[i + 1:n].strip("\n")
n = i


def reverse_readline(m_file, blk_size=4096, max_mem=4000000):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
setup(
name="monty",
packages=find_packages(),
version="0.5.7",
version="0.5.8",
install_requires=[],
extras_require={"yaml": ["pyyaml>=3.1"],},
package_data={},
Expand Down

0 comments on commit a7206c3

Please sign in to comment.