Skip to content

Commit

Permalink
Fix typing protocol for py 3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
schroeder- committed Mar 20, 2022
1 parent f8121dc commit d90117b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
10 changes: 8 additions & 2 deletions asyncua/pubsub/protocols.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@
from asyncua.ua.uatypes import Byte, ExtensionObject, String, UInt16, UInt32, UInt64
from asyncua import ua
from .uadp import UadpNetworkMessage
from typing import List, Optional, Protocol, Union
from typing import List, Optional, Union
from .dataset import DataSetMeta, DataSetValue, PublishedDataSet

try:
from typing import Protocol
except ImportError:
# Protocol is only supported in Python >= 3.8
# if mypy support is needed we should add typing extension as requirement
class Protocol:
pass

class PubSubSender(Protocol):
"""
Expand Down
10 changes: 9 additions & 1 deletion asyncua/pubsub/uadp.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,16 @@
from asyncua.ua.status_codes import StatusCodes
from asyncua.ua import VariantType
from enum import IntEnum, IntFlag
from typing import Optional, Protocol, Tuple, Union, List
from typing import Optional, Tuple, Union, List
from dataclasses import dataclass, field
try:
from typing import Protocol
except ImportError:
# Protocol is only supported in Python >= 3.8
# if mypy support is needed we should add typing_extension as requirement
class Protocol:
pass


logger = logging.getLogger(__name__)

Expand Down

0 comments on commit d90117b

Please sign in to comment.