Skip to content

Commit 341b278

Browse files
committed
Remove string_types
1 parent 9c2570b commit 341b278

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

smmap/mman.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
MapRegion,
55
MapRegionList,
66
is_64_bit,
7-
string_types,
87
buffer,
98
)
109

@@ -227,7 +226,7 @@ def fd(self):
227226
228227
**Note:** it is not required to be valid anymore
229228
:raise ValueError: if the mapping was not created by a file descriptor"""
230-
if isinstance(self._rlist.path_or_fd(), string_types()):
229+
if isinstance(self._rlist.path_or_fd(), str):
231230
raise ValueError("File descriptor queried although mapping was generated from path")
232231
# END handle type
233232
return self._rlist.path_or_fd()

smmap/util.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,6 @@ def buffer(obj, offset, size):
2222
# return obj[offset:offset + size]
2323

2424

25-
def string_types():
26-
if sys.version_info[0] >= 3:
27-
return str
28-
else:
29-
return basestring # noqa: F821
30-
31-
3225
def align_to_mmap(num, round_up):
3326
"""
3427
Align the given integer number to the closest page offset, which usually is 4096 bytes.
@@ -146,7 +139,7 @@ def __init__(self, path_or_fd, ofs, size, flags=0):
146139

147140
self._size = len(self._mf)
148141
finally:
149-
if isinstance(path_or_fd, string_types()):
142+
if isinstance(path_or_fd, str):
150143
os.close(fd)
151144
# END only close it if we opened it
152145
# END close file handle
@@ -229,7 +222,7 @@ def path_or_fd(self):
229222
def file_size(self):
230223
""":return: size of file we manager"""
231224
if self._file_size is None:
232-
if isinstance(self._path_or_fd, string_types()):
225+
if isinstance(self._path_or_fd, str):
233226
self._file_size = os.stat(self._path_or_fd).st_size
234227
else:
235228
self._file_size = os.fstat(self._path_or_fd).st_size

0 commit comments

Comments
 (0)