add type annotations .pyi file for SimdScope
authorJacob Lifshay <programmerjake@gmail.com>
Fri, 22 Oct 2021 07:40:09 +0000 (00:40 -0700)
committerJacob Lifshay <programmerjake@gmail.com>
Fri, 22 Oct 2021 07:40:09 +0000 (00:40 -0700)
expand-simd-map-input.sh [new file with mode: 0755]
src/ieee754/part/util.pyi [new file with mode: 0644]

diff --git a/expand-simd-map-input.sh b/expand-simd-map-input.sh
new file mode 100755 (executable)
index 0000000..1fbb30d
--- /dev/null
@@ -0,0 +1,58 @@
+#!/bin/bash
+# SPDX-License-Identifier: LGPL-3-or-later
+# See Notices.txt for copyright information
+
+# utility script for expanding input type annotations for SimdMap methods.
+# not actually needed anymore, but I thought I'd commit it in case anyone
+# finds it useful.
+
+mapfile lines < src/ieee754/part/util.pyi
+
+defs=()
+def=""
+LOOKING_FOR_DEF=0
+PARSING_BODY=1
+((state = LOOKING_FOR_DEF))
+
+# split into list of python method definitions
+for line in "${lines[@]}"; do
+    if ((state == LOOKING_FOR_DEF)); then
+        if [[ "$line" =~ ^' '*'def ' ]]; then
+            ((state = PARSING_BODY))
+        fi
+        def+="$line"
+    elif [[ "$line" =~ ^' '*'@' ]]; then
+        defs+=("$def")
+        def="$line"
+        ((state = LOOKING_FOR_DEF))
+    elif [[ "$line" =~ ^' '*'def ' ]]; then
+        defs+=("$def")
+        def="$line"
+    else
+        def+="$line"
+    fi
+done
+if [[ "$def" != "" ]]; then
+    defs+=("$def")
+fi
+
+# expand all occurrences of _SimdMapInput[_T...]
+((working = 1))
+while ((working)); do
+    ((working = 0))
+    old_defs=("${defs[@]}")
+    defs=()
+    for def in "${old_defs[@]}"; do
+        if [[ "$def" =~ ^(.*)'Optional[_SimdMapInput['(_T[0-9]*)']]'(.*)$ ]] ||
+                [[ "$a" =~ ^(.*)'_SimdMapInput['(_T[0-9]*)']'(.*)$ ]]; then
+            ((working = 1))
+            defs+=("${BASH_REMATCH[1]}SimdMap[${BASH_REMATCH[2]}]${BASH_REMATCH[3]}")
+            defs+=("${BASH_REMATCH[1]}Mapping[_ElWid, Optional[${BASH_REMATCH[2]}]]${BASH_REMATCH[3]}")
+            defs+=("${BASH_REMATCH[1]}Optional[${BASH_REMATCH[2]}]${BASH_REMATCH[3]}")
+        else
+            defs+=("$def")
+        fi
+    done
+done
+
+printf "%s" "${defs[@]}" > out.txt
diff --git a/src/ieee754/part/util.pyi b/src/ieee754/part/util.pyi
new file mode 100644 (file)
index 0000000..9748660
--- /dev/null
@@ -0,0 +1,1116 @@
+# SPDX-License-Identifier: LGPL-3-or-later
+# See Notices.txt for copyright information
+
+from enum import Enum
+from typing import (Any, Callable, ClassVar, Generic, ItemsView, Iterable,
+                    KeysView, Literal, Mapping, Optional, Tuple, TypeVar,
+                    Union, ValuesView, overload)
+
+
+class ElWid(Enum):
+    def __repr__(self) -> str: ...
+
+
+class FpElWid(ElWid):
+    F64 = 0
+    F32 = 1
+    F16 = 2
+    BF16 = 3
+
+
+class IntElWid(ElWid):
+    I64 = 0
+    I32 = 1
+    I16 = 2
+    I8 = 3
+
+
+_T = TypeVar('_T')
+_T1 = TypeVar('_T1')
+_T2 = TypeVar('_T2')
+
+_ElWid = Union[FpElWid, IntElWid]
+
+
+class SimdMap(Generic[_T]):
+    ALL_ELWIDTHS: ClassVar[Tuple[_ElWid, ...]]
+
+    __map: Mapping[_ElWid, _T]
+
+    @overload
+    @classmethod
+    def extract_value(cls,
+                      elwid: _ElWid,
+                      values: None,
+                      default: _T2 = None) -> _T2: ...
+
+    @overload
+    @classmethod
+    def extract_value(cls,
+                      elwid: _ElWid,
+                      values: SimdMap[_T],
+                      default: _T2 = None) -> Union[_T, _T2]: ...
+
+    @overload
+    @classmethod
+    def extract_value(cls,
+                      elwid: _ElWid,
+                      values: Mapping[_ElWid, _T],
+                      default: _T2 = None) -> Union[_T, _T2]: ...
+
+    @overload
+    @classmethod
+    def extract_value(cls,
+                      elwid: _ElWid,
+                      values: _T,
+                      default: _T2 = None) -> Union[_T, _T2]: ...
+
+    @overload
+    def __init__(self, values: Optional[SimdMap[_T]] = None): ...
+    @overload
+    def __init__(self, values: Optional[Mapping[_ElWid, _T]] = None): ...
+    @overload
+    def __init__(self, values: Optional[_T] = None): ...
+
+    @property
+    def mapping(self) -> Mapping[_ElWid, _T]: ...
+
+    def values(self) -> ValuesView[_T]: ...
+
+    def keys(self) -> KeysView[_ElWid]: ...
+
+    def items(self) -> ItemsView[_ElWid, _T]: ...
+
+    @overload
+    @classmethod
+    def map_with_elwid(cls,
+                       f: Callable[[_ElWid],
+                                   SimdMap[_T]],
+                       ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map_with_elwid(cls,
+                       f: Callable[[_ElWid],
+                                   Mapping[_ElWid, Optional[_T]]],
+                       ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map_with_elwid(cls,
+                       f: Callable[[_ElWid],
+                                   Optional[_T]],
+                       ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map_with_elwid(cls,
+                       f: Callable[[_ElWid, _T1],
+                                   SimdMap[_T]],
+                       __arg1: SimdMap[_T1],
+                       ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map_with_elwid(cls,
+                       f: Callable[[_ElWid, _T1],
+                                   Mapping[_ElWid, Optional[_T]]],
+                       __arg1: SimdMap[_T1],
+                       ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map_with_elwid(cls,
+                       f: Callable[[_ElWid, _T1],
+                                   Optional[_T]],
+                       __arg1: SimdMap[_T1],
+                       ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map_with_elwid(cls,
+                       f: Callable[[_ElWid, _T1],
+                                   SimdMap[_T]],
+                       __arg1: Mapping[_ElWid, Optional[_T1]],
+                       ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map_with_elwid(cls,
+                       f: Callable[[_ElWid, _T1],
+                                   Mapping[_ElWid, Optional[_T]]],
+                       __arg1: Mapping[_ElWid, Optional[_T1]],
+                       ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map_with_elwid(cls,
+                       f: Callable[[_ElWid, _T1],
+                                   Optional[_T]],
+                       __arg1: Mapping[_ElWid, Optional[_T1]],
+                       ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map_with_elwid(cls,
+                       f: Callable[[_ElWid, _T1],
+                                   SimdMap[_T]],
+                       __arg1: Optional[_T1],
+                       ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map_with_elwid(cls,
+                       f: Callable[[_ElWid, _T1],
+                                   Mapping[_ElWid, Optional[_T]]],
+                       __arg1: Optional[_T1],
+                       ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map_with_elwid(cls,
+                       f: Callable[[_ElWid, _T1],
+                                   Optional[_T]],
+                       __arg1: Optional[_T1],
+                       ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map_with_elwid(cls,
+                       f: Callable[[_ElWid, _T1, _T2],
+                                   SimdMap[_T]],
+                       __arg1: SimdMap[_T1],
+                       __arg2: SimdMap[_T2],
+                       ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map_with_elwid(cls,
+                       f: Callable[[_ElWid, _T1, _T2],
+                                   Mapping[_ElWid, Optional[_T]]],
+                       __arg1: SimdMap[_T1],
+                       __arg2: SimdMap[_T2],
+                       ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map_with_elwid(cls,
+                       f: Callable[[_ElWid, _T1, _T2],
+                                   Optional[_T]],
+                       __arg1: SimdMap[_T1],
+                       __arg2: SimdMap[_T2],
+                       ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map_with_elwid(cls,
+                       f: Callable[[_ElWid, _T1, _T2],
+                                   SimdMap[_T]],
+                       __arg1: Mapping[_ElWid, Optional[_T1]],
+                       __arg2: SimdMap[_T2],
+                       ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map_with_elwid(cls,
+                       f: Callable[[_ElWid, _T1, _T2],
+                                   Mapping[_ElWid, Optional[_T]]],
+                       __arg1: Mapping[_ElWid, Optional[_T1]],
+                       __arg2: SimdMap[_T2],
+                       ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map_with_elwid(cls,
+                       f: Callable[[_ElWid, _T1, _T2],
+                                   Optional[_T]],
+                       __arg1: Mapping[_ElWid, Optional[_T1]],
+                       __arg2: SimdMap[_T2],
+                       ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map_with_elwid(cls,
+                       f: Callable[[_ElWid, _T1, _T2],
+                                   SimdMap[_T]],
+                       __arg1: Optional[_T1],
+                       __arg2: SimdMap[_T2],
+                       ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map_with_elwid(cls,
+                       f: Callable[[_ElWid, _T1, _T2],
+                                   Mapping[_ElWid, Optional[_T]]],
+                       __arg1: Optional[_T1],
+                       __arg2: SimdMap[_T2],
+                       ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map_with_elwid(cls,
+                       f: Callable[[_ElWid, _T1, _T2],
+                                   Optional[_T]],
+                       __arg1: Optional[_T1],
+                       __arg2: SimdMap[_T2],
+                       ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map_with_elwid(cls,
+                       f: Callable[[_ElWid, _T1, _T2],
+                                   SimdMap[_T]],
+                       __arg1: SimdMap[_T1],
+                       __arg2: Mapping[_ElWid, Optional[_T2]],
+                       ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map_with_elwid(cls,
+                       f: Callable[[_ElWid, _T1, _T2],
+                                   Mapping[_ElWid, Optional[_T]]],
+                       __arg1: SimdMap[_T1],
+                       __arg2: Mapping[_ElWid, Optional[_T2]],
+                       ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map_with_elwid(cls,
+                       f: Callable[[_ElWid, _T1, _T2],
+                                   Optional[_T]],
+                       __arg1: SimdMap[_T1],
+                       __arg2: Mapping[_ElWid, Optional[_T2]],
+                       ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map_with_elwid(cls,
+                       f: Callable[[_ElWid, _T1, _T2],
+                                   SimdMap[_T]],
+                       __arg1: Mapping[_ElWid, Optional[_T1]],
+                       __arg2: Mapping[_ElWid, Optional[_T2]],
+                       ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map_with_elwid(cls,
+                       f: Callable[[_ElWid, _T1, _T2],
+                                   Mapping[_ElWid, Optional[_T]]],
+                       __arg1: Mapping[_ElWid, Optional[_T1]],
+                       __arg2: Mapping[_ElWid, Optional[_T2]],
+                       ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map_with_elwid(cls,
+                       f: Callable[[_ElWid, _T1, _T2],
+                                   Optional[_T]],
+                       __arg1: Mapping[_ElWid, Optional[_T1]],
+                       __arg2: Mapping[_ElWid, Optional[_T2]],
+                       ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map_with_elwid(cls,
+                       f: Callable[[_ElWid, _T1, _T2],
+                                   SimdMap[_T]],
+                       __arg1: Optional[_T1],
+                       __arg2: Mapping[_ElWid, Optional[_T2]],
+                       ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map_with_elwid(cls,
+                       f: Callable[[_ElWid, _T1, _T2],
+                                   Mapping[_ElWid, Optional[_T]]],
+                       __arg1: Optional[_T1],
+                       __arg2: Mapping[_ElWid, Optional[_T2]],
+                       ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map_with_elwid(cls,
+                       f: Callable[[_ElWid, _T1, _T2],
+                                   Optional[_T]],
+                       __arg1: Optional[_T1],
+                       __arg2: Mapping[_ElWid, Optional[_T2]],
+                       ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map_with_elwid(cls,
+                       f: Callable[[_ElWid, _T1, _T2],
+                                   SimdMap[_T]],
+                       __arg1: SimdMap[_T1],
+                       __arg2: Optional[_T2],
+                       ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map_with_elwid(cls,
+                       f: Callable[[_ElWid, _T1, _T2],
+                                   Mapping[_ElWid, Optional[_T]]],
+                       __arg1: SimdMap[_T1],
+                       __arg2: Optional[_T2],
+                       ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map_with_elwid(cls,
+                       f: Callable[[_ElWid, _T1, _T2],
+                                   Optional[_T]],
+                       __arg1: SimdMap[_T1],
+                       __arg2: Optional[_T2],
+                       ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map_with_elwid(cls,
+                       f: Callable[[_ElWid, _T1, _T2],
+                                   SimdMap[_T]],
+                       __arg1: Mapping[_ElWid, Optional[_T1]],
+                       __arg2: Optional[_T2],
+                       ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map_with_elwid(cls,
+                       f: Callable[[_ElWid, _T1, _T2],
+                                   Mapping[_ElWid, Optional[_T]]],
+                       __arg1: Mapping[_ElWid, Optional[_T1]],
+                       __arg2: Optional[_T2],
+                       ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map_with_elwid(cls,
+                       f: Callable[[_ElWid, _T1, _T2],
+                                   Optional[_T]],
+                       __arg1: Mapping[_ElWid, Optional[_T1]],
+                       __arg2: Optional[_T2],
+                       ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map_with_elwid(cls,
+                       f: Callable[[_ElWid, _T1, _T2],
+                                   SimdMap[_T]],
+                       __arg1: Optional[_T1],
+                       __arg2: Optional[_T2],
+                       ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map_with_elwid(cls,
+                       f: Callable[[_ElWid, _T1, _T2],
+                                   Mapping[_ElWid, Optional[_T]]],
+                       __arg1: Optional[_T1],
+                       __arg2: Optional[_T2],
+                       ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map_with_elwid(cls,
+                       f: Callable[[_ElWid, _T1, _T2],
+                                   Optional[_T]],
+                       __arg1: Optional[_T1],
+                       __arg2: Optional[_T2],
+                       ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map_with_elwid(cls,
+                       f: Callable[..., SimdMap[_T]],
+                       *args: Any) -> SimdMap[_T]:
+        ...
+
+    @overload
+    @classmethod
+    def map_with_elwid(cls,
+                       f: Callable[..., Mapping[_ElWid, Optional[_T]]],
+                       *args: Any) -> SimdMap[_T]:
+        ...
+
+    @overload
+    @classmethod
+    def map_with_elwid(cls,
+                       f: Callable[..., Optional[_T]],
+                       *args: Any) -> SimdMap[_T]:
+        ...
+
+    @overload
+    @classmethod
+    def map(cls,
+            f: Callable[[],
+                        SimdMap[_T]],
+            ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map(cls,
+            f: Callable[[],
+                        Mapping[_ElWid, Optional[_T]]],
+            ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map(cls,
+            f: Callable[[],
+                        Optional[_T]],
+            ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map(cls,
+            f: Callable[[_T1],
+                        SimdMap[_T]],
+            __arg1: SimdMap[_T1],
+            ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map(cls,
+            f: Callable[[_T1],
+                        Mapping[_ElWid, Optional[_T]]],
+            __arg1: SimdMap[_T1],
+            ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map(cls,
+            f: Callable[[_T1],
+                        Optional[_T]],
+            __arg1: SimdMap[_T1],
+            ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map(cls,
+            f: Callable[[_T1],
+                        SimdMap[_T]],
+            __arg1: Mapping[_ElWid, Optional[_T1]],
+            ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map(cls,
+            f: Callable[[_T1],
+                        Mapping[_ElWid, Optional[_T]]],
+            __arg1: Mapping[_ElWid, Optional[_T1]],
+            ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map(cls,
+            f: Callable[[_T1],
+                        Optional[_T]],
+            __arg1: Mapping[_ElWid, Optional[_T1]],
+            ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map(cls,
+            f: Callable[[_T1],
+                        SimdMap[_T]],
+            __arg1: Optional[_T1],
+            ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map(cls,
+            f: Callable[[_T1],
+                        Mapping[_ElWid, Optional[_T]]],
+            __arg1: Optional[_T1],
+            ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map(cls,
+            f: Callable[[_T1],
+                        Optional[_T]],
+            __arg1: Optional[_T1],
+            ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map(cls,
+            f: Callable[[_T1, _T2],
+                        SimdMap[_T]],
+            __arg1: SimdMap[_T1],
+            __arg2: SimdMap[_T2],
+            ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map(cls,
+            f: Callable[[_T1, _T2],
+                        Mapping[_ElWid, Optional[_T]]],
+            __arg1: SimdMap[_T1],
+            __arg2: SimdMap[_T2],
+            ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map(cls,
+            f: Callable[[_T1, _T2],
+                        Optional[_T]],
+            __arg1: SimdMap[_T1],
+            __arg2: SimdMap[_T2],
+            ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map(cls,
+            f: Callable[[_T1, _T2],
+                        SimdMap[_T]],
+            __arg1: Mapping[_ElWid, Optional[_T1]],
+            __arg2: SimdMap[_T2],
+            ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map(cls,
+            f: Callable[[_T1, _T2],
+                        Mapping[_ElWid, Optional[_T]]],
+            __arg1: Mapping[_ElWid, Optional[_T1]],
+            __arg2: SimdMap[_T2],
+            ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map(cls,
+            f: Callable[[_T1, _T2],
+                        Optional[_T]],
+            __arg1: Mapping[_ElWid, Optional[_T1]],
+            __arg2: SimdMap[_T2],
+            ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map(cls,
+            f: Callable[[_T1, _T2],
+                        SimdMap[_T]],
+            __arg1: Optional[_T1],
+            __arg2: SimdMap[_T2],
+            ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map(cls,
+            f: Callable[[_T1, _T2],
+                        Mapping[_ElWid, Optional[_T]]],
+            __arg1: Optional[_T1],
+            __arg2: SimdMap[_T2],
+            ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map(cls,
+            f: Callable[[_T1, _T2],
+                        Optional[_T]],
+            __arg1: Optional[_T1],
+            __arg2: SimdMap[_T2],
+            ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map(cls,
+            f: Callable[[_T1, _T2],
+                        SimdMap[_T]],
+            __arg1: SimdMap[_T1],
+            __arg2: Mapping[_ElWid, Optional[_T2]],
+            ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map(cls,
+            f: Callable[[_T1, _T2],
+                        Mapping[_ElWid, Optional[_T]]],
+            __arg1: SimdMap[_T1],
+            __arg2: Mapping[_ElWid, Optional[_T2]],
+            ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map(cls,
+            f: Callable[[_T1, _T2],
+                        Optional[_T]],
+            __arg1: SimdMap[_T1],
+            __arg2: Mapping[_ElWid, Optional[_T2]],
+            ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map(cls,
+            f: Callable[[_T1, _T2],
+                        SimdMap[_T]],
+            __arg1: Mapping[_ElWid, Optional[_T1]],
+            __arg2: Mapping[_ElWid, Optional[_T2]],
+            ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map(cls,
+            f: Callable[[_T1, _T2],
+                        Mapping[_ElWid, Optional[_T]]],
+            __arg1: Mapping[_ElWid, Optional[_T1]],
+            __arg2: Mapping[_ElWid, Optional[_T2]],
+            ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map(cls,
+            f: Callable[[_T1, _T2],
+                        Optional[_T]],
+            __arg1: Mapping[_ElWid, Optional[_T1]],
+            __arg2: Mapping[_ElWid, Optional[_T2]],
+            ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map(cls,
+            f: Callable[[_T1, _T2],
+                        SimdMap[_T]],
+            __arg1: Optional[_T1],
+            __arg2: Mapping[_ElWid, Optional[_T2]],
+            ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map(cls,
+            f: Callable[[_T1, _T2],
+                        Mapping[_ElWid, Optional[_T]]],
+            __arg1: Optional[_T1],
+            __arg2: Mapping[_ElWid, Optional[_T2]],
+            ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map(cls,
+            f: Callable[[_T1, _T2],
+                        Optional[_T]],
+            __arg1: Optional[_T1],
+            __arg2: Mapping[_ElWid, Optional[_T2]],
+            ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map(cls,
+            f: Callable[[_T1, _T2],
+                        SimdMap[_T]],
+            __arg1: SimdMap[_T1],
+            __arg2: Optional[_T2],
+            ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map(cls,
+            f: Callable[[_T1, _T2],
+                        Mapping[_ElWid, Optional[_T]]],
+            __arg1: SimdMap[_T1],
+            __arg2: Optional[_T2],
+            ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map(cls,
+            f: Callable[[_T1, _T2],
+                        Optional[_T]],
+            __arg1: SimdMap[_T1],
+            __arg2: Optional[_T2],
+            ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map(cls,
+            f: Callable[[_T1, _T2],
+                        SimdMap[_T]],
+            __arg1: Mapping[_ElWid, Optional[_T1]],
+            __arg2: Optional[_T2],
+            ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map(cls,
+            f: Callable[[_T1, _T2],
+                        Mapping[_ElWid, Optional[_T]]],
+            __arg1: Mapping[_ElWid, Optional[_T1]],
+            __arg2: Optional[_T2],
+            ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map(cls,
+            f: Callable[[_T1, _T2],
+                        Optional[_T]],
+            __arg1: Mapping[_ElWid, Optional[_T1]],
+            __arg2: Optional[_T2],
+            ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map(cls,
+            f: Callable[[_T1, _T2],
+                        SimdMap[_T]],
+            __arg1: Optional[_T1],
+            __arg2: Optional[_T2],
+            ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map(cls,
+            f: Callable[[_T1, _T2],
+                        Mapping[_ElWid, Optional[_T]]],
+            __arg1: Optional[_T1],
+            __arg2: Optional[_T2],
+            ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map(cls,
+            f: Callable[[_T1, _T2],
+                        Optional[_T]],
+            __arg1: Optional[_T1],
+            __arg2: Optional[_T2],
+            ) -> SimdMap[_T]: ...
+
+    @overload
+    @classmethod
+    def map(cls,
+            f: Callable[..., SimdMap[_T]],
+            *args: Any) -> SimdMap[_T]:
+        ...
+
+    @overload
+    @classmethod
+    def map(cls,
+            f: Callable[..., Mapping[_ElWid, Optional[_T]]],
+            *args: Any) -> SimdMap[_T]:
+        ...
+
+    @overload
+    @classmethod
+    def map(cls,
+            f: Callable[..., Optional[_T]],
+            *args: Any) -> SimdMap[_T]:
+        ...
+
+    @overload
+    def get(self, elwid: _ElWid, default: Any = None, *,
+            raise_key_error: Literal[True]) -> _T: ...
+
+    @overload
+    def get(self, elwid: _ElWid, default: _T2 = None, *,
+            raise_key_error: bool = False) -> Union[_T, _T2]: ...
+
+    def __iter__(self) -> Iterable[Tuple[_ElWid, _T]]: ...
+
+    @overload
+    def __add__(self, other: SimdMap[_T]) -> SimdMap[_T]: ...
+    @overload
+    def __add__(self, other: Mapping[_ElWid, Optional[_T]]) -> SimdMap[_T]: ...
+    @overload
+    def __add__(self, other: Optional[_T]) -> SimdMap[_T]: ...
+    @overload
+    def __add__(self, other: Any) -> SimdMap[Any]: ...
+
+    @overload
+    def __radd__(self, other: SimdMap[_T]) -> SimdMap[_T]: ...
+
+    @overload
+    def __radd__(self, other: Mapping[_ElWid,
+                                      Optional[_T]]) -> SimdMap[_T]: ...
+
+    @overload
+    def __radd__(self, other: Optional[_T]) -> SimdMap[_T]: ...
+    @overload
+    def __radd__(self, other: Any) -> SimdMap[Any]: ...
+
+    @overload
+    def __sub__(self, other: SimdMap[_T]) -> SimdMap[_T]: ...
+    @overload
+    def __sub__(self, other: Mapping[_ElWid, Optional[_T]]) -> SimdMap[_T]: ...
+    @overload
+    def __sub__(self, other: Optional[_T]) -> SimdMap[_T]: ...
+    @overload
+    def __sub__(self, other: Any) -> SimdMap[Any]: ...
+
+    @overload
+    def __rsub__(self, other: SimdMap[_T]) -> SimdMap[_T]: ...
+
+    @overload
+    def __rsub__(self, other: Mapping[_ElWid,
+                                      Optional[_T]]) -> SimdMap[_T]: ...
+
+    @overload
+    def __rsub__(self, other: Optional[_T]) -> SimdMap[_T]: ...
+    @overload
+    def __rsub__(self, other: Any) -> SimdMap[Any]: ...
+
+    @overload
+    def __mul__(self, other: SimdMap[_T]) -> SimdMap[_T]: ...
+    @overload
+    def __mul__(self, other: Mapping[_ElWid, Optional[_T]]) -> SimdMap[_T]: ...
+    @overload
+    def __mul__(self, other: Optional[_T]) -> SimdMap[_T]: ...
+    @overload
+    def __mul__(self, other: Any) -> SimdMap[Any]: ...
+
+    @overload
+    def __rmul__(self, other: SimdMap[_T]) -> SimdMap[_T]: ...
+
+    @overload
+    def __rmul__(self, other: Mapping[_ElWid,
+                                      Optional[_T]]) -> SimdMap[_T]: ...
+
+    @overload
+    def __rmul__(self, other: Optional[_T]) -> SimdMap[_T]: ...
+    @overload
+    def __rmul__(self, other: Any) -> SimdMap[Any]: ...
+
+    @overload
+    def __floordiv__(
+        self, other: SimdMap[_T]) -> SimdMap[_T]: ...
+
+    @overload
+    def __floordiv__(
+        self, other: Mapping[_ElWid, Optional[_T]]) -> SimdMap[_T]: ...
+
+    @overload
+    def __floordiv__(
+        self, other: Optional[_T]) -> SimdMap[_T]: ...
+
+    @overload
+    def __floordiv__(self, other: Any) -> SimdMap[Any]: ...
+
+    @overload
+    def __rfloordiv__(
+        self, other: SimdMap[_T]) -> SimdMap[_T]: ...
+
+    @overload
+    def __rfloordiv__(
+        self, other: Mapping[_ElWid, Optional[_T]]) -> SimdMap[_T]: ...
+
+    @overload
+    def __rfloordiv__(
+        self, other: Optional[_T]) -> SimdMap[_T]: ...
+
+    @overload
+    def __rfloordiv__(self, other: Any) -> SimdMap[Any]: ...
+
+    @overload
+    def __truediv__(
+        self, other: SimdMap[_T]) -> SimdMap[_T]: ...
+
+    @overload
+    def __truediv__(
+        self, other: Mapping[_ElWid, Optional[_T]]) -> SimdMap[_T]: ...
+
+    @overload
+    def __truediv__(
+        self, other: Optional[_T]) -> SimdMap[_T]: ...
+
+    @overload
+    def __truediv__(self, other: Any) -> SimdMap[Any]: ...
+
+    @overload
+    def __rtruediv__(
+        self, other: SimdMap[_T]) -> SimdMap[_T]: ...
+
+    @overload
+    def __rtruediv__(
+        self, other: Mapping[_ElWid, Optional[_T]]) -> SimdMap[_T]: ...
+
+    @overload
+    def __rtruediv__(
+        self, other: Optional[_T]) -> SimdMap[_T]: ...
+
+    @overload
+    def __rtruediv__(self, other: Any) -> SimdMap[Any]: ...
+
+    @overload
+    def __mod__(self, other: SimdMap[_T]) -> SimdMap[_T]: ...
+    @overload
+    def __mod__(self, other: Mapping[_ElWid, Optional[_T]]) -> SimdMap[_T]: ...
+    @overload
+    def __mod__(self, other: Optional[_T]) -> SimdMap[_T]: ...
+    @overload
+    def __mod__(self, other: Any) -> SimdMap[Any]: ...
+
+    @overload
+    def __rmod__(self, other: SimdMap[_T]) -> SimdMap[_T]: ...
+
+    @overload
+    def __rmod__(self, other: Mapping[_ElWid,
+                                      Optional[_T]]) -> SimdMap[_T]: ...
+
+    @overload
+    def __rmod__(self, other: Optional[_T]) -> SimdMap[_T]: ...
+    @overload
+    def __rmod__(self, other: Any) -> SimdMap[Any]: ...
+
+    def __abs__(self) -> SimdMap[_T]: ...
+
+    @overload
+    def __and__(self, other: SimdMap[_T]) -> SimdMap[_T]: ...
+    @overload
+    def __and__(self, other: Mapping[_ElWid, Optional[_T]]) -> SimdMap[_T]: ...
+    @overload
+    def __and__(self, other: Optional[_T]) -> SimdMap[_T]: ...
+    @overload
+    def __and__(self, other: Any) -> SimdMap[Any]: ...
+
+    @overload
+    def __rand__(self, other: SimdMap[_T]) -> SimdMap[_T]: ...
+
+    @overload
+    def __rand__(self, other: Mapping[_ElWid,
+                                      Optional[_T]]) -> SimdMap[_T]: ...
+
+    @overload
+    def __rand__(self, other: Optional[_T]) -> SimdMap[_T]: ...
+    @overload
+    def __rand__(self, other: Any) -> SimdMap[Any]: ...
+
+    @overload
+    def __divmod__(
+        self, other: SimdMap[_T]) -> SimdMap[_T]: ...
+
+    @overload
+    def __divmod__(
+        self, other: Mapping[_ElWid, Optional[_T]]) -> SimdMap[_T]: ...
+
+    @overload
+    def __divmod__(
+        self, other: Optional[_T]) -> SimdMap[_T]: ...
+
+    @overload
+    def __divmod__(self, other: Any) -> SimdMap[Any]: ...
+
+    def __ceil__(self) -> SimdMap[int]: ...
+
+    def __float__(self) -> SimdMap[float]: ...
+
+    def __floor__(self) -> SimdMap[int]: ...
+
+    def __eq__(self, other: Any) -> bool: ...
+
+    def __hash__(self) -> int: ...
+
+    def __repr__(self) -> str: ...
+
+    def __invert__(self) -> SimdMap[_T]: ...
+
+    @overload
+    def __lshift__(
+        self, other: SimdMap[_T]) -> SimdMap[_T]: ...
+
+    @overload
+    def __lshift__(
+        self, other: Mapping[_ElWid, Optional[_T]]) -> SimdMap[_T]: ...
+
+    @overload
+    def __lshift__(
+        self, other: Optional[_T]) -> SimdMap[_T]: ...
+
+    @overload
+    def __lshift__(self, other: Any) -> SimdMap[Any]: ...
+
+    @overload
+    def __rlshift__(
+        self, other: SimdMap[_T]) -> SimdMap[_T]: ...
+
+    @overload
+    def __rlshift__(
+        self, other: Mapping[_ElWid, Optional[_T]]) -> SimdMap[_T]: ...
+
+    @overload
+    def __rlshift__(
+        self, other: Optional[_T]) -> SimdMap[_T]: ...
+
+    @overload
+    def __rlshift__(self, other: Any) -> SimdMap[Any]: ...
+
+    @overload
+    def __rshift__(
+        self, other: SimdMap[_T]) -> SimdMap[_T]: ...
+
+    @overload
+    def __rshift__(
+        self, other: Mapping[_ElWid, Optional[_T]]) -> SimdMap[_T]: ...
+
+    @overload
+    def __rshift__(
+        self, other: Optional[_T]) -> SimdMap[_T]: ...
+
+    @overload
+    def __rshift__(self, other: Any) -> SimdMap[Any]: ...
+
+    @overload
+    def __rrshift__(
+        self, other: SimdMap[_T]) -> SimdMap[_T]: ...
+
+    @overload
+    def __rrshift__(
+        self, other: Mapping[_ElWid, Optional[_T]]) -> SimdMap[_T]: ...
+
+    @overload
+    def __rrshift__(
+        self, other: Optional[_T]) -> SimdMap[_T]: ...
+
+    @overload
+    def __rrshift__(self, other: Any) -> SimdMap[Any]: ...
+
+    def __neg__(self) -> SimdMap[_T]: ...
+
+    def __pos__(self) -> SimdMap[_T]: ...
+
+    @overload
+    def __or__(self, other: SimdMap[_T]) -> SimdMap[_T]: ...
+    @overload
+    def __or__(self, other: Mapping[_ElWid, Optional[_T]]) -> SimdMap[_T]: ...
+    @overload
+    def __or__(self, other: Optional[_T]) -> SimdMap[_T]: ...
+    @overload
+    def __or__(self, other: Any) -> SimdMap[Any]: ...
+
+    @overload
+    def __ror__(self, other: SimdMap[_T]) -> SimdMap[_T]: ...
+    @overload
+    def __ror__(self, other: Mapping[_ElWid, Optional[_T]]) -> SimdMap[_T]: ...
+    @overload
+    def __ror__(self, other: Optional[_T]) -> SimdMap[_T]: ...
+    @overload
+    def __ror__(self, other: Any) -> SimdMap[Any]: ...
+
+    @overload
+    def __xor__(self, other: SimdMap[_T]) -> SimdMap[_T]: ...
+    @overload
+    def __xor__(self, other: Mapping[_ElWid, Optional[_T]]) -> SimdMap[_T]: ...
+    @overload
+    def __xor__(self, other: Optional[_T]) -> SimdMap[_T]: ...
+    @overload
+    def __xor__(self, other: Any) -> SimdMap[Any]: ...
+
+    @overload
+    def __rxor__(self, other: SimdMap[_T]) -> SimdMap[_T]: ...
+
+    @overload
+    def __rxor__(self, other: Mapping[_ElWid,
+                                      Optional[_T]]) -> SimdMap[_T]: ...
+
+    @overload
+    def __rxor__(self, other: Optional[_T]) -> SimdMap[_T]: ...
+    @overload
+    def __rxor__(self, other: Any) -> SimdMap[Any]: ...
+
+    def missing_elwidths(self, *,
+                         all_elwidths: Optional[Iterable[_ElWid]] = None,
+                         ) -> Iterable[_ElWid]: ...
+
+
+XLEN: SimdMap[int] = ...
+
+DEFAULT_FP_VEC_EL_COUNTS: SimdMap[int] = ...
+
+DEFAULT_INT_VEC_EL_COUNTS: SimdMap[int] = ...