Skip to content

Commit eb5c29d

Browse files
committed
Fix typing protocol for py 3.7
1 parent db418fe commit eb5c29d

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

asyncua/pubsub/protocols.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,15 @@
44
from asyncua.ua.uatypes import Byte, ExtensionObject, String, UInt16, UInt32, UInt64
55
from asyncua import ua
66
from .uadp import UadpNetworkMessage
7-
from typing import List, Optional, Protocol, Union
7+
from typing import List, Optional, Union
88
from .dataset import DataSetMeta, DataSetValue, PublishedDataSet
9-
9+
try:
10+
from typing import Protocol
11+
except ImportError:
12+
# Protocol is only supported in Python >= 3.8
13+
# if mypy support is needed we should add typing extension as requirement
14+
class Protocol:
15+
pass
1016

1117
class PubSubSender(Protocol):
1218
"""

asyncua/pubsub/uadp.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,16 @@
3535
from asyncua.ua.status_codes import StatusCodes
3636
from asyncua.ua import VariantType
3737
from enum import IntEnum, IntFlag
38-
from typing import Optional, Protocol, Tuple, Union, List
38+
from typing import Optional, Tuple, Union, List
3939
from dataclasses import dataclass, field
40+
try:
41+
from typing import Protocol
42+
except ImportError:
43+
# Protocol is only supported in Python >= 3.8
44+
# if mypy support is needed we should add typing_extension as requirement
45+
class Protocol:
46+
pass
47+
4048

4149
logger = logging.getLogger(__name__)
4250

0 commit comments

Comments
 (0)