diff --git a/docs/examples.ipynb b/docs/examples.ipynb index c852be0..28c9266 100644 --- a/docs/examples.ipynb +++ b/docs/examples.ipynb @@ -5,7 +5,7 @@ "metadata": {}, "source": [ "# Examples\n", - "## mutlimethod\n", + "## multimethod\n", "Multimethods are a mapping of signatures (tuple of types) to functions. They maintain an efficient dispatch tree, and cache the called signatures." ] }, @@ -68,18 +68,18 @@ "\n", "\n", "@multimethod\n", - "def chunks(values: Iterable, size):\n", + "def batched(values: Iterable, size):\n", " it = iter(values)\n", " return iter(lambda: list(itertools.islice(it, size)), [])\n", "\n", "\n", "@multimethod\n", - "def chunks(values: Sequence, size):\n", + "def batched(values: Sequence, size):\n", " for index in range(0, len(values), size):\n", " yield values[index : index + size]\n", "\n", "\n", - "list(chunks(iter('abcde'), 3))" + "list(batched(iter('abcde'), 3))" ] }, { @@ -88,7 +88,7 @@ "metadata": {}, "outputs": [], "source": [ - "list(chunks('abcde', 3))" + "list(batched('abcde', 3))" ] }, { @@ -241,7 +241,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.1" + "version": "3.12.3" } }, "nbformat": 4, diff --git a/multimethod/__init__.py b/multimethod/__init__.py index e116f6a..3092425 100644 --- a/multimethod/__init__.py +++ b/multimethod/__init__.py @@ -400,7 +400,7 @@ class multidispatch(multimethod, dict[tuple[type, ...], Callable[..., RETURN]]): signature: Optional[inspect.Signature] def __new__(cls, func: Callable[..., RETURN]) -> "multidispatch[RETURN]": - return functools.update_wrapper(dict.__new__(cls), func) + return functools.update_wrapper(dict.__new__(cls), func) # type: ignore def __init__(self, func: Callable[..., RETURN]) -> None: self.pending = set()