Mercurial > hg
comparison hgext/remotenames.py @ 48913:f254fc73d956
global: bulk replace simple pycompat.iteritems(x) with x.items()
pycompat.iteritems() just calls .items().
This commit applies a regular expression search and replace to convert
simple instances of pycompat.iteritems() with .items(). There are still
a handful of calls to pycompat.iteritems() remaining. But these all have
more complicated expressions that I wasn't comfortable performing an
automated replace on. In addition, some simple replacements were withheld
because they broke pytype. These will be handled by their own changesets.
Differential Revision: https://phab.mercurial-scm.org/D12318
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Thu, 03 Mar 2022 18:28:30 -0800 |
parents | 6000f5b25c9b |
children | 642e31cb55f0 |
comparison
equal
deleted
inserted
replaced
48912:a0674e916fb6 | 48913:f254fc73d956 |
---|---|
168 """Iterate over (name, node) tuples""" | 168 """Iterate over (name, node) tuples""" |
169 | 169 |
170 if not self.loaded: | 170 if not self.loaded: |
171 self._load() | 171 self._load() |
172 | 172 |
173 for k, vtup in pycompat.iteritems(self.potentialentries): | 173 for k, vtup in self.potentialentries.items(): |
174 yield (k, [bin(vtup[0])]) | 174 yield (k, [bin(vtup[0])]) |
175 | 175 |
176 items = iteritems | 176 items = iteritems |
177 | 177 |
178 | 178 |
205 | 205 |
206 def nodetobmarks(self): | 206 def nodetobmarks(self): |
207 if not self._nodetobmarks: | 207 if not self._nodetobmarks: |
208 bmarktonodes = self.bmarktonodes() | 208 bmarktonodes = self.bmarktonodes() |
209 self._nodetobmarks = {} | 209 self._nodetobmarks = {} |
210 for name, node in pycompat.iteritems(bmarktonodes): | 210 for name, node in bmarktonodes.items(): |
211 self._nodetobmarks.setdefault(node[0], []).append(name) | 211 self._nodetobmarks.setdefault(node[0], []).append(name) |
212 return self._nodetobmarks | 212 return self._nodetobmarks |
213 | 213 |
214 def branchtonodes(self): | 214 def branchtonodes(self): |
215 return self.branches | 215 return self.branches |
216 | 216 |
217 def nodetobranch(self): | 217 def nodetobranch(self): |
218 if not self._nodetobranch: | 218 if not self._nodetobranch: |
219 branchtonodes = self.branchtonodes() | 219 branchtonodes = self.branchtonodes() |
220 self._nodetobranch = {} | 220 self._nodetobranch = {} |
221 for name, nodes in pycompat.iteritems(branchtonodes): | 221 for name, nodes in branchtonodes.items(): |
222 for node in nodes: | 222 for node in nodes: |
223 self._nodetobranch.setdefault(node, []).append(name) | 223 self._nodetobranch.setdefault(node, []).append(name) |
224 return self._nodetobranch | 224 return self._nodetobranch |
225 | 225 |
226 def hoisttonodes(self, hoist): | 226 def hoisttonodes(self, hoist): |
227 if not self._hoisttonodes: | 227 if not self._hoisttonodes: |
228 marktonodes = self.bmarktonodes() | 228 marktonodes = self.bmarktonodes() |
229 self._hoisttonodes = {} | 229 self._hoisttonodes = {} |
230 hoist += b'/' | 230 hoist += b'/' |
231 for name, node in pycompat.iteritems(marktonodes): | 231 for name, node in marktonodes.items(): |
232 if name.startswith(hoist): | 232 if name.startswith(hoist): |
233 name = name[len(hoist) :] | 233 name = name[len(hoist) :] |
234 self._hoisttonodes[name] = node | 234 self._hoisttonodes[name] = node |
235 return self._hoisttonodes | 235 return self._hoisttonodes |
236 | 236 |
237 def nodetohoists(self, hoist): | 237 def nodetohoists(self, hoist): |
238 if not self._nodetohoists: | 238 if not self._nodetohoists: |
239 marktonodes = self.bmarktonodes() | 239 marktonodes = self.bmarktonodes() |
240 self._nodetohoists = {} | 240 self._nodetohoists = {} |
241 hoist += b'/' | 241 hoist += b'/' |
242 for name, node in pycompat.iteritems(marktonodes): | 242 for name, node in marktonodes.items(): |
243 if name.startswith(hoist): | 243 if name.startswith(hoist): |
244 name = name[len(hoist) :] | 244 name = name[len(hoist) :] |
245 self._nodetohoists.setdefault(node[0], []).append(name) | 245 self._nodetohoists.setdefault(node[0], []).append(name) |
246 return self._nodetohoists | 246 return self._nodetohoists |
247 | 247 |