Merge pull request #357 from NIC619/minor_fix_replace_del

Replace (check and) del pattern with pop method
This commit is contained in:
NIC Lin
2019-11-26 19:39:41 +08:00
committed by GitHub
8 changed files with 12 additions and 24 deletions

View File

@ -50,8 +50,7 @@ class SecurityMultistream(ABC):
:param transport: the corresponding transportation to the ``protocol``.
"""
# If protocol is already added before, remove it and add it again.
if protocol in self.transports:
del self.transports[protocol]
self.transports.pop(protocol, None)
self.transports[protocol] = transport
# Note: None is added as the handler for the given protocol since
# we only care about selecting the protocol, not any handler function