pytype: drop the now useless assert
As the imported types are now used by type annotation, these ugly assert are
no longer needed.
--- 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
--- 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')
--- 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:
--- 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
--- 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"""
--- 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.
--- 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())
--- 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: