# HG changeset patch # User Pierre-Yves David # Date 1703107023 -3600 # Node ID f4a0806081f2e6fed91f6bf4ff4dee5dbfea8ef6 # Parent 7bd7fcc711f299bf3d69bb2fee3fcc03b14707be pytype: drop the now useless assert As the imported types are now used by type annotation, these ugly assert are no longer needed. diff -r 7bd7fcc711f2 -r f4a0806081f2 mercurial/branchmap.py --- a/mercurial/branchmap.py Wed Dec 20 16:39:03 2023 +0100 +++ b/mercurial/branchmap.py Wed Dec 20 22:17:03 2023 +0100 @@ -15,7 +15,6 @@ ) from typing import ( - Any, Callable, Dict, Iterable, @@ -40,19 +39,6 @@ stringutil, ) -# keeps pyflakes happy -assert [ - Any, - Callable, - Dict, - Iterable, - List, - Optional, - Set, - Tuple, - Union, -] - if TYPE_CHECKING: from . import localrepo diff -r 7bd7fcc711f2 -r f4a0806081f2 mercurial/encoding.py --- a/mercurial/encoding.py Wed Dec 20 16:39:03 2023 +0100 +++ b/mercurial/encoding.py Wed Dec 20 22:17:03 2023 +0100 @@ -15,11 +15,8 @@ from typing import ( Any, Callable, - List, Text, - Type, TypeVar, - Union, ) from . import ( @@ -30,10 +27,6 @@ from .pure import charencode as charencodepure -# keep pyflakes happy -for t in (Any, Callable, List, Text, Type, Union): - assert t - _Tlocalstr = TypeVar('_Tlocalstr', bound='localstr') charencode = policy.importmod('charencode') diff -r 7bd7fcc711f2 -r f4a0806081f2 mercurial/error.py --- a/mercurial/error.py Wed Dec 20 16:39:03 2023 +0100 +++ b/mercurial/error.py Wed Dec 20 22:17:03 2023 +0100 @@ -15,7 +15,6 @@ import difflib from typing import ( - Any, AnyStr, Iterable, List, @@ -28,18 +27,6 @@ from . import pycompat -# keeps pyflakes happy -assert [ - Any, - AnyStr, - Iterable, - List, - Optional, - Sequence, - Union, -] - - def _tobytes(exc) -> bytes: """Byte-stringify exception in the same way as BaseException_str()""" if not exc.args: diff -r 7bd7fcc711f2 -r f4a0806081f2 mercurial/i18n.py --- a/mercurial/i18n.py Wed Dec 20 16:39:03 2023 +0100 +++ b/mercurial/i18n.py Wed Dec 20 22:17:03 2023 +0100 @@ -12,7 +12,6 @@ import sys from typing import ( - Callable, List, ) @@ -22,12 +21,6 @@ pycompat, ) -# keeps pyflakes happy -assert [ - Callable, - List, -] - # modelled after templater.templatepath: if getattr(sys, 'frozen', None) is not None: module = pycompat.sysexecutable diff -r 7bd7fcc711f2 -r f4a0806081f2 mercurial/logcmdutil.py --- a/mercurial/logcmdutil.py Wed Dec 20 16:39:03 2023 +0100 +++ b/mercurial/logcmdutil.py Wed Dec 20 22:17:03 2023 +0100 @@ -48,20 +48,6 @@ stringutil, ) -# keeps pyflakes happy -assert [ - Any, - Callable, - Dict, - Optional, - Sequence, - Tuple, -] - -# keep pyflakes happy -for t in (Any, Callable, Dict, Optional, Tuple): - assert t - def getlimit(opts): """get the log limit according to option -l/--limit""" diff -r 7bd7fcc711f2 -r f4a0806081f2 mercurial/mail.py --- a/mercurial/mail.py Wed Dec 20 16:39:03 2023 +0100 +++ b/mercurial/mail.py Wed Dec 20 22:17:03 2023 +0100 @@ -44,15 +44,6 @@ ) -# keep pyflakes happy -assert [ - Any, - List, - Tuple, - Union, -] - - class STARTTLS(smtplib.SMTP): """Derived class to verify the peer certificate for STARTTLS. diff -r 7bd7fcc711f2 -r f4a0806081f2 mercurial/pathutil.py --- a/mercurial/pathutil.py Wed Dec 20 16:39:03 2023 +0100 +++ b/mercurial/pathutil.py Wed Dec 20 22:17:03 2023 +0100 @@ -23,14 +23,6 @@ rustdirs = policy.importrust('dirstate', 'Dirs') parsers = policy.importmod('parsers') -# keeps pyflakes happy -assert [ - Any, - Callable, - Iterator, - Optional, -] - def _lowerclean(s: bytes) -> bytes: return encoding.hfsignoreclean(s.lower()) diff -r 7bd7fcc711f2 -r f4a0806081f2 mercurial/phases.py --- a/mercurial/phases.py Wed Dec 20 16:39:03 2023 +0100 +++ b/mercurial/phases.py Wed Dec 20 22:17:03 2023 +0100 @@ -132,18 +132,6 @@ util, ) -# keeps pyflakes happy -assert [ - Any, - Callable, - Dict, - Iterable, - List, - Optional, - Set, - Tuple, -] - Phaseroots = Dict[int, Set[bytes]] if typing.TYPE_CHECKING: