Python:Chapter
Jump to navigation
Jump to search
from dataclasses import dataclass from typing import Optional import dacite @dataclass class Chapter:
""" a chapter of a lecture """ pageTitle:str key:Optional[str] # The key of the presentation for this Chapter no:Optional[str] # The number of the Chapter pres_id:Optional[str] # The numeric id of the presentation for the Chapter week:Optional[str] # The relative week of the Chapter de:Optional[str] # Das Thema des Kapitels in deutsch en:Optional[str] # The topic of the chapter in english
@classmethod def askQuery(cls): """ get the ask Query for Chapter Returns: str: the mediawiki markup for the ask query """
ask="""
pageTitle | key | no | pres_id | week | de | en |
---|---|---|---|---|---|---|
Chapter/1 | Orga | 1 | 0 | 1 | Organisation | Organization |
Chapter/3 | ERM | 3 | 2 | 2 | Entity-Relationship (erste Hälfte) | Entity-Relationship (first half) |
Chapter/4 | ERM | 4 | 2 | 3 | Entity-Relationship (zweite Hälfte) | Entity-Relationship (second half) |
Chapter/8 | SQL | 8 | 4 | 7 | SQL (Änderungsoperationen der Data Manipulation Language) | SQL (Change operations of the Data Manipulation Language) |
Chapter/9 | RelQuery | 9 | 5 | 8 | Anfragebearbeitung | Query processing |
Chapter/10 | RelQuery | 10 | 5 | 9 | DB Algorithmen und Indexstrukturen | DB Algorithms and Index Structures |
Chapter/11 | RelDesign | 11 | 6 | 10 | Funktionale Abhängigkeiten & Armstrong Kalkül | Functional Dependencies & Armstrong Calculus |
Chapter/12 | RelDesign | 12 | 6 | 11 | Zerlegungen und Normalformen | Decompositions and Normal Forms |
Chapter/14 | AltDM | 14 | 7 | 13 | AltDM Teil 2 | AltDM Part 2 |
Chapter/16 | TM | 16 | 8 | 15 | Transaktionsverwaltung (Teil 1) | Transaction Management (Part 1) |
Chapter/17 | TM | 17 | 8 | 16 | Transaktionsverwaltung (Teil 2) | Transaction Management (Part 2) |
"""
return ask @classmethod def fromDict(cls,data:dict): """ create a Chapter from the given dict Args: data(dict): the dict to create the Chapter from Returns: Chapter: the freshly created Chapter """ chapter=dacite.from_dict(data_class=cls,data=data) return chapter