didier/enums/platform.py

31 lines
838 B
Python
Raw Normal View History

from enum import Enum
from typing import Optional
class Platform(Enum):
"""
An Enum to represent online class platforms
Name: The name of the platform
Rep: A shorter, lowercased & space-less version
"""
2021-08-08 18:12:16 +02:00
BongoVC = {"name": "Bongo Virtual Classroom", "rep": "bongo"}
GatherTown = {"name": "Gather Town", "rep": "gather"}
MSTeams = {"name": "MS Teams", "rep": "msteams"}
2021-08-08 18:12:16 +02:00
OpenCast = {"name": "OpenCast", "rep": "opencast"}
Ufora = {"name": "Ufora", "rep": "ufora"}
Zoom = {"name": "Zoom", "rep": "zoom"}
def get_platform(rep: Optional[str]) -> Optional[Platform]:
"""
Find the platform that corresponds to the given name
"""
if rep is None:
return None
for platform in Platform:
if platform.value["rep"] == rep:
return platform
return None