# HG changeset patch # User RhodeCode Admin # Date 2023-08-22 07:47:45 # Node ID a0c4958088ea38fb83ba8309555cc7973eab2462 # Parent f738f9137af7fe39dbfc47854ea866d2a0e7e49f lint: auto-fixes diff --git a/vcsserver/base.py b/vcsserver/base.py --- a/vcsserver/base.py +++ b/vcsserver/base.py @@ -30,7 +30,7 @@ from vcsserver.lib.exc_tracking import f log = logging.getLogger(__name__) -class RepoFactory(object): +class RepoFactory: """ Utility to create instances of repository @@ -84,7 +84,7 @@ def raise_from_original(new_type, org_ex del exc_traceback -class ArchiveNode(object): +class ArchiveNode: def __init__(self, path, mode, is_link, raw_bytes): self.path = path self.mode = mode @@ -176,7 +176,7 @@ def store_archive_in_cache(node_walker, return reader.name -class BinaryEnvelope(object): +class BinaryEnvelope: def __init__(self, val): self.val = val diff --git a/vcsserver/config/settings_maker.py b/vcsserver/config/settings_maker.py --- a/vcsserver/config/settings_maker.py +++ b/vcsserver/config/settings_maker.py @@ -34,7 +34,7 @@ set_keys = { } -class SettingsMaker(object): +class SettingsMaker: def __init__(self, app_settings): self.settings = app_settings diff --git a/vcsserver/echo_stub/echo_app.py b/vcsserver/echo_stub/echo_app.py --- a/vcsserver/echo_stub/echo_app.py +++ b/vcsserver/echo_stub/echo_app.py @@ -12,7 +12,7 @@ import logging log = logging.getLogger(__name__) -class EchoApp(object): +class EchoApp: def __init__(self, repo_path, repo_name, config): self._repo_path = repo_path @@ -28,7 +28,7 @@ class EchoApp(object): return [b"ECHO"] -class EchoAppStream(object): +class EchoAppStream: def __init__(self, repo_path, repo_name, config): self._repo_path = repo_path diff --git a/vcsserver/echo_stub/remote_wsgi.py b/vcsserver/echo_stub/remote_wsgi.py --- a/vcsserver/echo_stub/remote_wsgi.py +++ b/vcsserver/echo_stub/remote_wsgi.py @@ -15,7 +15,7 @@ from vcsserver import wsgi_app_caller log = logging.getLogger(__name__) -class GitRemoteWsgi(object): +class GitRemoteWsgi: def handle(self, environ, input_data, *args, **kwargs): app = wsgi_app_caller.WSGIAppCaller( create_echo_wsgi_app(*args, **kwargs)) @@ -23,7 +23,7 @@ class GitRemoteWsgi(object): return app.handle(environ, input_data) -class HgRemoteWsgi(object): +class HgRemoteWsgi: def handle(self, environ, input_data, *args, **kwargs): app = wsgi_app_caller.WSGIAppCaller( create_echo_wsgi_app(*args, **kwargs)) diff --git a/vcsserver/git_lfs/app.py b/vcsserver/git_lfs/app.py --- a/vcsserver/git_lfs/app.py +++ b/vcsserver/git_lfs/app.py @@ -47,7 +47,7 @@ def write_response_error(http_exception, return _exception -class AuthHeaderRequired(object): +class AuthHeaderRequired: """ Decorator to check if request has proper auth-header """ @@ -94,7 +94,7 @@ def lfs_objects_batch(request): if operation not in ('download', 'upload'): log.debug('LFS: unsupported operation:%s', operation) return write_response_error( - HTTPBadRequest, 'unsupported operation mode: `%s`' % operation) + HTTPBadRequest, f'unsupported operation mode: `{operation}`') if 'objects' not in data: log.debug('LFS: missing objects data') @@ -178,7 +178,7 @@ def lfs_objects_oid_download(request): if not store.has_oid(): log.debug('LFS: oid %s does not exists in store', oid) return write_response_error( - HTTPNotFound, 'requested file with oid `%s` not found in store' % oid) + HTTPNotFound, f'requested file with oid `{oid}` not found in store') # TODO(marcink): support range header ? # Range: bytes=0-, `bytes=(\d+)\-.*` @@ -207,7 +207,7 @@ def lfs_objects_verify(request): if not store.has_oid(): log.debug('LFS: oid %s does not exists in store', oid) return write_response_error( - HTTPNotFound, 'oid `%s` does not exists in store' % oid) + HTTPNotFound, f'oid `{oid}` does not exists in store') store_size = store.size_oid() if store_size != size: diff --git a/vcsserver/git_lfs/lib.py b/vcsserver/git_lfs/lib.py --- a/vcsserver/git_lfs/lib.py +++ b/vcsserver/git_lfs/lib.py @@ -23,7 +23,7 @@ from collections import OrderedDict log = logging.getLogger(__name__) -class OidHandler(object): +class OidHandler: def __init__(self, store, repo_name, auth, oid, obj_size, obj_data, obj_href, obj_verify_href=None): @@ -113,7 +113,7 @@ class OidHandler(object): return handler(*args, **kwargs) -class LFSOidStore(object): +class LFSOidStore: def __init__(self, oid, repo, store_location=None): self.oid = oid diff --git a/vcsserver/git_lfs/tests/test_lfs_app.py b/vcsserver/git_lfs/tests/test_lfs_app.py --- a/vcsserver/git_lfs/tests/test_lfs_app.py +++ b/vcsserver/git_lfs/tests/test_lfs_app.py @@ -47,7 +47,7 @@ def http_auth(): return {'HTTP_AUTHORIZATION': "Basic XXXXX"} -class TestLFSApplication(object): +class TestLFSApplication: def test_app_wrong_path(self, git_lfs_app): git_lfs_app.get('/repo/info/lfs/xxx', status=404) diff --git a/vcsserver/git_lfs/tests/test_lib.py b/vcsserver/git_lfs/tests/test_lib.py --- a/vcsserver/git_lfs/tests/test_lib.py +++ b/vcsserver/git_lfs/tests/test_lib.py @@ -43,7 +43,7 @@ def oid_handler(lfs_store): return oid_handler -class TestOidHandler(object): +class TestOidHandler: @pytest.mark.parametrize('exec_action', [ 'download', @@ -120,7 +120,7 @@ class TestOidHandler(object): } -class TestLFSStore(object): +class TestLFSStore: def test_write_oid(self, lfs_store): oid_location = lfs_store.oid_path diff --git a/vcsserver/hook_utils/__init__.py b/vcsserver/hook_utils/__init__.py --- a/vcsserver/hook_utils/__init__.py +++ b/vcsserver/hook_utils/__init__.py @@ -62,7 +62,7 @@ def install_git_hooks(repo_path, bare, e for h_type, template in [('pre', tmpl_pre), ('post', tmpl_post)]: log.debug('Installing git hook in repo %s', repo_path) - _hook_file = os.path.join(hooks_path, '%s-receive' % h_type) + _hook_file = os.path.join(hooks_path, f'{h_type}-receive') _rhodecode_hook = check_rhodecode_hook(_hook_file) if _rhodecode_hook or force_create: @@ -114,7 +114,7 @@ def install_svn_hooks(repo_path, executa for h_type, template in [('pre', tmpl_pre), ('post', tmpl_post)]: log.debug('Installing svn hook in repo %s', repo_path) - _hook_file = os.path.join(hooks_path, '%s-commit' % h_type) + _hook_file = os.path.join(hooks_path, f'{h_type}-commit') _rhodecode_hook = check_rhodecode_hook(_hook_file) if _rhodecode_hook or force_create: diff --git a/vcsserver/hooks.py b/vcsserver/hooks.py --- a/vcsserver/hooks.py +++ b/vcsserver/hooks.py @@ -40,7 +40,7 @@ from vcsserver.remote.git_remote import log = logging.getLogger(__name__) -class HooksHttpClient(object): +class HooksHttpClient: proto = 'msgpack.v1' connection = None @@ -88,7 +88,7 @@ class HooksHttpClient(object): return headers, msgpack.packb(data) -class HooksDummyClient(object): +class HooksDummyClient: def __init__(self, hooks_module): self._hooks_module = importlib.import_module(hooks_module) @@ -97,13 +97,13 @@ class HooksDummyClient(object): return getattr(hooks, hook_name)(extras) -class HooksShadowRepoClient(object): +class HooksShadowRepoClient: def __call__(self, hook_name, extras): return {'output': '', 'status': 0} -class RemoteMessageWriter(object): +class RemoteMessageWriter: """Writer base class.""" def write(self, message): raise NotImplementedError() @@ -627,7 +627,7 @@ def git_post_receive(unused_repo_path, r # delete branch case elif push_ref['new_rev'] == empty_commit_id: - git_revs.append('delete_branch=>%s' % push_ref['name']) + git_revs.append(f'delete_branch=>{push_ref["name"]}') else: if push_ref['name'] not in branches: branches.append(push_ref['name']) @@ -659,7 +659,7 @@ def git_post_receive(unused_repo_path, r elif type_ == 'tags': if push_ref['name'] not in tags: tags.append(push_ref['name']) - git_revs.append('tag=>%s' % push_ref['name']) + git_revs.append(f'tag=>{push_ref["name"]}') extras['hook_type'] = 'post_receive' extras['commit_ids'] = git_revs diff --git a/vcsserver/http_main.py b/vcsserver/http_main.py --- a/vcsserver/http_main.py +++ b/vcsserver/http_main.py @@ -112,7 +112,7 @@ def log_max_fd(): pass -class VCS(object): +class VCS: def __init__(self, locale_conf=None, cache_config=None): self.locale = locale_conf self.cache_config = cache_config @@ -162,7 +162,7 @@ class VCS(object): log.exception('Cannot set locale, not configuring the locale system') -class WsgiProxy(object): +class WsgiProxy: def __init__(self, wsgi): self.wsgi = wsgi @@ -200,7 +200,7 @@ def not_found(request): return {'status': '404 NOT FOUND'} -class VCSViewPredicate(object): +class VCSViewPredicate: def __init__(self, val, config): self.remotes = val @@ -218,7 +218,7 @@ class VCSViewPredicate(object): return backend in self.remotes -class HTTPApplication(object): +class HTTPApplication: ALLOWED_EXCEPTIONS = ('KeyError', 'URLError') remote_wsgi = remote_wsgi @@ -684,7 +684,7 @@ class HTTPApplication(object): raise exception -class ResponseFilter(object): +class ResponseFilter: def __init__(self, start_response): self._start_response = start_response diff --git a/vcsserver/lib/_vendor/redis_lock/__init__.py b/vcsserver/lib/_vendor/redis_lock/__init__.py --- a/vcsserver/lib/_vendor/redis_lock/__init__.py +++ b/vcsserver/lib/_vendor/redis_lock/__init__.py @@ -102,7 +102,7 @@ class NotExpirable(RuntimeError): pass -class Lock(object): +class Lock: """ A Lock context manager implemented via redis SETNX/BLPOP. """ diff --git a/vcsserver/lib/_vendor/statsd/base.py b/vcsserver/lib/_vendor/statsd/base.py --- a/vcsserver/lib/_vendor/statsd/base.py +++ b/vcsserver/lib/_vendor/statsd/base.py @@ -29,7 +29,7 @@ def normalize_tags(tag_list): return _normalize_tags_with_cache(tuple(tag_list)) -class StatsClientBase(object): +class StatsClientBase: """A Base class for various statsd clients.""" def close(self): diff --git a/vcsserver/lib/_vendor/statsd/timer.py b/vcsserver/lib/_vendor/statsd/timer.py --- a/vcsserver/lib/_vendor/statsd/timer.py +++ b/vcsserver/lib/_vendor/statsd/timer.py @@ -9,7 +9,7 @@ def safe_wraps(wrapper, *args, **kwargs) return functools.wraps(wrapper, *args, **kwargs) -class Timer(object): +class Timer: """A context manager/decorator for statsd.timing().""" def __init__(self, client, stat, rate=1, tags=None, use_decimals=True, auto_send=True): diff --git a/vcsserver/lib/rc_cache/backends.py b/vcsserver/lib/rc_cache/backends.py --- a/vcsserver/lib/rc_cache/backends.py +++ b/vcsserver/lib/rc_cache/backends.py @@ -87,7 +87,7 @@ class PickleSerializer: ) -class MsgPackSerializer(object): +class MsgPackSerializer: serializer: None | Serializer = staticmethod( # type: ignore msgpack.packb ) @@ -223,7 +223,7 @@ class RedisMsgPackBackend(MsgPackSeriali def get_mutex_lock(client, lock_key, lock_timeout, auto_renewal=False): from vcsserver.lib._vendor import redis_lock - class _RedisLockWrapper(object): + class _RedisLockWrapper: """LockWrapper for redis_lock""" @classmethod diff --git a/vcsserver/lib/svnremoterepo.py b/vcsserver/lib/svnremoterepo.py --- a/vcsserver/lib/svnremoterepo.py +++ b/vcsserver/lib/svnremoterepo.py @@ -95,7 +95,7 @@ def _create_auth_baton(pool): return core.svn_auth_open(providers, pool) -class SubversionRepo(object): +class SubversionRepo: """Wrapper for a Subversion repository. It uses the SWIG Python bindings, see above for requirements. @@ -145,7 +145,7 @@ class SubversionRepo(object): raise SubversionConnectionException(msg) -class svnremoterepo(object): +class svnremoterepo: """ the dumb wrapper for actual Subversion repositories """ def __init__(self, username: bytes = b'', password: bytes = b'', svn_url: bytes = b''): diff --git a/vcsserver/pygrack.py b/vcsserver/pygrack.py --- a/vcsserver/pygrack.py +++ b/vcsserver/pygrack.py @@ -33,7 +33,7 @@ from vcsserver.str_utils import ascii_by log = logging.getLogger(__name__) -class FileWrapper(object): +class FileWrapper: """File wrapper that ensures how much data is read from it.""" def __init__(self, fd, content_length): @@ -61,7 +61,7 @@ class FileWrapper(object): ) -class GitRepository(object): +class GitRepository: """WSGI app for handling Git smart protocol endpoints.""" git_folder_signature = frozenset(('config', 'head', 'info', 'objects', 'refs')) diff --git a/vcsserver/remote/git_remote.py b/vcsserver/remote/git_remote.py --- a/vcsserver/remote/git_remote.py +++ b/vcsserver/remote/git_remote.py @@ -482,7 +482,7 @@ class GitRemote(RemoteBase): o.addheaders = [('User-Agent', 'git/1.7.8.0')] # fake some git q = {"service": 'git-upload-pack'} - qs = '?%s' % urllib.parse.urlencode(q) + qs = f'?{urllib.parse.urlencode(q)}' cu = f"{test_uri}{qs}" req = urllib.request.Request(cu, None, {}) @@ -507,8 +507,7 @@ class GitRemote(RemoteBase): else: e = None raise exceptions.URLError(e)( - "url [%s] does not look like an hg repo org_exc: %s" - % (obfuscated_uri, e)) + f"url [{obfuscated_uri}] does not look like an hg repo org_exc: {e}") return True @@ -1184,7 +1183,7 @@ class GitRemote(RemoteBase): """ flags = [ - '-U%s' % context, '--patch', + f'-U{context}', '--patch', '--binary', '--find-renames', '--no-indent-heuristic', diff --git a/vcsserver/remote/hg_remote.py b/vcsserver/remote/hg_remote.py --- a/vcsserver/remote/hg_remote.py +++ b/vcsserver/remote/hg_remote.py @@ -333,7 +333,7 @@ class HgRemote(RemoteBase): result[attr] = method(wire, commit_id) except KeyError as e: raise exceptions.VcsException(e)( - 'Unknown bulk attribute: "%s"' % attr) + f'Unknown bulk attribute: "{attr}"') return result return _bulk_request(repo_id, commit_id, sorted(pre_load)) @@ -499,7 +499,7 @@ class HgRemote(RemoteBase): q = {"cmd": 'between'} q.update({'pairs': "{}-{}".format('0' * 40, '0' * 40)}) - qs = '?%s' % urllib.parse.urlencode(q) + qs = f'?{urllib.parse.urlencode(q)}' cu = f"{test_uri}{qs}" req = urllib.request.Request(cu, None, {}) @@ -528,8 +528,7 @@ class HgRemote(RemoteBase): log.warning("URL is not a valid Mercurial repository: %s", obfuscated_uri) raise exceptions.URLError(e)( - "url [%s] does not look like an hg repo org_exc: %s" - % (obfuscated_uri, e)) + f"url [{obfuscated_uri}] does not look like an hg repo org_exc: {e}") log.info("URL is a valid Mercurial repository: %s", obfuscated_uri) return True diff --git a/vcsserver/remote/svn_remote.py b/vcsserver/remote/svn_remote.py --- a/vcsserver/remote/svn_remote.py +++ b/vcsserver/remote/svn_remote.py @@ -203,7 +203,7 @@ class SvnRemote(RemoteBase): repo_path = wire['path'] if not self.is_path_valid_repository(wire, repo_path): raise Exception( - "Path %s is not a valid Subversion repository." % repo_path) + f"Path {repo_path} is not a valid Subversion repository.") cmd = ['svnadmin', 'info', repo_path] stdout, stderr = subprocessio.run_command(cmd) @@ -439,7 +439,7 @@ class SvnRemote(RemoteBase): repo_path = wire['path'] if not self.is_path_valid_repository(wire, repo_path): raise Exception( - "Path %s is not a valid Subversion repository." % repo_path) + f"Path {repo_path} is not a valid Subversion repository.") username, password, src_url = self.get_url_and_credentials(src_url) rdump_cmd = ['svnrdump', 'dump', '--non-interactive', @@ -477,8 +477,7 @@ class SvnRemote(RemoteBase): src_url, reason)) if load.returncode != 0: raise Exception( - 'Failed to load the dump of remote repository from %s.' % - (src_url, )) + f'Failed to load the dump of remote repository from {src_url}.') def commit(self, wire, message, author, timestamp, updated, removed): @@ -673,7 +672,7 @@ class SvnRemote(RemoteBase): file_walker, archive_name_key, kind, mtime, archive_at_path, archive_dir_name, commit_id, cache_config=cache_config) -class SvnDiffer(object): +class SvnDiffer: """ Utility to create diffs based on difflib and the Subversion api """ @@ -865,7 +864,7 @@ def authorization_callback_allow_all(roo return True -class TxnNodeProcessor(object): +class TxnNodeProcessor: """ Utility to process the change of one node within a transaction root. diff --git a/vcsserver/remote_wsgi.py b/vcsserver/remote_wsgi.py --- a/vcsserver/remote_wsgi.py +++ b/vcsserver/remote_wsgi.py @@ -18,7 +18,7 @@ from vcsserver import scm_app, wsgi_app_caller -class GitRemoteWsgi(object): +class GitRemoteWsgi: def handle(self, environ, input_data, *args, **kwargs): app = wsgi_app_caller.WSGIAppCaller( scm_app.create_git_wsgi_app(*args, **kwargs)) @@ -26,7 +26,7 @@ class GitRemoteWsgi(object): return app.handle(environ, input_data) -class HgRemoteWsgi(object): +class HgRemoteWsgi: def handle(self, environ, input_data, *args, **kwargs): app = wsgi_app_caller.WSGIAppCaller( scm_app.create_hg_wsgi_app(*args, **kwargs)) diff --git a/vcsserver/scm_app.py b/vcsserver/scm_app.py --- a/vcsserver/scm_app.py +++ b/vcsserver/scm_app.py @@ -163,7 +163,7 @@ def create_hg_wsgi_app(repo_path, repo_n raise exceptions.RequirementException(e)(e) -class GitHandler(object): +class GitHandler: """ Handler for Git operations like push/pull etc """ @@ -209,7 +209,7 @@ def create_git_wsgi_app(repo_path, repo_ return app -class GitLFSHandler(object): +class GitLFSHandler: """ Handler for Git LFS operations """ diff --git a/vcsserver/server.py b/vcsserver/server.py --- a/vcsserver/server.py +++ b/vcsserver/server.py @@ -24,7 +24,7 @@ import time log = logging.getLogger(__name__) -class VcsServer(object): +class VcsServer: """ Exposed remote interface of the vcsserver itself. diff --git a/vcsserver/subprocessio.py b/vcsserver/subprocessio.py --- a/vcsserver/subprocessio.py +++ b/vcsserver/subprocessio.py @@ -152,7 +152,7 @@ class InputStreamChunker(threading.Threa da.set() # for cases when done but there was no input. -class BufferedGenerator(object): +class BufferedGenerator: """ Class behaves as a non-blocking, buffered pipe reader. Reads chunks of data (through a thread) @@ -294,7 +294,7 @@ class BufferedGenerator(object): return self.data_queue[i] -class SubprocessIOChunker(object): +class SubprocessIOChunker: """ Processor class wrapping handling of subprocess IO. diff --git a/vcsserver/tests/fixture.py b/vcsserver/tests/fixture.py --- a/vcsserver/tests/fixture.py +++ b/vcsserver/tests/fixture.py @@ -21,7 +21,7 @@ import tempfile import configparser -class ContextINI(object): +class ContextINI: """ Allows to create a new test.ini file as a copy of existing one with edited data. If existing file is not present, it creates a new one. Example usage:: diff --git a/vcsserver/tests/test_git.py b/vcsserver/tests/test_git.py --- a/vcsserver/tests/test_git.py +++ b/vcsserver/tests/test_git.py @@ -47,7 +47,7 @@ def test_discover_git_version(git_remote assert version -class TestGitFetch(object): +class TestGitFetch: def setup_method(self): self.mock_repo = Mock() factory = Mock() @@ -99,7 +99,7 @@ class TestGitFetch(object): assert remote_refs == sample_refs -class TestReraiseSafeExceptions(object): +class TestReraiseSafeExceptions: def test_method_decorated_with_reraise_safe_exceptions(self): factory = Mock() @@ -134,7 +134,7 @@ class TestReraiseSafeExceptions(object): assert exc_info.value._vcs_kind == expected_type -class TestDulwichRepoWrapper(object): +class TestDulwichRepoWrapper: def test_calls_close_on_delete(self): isdir_patcher = patch('dulwich.repo.os.path.isdir', return_value=True) with patch.object(git_remote.Repo, 'close') as close_mock: @@ -147,7 +147,7 @@ class TestDulwichRepoWrapper(object): close_mock.assert_called_once_with() -class TestGitFactory(object): +class TestGitFactory: def test_create_repo_returns_dulwich_wrapper(self): with patch('vcsserver.lib.rc_cache.region_meta.dogpile_cache_regions') as mock: diff --git a/vcsserver/tests/test_hg.py b/vcsserver/tests/test_hg.py --- a/vcsserver/tests/test_hg.py +++ b/vcsserver/tests/test_hg.py @@ -27,7 +27,7 @@ from vcsserver import exceptions, hgcomp from vcsserver.remote import hg_remote -class TestDiff(object): +class TestDiff: def test_raising_safe_exception_when_lookup_failed(self): factory = Mock() @@ -44,7 +44,7 @@ class TestDiff(object): assert exc_info.value._vcs_kind == 'lookup' -class TestReraiseSafeExceptions(object): +class TestReraiseSafeExceptions: original_traceback = None def test_method_decorated_with_reraise_safe_exceptions(self): diff --git a/vcsserver/tests/test_hooks.py b/vcsserver/tests/test_hooks.py --- a/vcsserver/tests/test_hooks.py +++ b/vcsserver/tests/test_hooks.py @@ -121,7 +121,7 @@ def test_git_post_pull_is_disabled(): hooks.git_post_pull({'hooks': ['push']}) == hooks.HookResponse(0, '')) -class TestGetHooksClient(object): +class TestGetHooksClient: def test_returns_http_client_when_protocol_matches(self): hooks_uri = 'localhost:8000' @@ -146,7 +146,7 @@ class TestGetHooksClient(object): assert result._hooks_module == fake_module -class TestHooksHttpClient(object): +class TestHooksHttpClient: def test_init_sets_hooks_uri(self): uri = 'localhost:3000' client = hooks.HooksHttpClient(uri) @@ -182,7 +182,7 @@ class TestHooksHttpClient(object): assert result == expected_result -class TestHooksDummyClient(object): +class TestHooksDummyClient: def test_init_imports_hooks_module(self): hooks_module_name = 'rhodecode.fake.module' hooks_module = mock.MagicMock() @@ -224,7 +224,7 @@ class MirrorHttpHandler(BaseHTTPRequestH self.wfile.write(body) -class MirrorHttpServer(object): +class MirrorHttpServer: ip_address = '127.0.0.1' port = 0 diff --git a/vcsserver/tests/test_install_hooks.py b/vcsserver/tests/test_install_hooks.py --- a/vcsserver/tests/test_install_hooks.py +++ b/vcsserver/tests/test_install_hooks.py @@ -27,7 +27,7 @@ from vcsserver.str_utils import safe_byt from vcsserver.utils import AttributeDict -class TestCheckRhodecodeHook(object): +class TestCheckRhodecodeHook: def test_returns_false_when_hook_file_is_wrong_found(self, tmpdir): hook = os.path.join(str(tmpdir), 'fake_hook_file.py') @@ -55,7 +55,7 @@ class TestCheckRhodecodeHook(object): assert result is expected_result -class BaseInstallHooks(object): +class BaseInstallHooks: HOOK_FILES = () def _check_hook_file_mode(self, file_path): diff --git a/vcsserver/tests/test_pygrack.py b/vcsserver/tests/test_pygrack.py --- a/vcsserver/tests/test_pygrack.py +++ b/vcsserver/tests/test_pygrack.py @@ -72,7 +72,7 @@ def test_invalid_endpoint_returns_403(py def test_pre_pull_hook_fails_with_sideband(pygrack_app, sideband): request = ''.join([ '0054want 74730d410fcb6603ace96f1dc55ea6196122532d ', - 'multi_ack %s ofs-delta\n' % sideband, + f'multi_ack {sideband} ofs-delta\n', '0000', '0009done\n', ]) diff --git a/vcsserver/tests/test_subprocessio.py b/vcsserver/tests/test_subprocessio.py --- a/vcsserver/tests/test_subprocessio.py +++ b/vcsserver/tests/test_subprocessio.py @@ -25,7 +25,7 @@ from vcsserver import subprocessio from vcsserver.str_utils import ascii_bytes -class FileLikeObj(object): # pragma: no cover +class FileLikeObj: # pragma: no cover def __init__(self, data: bytes, size): chunks = size // len(data) diff --git a/vcsserver/tests/test_svn.py b/vcsserver/tests/test_svn.py --- a/vcsserver/tests/test_svn.py +++ b/vcsserver/tests/test_svn.py @@ -23,7 +23,7 @@ import sys from vcsserver.str_utils import ascii_bytes -class MockPopen(object): +class MockPopen: def __init__(self, stderr): self.stdout = io.BytesIO(b'') self.stderr = io.BytesIO(stderr) diff --git a/vcsserver/tweens/request_wrapper.py b/vcsserver/tweens/request_wrapper.py --- a/vcsserver/tweens/request_wrapper.py +++ b/vcsserver/tweens/request_wrapper.py @@ -55,7 +55,7 @@ def get_headers_call_context(environ, st raise ValueError('Expected header HTTP_X_RC_VCS_STREAM_CALL_CONTEXT not found') -class RequestWrapperTween(object): +class RequestWrapperTween: def __init__(self, handler, registry): self.handler = handler self.registry = registry diff --git a/vcsserver/vcs_base.py b/vcsserver/vcs_base.py --- a/vcsserver/vcs_base.py +++ b/vcsserver/vcs_base.py @@ -18,7 +18,7 @@ from vcsserver.lib import rc_cache -class RemoteBase(object): +class RemoteBase: EMPTY_COMMIT = '0' * 40 def _region(self, wire): diff --git a/vcsserver/wsgi_app_caller.py b/vcsserver/wsgi_app_caller.py --- a/vcsserver/wsgi_app_caller.py +++ b/vcsserver/wsgi_app_caller.py @@ -50,7 +50,7 @@ def _complete_environ(environ, input_dat # pylint: disable=too-few-public-methods -class _StartResponse(object): +class _StartResponse: """Save the arguments of a start_response call.""" __slots__ = ['status', 'headers', 'content'] @@ -76,7 +76,7 @@ class _StartResponse(object): self.content.append(content) -class WSGIAppCaller(object): +class WSGIAppCaller: """Calls a WSGI app.""" def __init__(self, app):