mirror of
https://github.com/stijndcl/didier.git
synced 2026-04-07 15:48:29 +02:00
Rework schedule a bit to make it more maintainable & easier to code
This commit is contained in:
parent
54d31c943a
commit
1857bdefe9
4 changed files with 161 additions and 94 deletions
|
|
@ -1,7 +1,8 @@
|
|||
from enum import Enum
|
||||
from typing import Optional
|
||||
|
||||
|
||||
class Platforms(Enum):
|
||||
class Platform(Enum):
|
||||
"""
|
||||
An Enum to represent online class platforms
|
||||
Name: The name of the platform
|
||||
|
|
@ -11,3 +12,17 @@ class Platforms(Enum):
|
|||
MSTeams = {"name": "MS Teams", "rep": "msteams"}
|
||||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue