Skip to content
Snippets Groups Projects
Unverified Commit 0c78a36b authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Add type hints. Advances BiscuIT-ng#20.

parent 50638fe2
No related branches found
No related tags found
No related merge requests found
from datetime import date, time
from xml.dom import minidom
from typing import ByteIO, Optional
from xml.dom import minidom, Node
from django.http import HttpRequest
from django.utils.translation import ugettext_lazy as _
from biscuit.apps.chronos.models import Subject, TimePeriod, Room, Lesson
......@@ -8,7 +10,7 @@ from biscuit.core.models import Group, Person
from biscuit.core.util import messages
def get_child_node_text(node, tag):
def get_child_node_text(node: Node, tag: str) -> Optional[str]:
tag_nodes = node.getElementsByTagName(tag)
if len(tag_nodes) == 1:
......@@ -17,7 +19,7 @@ def get_child_node_text(node, tag):
return None
def get_child_node_id(node, tag):
def get_child_node_id(node: Node, tag: str) -> Optional[str]:
tag_nodes = node.getElementsByTagName(tag)
if len(tag_nodes) == 1:
......@@ -26,7 +28,7 @@ def get_child_node_id(node, tag):
return None
def untis_import_xml(request, untis_xml):
def untis_import_xml(request: HttpRequest, untis_xml: Union{ByteIO, str]) -> None:
dom = minidom.parse(untis_xml)
subjects = dom.getElementsByTagName('subject')
......
from django.contrib.auth.decorators import login_required
from django.http import HttpRequest, HttpResponse
from django.shortcuts import render
from .forms import UntisUploadForm
......@@ -9,7 +10,7 @@ from biscuit.core.decorators import admin_required
@login_required
@admin_required
def untis_import(request):
def untis_import(request: HttpRequest) -> HttpResponse:
context = {}
upload_form = UntisUploadForm()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment