mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2025-12-31 20:36:24 +00:00
Avoid sharing default dictionary argument across all instances of class
This commit is contained in:
@ -19,7 +19,11 @@ class Multiselect(IMultiselectMuxer):
|
|||||||
|
|
||||||
handlers: Dict[TProtocol, StreamHandlerFn]
|
handlers: Dict[TProtocol, StreamHandlerFn]
|
||||||
|
|
||||||
def __init__(self, default_handlers: Dict[TProtocol, StreamHandlerFn] = {}) -> None:
|
def __init__(
|
||||||
|
self, default_handlers: Dict[TProtocol, StreamHandlerFn] = None
|
||||||
|
) -> None:
|
||||||
|
if not default_handlers:
|
||||||
|
default_handlers = {}
|
||||||
self.handlers = default_handlers
|
self.handlers = default_handlers
|
||||||
|
|
||||||
def add_handler(self, protocol: TProtocol, handler: StreamHandlerFn) -> None:
|
def add_handler(self, protocol: TProtocol, handler: StreamHandlerFn) -> None:
|
||||||
|
|||||||
Reference in New Issue
Block a user