| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,7 +4,6 @@ | |||
| 4 | 4 | MapRegion, | |
| 5 | 5 | MapRegionList, | |
| 6 | 6 | is_64_bit, | |
| 7 | - string_types, | ||
| 8 | 7 | buffer, | |
| 9 | 8 | ) | |
| 10 | 9 | ||
@@ -227,7 +226,7 @@ def fd(self): | |||
| 227 | 226 | ||
| 228 | 227 | **Note:** it is not required to be valid anymore | |
| 229 | 228 | :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): | ||
| 231 | 230 | raise ValueError("File descriptor queried although mapping was generated from path") | |
| 232 | 231 | # END handle type | |
| 233 | 232 | return self._rlist.path_or_fd() | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,13 +22,6 @@ def buffer(obj, offset, size): | |||
| 22 | 22 | # return obj[offset:offset + size] | |
| 23 | 23 | ||
| 24 | 24 | ||
| 25 | - def string_types(): | ||
| 26 | - if sys.version_info[0] >= 3: | ||
| 27 | - return str | ||
| 28 | - else: | ||
| 29 | - return basestring # noqa: F821 | ||
| 30 | - | ||
| 31 | - | ||
| 32 | 25 | def align_to_mmap(num, round_up): | |
| 33 | 26 | """ | |
| 34 | 27 | 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): | |||
| 146 | 139 | ||
| 147 | 140 | self._size = len(self._mf) | |
| 148 | 141 | finally: | |
| 149 | - if isinstance(path_or_fd, string_types()): | ||
| 142 | + if isinstance(path_or_fd, str): | ||
| 150 | 143 | os.close(fd) | |
| 151 | 144 | # END only close it if we opened it | |
| 152 | 145 | # END close file handle | |
@@ -229,7 +222,7 @@ def path_or_fd(self): | |||
| 229 | 222 | def file_size(self): | |
| 230 | 223 | """:return: size of file we manager""" | |
| 231 | 224 | if self._file_size is None: | |
| 232 | - if isinstance(self._path_or_fd, string_types()): | ||
| 225 | + if isinstance(self._path_or_fd, str): | ||
| 233 | 226 | self._file_size = os.stat(self._path_or_fd).st_size | |
| 234 | 227 | else: | |
| 235 | 228 | self._file_size = os.fstat(self._path_or_fd).st_size | |
| Back | FazBrowse Home | New Git URL |
0 commit comments