Browse Source

workaround mypy reporting 'error: Cannot determine type of "dispatcher" [has-type]'

Fabian Peter Hammerle 1 year ago
parent
commit
83b0322e55
1 changed files with 4 additions and 1 deletions
  1. 4 1
      location_guessing_game_telegram_bot/__init__.py

+ 4 - 1
location_guessing_game_telegram_bot/__init__.py

@@ -167,7 +167,10 @@ def _run(
         use_context=True,
         persistence=_Persistence(photos=photos),
     )
-    updater.dispatcher.add_handler(telegram.ext.CommandHandler("photo", _photo_command))
+    # workaround for mypy reporting
+    # > error: Cannot determine type of "dispatcher"  [has-type]
+    dispatcher: telegram.ext.dispatcher.Dispatcher = updater.dispatcher  # type: ignore
+    dispatcher.add_handler(telegram.ext.CommandHandler("photo", _photo_command))
     updater.start_polling()