# Buggy code
def __init__(
    self,
    loop: asyncio.AbstractEventLoop,
    config: "Config",
    blob_manager: "BlobManager",
    wallet_manager: "WalletManager",
    storage: "SQLiteStorage",
    node: Optional["Node"],
    analytics_manager: Optional["AnalyticsManager"] = None,
):
    self.loop = loop
    self.config = config
    self.blob_manager = blob_manager
    self.wallet_manager = wallet_manager
    self.storage = storage
    self.node = node
    self.analytics_manager = analytics_manager
    self.streams: typing.Dict[str, ManagedStream] = {}
    self.resume_saving_task: Optional[asyncio.Task] = None
    self.re_reflect_task: Optional[asyncio.Task] = None
    self.update_stream_finished_futs: typing.List[asyncio.Future] = []
    self.running_reflector_uploads: typing.List[asyncio.Task] = []
    self.started = asyncio.Event(loop=self.loop)


# Traceback (AttributeError)
2019-08-01 18:18:06,916 INFO     lbry.stream.reflector.client:119: Sent reflector blob e5828b7e
2019-08-01 18:18:29,221 INFO     lbry.stream.reflector.client:119: Sent reflector blob 867d1a2c
2019-08-01 18:18:51,545 INFO     lbry.stream.reflector.client:119: Sent reflector blob 6e365367
2019-08-01 18:18:58,400 INFO     lbry.extras.daemon.Daemon:2330: publishing: name: xxxx params: {'title': 'xxxx', 'description': 'xxxxxx', 'bid': '0.10000000', 'languages': ['en'], 'tags': ['xxxxx'], 'thumbnail_url': 'https://spee.ch/8/xxxxxxxxx', 'license': 'All rights reserved   Published With Permission', 'release_time': 1564696220, 'channel_id': 'xxxxxxxxxxxx', 'fee_currency': 'LBC', 'fee_amount': '1.00000000', 'file_path': 'C:\\Users\\David T\\Desktop\\GMCZ0549_VID_1280x720x1500kbs_HCVC549.mp4'}
2019-08-01 18:19:22,348 ERROR    lbry.extras.daemon.Daemon:586: error handling api request
Traceback (most recent call last):
File "lbry\extras\daemon\Daemon.py", line 580, in _process_rpc_call
File "lbry\extras\daemon\Daemon.py", line 2342, in jsonrpc_publish
File "lbry\extras\daemon\Daemon.py", line 2659, in jsonrpc_stream_update
File "lbry\stream\stream_manager.py", line 232, in delete_stream
AttributeError: 'NoneType' object has no attribute 'stop_tasks'
2019-08-01 18:19:37,886 INFO     lbry.stream.reflector.client:119: Sent reflector blob f5b10e7b
2019-08-01 18:20:00,717 INFO     lbry.stream.reflector.client:119: Sent reflector blob d5ffe375

# Fixed code
def __init__(
    self,
    loop: asyncio.AbstractEventLoop,
    config: "Config",
    blob_manager: "BlobManager",
    wallet_manager: "WalletManager",
    storage: "SQLiteStorage",
    node: Optional["Node"],
    analytics_manager: Optional["AnalyticsManager"] = None,
):
    self.loop = loop
    self.config = config
    self.blob_manager = blob_manager
    self.wallet_manager = wallet_manager
    self.storage = storage
    self.node = node
    self.analytics_manager = analytics_manager
    self.streams: typing.Dict[str, ManagedStream] = {}
    self.resume_saving_task: Optional[asyncio.Task] = None
    self.re_reflect_task: Optional[asyncio.Task] = None
    self.update_stream_finished_futs: typing.List[asyncio.Future] = []
    self.running_reflector_uploads: typing.Dict[str, asyncio.Task] = {}
    self.started = asyncio.Event(loop=self.loop)