Status: | Rejected |
---|---|
Rejected by: | Jelmer Vernooij |
Proposed branch: | lp:~jelmer/brz/fstrings |
Merge into: | lp:brz |
Diff against target: |
1191 lines (+90/-349) 52 files modified
breezy/_known_graph_py.py (+1/-7) breezy/branch.py (+2/-11) breezy/bzr/_dirstate_helpers_py.py (+2/-8) breezy/bzr/branch.py (+1/-3) breezy/bzr/bzrdir.py (+1/-3) breezy/bzr/chk_map.py (+2/-19) breezy/bzr/dirstate.py (+6/-12) breezy/bzr/groupcompress_repo.py (+3/-11) breezy/bzr/inventory.py (+3/-7) breezy/bzr/pack_repo.py (+2/-10) breezy/bzr/remote.py (+4/-12) breezy/bzr/smart/medium.py (+2/-10) breezy/bzr/tests/per_repository_vf/test_check_reconcile.py (+1/-3) breezy/bzr/tests/test__dirstate_helpers.py (+2/-6) breezy/bzr/tests/test_btree_index.py (+1/-3) breezy/bzr/tests/test_dirstate.py (+1/-3) breezy/bzr/vf_search.py (+2/-10) breezy/bzr/weave.py (+1/-3) breezy/bzr/workingtree_4.py (+2/-6) breezy/crash.py (+1/-5) breezy/delta.py (+3/-12) breezy/diff.py (+1/-6) breezy/git/object_store.py (+1/-3) breezy/git/repository.py (+1/-3) breezy/git/tree.py (+5/-27) breezy/lru_cache.py (+1/-3) breezy/plugin.py (+2/-10) breezy/plugins/fastimport/tests/test_generic_processor.py (+1/-3) breezy/plugins/github/forge.py (+1/-3) breezy/plugins/propose/cmds.py (+1/-3) breezy/progress.py (+1/-3) breezy/registry.py (+1/-8) breezy/repository.py (+1/-3) breezy/revisionspec.py (+1/-3) breezy/revisiontree.py (+1/-3) breezy/status.py (+1/-11) breezy/symbol_versioning.py (+2/-10) breezy/tests/TestUtil.py (+1/-3) breezy/tests/__init__.py (+1/-5) breezy/tests/blackbox/test_info.py (+6/-16) breezy/tests/features.py (+1/-3) breezy/tests/matchers.py (+2/-6) breezy/tests/per_interbranch/__init__.py (+1/-5) breezy/tests/per_interrepository/__init__.py (+1/-5) breezy/tests/per_tree/test_test_trees.py (+1/-3) breezy/tests/stub_sftp.py (+2/-2) breezy/transport/__init__.py (+2/-6) breezy/transport/http/urllib.py (+2/-6) breezy/transport/log.py (+1/-6) breezy/transport/remote.py (+2/-2) breezy/ui/__init__.py (+1/-6) breezy/urlutils.py (+1/-9) |
To merge this branch: | bzr merge lp:~jelmer/brz/fstrings |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jelmer Vernooij | Approve | ||
Review via email: mp+462189@code.launchpad.net |
Commit message
Use f-strings
Description of the change
Use f-strings
To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) : | # |
review:
Approve
Revision history for this message
Robert Ladyman (saccadic-masking) wrote : | # |
Revision history for this message
Jelmer Vernooij (jelmer) wrote : | # |
On Tue, Mar 12, 2024 at 06:25:36AM -0000, Robert Ladyman wrote:
> f-strings can pose issues with translation / gettext()
Ah, hmm - that's a good point
Unmerged revisions
- 7930. By Jelmer Vernooij
-
Use f-strings
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'breezy/_known_graph_py.py' |
2 | --- breezy/_known_graph_py.py 2023-11-07 10:54:10 +0000 |
3 | +++ breezy/_known_graph_py.py 2024-03-12 01:21:34 +0000 |
4 | @@ -34,13 +34,7 @@ |
5 | self.gdfo = None |
6 | |
7 | def __repr__(self): |
8 | - return "{}({} gdfo:{} par:{} child:{})".format( |
9 | - self.__class__.__name__, |
10 | - self.key, |
11 | - self.gdfo, |
12 | - self.parent_keys, |
13 | - self.child_keys, |
14 | - ) |
15 | + return f"{self.__class__.__name__}({self.key} gdfo:{self.gdfo} par:{self.parent_keys} child:{self.child_keys})" |
16 | |
17 | |
18 | class _MergeSortNode: |
19 | |
20 | === modified file 'breezy/branch.py' |
21 | --- breezy/branch.py 2023-11-16 15:15:02 +0000 |
22 | +++ breezy/branch.py 2024-03-12 01:21:34 +0000 |
23 | @@ -1833,14 +1833,7 @@ |
24 | return self.__dict__ == other.__dict__ |
25 | |
26 | def __repr__(self): |
27 | - return "<{} of {} from ({}, {}) to ({}, {})>".format( |
28 | - self.__class__.__name__, |
29 | - self.branch, |
30 | - self.old_revno, |
31 | - self.old_revid, |
32 | - self.new_revno, |
33 | - self.new_revid, |
34 | - ) |
35 | + return f"<{self.__class__.__name__} of {self.branch} from ({self.old_revno}, {self.old_revid}) to ({self.new_revno}, {self.new_revid})>" |
36 | |
37 | |
38 | class BranchInitHookParams: |
39 | @@ -1915,9 +1908,7 @@ |
40 | return self.__dict__ == other.__dict__ |
41 | |
42 | def __repr__(self): |
43 | - return "<{} for {} to ({}, {})>".format( |
44 | - self.__class__.__name__, self.control_dir, self.to_branch, self.revision_id |
45 | - ) |
46 | + return f"<{self.__class__.__name__} for {self.control_dir} to ({self.to_branch}, {self.revision_id})>" |
47 | |
48 | |
49 | class BranchFormatRegistry(ControlComponentFormatRegistry): |
50 | |
51 | === modified file 'breezy/bzr/_dirstate_helpers_py.py' |
52 | --- breezy/bzr/_dirstate_helpers_py.py 2023-11-07 10:54:10 +0000 |
53 | +++ breezy/bzr/_dirstate_helpers_py.py 2024-03-12 01:21:34 +0000 |
54 | @@ -60,14 +60,8 @@ |
55 | if field_count - cur != expected_field_count: |
56 | raise DirstateCorrupt( |
57 | state, |
58 | - "field count incorrect {} != {}, entry_size={}, " |
59 | - "num_entries={} fields={!r}".format( |
60 | - field_count - cur, |
61 | - expected_field_count, |
62 | - entry_size, |
63 | - state._num_entries, |
64 | - fields, |
65 | - ), |
66 | + f"field count incorrect {field_count - cur} != {expected_field_count}, entry_size={entry_size}, " |
67 | + f"num_entries={state._num_entries} fields={fields!r}", |
68 | ) |
69 | |
70 | if num_present_parents == 1: |
71 | |
72 | === modified file 'breezy/bzr/branch.py' |
73 | --- breezy/bzr/branch.py 2023-11-16 15:15:02 +0000 |
74 | +++ breezy/bzr/branch.py 2024-03-12 01:21:34 +0000 |
75 | @@ -543,9 +543,7 @@ |
76 | if len(old_repository._fallback_repositories) != 1: |
77 | raise AssertionError( |
78 | "can't cope with fallback repositories " |
79 | - "of {!r} (fallbacks: {!r})".format( |
80 | - old_repository, old_repository._fallback_repositories |
81 | - ) |
82 | + f"of {old_repository!r} (fallbacks: {old_repository._fallback_repositories!r})" |
83 | ) |
84 | # Open the new repository object. |
85 | # Repositories don't offer an interface to remove fallback |
86 | |
87 | === modified file 'breezy/bzr/bzrdir.py' |
88 | --- breezy/bzr/bzrdir.py 2023-11-28 14:31:46 +0000 |
89 | +++ breezy/bzr/bzrdir.py 2024-03-12 01:21:34 +0000 |
90 | @@ -1536,9 +1536,7 @@ |
91 | found_format = controldir.ControlDirFormat.find_format(transport) |
92 | if not isinstance(found_format, self.__class__): |
93 | raise AssertionError( |
94 | - "{} was asked to open {}, but it seems to need " "format {}".format( |
95 | - self, transport, found_format |
96 | - ) |
97 | + f"{self} was asked to open {transport}, but it seems to need " f"format {found_format}" |
98 | ) |
99 | # Allow subclasses - use the found format. |
100 | self._supply_sub_formats_to(found_format) |
101 | |
102 | === modified file 'breezy/bzr/chk_map.py' |
103 | --- breezy/bzr/chk_map.py 2023-11-16 15:15:02 +0000 |
104 | +++ breezy/bzr/chk_map.py 2024-03-12 01:21:34 +0000 |
105 | @@ -638,15 +638,7 @@ |
106 | items_str = str(sorted(self._items)) |
107 | if len(items_str) > 20: |
108 | items_str = items_str[:16] + "...]" |
109 | - return "{}(key:{} len:{} size:{} max:{} prefix:{} items:{})".format( |
110 | - self.__class__.__name__, |
111 | - self._key, |
112 | - self._len, |
113 | - self._raw_size, |
114 | - self._maximum_size, |
115 | - self._search_prefix, |
116 | - items_str, |
117 | - ) |
118 | + return f"{self.__class__.__name__}(key:{self._key} len:{self._len} size:{self._raw_size} max:{self._maximum_size} prefix:{self._search_prefix} items:{items_str})" |
119 | |
120 | def key(self): |
121 | return self._key |
122 | @@ -695,16 +687,7 @@ |
123 | items_str = str(sorted(self._items)) |
124 | if len(items_str) > 20: |
125 | items_str = items_str[:16] + "...]" |
126 | - return "{}(key:{} len:{} size:{} max:{} prefix:{} keywidth:{} items:{})".format( |
127 | - self.__class__.__name__, |
128 | - self._key, |
129 | - self._len, |
130 | - self._raw_size, |
131 | - self._maximum_size, |
132 | - self._search_prefix, |
133 | - self._key_width, |
134 | - items_str, |
135 | - ) |
136 | + return f"{self.__class__.__name__}(key:{self._key} len:{self._len} size:{self._raw_size} max:{self._maximum_size} prefix:{self._search_prefix} keywidth:{self._key_width} items:{items_str})" |
137 | |
138 | def _current_size(self): |
139 | """Answer the current serialised size of this node. |
140 | |
141 | === modified file 'breezy/bzr/dirstate.py' |
142 | --- breezy/bzr/dirstate.py 2023-11-16 15:15:57 +0000 |
143 | +++ breezy/bzr/dirstate.py 2024-03-12 01:21:34 +0000 |
144 | @@ -2229,9 +2229,7 @@ |
145 | return None, None |
146 | if entry[1][tree_index][0] != b"r": |
147 | raise AssertionError( |
148 | - "entry {!r} has invalid minikind {!r} for tree {!r}".format( |
149 | - entry, entry[1][tree_index][0], tree_index |
150 | - ) |
151 | + f"entry {entry!r} has invalid minikind {entry[1][tree_index][0]!r} for tree {tree_index!r}" |
152 | ) |
153 | real_path = entry[1][tree_index][1] |
154 | return self._get_entry( |
155 | @@ -3345,10 +3343,8 @@ |
156 | # pointed to by a relocation, which must point here |
157 | if previous_path != this_path: |
158 | raise AssertionError( |
159 | - "entry {!r} inconsistent with previous path {!r} " |
160 | - "seen at {!r}".format( |
161 | - entry, previous_path, previous_loc |
162 | - ) |
163 | + f"entry {entry!r} inconsistent with previous path {previous_path!r} " |
164 | + f"seen at {previous_loc!r}" |
165 | ) |
166 | check_valid_parent() |
167 | else: |
168 | @@ -3680,9 +3676,9 @@ |
169 | if old_entry == (None, None): |
170 | raise DirstateCorrupt( |
171 | self.state._filename, |
172 | - "entry '{}/{}' is considered renamed from {!r}" |
173 | + f"entry '{entry[0][0]}/{entry[0][1]}' is considered renamed from {old_path!r}" |
174 | " but source does not exist\n" |
175 | - "entry: {}".format(entry[0][0], entry[0][1], old_path, entry), |
176 | + f"entry: {entry}", |
177 | ) |
178 | source_details = old_entry[1][self.source_index] |
179 | source_minikind = source_details[0] |
180 | @@ -4347,9 +4343,7 @@ |
181 | ) |
182 | if not found_item: |
183 | raise AssertionError( |
184 | - "Missing entry for specific path parent {!r}, {!r}".format( |
185 | - path_utf8, path_entries |
186 | - ) |
187 | + f"Missing entry for specific path parent {path_utf8!r}, {path_entries!r}" |
188 | ) |
189 | path_info = self._path_info(path_utf8, path_utf8.decode("utf8")) |
190 | for entry in selected_entries: |
191 | |
192 | === modified file 'breezy/bzr/groupcompress_repo.py' |
193 | --- breezy/bzr/groupcompress_repo.py 2024-01-27 14:21:25 +0000 |
194 | +++ breezy/bzr/groupcompress_repo.py 2024-03-12 01:21:34 +0000 |
195 | @@ -725,12 +725,8 @@ |
196 | ) |
197 | if chk_inv.id_to_entry.key() != canonical_inv.id_to_entry.key(): |
198 | trace.mutter( |
199 | - "Non-canonical CHK map for id_to_entry of inv: {} " |
200 | - "(root is {}, should be {})".format( |
201 | - chk_inv.revision_id, |
202 | - chk_inv.id_to_entry.key()[0], |
203 | - canonical_inv.id_to_entry.key()[0], |
204 | - ) |
205 | + f"Non-canonical CHK map for id_to_entry of inv: {chk_inv.revision_id} " |
206 | + f"(root is {chk_inv.id_to_entry.key()[0]}, should be {canonical_inv.id_to_entry.key()[0]})" |
207 | ) |
208 | self._data_changed = True |
209 | p_id_map = chk_inv.parent_id_basename_to_file_id |
210 | @@ -739,11 +735,7 @@ |
211 | if p_id_map.key() != canon_p_id_map.key(): |
212 | trace.mutter( |
213 | "Non-canonical CHK map for parent_id_to_basename of " |
214 | - "inv: {} (root is {}, should be {})".format( |
215 | - chk_inv.revision_id, |
216 | - p_id_map.key()[0], |
217 | - canon_p_id_map.key()[0], |
218 | - ) |
219 | + f"inv: {chk_inv.revision_id} (root is {p_id_map.key()[0]}, should be {canon_p_id_map.key()[0]})" |
220 | ) |
221 | self._data_changed = True |
222 | yield versionedfile.ChunkedContentFactory( |
223 | |
224 | === modified file 'breezy/bzr/inventory.py' |
225 | --- breezy/bzr/inventory.py 2024-02-18 12:34:57 +0000 |
226 | +++ breezy/bzr/inventory.py 2024-03-12 01:21:34 +0000 |
227 | @@ -1005,10 +1005,8 @@ |
228 | raise ValueError( |
229 | "Data inconsistency detected." |
230 | " In the parent_id_basename_to_file_id map, file_id" |
231 | - " {{{}}} is listed as having basename {!r}, but in the" |
232 | - " id_to_entry map it is {!r}".format( |
233 | - child_file_id, basename, ie.name |
234 | - ) |
235 | + f" {{{child_file_id}}} is listed as having basename {basename!r}, but in the" |
236 | + f" id_to_entry map it is {ie.name!r}" |
237 | ) |
238 | siblings[basename] = ie |
239 | self._fully_cached = True |
240 | @@ -1129,9 +1127,7 @@ |
241 | for (parent_id, name_utf8), file_id in items: # noqa: B007 |
242 | if parent_id != current_id or name_utf8 != basename_utf8: |
243 | raise errors.BzrError( |
244 | - "corrupt inventory lookup! " "{!r} {!r} {!r} {!r}".format( |
245 | - parent_id, current_id, name_utf8, basename_utf8 |
246 | - ) |
247 | + "corrupt inventory lookup! " f"{parent_id!r} {current_id!r} {name_utf8!r} {basename_utf8!r}" |
248 | ) |
249 | if file_id is None: |
250 | return None |
251 | |
252 | === modified file 'breezy/bzr/pack_repo.py' |
253 | --- breezy/bzr/pack_repo.py 2023-11-16 21:12:11 +0000 |
254 | +++ breezy/bzr/pack_repo.py 2024-03-12 01:21:34 +0000 |
255 | @@ -343,13 +343,7 @@ |
256 | return not self.__eq__(other) |
257 | |
258 | def __repr__(self): |
259 | - return "<{}.{} object at 0x{:x}, {}, {}".format( |
260 | - self.__class__.__module__, |
261 | - self.__class__.__name__, |
262 | - id(self), |
263 | - self.pack_transport, |
264 | - self.name, |
265 | - ) |
266 | + return f"<{self.__class__.__module__}.{self.__class__.__name__} object at 0x{id(self):x}, {self.pack_transport}, {self.name}" |
267 | |
268 | def __hash__(self): |
269 | return hash((type(self), self.name)) |
270 | @@ -839,9 +833,7 @@ |
271 | # considering 'done'. |
272 | if self._pack_collection._new_pack is not None: |
273 | raise errors.BzrError( |
274 | - "call to {}.pack() while another pack is" " being written.".format( |
275 | - self.__class__.__name__ |
276 | - ) |
277 | + f"call to {self.__class__.__name__}.pack() while another pack is" " being written." |
278 | ) |
279 | if self.revision_ids is not None: |
280 | if len(self.revision_ids) == 0: |
281 | |
282 | === modified file 'breezy/bzr/remote.py' |
283 | --- breezy/bzr/remote.py 2024-02-18 12:34:57 +0000 |
284 | +++ breezy/bzr/remote.py 2024-03-12 01:21:34 +0000 |
285 | @@ -2228,9 +2228,7 @@ |
286 | src_format, stream = decoded |
287 | if src_format.network_name() != self._format.network_name(): |
288 | raise AssertionError( |
289 | - "Mismatched RemoteRepository and stream src {!r}, {!r}".format( |
290 | - src_format.network_name(), self._format.network_name() |
291 | - ) |
292 | + f"Mismatched RemoteRepository and stream src {src_format.network_name()!r}, {self._format.network_name()!r}" |
293 | ) |
294 | # ignore the src format, it's not really relevant |
295 | prev_inv = Inventory(root_id=None, revision_id=_mod_revision.NULL_REVISION) |
296 | @@ -3318,9 +3316,7 @@ |
297 | ) |
298 | if src_format.network_name() != self.from_repository._format.network_name(): |
299 | raise AssertionError( |
300 | - "Mismatched RemoteRepository and stream src {!r}, {!r}".format( |
301 | - src_format.network_name(), repo._format.network_name() |
302 | - ) |
303 | + f"Mismatched RemoteRepository and stream src {src_format.network_name()!r}, {repo._format.network_name()!r}" |
304 | ) |
305 | return stream |
306 | |
307 | @@ -3402,9 +3398,7 @@ |
308 | ) |
309 | if src_format.network_name() != repo._format.network_name(): |
310 | raise AssertionError( |
311 | - "Mismatched RemoteRepository and stream src {!r}, {!r}".format( |
312 | - src_format.network_name(), repo._format.network_name() |
313 | - ) |
314 | + f"Mismatched RemoteRepository and stream src {src_format.network_name()!r}, {repo._format.network_name()!r}" |
315 | ) |
316 | return stream |
317 | |
318 | @@ -3983,9 +3977,7 @@ |
319 | if len(old_repository._fallback_repositories) != 1: |
320 | raise AssertionError( |
321 | "can't cope with fallback repositories " |
322 | - "of {!r} (fallbacks: {!r})".format( |
323 | - old_repository, old_repository._fallback_repositories |
324 | - ) |
325 | + f"of {old_repository!r} (fallbacks: {old_repository._fallback_repositories!r})" |
326 | ) |
327 | # Open the new repository object. |
328 | # Repositories don't offer an interface to remove fallback |
329 | |
330 | === modified file 'breezy/bzr/smart/medium.py' |
331 | --- breezy/bzr/smart/medium.py 2023-11-16 15:15:02 +0000 |
332 | +++ breezy/bzr/smart/medium.py 2024-03-12 01:21:34 +0000 |
333 | @@ -387,9 +387,7 @@ |
334 | return f"{self.__class__.__name__}(client={self._client_info})" |
335 | |
336 | def __repr__(self): |
337 | - return "{}.{}(client={})".format( |
338 | - self.__module__, self.__class__.__name__, self._client_info |
339 | - ) |
340 | + return f"{self.__module__}.{self.__class__.__name__}(client={self._client_info})" |
341 | |
342 | def _serve_one_request_unguarded(self, protocol): |
343 | while protocol.next_read_size(): |
344 | @@ -1010,13 +1008,7 @@ |
345 | maybe_user = "" |
346 | else: |
347 | maybe_user = f"{self._ssh_params.username}@" |
348 | - return "{}({}://{}{}{}/)".format( |
349 | - self.__class__.__name__, |
350 | - self._scheme, |
351 | - maybe_user, |
352 | - self._ssh_params.host, |
353 | - maybe_port, |
354 | - ) |
355 | + return f"{self.__class__.__name__}({self._scheme}://{maybe_user}{self._ssh_params.host}{maybe_port}/)" |
356 | |
357 | def _accept_bytes(self, bytes): |
358 | """See SmartClientStreamMedium.accept_bytes.""" |
359 | |
360 | === modified file 'breezy/bzr/tests/per_repository_vf/test_check_reconcile.py' |
361 | --- breezy/bzr/tests/per_repository_vf/test_check_reconcile.py 2023-11-16 15:15:02 +0000 |
362 | +++ breezy/bzr/tests/per_repository_vf/test_check_reconcile.py 2024-03-12 01:21:34 +0000 |
363 | @@ -1038,9 +1038,7 @@ |
364 | self.assertEqual( |
365 | expected_parents, |
366 | found_parents, |
367 | - "{} reconcile {} has parents {}, should have {}.".format( |
368 | - when_description, version, found_parents, expected_parents |
369 | - ), |
370 | + f"{when_description} reconcile {version} has parents {found_parents}, should have {expected_parents}.", |
371 | ) |
372 | |
373 | def prepare_test_repository(self): |
374 | |
375 | === modified file 'breezy/bzr/tests/test__dirstate_helpers.py' |
376 | --- breezy/bzr/tests/test__dirstate_helpers.py 2023-11-07 10:54:10 +0000 |
377 | +++ breezy/bzr/tests/test__dirstate_helpers.py 2024-03-12 01:21:34 +0000 |
378 | @@ -102,9 +102,7 @@ |
379 | self.assertEqual( |
380 | bisect_split_idx, |
381 | bisect_path_idx, |
382 | - "{} disagreed. {} != {}" " for key {!r}".format( |
383 | - bisect_path.__name__, bisect_split_idx, bisect_path_idx, path |
384 | - ), |
385 | + f"{bisect_path.__name__} disagreed. {bisect_split_idx} != {bisect_path_idx}" f" for key {path!r}", |
386 | ) |
387 | if exists: |
388 | self.assertEqual(path, paths[bisect_path_idx + offset]) |
389 | @@ -383,9 +381,7 @@ |
390 | self.assertEqual( |
391 | idx1 < idx2, |
392 | lt_result, |
393 | - "{} did not state that {!r} < {!r}, lt={}".format( |
394 | - lt_path_by_dirblock.__name__, path1, path2, lt_result |
395 | - ), |
396 | + f"{lt_path_by_dirblock.__name__} did not state that {path1!r} < {path2!r}, lt={lt_result}", |
397 | ) |
398 | |
399 | def test_cmp_simple_paths(self): |
400 | |
401 | === modified file 'breezy/bzr/tests/test_btree_index.py' |
402 | --- breezy/bzr/tests/test_btree_index.py 2023-11-16 15:15:02 +0000 |
403 | +++ breezy/bzr/tests/test_btree_index.py 2024-03-12 01:21:34 +0000 |
404 | @@ -1211,9 +1211,7 @@ |
405 | rev_keys = [] |
406 | for i in range(400): |
407 | rev_id = ( |
408 | - "{}-{}-{}".format( |
409 | - email, osutils.compact_date(start_time + i), osutils.rand_chars(16) |
410 | - ) |
411 | + f"{email}-{osutils.compact_date(start_time + i)}-{osutils.rand_chars(16)}" |
412 | ).encode("ascii") |
413 | rev_key = (rev_id,) |
414 | nodes.append((rev_key, b"value", ref_lists)) |
415 | |
416 | === modified file 'breezy/bzr/tests/test_dirstate.py' |
417 | --- breezy/bzr/tests/test_dirstate.py 2023-11-08 17:49:57 +0000 |
418 | +++ breezy/bzr/tests/test_dirstate.py 2024-03-12 01:21:34 +0000 |
419 | @@ -3393,9 +3393,7 @@ |
420 | self.assertEqual( |
421 | bisect_left_idx, |
422 | bisect_split_idx, |
423 | - "bisect_split disagreed. {} != {}" " for key {!r}".format( |
424 | - bisect_left_idx, bisect_split_idx, path |
425 | - ), |
426 | + f"bisect_split disagreed. {bisect_left_idx} != {bisect_split_idx}" f" for key {path!r}", |
427 | ) |
428 | |
429 | def paths_to_dirblocks(self, paths): |
430 | |
431 | === modified file 'breezy/bzr/vf_search.py' |
432 | --- breezy/bzr/vf_search.py 2023-11-07 10:54:10 +0000 |
433 | +++ breezy/bzr/vf_search.py 2024-03-12 01:21:34 +0000 |
434 | @@ -327,16 +327,8 @@ |
435 | ifp_revs_repr = repr(self.if_present_ids) |
436 | |
437 | return ( |
438 | - "<{} from:{!r} to:{!r} find_ghosts:{!r} req'd:{!r} if-present:{!r}" |
439 | - "limit:{!r}>" |
440 | - ).format( |
441 | - self.__class__.__name__, |
442 | - self.from_repo, |
443 | - self.to_repo, |
444 | - self.find_ghosts, |
445 | - reqd_revs_repr, |
446 | - ifp_revs_repr, |
447 | - self.limit, |
448 | + f"<{self.__class__.__name__} from:{self.from_repo!r} to:{self.to_repo!r} find_ghosts:{self.find_ghosts!r} req'd:{reqd_revs_repr!r} if-present:{ifp_revs_repr!r}" |
449 | + f"limit:{self.limit!r}>" |
450 | ) |
451 | |
452 | def execute(self): |
453 | |
454 | === modified file 'breezy/bzr/weave.py' |
455 | --- breezy/bzr/weave.py 2024-02-18 12:34:57 +0000 |
456 | +++ breezy/bzr/weave.py 2024-03-12 01:21:34 +0000 |
457 | @@ -815,9 +815,7 @@ |
458 | measured_sha1 = sha_strings(result) |
459 | if measured_sha1 != expected_sha1: |
460 | raise WeaveInvalidChecksum( |
461 | - "file {}, revision {}, expected: {}, measured {}".format( |
462 | - self._weave_name, version_id, expected_sha1, measured_sha1 |
463 | - ) |
464 | + f"file {self._weave_name}, revision {version_id}, expected: {expected_sha1}, measured {measured_sha1}" |
465 | ) |
466 | return result |
467 | |
468 | |
469 | === modified file 'breezy/bzr/workingtree_4.py' |
470 | --- breezy/bzr/workingtree_4.py 2023-11-16 21:12:11 +0000 |
471 | +++ breezy/bzr/workingtree_4.py 2024-03-12 01:21:34 +0000 |
472 | @@ -1944,9 +1944,7 @@ |
473 | self._dirstate._read_dirblocks_if_needed() |
474 | if self._revision_id not in self._dirstate.get_parent_ids(): |
475 | raise AssertionError( |
476 | - "parent {} has disappeared from {}".format( |
477 | - self._revision_id, self._dirstate.get_parent_ids() |
478 | - ) |
479 | + f"parent {self._revision_id} has disappeared from {self._dirstate.get_parent_ids()}" |
480 | ) |
481 | parent_index = self._dirstate.get_parent_ids().index(self._revision_id) + 1 |
482 | # This is identical now to the WorkingTree _generate_inventory except |
483 | @@ -2398,9 +2396,7 @@ |
484 | else: |
485 | if self.source._revision_id not in parent_ids: |
486 | raise AssertionError( |
487 | - "Failure: source._revision_id: {} not in target.parent_ids({})".format( |
488 | - self.source._revision_id, parent_ids |
489 | - ) |
490 | + f"Failure: source._revision_id: {self.source._revision_id} not in target.parent_ids({parent_ids})" |
491 | ) |
492 | source_index = 1 + parent_ids.index(self.source._revision_id) |
493 | indices = (source_index, target_index) |
494 | |
495 | === modified file 'breezy/crash.py' |
496 | --- breezy/crash.py 2023-11-07 10:54:10 +0000 |
497 | +++ breezy/crash.py 2024-03-12 01:21:34 +0000 |
498 | @@ -83,11 +83,7 @@ |
499 | err_file.write(textwrap.fill(l, width=78, subsequent_indent=" ") + "\n") |
500 | |
501 | print_wrapped( |
502 | - "brz {} on python {} ({})\n".format( |
503 | - breezy.__version__, |
504 | - breezy._format_version_tuple(sys.version_info), |
505 | - platform.platform(aliased=1), |
506 | - ) |
507 | + f"brz {breezy.__version__} on python {breezy._format_version_tuple(sys.version_info)} ({platform.platform(aliased=1)})\n" |
508 | ) |
509 | print_wrapped(f"arguments: {sys.argv!r}\n") |
510 | print_wrapped( |
511 | |
512 | === modified file 'breezy/delta.py' |
513 | --- breezy/delta.py 2023-11-16 15:15:02 +0000 |
514 | +++ breezy/delta.py 2024-03-12 01:21:34 +0000 |
515 | @@ -79,18 +79,9 @@ |
516 | |
517 | def __repr__(self): |
518 | return ( |
519 | - "TreeDelta(added={!r}, removed={!r}, renamed={!r}," |
520 | - " copied={!r}, kind_changed={!r}, modified={!r}, unchanged={!r}," |
521 | - " unversioned={!r})".format( |
522 | - self.added, |
523 | - self.removed, |
524 | - self.renamed, |
525 | - self.copied, |
526 | - self.kind_changed, |
527 | - self.modified, |
528 | - self.unchanged, |
529 | - self.unversioned, |
530 | - ) |
531 | + f"TreeDelta(added={self.added!r}, removed={self.removed!r}, renamed={self.renamed!r}," |
532 | + f" copied={self.copied!r}, kind_changed={self.kind_changed!r}, modified={self.modified!r}, unchanged={self.unchanged!r}," |
533 | + f" unversioned={self.unversioned!r})" |
534 | ) |
535 | |
536 | def has_changed(self): |
537 | |
538 | === modified file 'breezy/diff.py' |
539 | --- breezy/diff.py 2023-11-16 15:15:02 +0000 |
540 | +++ breezy/diff.py 2024-03-12 01:21:34 +0000 |
541 | @@ -836,12 +836,7 @@ |
542 | except errors.BinaryFile: |
543 | self.to_file.write( |
544 | ( |
545 | - "Binary files {}{} and {}{} differ\n".format( |
546 | - self.old_label, |
547 | - from_path or to_path, |
548 | - self.new_label, |
549 | - to_path or from_path, |
550 | - ) |
551 | + f"Binary files {self.old_label}{from_path or to_path} and {self.new_label}{to_path or from_path} differ\n" |
552 | ).encode(self.path_encoding, "replace") |
553 | ) |
554 | return self.CHANGED |
555 | |
556 | === modified file 'breezy/git/object_store.py' |
557 | --- breezy/git/object_store.py 2023-11-16 15:15:02 +0000 |
558 | +++ breezy/git/object_store.py 2024-03-12 01:21:34 +0000 |
559 | @@ -90,9 +90,7 @@ |
560 | else: |
561 | if tree.get_revision_id() != revid: |
562 | raise AssertionError( |
563 | - "revision id did not match: {} != {}".format( |
564 | - tree.get_revision_id(), revid |
565 | - ) |
566 | + f"revision id did not match: {tree.get_revision_id()} != {revid}" |
567 | ) |
568 | trees[revid] = tree |
569 | for tree in self.repository.revision_trees(todo): |
570 | |
571 | === modified file 'breezy/git/repository.py' |
572 | --- breezy/git/repository.py 2024-01-24 22:02:59 +0000 |
573 | +++ breezy/git/repository.py 2024-03-12 01:21:34 +0000 |
574 | @@ -58,9 +58,7 @@ |
575 | |
576 | def _report_repo_results(self, verbose): |
577 | trace.note( |
578 | - "checked repository {} format {}".format( |
579 | - self.repository.user_url, self.repository._format |
580 | - ) |
581 | + f"checked repository {self.repository.user_url} format {self.repository._format}" |
582 | ) |
583 | trace.note("%6d objects", self.object_count) |
584 | for sha, problem in self.problems: |
585 | |
586 | === modified file 'breezy/git/tree.py' |
587 | --- breezy/git/tree.py 2024-01-24 22:02:59 +0000 |
588 | +++ breezy/git/tree.py 2024-03-12 01:21:34 +0000 |
589 | @@ -80,9 +80,7 @@ |
590 | return self.__class__(self.file_id, self.name, self.parent_id) |
591 | |
592 | def __repr__(self): |
593 | - return "{}(file_id={!r}, name={!r}, parent_id={!r})".format( |
594 | - self.__class__.__name__, self.file_id, self.name, self.parent_id |
595 | - ) |
596 | + return f"{self.__class__.__name__}(file_id={self.file_id!r}, name={self.name!r}, parent_id={self.parent_id!r})" |
597 | |
598 | def __eq__(self, other): |
599 | return ( |
600 | @@ -123,16 +121,8 @@ |
601 | |
602 | def __repr__(self): |
603 | return ( |
604 | - "{}(file_id={!r}, name={!r}, parent_id={!r}, text_size={!r}, " |
605 | - "git_sha1={!r}, executable={!r})" |
606 | - ).format( |
607 | - type(self).__name__, |
608 | - self.file_id, |
609 | - self.name, |
610 | - self.parent_id, |
611 | - self.text_size, |
612 | - self.git_sha1, |
613 | - self.executable, |
614 | + f"{type(self).__name__}(file_id={self.file_id!r}, name={self.name!r}, parent_id={self.parent_id!r}, text_size={self.text_size!r}, " |
615 | + f"git_sha1={self.git_sha1!r}, executable={self.executable!r})" |
616 | ) |
617 | |
618 | def copy(self): |
619 | @@ -167,13 +157,7 @@ |
620 | |
621 | def __repr__(self): |
622 | return ( |
623 | - "{}(file_id={!r}, name={!r}, parent_id={!r}, symlink_target={!r})".format( |
624 | - type(self).__name__, |
625 | - self.file_id, |
626 | - self.name, |
627 | - self.parent_id, |
628 | - self.symlink_target, |
629 | - ) |
630 | + f"{type(self).__name__}(file_id={self.file_id!r}, name={self.name!r}, parent_id={self.parent_id!r}, symlink_target={self.symlink_target!r})" |
631 | ) |
632 | |
633 | def __eq__(self, other): |
634 | @@ -213,13 +197,7 @@ |
635 | |
636 | def __repr__(self): |
637 | return ( |
638 | - "{}(file_id={!r}, name={!r}, parent_id={!r}, " "reference_revision={!r})" |
639 | - ).format( |
640 | - type(self).__name__, |
641 | - self.file_id, |
642 | - self.name, |
643 | - self.parent_id, |
644 | - self.reference_revision, |
645 | + f"{type(self).__name__}(file_id={self.file_id!r}, name={self.name!r}, parent_id={self.parent_id!r}, " f"reference_revision={self.reference_revision!r})" |
646 | ) |
647 | |
648 | def __eq__(self, other): |
649 | |
650 | === modified file 'breezy/lru_cache.py' |
651 | --- breezy/lru_cache.py 2023-11-16 15:15:02 +0000 |
652 | +++ breezy/lru_cache.py 2024-03-12 01:21:34 +0000 |
653 | @@ -34,9 +34,7 @@ |
654 | |
655 | def __repr__(self): |
656 | prev_key = None if self.prev is None else self.prev.key |
657 | - return "{}({!r} n:{!r} p:{!r})".format( |
658 | - self.__class__.__name__, self.key, self.next_key, prev_key |
659 | - ) |
660 | + return f"{self.__class__.__name__}({self.key!r} n:{self.next_key!r} p:{prev_key!r})" |
661 | |
662 | |
663 | class LRUCache: |
664 | |
665 | === modified file 'breezy/plugin.py' |
666 | --- breezy/plugin.py 2023-11-16 15:15:02 +0000 |
667 | +++ breezy/plugin.py 2024-03-12 01:21:34 +0000 |
668 | @@ -144,13 +144,7 @@ |
669 | self.extra_details = extra |
670 | |
671 | def __repr__(self): |
672 | - return "{}({!r}, {!r}, {!r}, {})".format( |
673 | - self.__class__.__name__, |
674 | - self.package_name, |
675 | - self.blocked_names, |
676 | - self.extra_details, |
677 | - list.__repr__(self), |
678 | - ) |
679 | + return f"{self.__class__.__name__}({self.package_name!r}, {self.blocked_names!r}, {self.extra_details!r}, {list.__repr__(self)})" |
680 | |
681 | |
682 | def _expect_identifier(name, env_key, env_value): |
683 | @@ -567,9 +561,7 @@ |
684 | return repr(self.module) |
685 | |
686 | def __repr__(self): |
687 | - return "<{}.{} name={}, module={}>".format( |
688 | - self.__class__.__module__, self.__class__.__name__, self.name, self.module |
689 | - ) |
690 | + return f"<{self.__class__.__module__}.{self.__class__.__name__} name={self.name}, module={self.module}>" |
691 | |
692 | def test_suite(self): |
693 | """Return the plugin's test suite.""" |
694 | |
695 | === modified file 'breezy/plugins/fastimport/tests/test_generic_processor.py' |
696 | --- breezy/plugins/fastimport/tests/test_generic_processor.py 2023-11-16 18:05:55 +0000 |
697 | +++ breezy/plugins/fastimport/tests/test_generic_processor.py 2024-03-12 01:21:34 +0000 |
698 | @@ -201,9 +201,7 @@ |
699 | self.assertIn( |
700 | expected_kind_changed_entry, |
701 | kind_changed_files, |
702 | - "{} is not kind-changed, {} are".format( |
703 | - expected_kind_changed_entry, kind_changed_files |
704 | - ), |
705 | + f"{expected_kind_changed_entry} is not kind-changed, {kind_changed_files} are", |
706 | ) |
707 | |
708 | def assertContent(self, branch, tree, path, content): |
709 | |
710 | === modified file 'breezy/plugins/github/forge.py' |
711 | --- breezy/plugins/github/forge.py 2023-11-16 15:15:02 +0000 |
712 | +++ breezy/plugins/github/forge.py 2024-03-12 01:21:34 +0000 |
713 | @@ -903,9 +903,7 @@ |
714 | """Determine the initial comment for the merge proposal.""" |
715 | info = [] |
716 | info.append( |
717 | - "Merge {} into {}:{}\n".format( |
718 | - self.source_branch_name, self.target_owner, self.target_branch_name |
719 | - ) |
720 | + f"Merge {self.source_branch_name} into {self.target_owner}:{self.target_branch_name}\n" |
721 | ) |
722 | info.append(f"Source: {self.source_branch.user_url}\n") |
723 | info.append(f"Target: {self.target_branch.user_url}\n") |
724 | |
725 | === modified file 'breezy/plugins/propose/cmds.py' |
726 | --- breezy/plugins/propose/cmds.py 2023-11-16 15:15:02 +0000 |
727 | +++ breezy/plugins/propose/cmds.py 2024-03-12 01:21:34 +0000 |
728 | @@ -345,9 +345,7 @@ |
729 | source_branch_url = mp.get_source_branch_url() |
730 | if source_branch_url: |
731 | self.outf.write( |
732 | - "(Merging {} into {})\n".format( |
733 | - source_branch_url, mp.get_target_branch_url() |
734 | - ) |
735 | + f"(Merging {source_branch_url} into {mp.get_target_branch_url()})\n" |
736 | ) |
737 | else: |
738 | self.outf.write( |
739 | |
740 | === modified file 'breezy/progress.py' |
741 | --- breezy/progress.py 2023-11-07 10:54:10 +0000 |
742 | +++ breezy/progress.py 2024-03-12 01:21:34 +0000 |
743 | @@ -102,9 +102,7 @@ |
744 | self.show_transport_activity = True |
745 | |
746 | def __repr__(self): |
747 | - return "{}({!r}/{!r}, msg={!r})".format( |
748 | - self.__class__.__name__, self.current_cnt, self.total_cnt, self.msg |
749 | - ) |
750 | + return f"{self.__class__.__name__}({self.current_cnt!r}/{self.total_cnt!r}, msg={self.msg!r})" |
751 | |
752 | def update(self, msg, current_cnt=None, total_cnt=None): |
753 | """Report updated task message and if relevent progress counters. |
754 | |
755 | === modified file 'breezy/registry.py' |
756 | --- breezy/registry.py 2023-11-16 15:15:02 +0000 |
757 | +++ breezy/registry.py 2024-03-12 01:21:34 +0000 |
758 | @@ -92,14 +92,7 @@ |
759 | |
760 | def __repr__(self): |
761 | return ( |
762 | - "<{}.{} object at {:x}, module={!r} attribute={!r} imported={!r}>".format( |
763 | - self.__class__.__module__, |
764 | - self.__class__.__name__, |
765 | - id(self), |
766 | - self._module_name, |
767 | - self._member_name, |
768 | - self._imported, |
769 | - ) |
770 | + f"<{self.__class__.__module__}.{self.__class__.__name__} object at {id(self):x}, module={self._module_name!r} attribute={self._member_name!r} imported={self._imported!r}>" |
771 | ) |
772 | |
773 | |
774 | |
775 | === modified file 'breezy/repository.py' |
776 | --- breezy/repository.py 2024-01-24 22:02:59 +0000 |
777 | +++ breezy/repository.py 2024-03-12 01:21:34 +0000 |
778 | @@ -421,9 +421,7 @@ |
779 | |
780 | def __repr__(self): |
781 | if self._fallback_repositories: |
782 | - return "{}({!r}, fallback_repositories={!r})".format( |
783 | - self.__class__.__name__, self.base, self._fallback_repositories |
784 | - ) |
785 | + return f"{self.__class__.__name__}({self.base!r}, fallback_repositories={self._fallback_repositories!r})" |
786 | else: |
787 | return f"{self.__class__.__name__}({self.base!r})" |
788 | |
789 | |
790 | === modified file 'breezy/revisionspec.py' |
791 | --- breezy/revisionspec.py 2023-11-16 15:15:02 +0000 |
792 | +++ breezy/revisionspec.py 2024-03-12 01:21:34 +0000 |
793 | @@ -105,9 +105,7 @@ |
794 | return tuple(self) == tuple(other) |
795 | |
796 | def __repr__(self): |
797 | - return "<breezy.revisionspec.RevisionInfo object {}, {} for {!r}>".format( |
798 | - self.revno, self.rev_id, self.branch |
799 | - ) |
800 | + return f"<breezy.revisionspec.RevisionInfo object {self.revno}, {self.rev_id} for {self.branch!r}>" |
801 | |
802 | @staticmethod |
803 | def from_revision_id(branch, revision_id): |
804 | |
805 | === modified file 'breezy/revisiontree.py' |
806 | --- breezy/revisiontree.py 2023-11-07 10:54:10 +0000 |
807 | +++ breezy/revisiontree.py 2024-03-12 01:21:34 +0000 |
808 | @@ -72,9 +72,7 @@ |
809 | return lock.LogicalLockResult(self.unlock) |
810 | |
811 | def __repr__(self): |
812 | - return "<{} instance at {:x}, rev_id={!r}>".format( |
813 | - self.__class__.__name__, id(self), self._revision_id |
814 | - ) |
815 | + return f"<{self.__class__.__name__} instance at {id(self):x}, rev_id={self._revision_id!r}>" |
816 | |
817 | def unlock(self): |
818 | self._repository.unlock() |
819 | |
820 | === modified file 'breezy/status.py' |
821 | --- breezy/status.py 2023-11-16 15:15:02 +0000 |
822 | +++ breezy/status.py 2024-03-12 01:21:34 +0000 |
823 | @@ -477,17 +477,7 @@ |
824 | return self.__dict__ == other.__dict__ |
825 | |
826 | def __repr__(self): |
827 | - return "<{}({}, {}, {}, {}, {}, {}, {}, {})>".format( |
828 | - self.__class__.__name__, |
829 | - self.old_tree, |
830 | - self.new_tree, |
831 | - self.to_file, |
832 | - self.versioned, |
833 | - self.show_ids, |
834 | - self.short, |
835 | - self.verbose, |
836 | - self.specific_files, |
837 | - ) |
838 | + return f"<{self.__class__.__name__}({self.old_tree}, {self.new_tree}, {self.to_file}, {self.versioned}, {self.show_ids}, {self.short}, {self.verbose}, {self.specific_files})>" |
839 | |
840 | |
841 | def _show_shelve_summary(params): |
842 | |
843 | === modified file 'breezy/symbol_versioning.py' |
844 | --- breezy/symbol_versioning.py 2023-11-16 15:15:02 +0000 |
845 | +++ breezy/symbol_versioning.py 2024-03-12 01:21:34 +0000 |
846 | @@ -77,11 +77,7 @@ |
847 | a nice python symbol and then substituted into deprecation_version. |
848 | """ |
849 | if getattr(a_callable, "__self__", None) is not None: |
850 | - symbol = "{}.{}.{}".format( |
851 | - a_callable.__self__.__class__.__module__, |
852 | - a_callable.__self__.__class__.__name__, |
853 | - a_callable.__name__, |
854 | - ) |
855 | + symbol = f"{a_callable.__self__.__class__.__module__}.{a_callable.__self__.__class__.__name__}.{a_callable.__name__}" |
856 | elif ( |
857 | getattr(a_callable, "__qualname__", None) is not None |
858 | and "<" not in a_callable.__qualname__ |
859 | @@ -140,11 +136,7 @@ |
860 | if callable.__name__ == "__init__": |
861 | symbol = f"{self.__class__.__module__}.{self.__class__.__name__}" |
862 | else: |
863 | - symbol = "{}.{}.{}".format( |
864 | - self.__class__.__module__, |
865 | - self.__class__.__name__, |
866 | - callable.__name__, |
867 | - ) |
868 | + symbol = f"{self.__class__.__module__}.{self.__class__.__name__}.{callable.__name__}" |
869 | trace.mutter_callsite(4, "Deprecated method called") |
870 | warn(deprecation_version % symbol, DeprecationWarning, stacklevel=2) |
871 | return callable(self, *args, **kwargs) |
872 | |
873 | === modified file 'breezy/tests/TestUtil.py' |
874 | --- breezy/tests/TestUtil.py 2023-11-16 18:05:55 +0000 |
875 | +++ breezy/tests/TestUtil.py 2024-03-12 01:21:34 +0000 |
876 | @@ -64,9 +64,7 @@ |
877 | visitTests(test, visitor) |
878 | else: |
879 | print( |
880 | - "unvisitable non-unittest.TestCase element {!r} ({!r})".format( |
881 | - test, test.__class__ |
882 | - ) |
883 | + f"unvisitable non-unittest.TestCase element {test!r} ({test.__class__!r})" |
884 | ) |
885 | |
886 | |
887 | |
888 | === modified file 'breezy/tests/__init__.py' |
889 | --- breezy/tests/__init__.py 2023-12-23 18:20:54 +0000 |
890 | +++ breezy/tests/__init__.py 2024-03-12 01:21:34 +0000 |
891 | @@ -557,11 +557,7 @@ |
892 | self.stream.write(f"brz selftest: {bzr_path}\n") |
893 | self.stream.write(f" {breezy.__path__[0]}\n") |
894 | self.stream.write( |
895 | - " bzr-{} python-{} {}\n".format( |
896 | - breezy.version_string, |
897 | - breezy._format_version_tuple(sys.version_info), |
898 | - platform.platform(aliased=1), |
899 | - ) |
900 | + f" bzr-{breezy.version_string} python-{breezy._format_version_tuple(sys.version_info)} {platform.platform(aliased=1)}\n" |
901 | ) |
902 | self.stream.write("\n") |
903 | |
904 | |
905 | === modified file 'breezy/tests/blackbox/test_info.py' |
906 | --- breezy/tests/blackbox/test_info.py 2023-11-16 15:15:02 +0000 |
907 | +++ breezy/tests/blackbox/test_info.py 2024-03-12 01:21:34 +0000 |
908 | @@ -582,14 +582,14 @@ |
909 | repo = branch.repository |
910 | out, err = self.run_bzr("info branch -v") |
911 | self.assertEqualDiff( |
912 | - """Standalone branch (format: {}) |
913 | + f"""Standalone branch (format: {info.describe_format(repo.controldir, repo, branch, None)}) |
914 | Location: |
915 | branch root: branch |
916 | |
917 | Format: |
918 | control: Meta directory format 1 |
919 | - branch: {} |
920 | - repository: {} |
921 | + branch: {format.get_branch_format().get_format_description()} |
922 | + repository: {format.repository_format.get_format_description()} |
923 | |
924 | Control directory: |
925 | 1 branches |
926 | @@ -599,11 +599,7 @@ |
927 | |
928 | Repository: |
929 | 0 revisions |
930 | -""".format( |
931 | - info.describe_format(repo.controldir, repo, branch, None), |
932 | - format.get_branch_format().get_format_description(), |
933 | - format.repository_format.get_format_description(), |
934 | - ), |
935 | +""", |
936 | out, |
937 | ) |
938 | self.assertEqual("", err) |
939 | @@ -1355,20 +1351,14 @@ |
940 | ) |
941 | extra_space = " " |
942 | if lco_tree.branch.get_bound_location() is not None: |
943 | - tree_data += "{} checkout root: {}\n".format( |
944 | - extra_space, |
945 | - friendly_location(lco_tree.branch.controldir.root_transport.base), |
946 | - ) |
947 | + tree_data += f"{extra_space} checkout root: {friendly_location(lco_tree.branch.controldir.root_transport.base)}\n" |
948 | if shared_repo is not None: |
949 | branch_data = ( |
950 | f" checkout of branch: {friendly_location(repo_branch.controldir.root_transport.base)}\n" |
951 | f" shared repository: {friendly_location(shared_repo.controldir.root_transport.base)}\n" |
952 | ) |
953 | elif repo_branch is not None: |
954 | - branch_data = "{} checkout of branch: {}\n".format( |
955 | - extra_space, |
956 | - friendly_location(repo_branch.controldir.root_transport.base), |
957 | - ) |
958 | + branch_data = f"{extra_space} checkout of branch: {friendly_location(repo_branch.controldir.root_transport.base)}\n" |
959 | else: |
960 | branch_data = ( |
961 | " checkout of branch: %s\n" |
962 | |
963 | === modified file 'breezy/tests/features.py' |
964 | --- breezy/tests/features.py 2023-11-16 21:12:11 +0000 |
965 | +++ breezy/tests/features.py 2024-03-12 01:21:34 +0000 |
966 | @@ -142,9 +142,7 @@ |
967 | from breezy import pyutils |
968 | |
969 | depr_msg = self._dep_version % (f"{self._module}.{self._name}") |
970 | - use_msg = " Use {}.{} instead.".format( |
971 | - self._replacement_module, self._replacement_name |
972 | - ) |
973 | + use_msg = f" Use {self._replacement_module}.{self._replacement_name} instead." |
974 | symbol_versioning.warn(depr_msg + use_msg, DeprecationWarning, stacklevel=5) |
975 | # Import the new feature and use it as a replacement for the |
976 | # deprecated one. |
977 | |
978 | === modified file 'breezy/tests/matchers.py' |
979 | --- breezy/tests/matchers.py 2023-11-16 15:15:02 +0000 |
980 | +++ breezy/tests/matchers.py 2024-03-12 01:21:34 +0000 |
981 | @@ -85,9 +85,7 @@ |
982 | self.expected = expected |
983 | |
984 | def describe(self): |
985 | - return "mismatched ancestry for revision {!r} was {!r}, expected {!r}".format( |
986 | - self.tip_revision, self.got, self.expected |
987 | - ) |
988 | + return f"mismatched ancestry for revision {self.tip_revision!r} was {self.got!r}, expected {self.expected!r}" |
989 | |
990 | |
991 | class MatchesAncestry(Matcher): |
992 | @@ -103,9 +101,7 @@ |
993 | self.revision_id = revision_id |
994 | |
995 | def __str__(self): |
996 | - return "MatchesAncestry(repository={!r}, revision_id={!r})".format( |
997 | - self.repository, self.revision_id |
998 | - ) |
999 | + return f"MatchesAncestry(repository={self.repository!r}, revision_id={self.revision_id!r})" |
1000 | |
1001 | def match(self, expected): |
1002 | with self.repository.lock_read(): |
1003 | |
1004 | === modified file 'breezy/tests/per_interbranch/__init__.py' |
1005 | --- breezy/tests/per_interbranch/__init__.py 2023-11-07 10:54:10 +0000 |
1006 | +++ breezy/tests/per_interbranch/__init__.py 2024-03-12 01:21:34 +0000 |
1007 | @@ -39,11 +39,7 @@ |
1008 | """ |
1009 | result = [] |
1010 | for interbranch_class, branch_format_from, branch_format_to in test_list: |
1011 | - id = "{},{},{}".format( |
1012 | - interbranch_class.__name__, |
1013 | - branch_format_from.__class__.__name__, |
1014 | - branch_format_to.__class__.__name__, |
1015 | - ) |
1016 | + id = f"{interbranch_class.__name__},{branch_format_from.__class__.__name__},{branch_format_to.__class__.__name__}" |
1017 | scenario = ( |
1018 | id, |
1019 | { |
1020 | |
1021 | === modified file 'breezy/tests/per_interrepository/__init__.py' |
1022 | --- breezy/tests/per_interrepository/__init__.py 2023-11-16 15:15:02 +0000 |
1023 | +++ breezy/tests/per_interrepository/__init__.py 2024-03-12 01:21:34 +0000 |
1024 | @@ -46,11 +46,7 @@ |
1025 | """ |
1026 | result = [] |
1027 | for label, repository_format, repository_format_to, extra_setup in formats: |
1028 | - id = "{},{},{}".format( |
1029 | - label, |
1030 | - repository_format.__class__.__name__, |
1031 | - repository_format_to.__class__.__name__, |
1032 | - ) |
1033 | + id = f"{label},{repository_format.__class__.__name__},{repository_format_to.__class__.__name__}" |
1034 | scenario = ( |
1035 | id, |
1036 | { |
1037 | |
1038 | === modified file 'breezy/tests/per_tree/test_test_trees.py' |
1039 | --- breezy/tests/per_tree/test_test_trees.py 2023-11-07 10:54:10 +0000 |
1040 | +++ breezy/tests/per_tree/test_test_trees.py 2024-03-12 01:21:34 +0000 |
1041 | @@ -484,9 +484,7 @@ |
1042 | self.assertEqual( |
1043 | len(path_and_ids), |
1044 | len(path_entries), |
1045 | - "{!r} vs {!r}".format( |
1046 | - [p for (p, f, pf, r) in path_and_ids], [p for (p, e) in path_entries] |
1047 | - ), |
1048 | + f"{[p for (p, f, pf, r) in path_and_ids]!r} vs {[p for (p, e) in path_entries]!r}", |
1049 | ) |
1050 | get_revision_id = getattr(tree, "get_revision_id", None) |
1051 | if get_revision_id is not None: |
1052 | |
1053 | === modified file 'breezy/tests/stub_sftp.py' |
1054 | --- breezy/tests/stub_sftp.py 2023-11-07 10:54:10 +0000 |
1055 | +++ breezy/tests/stub_sftp.py 2024-03-12 01:21:34 +0000 |
1056 | @@ -500,8 +500,8 @@ |
1057 | or isinstance(backing_server, test_server.LocalURLServer) |
1058 | ): |
1059 | raise AssertionError( |
1060 | - "backing_server should not be {!r}, because this can only serve " |
1061 | - "the local current working directory.".format(backing_server) |
1062 | + f"backing_server should not be {backing_server!r}, because this can only serve " |
1063 | + "the local current working directory." |
1064 | ) |
1065 | self._original_vendor = ssh._ssh_vendor_manager._cached_ssh_vendor |
1066 | ssh._ssh_vendor_manager._cached_ssh_vendor = self._vendor |
1067 | |
1068 | === modified file 'breezy/transport/__init__.py' |
1069 | --- breezy/transport/__init__.py 2024-02-18 12:34:57 +0000 |
1070 | +++ breezy/transport/__init__.py 2024-03-12 01:21:34 +0000 |
1071 | @@ -205,9 +205,7 @@ |
1072 | ) |
1073 | |
1074 | def __repr__(self): |
1075 | - return "{}({!r}, {!r}, {!r})".format( |
1076 | - self.__class__.__name__, self.start, self.length, self.ranges |
1077 | - ) |
1078 | + return f"{self.__class__.__name__}({self.start!r}, {self.length!r}, {self.ranges!r})" |
1079 | |
1080 | |
1081 | class LateReadError: |
1082 | @@ -1575,9 +1573,7 @@ |
1083 | try: |
1084 | return action(transport) |
1085 | except errors.RedirectRequested as e: |
1086 | - redirection_notice = "{} is{} redirected to {}".format( |
1087 | - e.source, e.permanently, e.target |
1088 | - ) |
1089 | + redirection_notice = f"{e.source} is{e.permanently} redirected to {e.target}" |
1090 | transport = redirected(transport, e, redirection_notice) |
1091 | else: |
1092 | # Loop exited without resolving redirect ? Either the |
1093 | |
1094 | === modified file 'breezy/transport/http/urllib.py' |
1095 | --- breezy/transport/http/urllib.py 2024-01-24 22:02:59 +0000 |
1096 | +++ breezy/transport/http/urllib.py 2024-03-12 01:21:34 +0000 |
1097 | @@ -157,9 +157,7 @@ |
1098 | if self.status in self._body_ignored_responses: |
1099 | if self.debuglevel >= 2: |
1100 | print( |
1101 | - "For status: [{}], will ready body, length: {}".format( |
1102 | - self.status, self.length |
1103 | - ) |
1104 | + f"For status: [{self.status}], will ready body, length: {self.length}" |
1105 | ) |
1106 | if not (self.length is None or self.will_close): |
1107 | # In some cases, we just can't read the body not |
1108 | @@ -1860,9 +1858,7 @@ |
1109 | |
1110 | if self._debuglevel > 0: |
1111 | print( |
1112 | - "perform: {} base: {}, url: {}".format( |
1113 | - request.method, self.base, request.get_full_url() |
1114 | - ) |
1115 | + f"perform: {request.method} base: {self.base}, url: {request.get_full_url()}" |
1116 | ) |
1117 | response = self._opener.open(request) |
1118 | if self._get_connection() is not request.connection: |
1119 | |
1120 | === modified file 'breezy/transport/log.py' |
1121 | --- breezy/transport/log.py 2023-11-16 15:15:02 +0000 |
1122 | +++ breezy/transport/log.py 2024-03-12 01:21:34 +0000 |
1123 | @@ -86,12 +86,7 @@ |
1124 | def _log_and_call(self, methodname, relpath, *args, **kwargs): |
1125 | kwargs_str = dict(kwargs) if kwargs else "" |
1126 | mutter( |
1127 | - "{} {} {} {}".format( |
1128 | - methodname, |
1129 | - relpath, |
1130 | - self._shorten(self._strip_tuple_parens(args)), |
1131 | - kwargs_str, |
1132 | - ) |
1133 | + f"{methodname} {relpath} {self._shorten(self._strip_tuple_parens(args))} {kwargs_str}" |
1134 | ) |
1135 | return self._call_and_log_result(methodname, (relpath,) + args, kwargs) |
1136 | |
1137 | |
1138 | === modified file 'breezy/transport/remote.py' |
1139 | --- breezy/transport/remote.py 2023-11-16 15:15:02 +0000 |
1140 | +++ breezy/transport/remote.py 2024-03-12 01:21:34 +0000 |
1141 | @@ -108,9 +108,9 @@ |
1142 | medium = self._shared_connection.connection |
1143 | else: |
1144 | raise AssertionError( |
1145 | - "Both _from_transport ({!r}) and medium ({!r}) passed to " |
1146 | + f"Both _from_transport ({_from_transport!r}) and medium ({medium!r}) passed to " |
1147 | "RemoteTransport.__init__, but these parameters are mutally " |
1148 | - "exclusive.".format(_from_transport, medium) |
1149 | + "exclusive." |
1150 | ) |
1151 | |
1152 | if _client is None: |
1153 | |
1154 | === modified file 'breezy/ui/__init__.py' |
1155 | --- breezy/ui/__init__.py 2023-11-16 15:15:02 +0000 |
1156 | +++ breezy/ui/__init__.py 2024-03-12 01:21:34 +0000 |
1157 | @@ -118,12 +118,7 @@ |
1158 | return getattr(self.wrapped_ui, name) |
1159 | |
1160 | def __repr__(self): |
1161 | - return "{}({!r}, {!r}, {!r})".format( |
1162 | - self.__class__.__name__, |
1163 | - self.wrapped_ui, |
1164 | - self.default_answer, |
1165 | - self.specific_answers, |
1166 | - ) |
1167 | + return f"{self.__class__.__name__}({self.wrapped_ui!r}, {self.default_answer!r}, {self.specific_answers!r})" |
1168 | |
1169 | def confirm_action(self, prompt, confirmation_id, prompt_kwargs): |
1170 | if confirmation_id in self.specific_answers: |
1171 | |
1172 | === modified file 'breezy/urlutils.py' |
1173 | --- breezy/urlutils.py 2023-11-16 18:05:55 +0000 |
1174 | +++ breezy/urlutils.py 2024-03-12 01:21:34 +0000 |
1175 | @@ -290,15 +290,7 @@ |
1176 | ) |
1177 | |
1178 | def __repr__(self): |
1179 | - return "<{}({!r}, {!r}, {!r}, {!r}, {!r}, {!r})>".format( |
1180 | - self.__class__.__name__, |
1181 | - self.scheme, |
1182 | - self.quoted_user, |
1183 | - self.quoted_password, |
1184 | - self.quoted_host, |
1185 | - self.port, |
1186 | - self.quoted_path, |
1187 | - ) |
1188 | + return f"<{self.__class__.__name__}({self.scheme!r}, {self.quoted_user!r}, {self.quoted_password!r}, {self.quoted_host!r}, {self.port!r}, {self.quoted_path!r})>" |
1189 | |
1190 | @classmethod |
1191 | def from_string(cls, url): |
f-strings can pose issues with translation / gettext()