Copy default data to avoid undesirable mutations

This commit is contained in:
Alex Stokes
2019-10-24 17:27:15 +09:00
parent d0c8b7d8af
commit 15cabb1c33
2 changed files with 7 additions and 2 deletions

View File

@ -5,3 +5,7 @@ if TYPE_CHECKING:
from libp2p.typing import TProtocol, StreamHandlerFn
DEFAULT_HOST_PROTOCOLS: "OrderedDict[TProtocol, StreamHandlerFn]" = OrderedDict()
def get_default_protocols() -> "OrderedDict[TProtocol, StreamHandlerFn]":
return DEFAULT_HOST_PROTOCOLS.copy()