Skip to content

Commit

Permalink
fix: typing added
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeWithEmad authored and regisb committed Nov 21, 2023
1 parent f594252 commit 139f241
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
1 change: 0 additions & 1 deletion tutorandroid/__about__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
__version__ = "16.0.0"

17 changes: 11 additions & 6 deletions tutorandroid/plugin.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
from __future__ import annotations

from glob import glob
import os
import typing as t
from glob import glob

import pkg_resources

from tutor import hooks as tutor_hooks
from tutor.__about__ import __version_suffix__
from tutor.types import Config, get_typed

from .__about__ import __version__

# Handle version suffix in nightly mode, just like tutor core
if __version_suffix__:
__version__ += "-" + __version_suffix__

config = {
"unique": {"OAUTH2_SECRET": "{{ 24|random_string }}"},

config: t.Dict[str, t.Dict[str, t.Any]] = {
"defaults": {
"VERSION": __version__,
"APP_HOST": "mobile.{{ LMS_HOST }}",
Expand All @@ -30,6 +30,9 @@
"RELEASE_KEY_PASSWORD": "android release key password",
"RELEASE_KEY_ALIAS": "android release key alias",
},
"unique": {
"OAUTH2_SECRET": "{{ 24|random_string }}",
},
}

with open(
Expand Down Expand Up @@ -68,7 +71,9 @@

@tutor_hooks.Filters.IMAGES_PULL.add()
@tutor_hooks.Filters.IMAGES_PUSH.add()
def _add_remote_android_app_image_iff_customized(images, user_config):
def _add_remote_android_app_image_iff_customized(
images: list[tuple[str, str]], user_config: Config
) -> list[tuple[str, str]]:
"""
Register ANDROID-APP image for pushing & pulling if and only if it has
been set to something other than the default.
Expand All @@ -80,7 +85,7 @@ def _add_remote_android_app_image_iff_customized(images, user_config):
to push/pull the ANDROID-APP image if the user has customized it to anything
other than the default image URL.
"""
image_tag = user_config["ANDROID_APP_DOCKER_IMAGE"]
image_tag = get_typed(user_config, "ANDROID_APP_DOCKER_IMAGE", str, "")
if not image_tag.startswith("docker.io/overhangio/openedx-android-app:"):
# Image has been customized. Add to list for pulling/pushing.
images.append(("android-app", image_tag))
Expand Down

0 comments on commit 139f241

Please sign in to comment.