Skip to content

Commit

Permalink
Also export Annotated
Browse files Browse the repository at this point in the history
  • Loading branch information
wesselb committed Jan 21, 2024
1 parent 727e968 commit 4b4e964
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
5 changes: 4 additions & 1 deletion plum/typing.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sys

__all__ = ["get_type_hints", "get_origin", "get_args"]
__all__ = ["get_type_hints", "get_origin", "get_args", "Annotated"]

# Before Python 3.9, e.g. `get_type_hints` does not include the keyword argument
# `include_extras`, so we take `get_type_hints` from `typing_extensions` instead,
Expand All @@ -12,10 +12,13 @@
get_type_hints = typing_extensions.get_type_hints
get_origin = typing_extensions.get_origin
get_args = typing_extensions.get_args
Annotated = typing_extensions.Annotated


else: # pragma: specific no cover 3.8
import typing

get_type_hints = typing.get_type_hints
get_origin = typing.get_origin
get_args = typing.get_args
Annotated = typing.Annotated
8 changes: 1 addition & 7 deletions tests/advanced/test_annotated.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
import sys

if sys.version_info < (3, 9):
from typing_extensions import Annotated
else:
from typing import Annotated

import pytest
from beartype.vale import Is

from plum import Dispatcher, NotFoundLookupError
from plum.typing import Annotated


def test_simple_annotated():
Expand Down

0 comments on commit 4b4e964

Please sign in to comment.