Show More
@@ -30,7 +30,7 b' from vcsserver.lib.exc_tracking import f' | |||
|
30 | 30 | log = logging.getLogger(__name__) |
|
31 | 31 | |
|
32 | 32 | |
|
33 |
class RepoFactory |
|
|
33 | class RepoFactory: | |
|
34 | 34 | """ |
|
35 | 35 | Utility to create instances of repository |
|
36 | 36 | |
@@ -84,7 +84,7 b' def raise_from_original(new_type, org_ex' | |||
|
84 | 84 | del exc_traceback |
|
85 | 85 | |
|
86 | 86 | |
|
87 |
class ArchiveNode |
|
|
87 | class ArchiveNode: | |
|
88 | 88 | def __init__(self, path, mode, is_link, raw_bytes): |
|
89 | 89 | self.path = path |
|
90 | 90 | self.mode = mode |
@@ -176,7 +176,7 b' def store_archive_in_cache(node_walker, ' | |||
|
176 | 176 | return reader.name |
|
177 | 177 | |
|
178 | 178 | |
|
179 |
class BinaryEnvelope |
|
|
179 | class BinaryEnvelope: | |
|
180 | 180 | def __init__(self, val): |
|
181 | 181 | self.val = val |
|
182 | 182 |
@@ -34,7 +34,7 b' set_keys = {' | |||
|
34 | 34 | } |
|
35 | 35 | |
|
36 | 36 | |
|
37 |
class SettingsMaker |
|
|
37 | class SettingsMaker: | |
|
38 | 38 | |
|
39 | 39 | def __init__(self, app_settings): |
|
40 | 40 | self.settings = app_settings |
@@ -12,7 +12,7 b' import logging' | |||
|
12 | 12 | log = logging.getLogger(__name__) |
|
13 | 13 | |
|
14 | 14 | |
|
15 |
class EchoApp |
|
|
15 | class EchoApp: | |
|
16 | 16 | |
|
17 | 17 | def __init__(self, repo_path, repo_name, config): |
|
18 | 18 | self._repo_path = repo_path |
@@ -28,7 +28,7 b' class EchoApp(object):' | |||
|
28 | 28 | return [b"ECHO"] |
|
29 | 29 | |
|
30 | 30 | |
|
31 |
class EchoAppStream |
|
|
31 | class EchoAppStream: | |
|
32 | 32 | |
|
33 | 33 | def __init__(self, repo_path, repo_name, config): |
|
34 | 34 | self._repo_path = repo_path |
@@ -15,7 +15,7 b' from vcsserver import wsgi_app_caller' | |||
|
15 | 15 | log = logging.getLogger(__name__) |
|
16 | 16 | |
|
17 | 17 | |
|
18 |
class GitRemoteWsgi |
|
|
18 | class GitRemoteWsgi: | |
|
19 | 19 | def handle(self, environ, input_data, *args, **kwargs): |
|
20 | 20 | app = wsgi_app_caller.WSGIAppCaller( |
|
21 | 21 | create_echo_wsgi_app(*args, **kwargs)) |
@@ -23,7 +23,7 b' class GitRemoteWsgi(object):' | |||
|
23 | 23 | return app.handle(environ, input_data) |
|
24 | 24 | |
|
25 | 25 | |
|
26 |
class HgRemoteWsgi |
|
|
26 | class HgRemoteWsgi: | |
|
27 | 27 | def handle(self, environ, input_data, *args, **kwargs): |
|
28 | 28 | app = wsgi_app_caller.WSGIAppCaller( |
|
29 | 29 | create_echo_wsgi_app(*args, **kwargs)) |
@@ -47,7 +47,7 b' def write_response_error(http_exception,' | |||
|
47 | 47 | return _exception |
|
48 | 48 | |
|
49 | 49 | |
|
50 |
class AuthHeaderRequired |
|
|
50 | class AuthHeaderRequired: | |
|
51 | 51 | """ |
|
52 | 52 | Decorator to check if request has proper auth-header |
|
53 | 53 | """ |
@@ -94,7 +94,7 b' def lfs_objects_batch(request):' | |||
|
94 | 94 | if operation not in ('download', 'upload'): |
|
95 | 95 | log.debug('LFS: unsupported operation:%s', operation) |
|
96 | 96 | return write_response_error( |
|
97 |
HTTPBadRequest, 'unsupported operation mode: ` |
|
|
97 | HTTPBadRequest, f'unsupported operation mode: `{operation}`') | |
|
98 | 98 | |
|
99 | 99 | if 'objects' not in data: |
|
100 | 100 | log.debug('LFS: missing objects data') |
@@ -178,7 +178,7 b' def lfs_objects_oid_download(request):' | |||
|
178 | 178 | if not store.has_oid(): |
|
179 | 179 | log.debug('LFS: oid %s does not exists in store', oid) |
|
180 | 180 | return write_response_error( |
|
181 |
HTTPNotFound, 'requested file with oid ` |
|
|
181 | HTTPNotFound, f'requested file with oid `{oid}` not found in store') | |
|
182 | 182 | |
|
183 | 183 | # TODO(marcink): support range header ? |
|
184 | 184 | # Range: bytes=0-, `bytes=(\d+)\-.*` |
@@ -207,7 +207,7 b' def lfs_objects_verify(request):' | |||
|
207 | 207 | if not store.has_oid(): |
|
208 | 208 | log.debug('LFS: oid %s does not exists in store', oid) |
|
209 | 209 | return write_response_error( |
|
210 |
HTTPNotFound, 'oid ` |
|
|
210 | HTTPNotFound, f'oid `{oid}` does not exists in store') | |
|
211 | 211 | |
|
212 | 212 | store_size = store.size_oid() |
|
213 | 213 | if store_size != size: |
@@ -23,7 +23,7 b' from collections import OrderedDict' | |||
|
23 | 23 | log = logging.getLogger(__name__) |
|
24 | 24 | |
|
25 | 25 | |
|
26 |
class OidHandler |
|
|
26 | class OidHandler: | |
|
27 | 27 | |
|
28 | 28 | def __init__(self, store, repo_name, auth, oid, obj_size, obj_data, obj_href, |
|
29 | 29 | obj_verify_href=None): |
@@ -113,7 +113,7 b' class OidHandler(object):' | |||
|
113 | 113 | return handler(*args, **kwargs) |
|
114 | 114 | |
|
115 | 115 | |
|
116 |
class LFSOidStore |
|
|
116 | class LFSOidStore: | |
|
117 | 117 | |
|
118 | 118 | def __init__(self, oid, repo, store_location=None): |
|
119 | 119 | self.oid = oid |
@@ -47,7 +47,7 b' def http_auth():' | |||
|
47 | 47 | return {'HTTP_AUTHORIZATION': "Basic XXXXX"} |
|
48 | 48 | |
|
49 | 49 | |
|
50 |
class TestLFSApplication |
|
|
50 | class TestLFSApplication: | |
|
51 | 51 | |
|
52 | 52 | def test_app_wrong_path(self, git_lfs_app): |
|
53 | 53 | git_lfs_app.get('/repo/info/lfs/xxx', status=404) |
@@ -43,7 +43,7 b' def oid_handler(lfs_store):' | |||
|
43 | 43 | return oid_handler |
|
44 | 44 | |
|
45 | 45 | |
|
46 |
class TestOidHandler |
|
|
46 | class TestOidHandler: | |
|
47 | 47 | |
|
48 | 48 | @pytest.mark.parametrize('exec_action', [ |
|
49 | 49 | 'download', |
@@ -120,7 +120,7 b' class TestOidHandler(object):' | |||
|
120 | 120 | } |
|
121 | 121 | |
|
122 | 122 | |
|
123 |
class TestLFSStore |
|
|
123 | class TestLFSStore: | |
|
124 | 124 | def test_write_oid(self, lfs_store): |
|
125 | 125 | oid_location = lfs_store.oid_path |
|
126 | 126 |
@@ -62,7 +62,7 b' def install_git_hooks(repo_path, bare, e' | |||
|
62 | 62 | |
|
63 | 63 | for h_type, template in [('pre', tmpl_pre), ('post', tmpl_post)]: |
|
64 | 64 | log.debug('Installing git hook in repo %s', repo_path) |
|
65 |
_hook_file = os.path.join(hooks_path, ' |
|
|
65 | _hook_file = os.path.join(hooks_path, f'{h_type}-receive') | |
|
66 | 66 | _rhodecode_hook = check_rhodecode_hook(_hook_file) |
|
67 | 67 | |
|
68 | 68 | if _rhodecode_hook or force_create: |
@@ -114,7 +114,7 b' def install_svn_hooks(repo_path, executa' | |||
|
114 | 114 | |
|
115 | 115 | for h_type, template in [('pre', tmpl_pre), ('post', tmpl_post)]: |
|
116 | 116 | log.debug('Installing svn hook in repo %s', repo_path) |
|
117 |
_hook_file = os.path.join(hooks_path, ' |
|
|
117 | _hook_file = os.path.join(hooks_path, f'{h_type}-commit') | |
|
118 | 118 | _rhodecode_hook = check_rhodecode_hook(_hook_file) |
|
119 | 119 | |
|
120 | 120 | if _rhodecode_hook or force_create: |
@@ -40,7 +40,7 b' from vcsserver.remote.git_remote import ' | |||
|
40 | 40 | log = logging.getLogger(__name__) |
|
41 | 41 | |
|
42 | 42 | |
|
43 |
class HooksHttpClient |
|
|
43 | class HooksHttpClient: | |
|
44 | 44 | proto = 'msgpack.v1' |
|
45 | 45 | connection = None |
|
46 | 46 | |
@@ -88,7 +88,7 b' class HooksHttpClient(object):' | |||
|
88 | 88 | return headers, msgpack.packb(data) |
|
89 | 89 | |
|
90 | 90 | |
|
91 |
class HooksDummyClient |
|
|
91 | class HooksDummyClient: | |
|
92 | 92 | def __init__(self, hooks_module): |
|
93 | 93 | self._hooks_module = importlib.import_module(hooks_module) |
|
94 | 94 | |
@@ -97,13 +97,13 b' class HooksDummyClient(object):' | |||
|
97 | 97 | return getattr(hooks, hook_name)(extras) |
|
98 | 98 | |
|
99 | 99 | |
|
100 |
class HooksShadowRepoClient |
|
|
100 | class HooksShadowRepoClient: | |
|
101 | 101 | |
|
102 | 102 | def __call__(self, hook_name, extras): |
|
103 | 103 | return {'output': '', 'status': 0} |
|
104 | 104 | |
|
105 | 105 | |
|
106 |
class RemoteMessageWriter |
|
|
106 | class RemoteMessageWriter: | |
|
107 | 107 | """Writer base class.""" |
|
108 | 108 | def write(self, message): |
|
109 | 109 | raise NotImplementedError() |
@@ -627,7 +627,7 b' def git_post_receive(unused_repo_path, r' | |||
|
627 | 627 | |
|
628 | 628 | # delete branch case |
|
629 | 629 | elif push_ref['new_rev'] == empty_commit_id: |
|
630 |
git_revs.append('delete_branch=> |
|
|
630 | git_revs.append(f'delete_branch=>{push_ref["name"]}') | |
|
631 | 631 | else: |
|
632 | 632 | if push_ref['name'] not in branches: |
|
633 | 633 | branches.append(push_ref['name']) |
@@ -659,7 +659,7 b' def git_post_receive(unused_repo_path, r' | |||
|
659 | 659 | elif type_ == 'tags': |
|
660 | 660 | if push_ref['name'] not in tags: |
|
661 | 661 | tags.append(push_ref['name']) |
|
662 |
git_revs.append('tag=> |
|
|
662 | git_revs.append(f'tag=>{push_ref["name"]}') | |
|
663 | 663 | |
|
664 | 664 | extras['hook_type'] = 'post_receive' |
|
665 | 665 | extras['commit_ids'] = git_revs |
@@ -112,7 +112,7 b' def log_max_fd():' | |||
|
112 | 112 | pass |
|
113 | 113 | |
|
114 | 114 | |
|
115 |
class VCS |
|
|
115 | class VCS: | |
|
116 | 116 | def __init__(self, locale_conf=None, cache_config=None): |
|
117 | 117 | self.locale = locale_conf |
|
118 | 118 | self.cache_config = cache_config |
@@ -162,7 +162,7 b' class VCS(object):' | |||
|
162 | 162 | log.exception('Cannot set locale, not configuring the locale system') |
|
163 | 163 | |
|
164 | 164 | |
|
165 |
class WsgiProxy |
|
|
165 | class WsgiProxy: | |
|
166 | 166 | def __init__(self, wsgi): |
|
167 | 167 | self.wsgi = wsgi |
|
168 | 168 | |
@@ -200,7 +200,7 b' def not_found(request):' | |||
|
200 | 200 | return {'status': '404 NOT FOUND'} |
|
201 | 201 | |
|
202 | 202 | |
|
203 |
class VCSViewPredicate |
|
|
203 | class VCSViewPredicate: | |
|
204 | 204 | def __init__(self, val, config): |
|
205 | 205 | self.remotes = val |
|
206 | 206 | |
@@ -218,7 +218,7 b' class VCSViewPredicate(object):' | |||
|
218 | 218 | return backend in self.remotes |
|
219 | 219 | |
|
220 | 220 | |
|
221 |
class HTTPApplication |
|
|
221 | class HTTPApplication: | |
|
222 | 222 | ALLOWED_EXCEPTIONS = ('KeyError', 'URLError') |
|
223 | 223 | |
|
224 | 224 | remote_wsgi = remote_wsgi |
@@ -684,7 +684,7 b' class HTTPApplication(object):' | |||
|
684 | 684 | raise exception |
|
685 | 685 | |
|
686 | 686 | |
|
687 |
class ResponseFilter |
|
|
687 | class ResponseFilter: | |
|
688 | 688 | |
|
689 | 689 | def __init__(self, start_response): |
|
690 | 690 | self._start_response = start_response |
@@ -102,7 +102,7 b' class NotExpirable(RuntimeError):' | |||
|
102 | 102 | pass |
|
103 | 103 | |
|
104 | 104 | |
|
105 |
class Lock |
|
|
105 | class Lock: | |
|
106 | 106 | """ |
|
107 | 107 | A Lock context manager implemented via redis SETNX/BLPOP. |
|
108 | 108 | """ |
@@ -29,7 +29,7 b' def normalize_tags(tag_list):' | |||
|
29 | 29 | return _normalize_tags_with_cache(tuple(tag_list)) |
|
30 | 30 | |
|
31 | 31 | |
|
32 |
class StatsClientBase |
|
|
32 | class StatsClientBase: | |
|
33 | 33 | """A Base class for various statsd clients.""" |
|
34 | 34 | |
|
35 | 35 | def close(self): |
@@ -9,7 +9,7 b' def safe_wraps(wrapper, *args, **kwargs)' | |||
|
9 | 9 | return functools.wraps(wrapper, *args, **kwargs) |
|
10 | 10 | |
|
11 | 11 | |
|
12 |
class Timer |
|
|
12 | class Timer: | |
|
13 | 13 | """A context manager/decorator for statsd.timing().""" |
|
14 | 14 | |
|
15 | 15 | def __init__(self, client, stat, rate=1, tags=None, use_decimals=True, auto_send=True): |
@@ -87,7 +87,7 b' class PickleSerializer:' | |||
|
87 | 87 | ) |
|
88 | 88 | |
|
89 | 89 | |
|
90 |
class MsgPackSerializer |
|
|
90 | class MsgPackSerializer: | |
|
91 | 91 | serializer: None | Serializer = staticmethod( # type: ignore |
|
92 | 92 | msgpack.packb |
|
93 | 93 | ) |
@@ -223,7 +223,7 b' class RedisMsgPackBackend(MsgPackSeriali' | |||
|
223 | 223 | def get_mutex_lock(client, lock_key, lock_timeout, auto_renewal=False): |
|
224 | 224 | from vcsserver.lib._vendor import redis_lock |
|
225 | 225 | |
|
226 |
class _RedisLockWrapper |
|
|
226 | class _RedisLockWrapper: | |
|
227 | 227 | """LockWrapper for redis_lock""" |
|
228 | 228 | |
|
229 | 229 | @classmethod |
@@ -95,7 +95,7 b' def _create_auth_baton(pool):' | |||
|
95 | 95 | return core.svn_auth_open(providers, pool) |
|
96 | 96 | |
|
97 | 97 | |
|
98 |
class SubversionRepo |
|
|
98 | class SubversionRepo: | |
|
99 | 99 | """Wrapper for a Subversion repository. |
|
100 | 100 | |
|
101 | 101 | It uses the SWIG Python bindings, see above for requirements. |
@@ -145,7 +145,7 b' class SubversionRepo(object):' | |||
|
145 | 145 | raise SubversionConnectionException(msg) |
|
146 | 146 | |
|
147 | 147 | |
|
148 |
class svnremoterepo |
|
|
148 | class svnremoterepo: | |
|
149 | 149 | """ the dumb wrapper for actual Subversion repositories """ |
|
150 | 150 | |
|
151 | 151 | def __init__(self, username: bytes = b'', password: bytes = b'', svn_url: bytes = b''): |
@@ -33,7 +33,7 b' from vcsserver.str_utils import ascii_by' | |||
|
33 | 33 | log = logging.getLogger(__name__) |
|
34 | 34 | |
|
35 | 35 | |
|
36 |
class FileWrapper |
|
|
36 | class FileWrapper: | |
|
37 | 37 | """File wrapper that ensures how much data is read from it.""" |
|
38 | 38 | |
|
39 | 39 | def __init__(self, fd, content_length): |
@@ -61,7 +61,7 b' class FileWrapper(object):' | |||
|
61 | 61 | ) |
|
62 | 62 | |
|
63 | 63 | |
|
64 |
class GitRepository |
|
|
64 | class GitRepository: | |
|
65 | 65 | """WSGI app for handling Git smart protocol endpoints.""" |
|
66 | 66 | |
|
67 | 67 | git_folder_signature = frozenset(('config', 'head', 'info', 'objects', 'refs')) |
@@ -482,7 +482,7 b' class GitRemote(RemoteBase):' | |||
|
482 | 482 | o.addheaders = [('User-Agent', 'git/1.7.8.0')] # fake some git |
|
483 | 483 | |
|
484 | 484 | q = {"service": 'git-upload-pack'} |
|
485 |
qs = '? |
|
|
485 | qs = f'?{urllib.parse.urlencode(q)}' | |
|
486 | 486 | cu = f"{test_uri}{qs}" |
|
487 | 487 | req = urllib.request.Request(cu, None, {}) |
|
488 | 488 | |
@@ -507,8 +507,7 b' class GitRemote(RemoteBase):' | |||
|
507 | 507 | else: |
|
508 | 508 | e = None |
|
509 | 509 | raise exceptions.URLError(e)( |
|
510 |
"url [ |
|
|
511 | % (obfuscated_uri, e)) | |
|
510 | f"url [{obfuscated_uri}] does not look like an hg repo org_exc: {e}") | |
|
512 | 511 | |
|
513 | 512 | return True |
|
514 | 513 | |
@@ -1184,7 +1183,7 b' class GitRemote(RemoteBase):' | |||
|
1184 | 1183 | """ |
|
1185 | 1184 | |
|
1186 | 1185 | flags = [ |
|
1187 |
'-U |
|
|
1186 | f'-U{context}', '--patch', | |
|
1188 | 1187 | '--binary', |
|
1189 | 1188 | '--find-renames', |
|
1190 | 1189 | '--no-indent-heuristic', |
@@ -333,7 +333,7 b' class HgRemote(RemoteBase):' | |||
|
333 | 333 | result[attr] = method(wire, commit_id) |
|
334 | 334 | except KeyError as e: |
|
335 | 335 | raise exceptions.VcsException(e)( |
|
336 |
'Unknown bulk attribute: " |
|
|
336 | f'Unknown bulk attribute: "{attr}"') | |
|
337 | 337 | return result |
|
338 | 338 | |
|
339 | 339 | return _bulk_request(repo_id, commit_id, sorted(pre_load)) |
@@ -499,7 +499,7 b' class HgRemote(RemoteBase):' | |||
|
499 | 499 | |
|
500 | 500 | q = {"cmd": 'between'} |
|
501 | 501 | q.update({'pairs': "{}-{}".format('0' * 40, '0' * 40)}) |
|
502 |
qs = '? |
|
|
502 | qs = f'?{urllib.parse.urlencode(q)}' | |
|
503 | 503 | cu = f"{test_uri}{qs}" |
|
504 | 504 | req = urllib.request.Request(cu, None, {}) |
|
505 | 505 | |
@@ -528,8 +528,7 b' class HgRemote(RemoteBase):' | |||
|
528 | 528 | log.warning("URL is not a valid Mercurial repository: %s", |
|
529 | 529 | obfuscated_uri) |
|
530 | 530 | raise exceptions.URLError(e)( |
|
531 |
"url [ |
|
|
532 | % (obfuscated_uri, e)) | |
|
531 | f"url [{obfuscated_uri}] does not look like an hg repo org_exc: {e}") | |
|
533 | 532 | |
|
534 | 533 | log.info("URL is a valid Mercurial repository: %s", obfuscated_uri) |
|
535 | 534 | return True |
@@ -203,7 +203,7 b' class SvnRemote(RemoteBase):' | |||
|
203 | 203 | repo_path = wire['path'] |
|
204 | 204 | if not self.is_path_valid_repository(wire, repo_path): |
|
205 | 205 | raise Exception( |
|
206 |
"Path |
|
|
206 | f"Path {repo_path} is not a valid Subversion repository.") | |
|
207 | 207 | |
|
208 | 208 | cmd = ['svnadmin', 'info', repo_path] |
|
209 | 209 | stdout, stderr = subprocessio.run_command(cmd) |
@@ -439,7 +439,7 b' class SvnRemote(RemoteBase):' | |||
|
439 | 439 | repo_path = wire['path'] |
|
440 | 440 | if not self.is_path_valid_repository(wire, repo_path): |
|
441 | 441 | raise Exception( |
|
442 |
"Path |
|
|
442 | f"Path {repo_path} is not a valid Subversion repository.") | |
|
443 | 443 | |
|
444 | 444 | username, password, src_url = self.get_url_and_credentials(src_url) |
|
445 | 445 | rdump_cmd = ['svnrdump', 'dump', '--non-interactive', |
@@ -477,8 +477,7 b' class SvnRemote(RemoteBase):' | |||
|
477 | 477 | src_url, reason)) |
|
478 | 478 | if load.returncode != 0: |
|
479 | 479 | raise Exception( |
|
480 |
'Failed to load the dump of remote repository from |
|
|
481 | (src_url, )) | |
|
480 | f'Failed to load the dump of remote repository from {src_url}.') | |
|
482 | 481 | |
|
483 | 482 | def commit(self, wire, message, author, timestamp, updated, removed): |
|
484 | 483 | |
@@ -673,7 +672,7 b' class SvnRemote(RemoteBase):' | |||
|
673 | 672 | file_walker, archive_name_key, kind, mtime, archive_at_path, archive_dir_name, commit_id, cache_config=cache_config) |
|
674 | 673 | |
|
675 | 674 | |
|
676 |
class SvnDiffer |
|
|
675 | class SvnDiffer: | |
|
677 | 676 | """ |
|
678 | 677 | Utility to create diffs based on difflib and the Subversion api |
|
679 | 678 | """ |
@@ -865,7 +864,7 b' def authorization_callback_allow_all(roo' | |||
|
865 | 864 | return True |
|
866 | 865 | |
|
867 | 866 | |
|
868 |
class TxnNodeProcessor |
|
|
867 | class TxnNodeProcessor: | |
|
869 | 868 | """ |
|
870 | 869 | Utility to process the change of one node within a transaction root. |
|
871 | 870 |
@@ -18,7 +18,7 b'' | |||
|
18 | 18 | from vcsserver import scm_app, wsgi_app_caller |
|
19 | 19 | |
|
20 | 20 | |
|
21 |
class GitRemoteWsgi |
|
|
21 | class GitRemoteWsgi: | |
|
22 | 22 | def handle(self, environ, input_data, *args, **kwargs): |
|
23 | 23 | app = wsgi_app_caller.WSGIAppCaller( |
|
24 | 24 | scm_app.create_git_wsgi_app(*args, **kwargs)) |
@@ -26,7 +26,7 b' class GitRemoteWsgi(object):' | |||
|
26 | 26 | return app.handle(environ, input_data) |
|
27 | 27 | |
|
28 | 28 | |
|
29 |
class HgRemoteWsgi |
|
|
29 | class HgRemoteWsgi: | |
|
30 | 30 | def handle(self, environ, input_data, *args, **kwargs): |
|
31 | 31 | app = wsgi_app_caller.WSGIAppCaller( |
|
32 | 32 | scm_app.create_hg_wsgi_app(*args, **kwargs)) |
@@ -163,7 +163,7 b' def create_hg_wsgi_app(repo_path, repo_n' | |||
|
163 | 163 | raise exceptions.RequirementException(e)(e) |
|
164 | 164 | |
|
165 | 165 | |
|
166 |
class GitHandler |
|
|
166 | class GitHandler: | |
|
167 | 167 | """ |
|
168 | 168 | Handler for Git operations like push/pull etc |
|
169 | 169 | """ |
@@ -209,7 +209,7 b' def create_git_wsgi_app(repo_path, repo_' | |||
|
209 | 209 | return app |
|
210 | 210 | |
|
211 | 211 | |
|
212 |
class GitLFSHandler |
|
|
212 | class GitLFSHandler: | |
|
213 | 213 | """ |
|
214 | 214 | Handler for Git LFS operations |
|
215 | 215 | """ |
@@ -24,7 +24,7 b' import time' | |||
|
24 | 24 | log = logging.getLogger(__name__) |
|
25 | 25 | |
|
26 | 26 | |
|
27 |
class VcsServer |
|
|
27 | class VcsServer: | |
|
28 | 28 | """ |
|
29 | 29 | Exposed remote interface of the vcsserver itself. |
|
30 | 30 |
@@ -152,7 +152,7 b' class InputStreamChunker(threading.Threa' | |||
|
152 | 152 | da.set() # for cases when done but there was no input. |
|
153 | 153 | |
|
154 | 154 | |
|
155 |
class BufferedGenerator |
|
|
155 | class BufferedGenerator: | |
|
156 | 156 | """ |
|
157 | 157 | Class behaves as a non-blocking, buffered pipe reader. |
|
158 | 158 | Reads chunks of data (through a thread) |
@@ -294,7 +294,7 b' class BufferedGenerator(object):' | |||
|
294 | 294 | return self.data_queue[i] |
|
295 | 295 | |
|
296 | 296 | |
|
297 |
class SubprocessIOChunker |
|
|
297 | class SubprocessIOChunker: | |
|
298 | 298 | """ |
|
299 | 299 | Processor class wrapping handling of subprocess IO. |
|
300 | 300 |
@@ -21,7 +21,7 b' import tempfile' | |||
|
21 | 21 | import configparser |
|
22 | 22 | |
|
23 | 23 | |
|
24 |
class ContextINI |
|
|
24 | class ContextINI: | |
|
25 | 25 | """ |
|
26 | 26 | Allows to create a new test.ini file as a copy of existing one with edited |
|
27 | 27 | data. If existing file is not present, it creates a new one. Example usage:: |
@@ -47,7 +47,7 b' def test_discover_git_version(git_remote' | |||
|
47 | 47 | assert version |
|
48 | 48 | |
|
49 | 49 | |
|
50 |
class TestGitFetch |
|
|
50 | class TestGitFetch: | |
|
51 | 51 | def setup_method(self): |
|
52 | 52 | self.mock_repo = Mock() |
|
53 | 53 | factory = Mock() |
@@ -99,7 +99,7 b' class TestGitFetch(object):' | |||
|
99 | 99 | assert remote_refs == sample_refs |
|
100 | 100 | |
|
101 | 101 | |
|
102 |
class TestReraiseSafeExceptions |
|
|
102 | class TestReraiseSafeExceptions: | |
|
103 | 103 | |
|
104 | 104 | def test_method_decorated_with_reraise_safe_exceptions(self): |
|
105 | 105 | factory = Mock() |
@@ -134,7 +134,7 b' class TestReraiseSafeExceptions(object):' | |||
|
134 | 134 | assert exc_info.value._vcs_kind == expected_type |
|
135 | 135 | |
|
136 | 136 | |
|
137 |
class TestDulwichRepoWrapper |
|
|
137 | class TestDulwichRepoWrapper: | |
|
138 | 138 | def test_calls_close_on_delete(self): |
|
139 | 139 | isdir_patcher = patch('dulwich.repo.os.path.isdir', return_value=True) |
|
140 | 140 | with patch.object(git_remote.Repo, 'close') as close_mock: |
@@ -147,7 +147,7 b' class TestDulwichRepoWrapper(object):' | |||
|
147 | 147 | close_mock.assert_called_once_with() |
|
148 | 148 | |
|
149 | 149 | |
|
150 |
class TestGitFactory |
|
|
150 | class TestGitFactory: | |
|
151 | 151 | def test_create_repo_returns_dulwich_wrapper(self): |
|
152 | 152 | |
|
153 | 153 | with patch('vcsserver.lib.rc_cache.region_meta.dogpile_cache_regions') as mock: |
@@ -27,7 +27,7 b' from vcsserver import exceptions, hgcomp' | |||
|
27 | 27 | from vcsserver.remote import hg_remote |
|
28 | 28 | |
|
29 | 29 | |
|
30 |
class TestDiff |
|
|
30 | class TestDiff: | |
|
31 | 31 | def test_raising_safe_exception_when_lookup_failed(self): |
|
32 | 32 | |
|
33 | 33 | factory = Mock() |
@@ -44,7 +44,7 b' class TestDiff(object):' | |||
|
44 | 44 | assert exc_info.value._vcs_kind == 'lookup' |
|
45 | 45 | |
|
46 | 46 | |
|
47 |
class TestReraiseSafeExceptions |
|
|
47 | class TestReraiseSafeExceptions: | |
|
48 | 48 | original_traceback = None |
|
49 | 49 | |
|
50 | 50 | def test_method_decorated_with_reraise_safe_exceptions(self): |
@@ -121,7 +121,7 b' def test_git_post_pull_is_disabled():' | |||
|
121 | 121 | hooks.git_post_pull({'hooks': ['push']}) == hooks.HookResponse(0, '')) |
|
122 | 122 | |
|
123 | 123 | |
|
124 |
class TestGetHooksClient |
|
|
124 | class TestGetHooksClient: | |
|
125 | 125 | |
|
126 | 126 | def test_returns_http_client_when_protocol_matches(self): |
|
127 | 127 | hooks_uri = 'localhost:8000' |
@@ -146,7 +146,7 b' class TestGetHooksClient(object):' | |||
|
146 | 146 | assert result._hooks_module == fake_module |
|
147 | 147 | |
|
148 | 148 | |
|
149 |
class TestHooksHttpClient |
|
|
149 | class TestHooksHttpClient: | |
|
150 | 150 | def test_init_sets_hooks_uri(self): |
|
151 | 151 | uri = 'localhost:3000' |
|
152 | 152 | client = hooks.HooksHttpClient(uri) |
@@ -182,7 +182,7 b' class TestHooksHttpClient(object):' | |||
|
182 | 182 | assert result == expected_result |
|
183 | 183 | |
|
184 | 184 | |
|
185 |
class TestHooksDummyClient |
|
|
185 | class TestHooksDummyClient: | |
|
186 | 186 | def test_init_imports_hooks_module(self): |
|
187 | 187 | hooks_module_name = 'rhodecode.fake.module' |
|
188 | 188 | hooks_module = mock.MagicMock() |
@@ -224,7 +224,7 b' class MirrorHttpHandler(BaseHTTPRequestH' | |||
|
224 | 224 | self.wfile.write(body) |
|
225 | 225 | |
|
226 | 226 | |
|
227 |
class MirrorHttpServer |
|
|
227 | class MirrorHttpServer: | |
|
228 | 228 | ip_address = '127.0.0.1' |
|
229 | 229 | port = 0 |
|
230 | 230 |
@@ -27,7 +27,7 b' from vcsserver.str_utils import safe_byt' | |||
|
27 | 27 | from vcsserver.utils import AttributeDict |
|
28 | 28 | |
|
29 | 29 | |
|
30 |
class TestCheckRhodecodeHook |
|
|
30 | class TestCheckRhodecodeHook: | |
|
31 | 31 | |
|
32 | 32 | def test_returns_false_when_hook_file_is_wrong_found(self, tmpdir): |
|
33 | 33 | hook = os.path.join(str(tmpdir), 'fake_hook_file.py') |
@@ -55,7 +55,7 b' class TestCheckRhodecodeHook(object):' | |||
|
55 | 55 | assert result is expected_result |
|
56 | 56 | |
|
57 | 57 | |
|
58 |
class BaseInstallHooks |
|
|
58 | class BaseInstallHooks: | |
|
59 | 59 | HOOK_FILES = () |
|
60 | 60 | |
|
61 | 61 | def _check_hook_file_mode(self, file_path): |
@@ -72,7 +72,7 b' def test_invalid_endpoint_returns_403(py' | |||
|
72 | 72 | def test_pre_pull_hook_fails_with_sideband(pygrack_app, sideband): |
|
73 | 73 | request = ''.join([ |
|
74 | 74 | '0054want 74730d410fcb6603ace96f1dc55ea6196122532d ', |
|
75 |
'multi_ack |
|
|
75 | f'multi_ack {sideband} ofs-delta\n', | |
|
76 | 76 | '0000', |
|
77 | 77 | '0009done\n', |
|
78 | 78 | ]) |
@@ -25,7 +25,7 b' from vcsserver import subprocessio' | |||
|
25 | 25 | from vcsserver.str_utils import ascii_bytes |
|
26 | 26 | |
|
27 | 27 | |
|
28 |
class FileLikeObj |
|
|
28 | class FileLikeObj: # pragma: no cover | |
|
29 | 29 | |
|
30 | 30 | def __init__(self, data: bytes, size): |
|
31 | 31 | chunks = size // len(data) |
@@ -23,7 +23,7 b' import sys' | |||
|
23 | 23 | from vcsserver.str_utils import ascii_bytes |
|
24 | 24 | |
|
25 | 25 | |
|
26 |
class MockPopen |
|
|
26 | class MockPopen: | |
|
27 | 27 | def __init__(self, stderr): |
|
28 | 28 | self.stdout = io.BytesIO(b'') |
|
29 | 29 | self.stderr = io.BytesIO(stderr) |
@@ -55,7 +55,7 b' def get_headers_call_context(environ, st' | |||
|
55 | 55 | raise ValueError('Expected header HTTP_X_RC_VCS_STREAM_CALL_CONTEXT not found') |
|
56 | 56 | |
|
57 | 57 | |
|
58 |
class RequestWrapperTween |
|
|
58 | class RequestWrapperTween: | |
|
59 | 59 | def __init__(self, handler, registry): |
|
60 | 60 | self.handler = handler |
|
61 | 61 | self.registry = registry |
@@ -18,7 +18,7 b'' | |||
|
18 | 18 | from vcsserver.lib import rc_cache |
|
19 | 19 | |
|
20 | 20 | |
|
21 |
class RemoteBase |
|
|
21 | class RemoteBase: | |
|
22 | 22 | EMPTY_COMMIT = '0' * 40 |
|
23 | 23 | |
|
24 | 24 | def _region(self, wire): |
@@ -50,7 +50,7 b' def _complete_environ(environ, input_dat' | |||
|
50 | 50 | |
|
51 | 51 | |
|
52 | 52 | # pylint: disable=too-few-public-methods |
|
53 |
class _StartResponse |
|
|
53 | class _StartResponse: | |
|
54 | 54 | """Save the arguments of a start_response call.""" |
|
55 | 55 | |
|
56 | 56 | __slots__ = ['status', 'headers', 'content'] |
@@ -76,7 +76,7 b' class _StartResponse(object):' | |||
|
76 | 76 | self.content.append(content) |
|
77 | 77 | |
|
78 | 78 | |
|
79 |
class WSGIAppCaller |
|
|
79 | class WSGIAppCaller: | |
|
80 | 80 | """Calls a WSGI app.""" |
|
81 | 81 | |
|
82 | 82 | def __init__(self, app): |
General Comments 0
You need to be logged in to leave comments.
Login now