You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2020/05/14 16:01:51 UTC

[GitHub] [incubator-superset] etr2460 commented on a change in pull request #9800: style: enforcing mypy typing for translations

etr2460 commented on a change in pull request #9800:
URL: https://github.com/apache/incubator-superset/pull/9800#discussion_r425251345



##########
File path: superset/translations/utils.py
##########
@@ -38,7 +38,7 @@ def get_language_pack(locale):
         try:
             with open(filename, encoding="utf8") as f:
                 pack = json.load(f)
-                ALL_LANGUAGE_PACKS[locale] = pack
+                ALL_LANGUAGE_PACKS[locale] = pack or {}
         except Exception:  # pylint: disable=broad-except
             # Assuming english, client side falls back on english

Review comment:
       Perhaps we should put:
   ```python
   pack = {}
   ```
   in this block, and move
   ```python
   ALL_LANGUAGE_PACKS[locale] = pack
   ```
   outside of the try/except.
   
   Then we could remove the `Optional` from the `get_language_pack` return type




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org