Mercurial > public > mercurial-scm > hg
comparison mercurial/smartset.py @ 43506:9f70512ae2cf
cleanup: remove pointless r-prefixes on single-quoted strings
This is the promised second step on single-quoted strings. These had
existed because our source transformer didn't turn r'' into b'', so we
had tagged some strings as r-strings to get "native" strings on both
Pythons. Now that the transformer is gone, we can dispense with this
nonsense.
Methodology:
I ran
hg locate 'set:added() or modified() or clean()' | egrep '.*\.py$' | xargs egrep --color=never -n -- \[\^b\]\[\^a-z\]r\'\[\^\'\\\\\]\*\'\[\^\'\
in an emacs grep-mode buffer, and then used a keyboard macro to
iterate over the results and remove the r prefix as needed.
# skip-blame removing unneeded r prefixes left over from Python 3 migration.
Differential Revision: https://phab.mercurial-scm.org/D7306
author | Augie Fackler <augie@google.com> |
---|---|
date | Fri, 08 Nov 2019 11:19:20 -0800 |
parents | c59eb1560c44 |
children | d4ba4d51f85f |
comparison
equal
deleted
inserted
replaced
43505:47fac1692ede | 43506:9f70512ae2cf |
---|---|
254 return asclist | 254 return asclist |
255 | 255 |
256 @util.propertycache | 256 @util.propertycache |
257 def _list(self): | 257 def _list(self): |
258 # _list is only lazily constructed if we have _set | 258 # _list is only lazily constructed if we have _set |
259 assert r'_set' in self.__dict__ | 259 assert '_set' in self.__dict__ |
260 return list(self._set) | 260 return list(self._set) |
261 | 261 |
262 def __iter__(self): | 262 def __iter__(self): |
263 if self._ascending is None: | 263 if self._ascending is None: |
264 return iter(self._list) | 264 return iter(self._list) |
292 else: | 292 else: |
293 self._ascending = not self._ascending | 293 self._ascending = not self._ascending |
294 self._istopo = False | 294 self._istopo = False |
295 | 295 |
296 def __len__(self): | 296 def __len__(self): |
297 if r'_list' in self.__dict__: | 297 if '_list' in self.__dict__: |
298 return len(self._list) | 298 return len(self._list) |
299 else: | 299 else: |
300 return len(self._set) | 300 return len(self._set) |
301 | 301 |
302 def isascending(self): | 302 def isascending(self): |
345 | 345 |
346 def _fastsetop(self, other, op): | 346 def _fastsetop(self, other, op): |
347 # try to use native set operations as fast paths | 347 # try to use native set operations as fast paths |
348 if ( | 348 if ( |
349 type(other) is baseset | 349 type(other) is baseset |
350 and r'_set' in other.__dict__ | 350 and '_set' in other.__dict__ |
351 and r'_set' in self.__dict__ | 351 and '_set' in self.__dict__ |
352 and self._ascending is not None | 352 and self._ascending is not None |
353 ): | 353 ): |
354 s = baseset( | 354 s = baseset( |
355 data=getattr(self._set, op)(other._set), istopo=self._istopo | 355 data=getattr(self._set, op)(other._set), istopo=self._istopo |
356 ) | 356 ) |