comparison mercurial/logcmdutil.py @ 51811:460e80488cf0

typing: lock in correct changes from pytype 2023.04.11 -> 2023.06.16 There were a handful of other changes to the pyi files generated when updating pytype locally (and jumping from python 3.8.0 to python 3.10.11), but they were not as clear (e.g. the embedded type in a list changing from `nothing` to `Any` or similar). These looked obviously correct, and agreed with PyCharm's thoughts on the signatures. Oddly, even though pytype starting inferring `obsutil._getfilteredreason()` as returning bytes, it (correctly) complained about the None path when it was typed that way. Instead, raise a ProgrammingError if an unhandled fate is calculated. (Currently, all possibilities are handled, so this isn't reachable unless another fate is added in the future.)
author Matt Harbison <matt_harbison@yahoo.com>
date Tue, 20 Aug 2024 18:30:47 -0400
parents 278af66e6595
children f4733654f144
comparison
equal deleted inserted replaced
51810:f1ef512e14ab 51811:460e80488cf0
572 Note: there are a variety of convenience functions to build a 572 Note: there are a variety of convenience functions to build a
573 changesettemplater for common cases. See functions such as: 573 changesettemplater for common cases. See functions such as:
574 maketemplater, changesetdisplayer, buildcommittemplate, or other 574 maketemplater, changesetdisplayer, buildcommittemplate, or other
575 functions that use changesest_templater. 575 functions that use changesest_templater.
576 """ 576 """
577
578 _tresources: formatter.templateresources
579 lastheader: Optional[bytes]
580 t: templater.templater
577 581
578 # Arguments before "buffered" used to be positional. Consider not 582 # Arguments before "buffered" used to be positional. Consider not
579 # adding/removing arguments before "buffered" to not break callers. 583 # adding/removing arguments before "buffered" to not break callers.
580 def __init__( 584 def __init__(
581 self, ui, repo, tmplspec, differ=None, diffopts=None, buffered=False 585 self, ui, repo, tmplspec, differ=None, diffopts=None, buffered=False
663 if self._parts[b'footer']: 667 if self._parts[b'footer']:
664 if not self.footer: 668 if not self.footer:
665 self.footer = self.t.render(self._parts[b'footer'], props) 669 self.footer = self.t.render(self._parts[b'footer'], props)
666 670
667 671
668 def templatespec(tmpl, mapfile): 672 def templatespec(tmpl, mapfile) -> formatter.templatespec:
669 assert not (tmpl and mapfile) 673 assert not (tmpl and mapfile)
670 if mapfile: 674 if mapfile:
671 return formatter.mapfile_templatespec(b'changeset', mapfile) 675 return formatter.mapfile_templatespec(b'changeset', mapfile)
672 else: 676 else:
673 return formatter.literal_templatespec(tmpl) 677 return formatter.literal_templatespec(tmpl)
674 678
675 679
676 def _lookuptemplate(ui, tmpl, style): 680 def _lookuptemplate(ui, tmpl, style) -> formatter.templatespec:
677 """Find the template matching the given template spec or style 681 """Find the template matching the given template spec or style
678 682
679 See formatter.lookuptemplate() for details. 683 See formatter.lookuptemplate() for details.
680 """ 684 """
681 685