Show More
@@ -64,7 +64,7 b' def obfuscate_qs(query_string):' | |||
|
64 | 64 | parsed.append((k, v)) |
|
65 | 65 | |
|
66 | 66 | return '&'.join('{}{}'.format( |
|
67 |
k, '={}' |
|
|
67 | k, f'={v}' if v else '') for k, v in parsed) | |
|
68 | 68 | |
|
69 | 69 | |
|
70 | 70 | def raise_from_original(new_type, org_exc: Exception): |
@@ -109,7 +109,7 b' class HTTPRepoLocked(HTTPLocked):' | |||
|
109 | 109 | def __init__(self, title, status_code=None, **kwargs): |
|
110 | 110 | self.code = status_code or HTTPLocked.code |
|
111 | 111 | self.title = title |
|
112 |
super( |
|
|
112 | super().__init__(**kwargs) | |
|
113 | 113 | |
|
114 | 114 | |
|
115 | 115 | class HTTPRepoBranchProtected(HTTPForbidden): |
@@ -1,5 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | ||
|
3 | 1 |
|
|
4 | 2 | # Copyright (C) 2014-2020 RhodeCode GmbH |
|
5 | 3 | # |
@@ -553,7 +551,7 b' def git_pre_receive(unused_repo_path, re' | |||
|
553 | 551 | if type_ == 'heads' and not (new_branch or delete_branch): |
|
554 | 552 | old_rev = push_ref['old_rev'] |
|
555 | 553 | new_rev = push_ref['new_rev'] |
|
556 |
cmd = [settings.GIT_EXECUTABLE, 'rev-list', old_rev, '^{}' |
|
|
554 | cmd = [settings.GIT_EXECUTABLE, 'rev-list', old_rev, f'^{new_rev}'] | |
|
557 | 555 | stdout, stderr = subprocessio.run_command( |
|
558 | 556 | cmd, env=os.environ.copy()) |
|
559 | 557 | # means we're having some non-reachable objects, this forced push was used |
@@ -206,7 +206,7 b' class VCSViewPredicate(object):' | |||
|
206 | 206 | self.remotes = val |
|
207 | 207 | |
|
208 | 208 | def text(self): |
|
209 |
return 'vcs view method = |
|
|
209 | return f'vcs view method = {list(self.remotes.keys())}' | |
|
210 | 210 | |
|
211 | 211 | phash = text |
|
212 | 212 | |
@@ -368,7 +368,7 b' class HTTPApplication(object):' | |||
|
368 | 368 | if statsd: |
|
369 | 369 | statsd.incr( |
|
370 | 370 | 'vcsserver_method_total', tags=[ |
|
371 |
"method:{}" |
|
|
371 | f"method:{method}", | |
|
372 | 372 | ]) |
|
373 | 373 | return payload, remote, method, args, kwargs |
|
374 | 374 | |
@@ -673,9 +673,9 b' class HTTPApplication(object):' | |||
|
673 | 673 | |
|
674 | 674 | statsd = request.registry.statsd |
|
675 | 675 | if statsd: |
|
676 |
exc_type = "{ |
|
|
676 | exc_type = f"{exception.__class__.__module__}.{exception.__class__.__name__}" | |
|
677 | 677 | statsd.incr('vcsserver_exception_total', |
|
678 |
tags=["type:{}" |
|
|
678 | tags=[f"type:{exc_type}"]) | |
|
679 | 679 | raise exception |
|
680 | 680 | |
|
681 | 681 |
@@ -1,5 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | ||
|
3 | 1 |
|
|
4 | 2 | # Copyright (C) 2014-2020 RhodeCode GmbH |
|
5 | 3 | # |
@@ -126,10 +124,10 b' def store_exception(exc_id, exc_info, pr' | |||
|
126 | 124 | def _find_exc_file(exc_id, prefix=global_prefix): |
|
127 | 125 | exc_store_path = get_exc_store() |
|
128 | 126 | if prefix: |
|
129 |
exc_id = '{}_{}' |
|
|
127 | exc_id = f'{exc_id}_{prefix}' | |
|
130 | 128 | else: |
|
131 | 129 | # search without a prefix |
|
132 |
exc_id = '{}' |
|
|
130 | exc_id = f'{exc_id}' | |
|
133 | 131 | |
|
134 | 132 | # we need to search the store for such start pattern as above |
|
135 | 133 | for fname in os.listdir(exc_store_path): |
@@ -1,5 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | ||
|
3 | 1 |
|
|
4 | 2 | # Copyright (C) 2014-2020 RhodeCode GmbH |
|
5 | 3 | # |
@@ -53,11 +51,11 b' class LRUDictDebug(LRUDict):' | |||
|
53 | 51 | Wrapper to provide some debug options |
|
54 | 52 | """ |
|
55 | 53 | def _report_keys(self): |
|
56 |
elems_cnt = ' |
|
|
54 | elems_cnt = '{}/{}'.format(len(list(self.keys())), self.size) | |
|
57 | 55 | # trick for pformat print it more nicely |
|
58 | 56 | fmt = '\n' |
|
59 | 57 | for cnt, elem in enumerate(self.keys()): |
|
60 |
fmt += ' |
|
|
58 | fmt += '{} - {}\n'.format(cnt+1, safe_str(elem)) | |
|
61 | 59 | log.debug('current LRU keys (%s):%s', elems_cnt, fmt) |
|
62 | 60 | |
|
63 | 61 | def __getitem__(self, key): |
@@ -1,5 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | ||
|
3 | 1 |
|
|
4 | 2 | # Copyright (C) 2014-2020 RhodeCode GmbH |
|
5 | 3 | # |
@@ -58,7 +58,7 b' class LRUMemoryBackend(memory_backend.Me' | |||
|
58 | 58 | LRUDictClass = LRUDictDebug |
|
59 | 59 | |
|
60 | 60 | arguments['cache_dict'] = LRUDictClass(self.max_size) |
|
61 |
super( |
|
|
61 | super().__init__(arguments) | |
|
62 | 62 | |
|
63 | 63 | def __repr__(self): |
|
64 | 64 | return f'{self.__class__}(maxsize=`{self.max_size}`)' |
@@ -79,19 +79,19 b' class LRUMemoryBackend(memory_backend.Me' | |||
|
79 | 79 | |
|
80 | 80 | |
|
81 | 81 | class PickleSerializer: |
|
82 |
serializer: |
|
|
82 | serializer: None | Serializer = staticmethod( # type: ignore | |
|
83 | 83 | functools.partial(pickle.dumps, protocol=pickle.HIGHEST_PROTOCOL) |
|
84 | 84 | ) |
|
85 |
deserializer: |
|
|
85 | deserializer: None | Deserializer = staticmethod( # type: ignore | |
|
86 | 86 | functools.partial(pickle.loads) |
|
87 | 87 | ) |
|
88 | 88 | |
|
89 | 89 | |
|
90 | 90 | class MsgPackSerializer(object): |
|
91 |
serializer: |
|
|
91 | serializer: None | Serializer = staticmethod( # type: ignore | |
|
92 | 92 | msgpack.packb |
|
93 | 93 | ) |
|
94 |
deserializer: |
|
|
94 | deserializer: None | Deserializer = staticmethod( # type: ignore | |
|
95 | 95 | functools.partial(msgpack.unpackb, use_list=False) |
|
96 | 96 | ) |
|
97 | 97 | |
@@ -114,7 +114,7 b' class FileNamespaceBackend(PickleSeriali' | |||
|
114 | 114 | os.makedirs(db_file_dir) |
|
115 | 115 | |
|
116 | 116 | try: |
|
117 |
super( |
|
|
117 | super().__init__(arguments) | |
|
118 | 118 | except Exception: |
|
119 | 119 | log.exception('Failed to initialize db at: %s', db_file) |
|
120 | 120 | raise |
@@ -152,7 +152,7 b' class BaseRedisBackend(redis_backend.Red' | |||
|
152 | 152 | |
|
153 | 153 | def __init__(self, arguments): |
|
154 | 154 | self.db_conn = arguments.get('host', '') or arguments.get('url', '') or 'redis-host' |
|
155 |
super( |
|
|
155 | super().__init__(arguments) | |
|
156 | 156 | |
|
157 | 157 | self._lock_timeout = self.lock_timeout |
|
158 | 158 | self._lock_auto_renewal = str2bool(arguments.pop("lock_auto_renewal", True)) |
@@ -168,7 +168,7 b' def get_or_create_region(region_name, re' | |||
|
168 | 168 | region_obj = region_meta.dogpile_cache_regions.get(region_name) |
|
169 | 169 | if not region_obj: |
|
170 | 170 | reg_keys = list(region_meta.dogpile_cache_regions.keys()) |
|
171 |
raise |
|
|
171 | raise OSError(f'Region `{region_name}` not in configured: {reg_keys}.') | |
|
172 | 172 | |
|
173 | 173 | region_uid_name = f'{region_name}:{region_namespace}' |
|
174 | 174 |
@@ -1,5 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | ||
|
3 | 1 |
|
|
4 | 2 | # Copyright (C) 2014-2020 RhodeCode GmbH |
|
5 | 3 | # |
@@ -29,7 +29,7 b' class _Singleton(type):' | |||
|
29 | 29 | |
|
30 | 30 | def __call__(cls, *args, **kwargs): |
|
31 | 31 | if cls not in cls._instances: |
|
32 |
cls._instances[cls] = super( |
|
|
32 | cls._instances[cls] = super().__call__(*args, **kwargs) | |
|
33 | 33 | return cls._instances[cls] |
|
34 | 34 | |
|
35 | 35 | |
@@ -47,13 +47,13 b' class StatsdClientClass(Singleton):' | |||
|
47 | 47 | |
|
48 | 48 | if name.startswith("statsd"): |
|
49 | 49 | if self.setup_run: |
|
50 |
return super( |
|
|
50 | return super().__getattribute__(name) | |
|
51 | 51 | else: |
|
52 | 52 | if self.strict_mode_init: |
|
53 | 53 | raise StatsdClientNotInitialised(f"requested key was {name}") |
|
54 | 54 | return None |
|
55 | 55 | |
|
56 |
return super( |
|
|
56 | return super().__getattribute__(name) | |
|
57 | 57 | |
|
58 | 58 | def setup(self, settings): |
|
59 | 59 | """ |
@@ -56,7 +56,7 b' class FileWrapper(object):' | |||
|
56 | 56 | return data |
|
57 | 57 | |
|
58 | 58 | def __repr__(self): |
|
59 |
return '<FileWrapper |
|
|
59 | return '<FileWrapper {} len: {}, read: {}>'.format( | |
|
60 | 60 | self.fd, self.content_length, self.content_length - self.remain |
|
61 | 61 | ) |
|
62 | 62 | |
@@ -66,7 +66,7 b' class GitRepository(object):' | |||
|
66 | 66 | |
|
67 | 67 | git_folder_signature = frozenset(('config', 'head', 'info', 'objects', 'refs')) |
|
68 | 68 | commands = frozenset(('git-upload-pack', 'git-receive-pack')) |
|
69 |
valid_accepts = frozenset( |
|
|
69 | valid_accepts = frozenset(f'application/x-{c}-result' for c in commands) | |
|
70 | 70 | |
|
71 | 71 | # The last bytes are the SHA1 of the first 12 bytes. |
|
72 | 72 | EMPTY_PACK = ( |
@@ -330,7 +330,7 b' class GitRepository(object):' | |||
|
330 | 330 | inputstream = request.body_file_seekable |
|
331 | 331 | |
|
332 | 332 | resp = Response() |
|
333 |
resp.content_type = 'application/x-{}-result' |
|
|
333 | resp.content_type = f'application/x-{git_command}-result' | |
|
334 | 334 | resp.charset = None |
|
335 | 335 | |
|
336 | 336 | pre_pull_messages = '' |
@@ -142,7 +142,7 b' class GitRemote(RemoteBase):' | |||
|
142 | 142 | |
|
143 | 143 | def _wire_to_config(self, wire): |
|
144 | 144 | if 'config' in wire: |
|
145 |
return |
|
|
145 | return {x[0] + '_' + x[1]: x[2] for x in wire['config']} | |
|
146 | 146 | return {} |
|
147 | 147 | |
|
148 | 148 | def _remote_conf(self, config): |
@@ -151,7 +151,7 b' class GitRemote(RemoteBase):' | |||
|
151 | 151 | ] |
|
152 | 152 | ssl_cert_dir = config.get('vcs_ssl_dir') |
|
153 | 153 | if ssl_cert_dir: |
|
154 |
params.extend(['-c', 'http.sslCAinfo={}' |
|
|
154 | params.extend(['-c', f'http.sslCAinfo={ssl_cert_dir}']) | |
|
155 | 155 | return params |
|
156 | 156 | |
|
157 | 157 | @reraise_safe_exceptions |
@@ -321,7 +321,7 b' class GitRemote(RemoteBase):' | |||
|
321 | 321 | store = LFSOidStore( |
|
322 | 322 | oid=oid, repo=repo_name, store_location=store_location) |
|
323 | 323 | return store.oid_path |
|
324 |
raise ValueError('Unable to fetch oid with path {}' |
|
|
324 | raise ValueError(f'Unable to fetch oid with path {oid}') | |
|
325 | 325 | |
|
326 | 326 | @reraise_safe_exceptions |
|
327 | 327 | def bulk_request(self, wire, rev, pre_load): |
@@ -383,7 +383,7 b' class GitRemote(RemoteBase):' | |||
|
383 | 383 | |
|
384 | 384 | q = {"service": 'git-upload-pack'} |
|
385 | 385 | qs = '?%s' % urllib.parse.urlencode(q) |
|
386 |
cu = " |
|
|
386 | cu = "{}{}".format(test_uri, qs) | |
|
387 | 387 | req = urllib.request.Request(cu, None, {}) |
|
388 | 388 | |
|
389 | 389 | try: |
@@ -394,7 +394,7 b' class GitRemote(RemoteBase):' | |||
|
394 | 394 | except Exception as e: |
|
395 | 395 | log.warning("URL cannot be opened: %s", cleaned_uri, exc_info=True) |
|
396 | 396 | # means it cannot be cloned |
|
397 |
raise exceptions.URLError(e)("[ |
|
|
397 | raise exceptions.URLError(e)("[{}] org_exc: {}".format(cleaned_uri, e)) | |
|
398 | 398 | |
|
399 | 399 | # now detect if it's proper git repo |
|
400 | 400 | gitdata = resp.read() |
@@ -405,7 +405,7 b' class GitRemote(RemoteBase):' | |||
|
405 | 405 | pass |
|
406 | 406 | else: |
|
407 | 407 | raise exceptions.URLError()( |
|
408 |
"url [ |
|
|
408 | "url [{}] does not look like an git".format(cleaned_uri)) | |
|
409 | 409 | |
|
410 | 410 | return True |
|
411 | 411 | |
@@ -943,12 +943,12 b' class GitRemote(RemoteBase):' | |||
|
943 | 943 | author = commit.get_object().author |
|
944 | 944 | |
|
945 | 945 | if author.email: |
|
946 |
return "{ |
|
|
946 | return f"{author.name} <{author.email}>" | |
|
947 | 947 | |
|
948 | 948 | try: |
|
949 |
return "{ |
|
|
949 | return f"{author.name}" | |
|
950 | 950 | except Exception: |
|
951 |
return "{ |
|
|
951 | return f"{safe_str(author.raw_name)}" | |
|
952 | 952 | |
|
953 | 953 | return _author(repo_id, commit_id) |
|
954 | 954 | |
@@ -997,7 +997,7 b' class GitRemote(RemoteBase):' | |||
|
997 | 997 | wire, ['rev-list', '--all', '--children', f'{commit_id}^..{head}']) |
|
998 | 998 | |
|
999 | 999 | child_ids = [] |
|
1000 |
pat = re.compile(r'^{}' |
|
|
1000 | pat = re.compile(fr'^{commit_id}') | |
|
1001 | 1001 | for line in output.splitlines(): |
|
1002 | 1002 | line = safe_str(line) |
|
1003 | 1003 | if pat.match(line): |
@@ -1036,7 +1036,7 b' class GitRemote(RemoteBase):' | |||
|
1036 | 1036 | def tag_remove(self, wire, tag_name): |
|
1037 | 1037 | repo_init = self._factory.repo_libgit2(wire) |
|
1038 | 1038 | with repo_init as repo: |
|
1039 |
key = 'refs/tags/{}' |
|
|
1039 | key = f'refs/tags/{tag_name}' | |
|
1040 | 1040 | repo.references.delete(key) |
|
1041 | 1041 | |
|
1042 | 1042 | @reraise_safe_exceptions |
@@ -1081,7 +1081,7 b' class GitRemote(RemoteBase):' | |||
|
1081 | 1081 | try: |
|
1082 | 1082 | tree = repo[tree_id] |
|
1083 | 1083 | except KeyError: |
|
1084 |
raise ObjectMissing('No tree with id: {}' |
|
|
1084 | raise ObjectMissing(f'No tree with id: {tree_id}') | |
|
1085 | 1085 | |
|
1086 | 1086 | result = [] |
|
1087 | 1087 | for item in tree: |
@@ -1363,7 +1363,7 b' class GitRemote(RemoteBase):' | |||
|
1363 | 1363 | try: |
|
1364 | 1364 | tree = repo[tree_id] |
|
1365 | 1365 | except KeyError: |
|
1366 |
raise ObjectMissing('No tree with id: {}' |
|
|
1366 | raise ObjectMissing(f'No tree with id: {tree_id}') | |
|
1367 | 1367 | |
|
1368 | 1368 | index = LibGit2Index.Index() |
|
1369 | 1369 | index.read_tree(tree) |
@@ -431,9 +431,9 b' class HgRemote(RemoteBase):' | |||
|
431 | 431 | ('Accept', 'application/mercurial-0.1')] |
|
432 | 432 | |
|
433 | 433 | q = {"cmd": 'between'} |
|
434 |
q.update({'pairs': " |
|
|
434 | q.update({'pairs': "{}-{}".format('0' * 40, '0' * 40)}) | |
|
435 | 435 | qs = '?%s' % urllib.parse.urlencode(q) |
|
436 |
cu = " |
|
|
436 | cu = "{}{}".format(test_uri, qs) | |
|
437 | 437 | req = urllib.request.Request(cu, None, {}) |
|
438 | 438 | |
|
439 | 439 | try: |
@@ -444,7 +444,7 b' class HgRemote(RemoteBase):' | |||
|
444 | 444 | except Exception as e: |
|
445 | 445 | log.warning("URL cannot be opened: %s", cleaned_uri, exc_info=True) |
|
446 | 446 | # means it cannot be cloned |
|
447 |
raise exceptions.URLError(e)("[ |
|
|
447 | raise exceptions.URLError(e)("[{}] org_exc: {}".format(cleaned_uri, e)) | |
|
448 | 448 | |
|
449 | 449 | # now check if it's a proper hg repo, but don't do it for svn |
|
450 | 450 | try: |
@@ -138,7 +138,7 b' class SvnRemote(RemoteBase):' | |||
|
138 | 138 | tb = traceback.format_exc() |
|
139 | 139 | log.debug("Invalid Subversion url: `%s`, tb: %s", url, tb) |
|
140 | 140 | raise URLError( |
|
141 |
'" |
|
|
141 | '"{}" is not a valid Subversion source url.'.format(url)) | |
|
142 | 142 | return True |
|
143 | 143 | |
|
144 | 144 | def is_path_valid_repository(self, wire, path): |
@@ -239,7 +239,7 b' class SvnRemote(RemoteBase):' | |||
|
239 | 239 | removed.append(path) |
|
240 | 240 | else: |
|
241 | 241 | raise NotImplementedError( |
|
242 |
"Action |
|
|
242 | "Action {} not supported on path {}".format( | |
|
243 | 243 | change.action, path)) |
|
244 | 244 | |
|
245 | 245 | changes = { |
@@ -418,10 +418,10 b' class SvnRemote(RemoteBase):' | |||
|
418 | 418 | reason = 'INVALID_CERTIFICATE' |
|
419 | 419 | |
|
420 | 420 | if reason == 'UNKNOWN': |
|
421 |
reason = 'UNKNOWN:{ |
|
|
421 | reason = f'UNKNOWN:{safe_str(errors)}' | |
|
422 | 422 | |
|
423 | 423 | raise Exception( |
|
424 |
'Failed to dump the remote repository from |
|
|
424 | 'Failed to dump the remote repository from {}. Reason:{}'.format( | |
|
425 | 425 | src_url, reason)) |
|
426 | 426 | if load.returncode != 0: |
|
427 | 427 | raise Exception( |
@@ -575,8 +575,7 b' class SvnRemote(RemoteBase):' | |||
|
575 | 575 | # return only DIR, and then all entries in that dir |
|
576 | 576 | yield os.path.join(root_dir, f_name), {'mode': filemode_default}, f_type |
|
577 | 577 | new_root = os.path.join(root_dir, f_name) |
|
578 |
|
|
|
579 | yield _f_name, _f_data, _f_type | |
|
578 | yield from walk_tree(root, new_root, _commit_id) | |
|
580 | 579 | else: |
|
581 | 580 | |
|
582 | 581 | f_path = os.path.join(root_dir, f_name).rstrip(b'/') |
@@ -723,10 +722,10 b' class SvnDiffer(object):' | |||
|
723 | 722 | buf.write("=" * 67 + '\n') |
|
724 | 723 | buf.write("Cannot display: file marked as a binary type.\n") |
|
725 | 724 | buf.write("svn:mime-type = %s\n" % mime_type) |
|
726 |
buf.write("Index: |
|
|
725 | buf.write("Index: {}\n".format(tgt_path)) | |
|
727 | 726 | buf.write("=" * 67 + '\n') |
|
728 |
buf.write("diff --git a/ |
|
|
729 |
|
|
|
727 | buf.write("diff --git a/{tgt_path} b/{tgt_path}\n".format( | |
|
728 | tgt_path=tgt_path)) | |
|
730 | 729 | |
|
731 | 730 | if change == 'add': |
|
732 | 731 | # TODO: johbo: SVN is missing a zero here compared to git |
@@ -746,15 +745,15 b' class SvnDiffer(object):' | |||
|
746 | 745 | # if self.binary_content: |
|
747 | 746 | # buf.write('GIT binary patch\n') |
|
748 | 747 | |
|
749 |
buf.write("--- a/ |
|
|
748 | buf.write("--- a/{}\t(revision {})\n".format( | |
|
750 | 749 | src_path, self.src_rev)) |
|
751 | 750 | src_lines = self._svn_readlines(self.src_root, src_full_path) |
|
752 | 751 | |
|
753 | 752 | if change == 'delete': |
|
754 |
buf.write("+++ /dev/null\t(revision |
|
|
753 | buf.write("+++ /dev/null\t(revision {})\n".format(self.tgt_rev)) | |
|
755 | 754 | tgt_lines = [] |
|
756 | 755 | else: |
|
757 |
buf.write("+++ b/ |
|
|
756 | buf.write("+++ b/{}\t(revision {})\n".format( | |
|
758 | 757 | tgt_path, self.tgt_rev)) |
|
759 | 758 | tgt_lines = self._svn_readlines(self.tgt_root, tgt_full_path) |
|
760 | 759 |
@@ -104,7 +104,7 b' class HgWeb(mercurial.hgweb.hgweb_mod.hg' | |||
|
104 | 104 | res.setbodybytes(b'') |
|
105 | 105 | return res.sendresponse() |
|
106 | 106 | |
|
107 |
return super( |
|
|
107 | return super()._runwsgi(req, res, repo) | |
|
108 | 108 | |
|
109 | 109 | |
|
110 | 110 | def make_hg_ui_from_config(repo_config): |
@@ -44,7 +44,7 b' def base64_to_str(text) -> str:' | |||
|
44 | 44 | return safe_str(base64.encodebytes(safe_bytes(text))).strip() |
|
45 | 45 | |
|
46 | 46 | |
|
47 |
def get_default_encodings() -> |
|
|
47 | def get_default_encodings() -> list[str]: | |
|
48 | 48 | return ['utf8'] |
|
49 | 49 | |
|
50 | 50 |
@@ -1,4 +1,3 b'' | |||
|
1 | # -*- coding: utf-8 -*- | |
|
2 | 1 |
|
|
3 | 2 | # Copyright (C) 2004-2009 Edgewall Software |
|
4 | 3 | # Copyright (C) 2004-2006 Christopher Lenz <cmlenz@gmx.de> |
@@ -174,7 +173,7 b' def unified_diff(fromlines, tolines, con' | |||
|
174 | 173 | i1, i2 = -1, -1 # support for Add changes |
|
175 | 174 | if j1 == 0 and j2 == 0: |
|
176 | 175 | j1, j2 = -1, -1 # support for Delete changes |
|
177 |
yield '@@ - |
|
|
176 | yield '@@ -{} +{} @@{}'.format( | |
|
178 | 177 | _hunk_range(i1 + 1, i2 - i1), |
|
179 | 178 | _hunk_range(j1 + 1, j2 - j1), |
|
180 | 179 | lineterm) |
@@ -41,7 +41,7 b' class StrictAttributeDict(AttributeDictB' | |||
|
41 | 41 | try: |
|
42 | 42 | return self[attr] |
|
43 | 43 | except KeyError: |
|
44 |
raise AttributeError(' |
|
|
44 | raise AttributeError('{} object has no attribute {}'.format( | |
|
45 | 45 | self.__class__, attr)) |
|
46 | 46 | |
|
47 | 47 |
@@ -28,7 +28,7 b' class RemoteBase(object):' | |||
|
28 | 28 | |
|
29 | 29 | def _cache_on(self, wire): |
|
30 | 30 | context = wire.get('context', '') |
|
31 |
context_uid = '{}' |
|
|
31 | context_uid = f'{context}' | |
|
32 | 32 | repo_id = wire.get('repo_id', '') |
|
33 | 33 | cache = wire.get('cache', True) |
|
34 | 34 | cache_on = context and cache |
General Comments 0
You need to be logged in to leave comments.
Login now