Skip to content

Commit

Permalink
Fix Protocol imports on >=3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
FasterSpeeding committed Jan 3, 2023
1 parent 309adab commit c77c27a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/slotscheck/cli.py
Expand Up @@ -19,7 +19,6 @@
)

import click
from typing_extensions import Protocol

from . import config
from .checks import (
Expand Down Expand Up @@ -52,6 +51,11 @@
walk_classes,
)

try:
from typing import Protocol
except ImportError: # pragma: no cover
from typing_extensions import Protocol


@click.command("slotscheck")
@click.argument(
Expand Down
6 changes: 5 additions & 1 deletion tests/examples/module_not_ok/foo.py
@@ -1,4 +1,8 @@
from typing_extensions import Protocol

try:
from typing import Protocol
except ImportError:
from typing_extensions import Protocol


class A:
Expand Down

0 comments on commit c77c27a

Please sign in to comment.