Commit a8b1092f authored by Thanassis Tsiodras's avatar Thanassis Tsiodras
Browse files

Appeasing newer versions of mypy.

parent ac5d3fd7
......@@ -30,7 +30,7 @@ import sys
import re
import distutils.spawn as spawn
from typing import List, Union
from typing import List, Union, Set
from ..commonPy import asnParser
from ..commonPy.utility import panic, inform
......
......@@ -24,7 +24,7 @@ Semantix's code generator A.'''
import os
import re
from typing import List, Union, IO, Any, Dict # NOQA pylint: disable=unused-import
from typing import List, Union, IO, Any, Dict, Set # NOQA pylint: disable=unused-import
from ..commonPy.asnAST import (
AsnMetaMember, AsnChoice, AsnSet, AsnSequence, AsnSequenceOf,
......
......@@ -82,7 +82,7 @@ import os
import sys
import distutils.spawn as spawn
from typing import cast, Optional, Dict, List, Tuple, Any # NOQA pylint: disable=unused-import
from typing import cast, Optional, Dict, List, Tuple, Set, Any # NOQA pylint: disable=unused-import
# from importlib import import_module
from .B_mappers import ada_B_mapper
......@@ -381,6 +381,8 @@ def ProcessCustomBackends(
return [cast(Sync_B_Mapper, zestSC1_B_mapper)] # pragma: no cover
else:
return [cast(Sync_B_Mapper, vhdl_B_mapper)] # pragma: no cover
else:
panic("Unexpected call of getCustomBackends...") # pragma: no cover
for si in [x for x in SystemsAndImplementations if x[2] is not None and x[2].lower() in ["gui_ri", "gui_pi", "vhdl"]]:
# We do, start the work
......
......@@ -95,7 +95,7 @@ class AsnNode(object):
def Location(self) -> str:
return "file %s, line %d" % (self._asnFilename, int(self._lineno)) # pragma: no cover
def IdenticalPerSMP2(self, _: 'AsnNode', __: Lookup, ___: Lookup) -> bool: # pylint: disable=no-self-use
def IdenticalPerSMP2(self, _: AsnNode, __: Lookup, ___: Lookup) -> bool: # pylint: disable=no-self-use
utility.panic("internal error: Must be defined in derived class...")
def AsASN1(self, _: Lookup) -> str: # pylint: disable=no-self-use
......@@ -106,7 +106,6 @@ class AsnBasicNode(AsnNode):
def __init__(self, asnFilename: str) -> None:
AsnNode.__init__(self, asnFilename)
class AsnComplexNode(AsnNode):
def __init__(self, asnFilename: str) -> None:
AsnNode.__init__(self, asnFilename)
......
......@@ -52,7 +52,7 @@ import tempfile
import re
import distutils.spawn as spawn
import xml.sax # type: ignore
import xml.sax.ContentHandler # type: ignore
from typing import IO, TypeVar, Type, Optional, Callable, Union, List, Dict, Tuple, Any # NOQA pylint: disable=W0611
from . import configMT
......@@ -458,9 +458,9 @@ class Element:
self._children = [] # type: List[Element]
class InputFormatXMLHandler(xml.sax.ContentHandler):
class InputFormatXMLHandler(xml.sax.ContentHandler): # type: ignore
def __init__(self, debug: bool=False) -> None:
xml.sax.ContentHandler.__init__(self)
xml.sax.ContentHandler.__init__(self) # type: ignore
self._debug = False
if debug:
self._debug = True # pragma: no cover
......
......@@ -3,7 +3,7 @@ import sys
from lxml import etree
from typing import List, Union, Optional, Any, Tuple, Dict # NOQA pylint: disable=unused-import
from typing import List, Union, Optional, Any, Tuple, Dict, NoReturn # NOQA pylint: disable=unused-import
from .asnAST import (
AsnBool, AsnInt, AsnReal, AsnEnumerated, AsnOctetString, AsnSequenceOf,
......@@ -38,7 +38,8 @@ class MagicSmp2SimpleTypesDict(dict):
# ---------------------------------------------------------------------------
def has_key(self, name: str) -> bool:
name = re.sub(r'/\d{4}/\d{2}/', '/', name)
return name in super(MagicSmp2SimpleTypesDict, self) # type: ignore pylint: disable=unsupported-membership-test
# return name in super(MagicSmp2SimpleTypesDict, self) # pylint: disable=unsupported-membership-test
return super(MagicSmp2SimpleTypesDict, self).__contains__(name)
simpleTypesTable = MagicSmp2SimpleTypesDict({
......@@ -85,7 +86,7 @@ def info(level: int, *args: Any) -> None:
return
def panic(x: str, coloredBanner: str="") -> None:
def panic(x: str, coloredBanner: str="") -> NoReturn:
"""Notifies the user that something fatal happened and aborts. """
info(0, yellow + coloredBanner + white + '\n' + x)
sys.exit(1)
......
......@@ -71,6 +71,7 @@ def panicWithCallStack(msg: str) -> NoReturn:
sys.stderr.write("\n" + chr(27) + "[32m" + msg + chr(27) + "[0m\n")
sys.stderr.write(
"\nCall stack was:\n%s\n" % "".join(traceback.format_stack()))
sys.exit(1)
else:
panic(msg)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment