summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo van Kemenade <hugovk@users.noreply.github.com>2021-10-14 17:27:17 +0300
committerHugo van Kemenade <hugovk@users.noreply.github.com>2021-10-14 17:27:17 +0300
commitf0b322afcf6934501bade7776c5331619485a06c (patch)
tree5312af0e01b555429690efa30a2763c4aa2d5df2
parent1bda3b6a5ee6e383e9fd3316caa2d8181e53bf45 (diff)
downloadsmmap-f0b322afcf6934501bade7776c5331619485a06c.tar.gz
Upgrade Python syntax with pyupgrade --py36-plus
-rw-r--r--doc/source/conf.py9
-rwxr-xr-xsetup.py2
-rw-r--r--smmap/buf.py2
-rw-r--r--smmap/mman.py6
-rw-r--r--smmap/test/lib.py2
-rw-r--r--smmap/test/test_buf.py2
-rw-r--r--smmap/test/test_mman.py2
-rw-r--r--smmap/util.py6
8 files changed, 13 insertions, 18 deletions
diff --git a/doc/source/conf.py b/doc/source/conf.py
index 5aa28e2..55dfc5c 100644
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# smmap documentation build configuration file, created by
# sphinx-quickstart on Wed Jun 8 15:14:25 2011.
@@ -38,8 +37,8 @@ source_suffix = '.rst'
master_doc = 'index'
# General information about the project.
-project = u'smmap'
-copyright = u'2011, Sebastian Thiel'
+project = 'smmap'
+copyright = '2011, Sebastian Thiel'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
@@ -173,8 +172,8 @@ htmlhelp_basename = 'smmapdoc'
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
- ('index', 'smmap.tex', u'smmap Documentation',
- u'Sebastian Thiel', 'manual'),
+ ('index', 'smmap.tex', 'smmap Documentation',
+ 'Sebastian Thiel', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
diff --git a/setup.py b/setup.py
index 56e560a..9ab8a7f 100755
--- a/setup.py
+++ b/setup.py
@@ -11,7 +11,7 @@ except ImportError:
import smmap
if os.path.exists("README.md"):
- long_description = open('README.md', "r", encoding="utf-8").read().replace('\r\n', '\n')
+ long_description = open('README.md', encoding="utf-8").read().replace('\r\n', '\n')
else:
long_description = "See https://github.com/gitpython-developers/smmap"
diff --git a/smmap/buf.py b/smmap/buf.py
index af8496e..795e0fd 100644
--- a/smmap/buf.py
+++ b/smmap/buf.py
@@ -4,7 +4,7 @@ import sys
__all__ = ["SlidingWindowMapBuffer"]
-class SlidingWindowMapBuffer(object):
+class SlidingWindowMapBuffer:
"""A buffer like object which allows direct byte-wise object and slicing into
memory of a mapped file. The mapping is controlled by the provided cursor.
diff --git a/smmap/mman.py b/smmap/mman.py
index 19c3a02..1de7d9e 100644
--- a/smmap/mman.py
+++ b/smmap/mman.py
@@ -15,7 +15,7 @@ __all__ = ["StaticWindowMapManager", "SlidingWindowMapManager", "WindowCursor"]
#}END utilities
-class WindowCursor(object):
+class WindowCursor:
"""
Pointer into the mapped region of the memory manager, keeping the map
@@ -233,7 +233,7 @@ class WindowCursor(object):
#} END interface
-class StaticWindowMapManager(object):
+class StaticWindowMapManager:
"""Provides a manager which will produce single size cursors that are allowed
to always map the whole file.
@@ -486,7 +486,7 @@ class SlidingWindowMapManager(StaticWindowMapManager):
def __init__(self, window_size=-1, max_memory_size=0, max_open_handles=sys.maxsize):
"""Adjusts the default window size to -1"""
- super(SlidingWindowMapManager, self).__init__(window_size, max_memory_size, max_open_handles)
+ super().__init__(window_size, max_memory_size, max_open_handles)
def _obtain_region(self, a, offset, size, flags, is_recursive):
# bisect to find an existing region. The c++ implementation cannot
diff --git a/smmap/test/lib.py b/smmap/test/lib.py
index f86c0c6..ca91ee9 100644
--- a/smmap/test/lib.py
+++ b/smmap/test/lib.py
@@ -8,7 +8,7 @@ __all__ = ['TestBase', 'FileCreator']
#{ Utilities
-class FileCreator(object):
+class FileCreator:
"""A instance which creates a temporary file with a prefix and a given size
and provides this info to the user.
diff --git a/smmap/test/test_buf.py b/smmap/test/test_buf.py
index 3b6009e..17555af 100644
--- a/smmap/test/test_buf.py
+++ b/smmap/test/test_buf.py
@@ -1,5 +1,3 @@
-from __future__ import print_function
-
from .lib import TestBase, FileCreator
from smmap.mman import (
diff --git a/smmap/test/test_mman.py b/smmap/test/test_mman.py
index 96bc355..d88316b 100644
--- a/smmap/test/test_mman.py
+++ b/smmap/test/test_mman.py
@@ -1,5 +1,3 @@
-from __future__ import print_function
-
from .lib import TestBase, FileCreator
from smmap.mman import (
diff --git a/smmap/util.py b/smmap/util.py
index 72b2394..cf027af 100644
--- a/smmap/util.py
+++ b/smmap/util.py
@@ -34,7 +34,7 @@ def is_64_bit():
#{ Utility Classes
-class MapWindow(object):
+class MapWindow:
"""Utility type which is used to snap windows towards each other, and to adjust their size"""
__slots__ = (
@@ -80,7 +80,7 @@ class MapWindow(object):
self.size = min(self.size + (window.ofs - self.ofs_end()), max_size)
-class MapRegion(object):
+class MapRegion:
"""Defines a mapped region of memory, aligned to pagesizes
@@ -198,7 +198,7 @@ class MapRegionList(list):
)
def __new__(cls, path):
- return super(MapRegionList, cls).__new__(cls)
+ return super().__new__(cls)
def __init__(self, path_or_fd):
self._path_or_fd = path_or_fd