Skip to content

Commit 84929ed

Browse files
committed
Applied autopep8
autopep8 -v -j 8 --max-line-length 120 --in-place --recursive
1 parent eb40b44 commit 84929ed

10 files changed

Lines changed: 165 additions & 152 deletions

File tree

doc/source/conf.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
# All configuration values have a default; values that are commented out
1212
# serve to show the default.
1313

14-
import sys, os
14+
import sys
15+
import os
1516

1617
# If extensions (or modules to document with autodoc) are in another directory,
1718
# add these directories to sys.path here. If the directory is relative to the
@@ -172,8 +173,8 @@
172173
# Grouping the document tree into LaTeX files. List of tuples
173174
# (source start file, target name, title, author, documentclass [howto/manual]).
174175
latex_documents = [
175-
('index', 'smmap.tex', u'smmap Documentation',
176-
u'Sebastian Thiel', 'manual'),
176+
('index', 'smmap.tex', u'smmap Documentation',
177+
u'Sebastian Thiel', 'manual'),
177178
]
178179

179180
# The name of an image file (relative to this directory) to place at the top of

smmap/buf.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111

1212
class SlidingWindowMapBuffer(object):
13+
1314
"""A buffer like object which allows direct byte-wise object and slicing into
1415
memory of a mapped file. The mapping is controlled by the provided cursor.
1516
@@ -20,9 +21,9 @@ class SlidingWindowMapBuffer(object):
2021
underneath, it can unfortunately not be used in any non-pure python method which
2122
needs a buffer or string"""
2223
__slots__ = (
23-
'_c', # our cursor
24-
'_size', # our supposed size
25-
)
24+
'_c', # our cursor
25+
'_size', # our supposed size
26+
)
2627

2728
def __init__(self, cursor=None, offset=0, size=sys.maxsize, flags=0):
2829
"""Initalize the instance to operate on the given cursor.
@@ -57,7 +58,7 @@ def __getitem__(self, i):
5758
if not c.includes_ofs(i):
5859
c.use_region(i, 1)
5960
# END handle region usage
60-
return c.buffer()[i-c.ofs_begin()]
61+
return c.buffer()[i - c.ofs_begin()]
6162

6263
def __getslice__(self, i, j):
6364
c = self._c
@@ -72,9 +73,9 @@ def __getslice__(self, i, j):
7273
j = self._size + j
7374
if (c.ofs_begin() <= i) and (j < c.ofs_end()):
7475
b = c.ofs_begin()
75-
return c.buffer()[i-b:j-b]
76+
return c.buffer()[i - b:j - b]
7677
else:
77-
l = j-i # total length
78+
l = j - i # total length
7879
ofs = i
7980
# It's fastest to keep tokens and join later, especially in py3, which was 7 times slower
8081
# in the previous iteration of this code
@@ -86,7 +87,7 @@ def __getslice__(self, i, j):
8687
ofs += len(d)
8788
l -= len(d)
8889
md.append(d)
89-
#END while there are bytes to read
90+
# END while there are bytes to read
9091
return bytes().join(md)
9192
# END fast or slow path
9293
#{ Interface
@@ -100,7 +101,7 @@ def begin_access(self, cursor=None, offset=0, size=sys.maxsize, flags=0):
100101
:return: True if the buffer can be used"""
101102
if cursor:
102103
self._c = cursor
103-
#END update our cursor
104+
# END update our cursor
104105

105106
# reuse existing cursors if possible
106107
if self._c is not None and self._c.is_associated():
@@ -112,9 +113,9 @@ def begin_access(self, cursor=None, offset=0, size=sys.maxsize, flags=0):
112113
# If not, the user is in trouble.
113114
if size > self._c.file_size():
114115
size = self._c.file_size() - offset
115-
#END handle size
116+
# END handle size
116117
self._size = size
117-
#END set size
118+
# END set size
118119
return res
119120
# END use our cursor
120121
return False
@@ -128,7 +129,7 @@ def end_access(self):
128129
self._size = 0
129130
if self._c is not None:
130131
self._c.unuse_region()
131-
#END unuse region
132+
# END unuse region
132133

133134
def cursor(self):
134135
""":return: the currently set cursor which provides access to the data"""

smmap/exc.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33

44
class MemoryManagerError(Exception):
5+
56
"""Base class for all exceptions thrown by the memory manager"""
67

78

89
class RegionCollectionError(MemoryManagerError):
10+
911
"""Thrown if a memory region could not be collected, or if no region for collection was found"""

0 commit comments

Comments
 (0)