diff --git a/stw_potsdam/xml_types/canteen_xml.py b/stw_potsdam/xml_types/canteen_xml.py index c25ffd2..37926c5 100644 --- a/stw_potsdam/xml_types/canteen_xml.py +++ b/stw_potsdam/xml_types/canteen_xml.py @@ -75,10 +75,10 @@ class CanteenXML: self.days = {} if days is None else days def __create_node(self, doc: minidom.Document, tag: str, value: str): - e = doc.createElement(tag) - tn = doc.createTextNode(value) - e.appendChild(tn) - return e + elem = doc.createElement(tag) + txt_node = doc.createTextNode(value) + elem.appendChild(txt_node) + return elem def __append_meta(self, doc: minidom.Document, canteen: minidom.Element): name = self.__create_node(doc, "name", self.canteen_meta.name) diff --git a/stw_potsdam/xml_types/feed_xml.py b/stw_potsdam/xml_types/feed_xml.py index 9ca03dc..edcb315 100644 --- a/stw_potsdam/xml_types/feed_xml.py +++ b/stw_potsdam/xml_types/feed_xml.py @@ -71,12 +71,12 @@ class FeedXML: feed.appendChild(schedule) url = doc.createElement("url") - tn = doc.createTextNode(self.url) - url.appendChild(tn) + txt_node = doc.createTextNode(self.url) + url.appendChild(txt_node) feed.appendChild(url) source = doc.createElement("source") - tn = doc.createTextNode(self.source) - source.appendChild(tn) + txt_node = doc.createTextNode(self.source) + source.appendChild(txt_node) feed.appendChild(source) return feed diff --git a/stw_potsdam/xml_types/meal_xml.py b/stw_potsdam/xml_types/meal_xml.py index ef2b653..d9629a2 100644 --- a/stw_potsdam/xml_types/meal_xml.py +++ b/stw_potsdam/xml_types/meal_xml.py @@ -26,13 +26,13 @@ class MealXML: """ meal = doc.createElement("meal") name = doc.createElement("name") - tn = doc.createTextNode(self.name) - name.appendChild(tn) + txt_node = doc.createTextNode(self.name) + name.appendChild(txt_node) meal.appendChild(name) if self.note is not None: note = doc.createElement("note") - tn = doc.createTextNode(self.note) - note.appendChild(tn) + txt_node = doc.createTextNode(self.note) + note.appendChild(txt_node) meal.appendChild(note) for key, val in self.price.items(): @@ -40,7 +40,7 @@ class MealXML: continue price = doc.createElement("price") price.setAttribute("role", key) - tn = doc.createTextNode(f"{val:.2f}") - price.appendChild(tn) + txt_node = doc.createTextNode(f"{val:.2f}") + price.appendChild(txt_node) meal.appendChild(price) return meal diff --git a/stw_potsdam/xml_types/openmensa_xml.py b/stw_potsdam/xml_types/openmensa_xml.py index dc43651..9022e5e 100644 --- a/stw_potsdam/xml_types/openmensa_xml.py +++ b/stw_potsdam/xml_types/openmensa_xml.py @@ -18,10 +18,10 @@ class OpenMensaXML: self.canteen = canteen def __create_version_node(self, doc: minidom.Document): - e = doc.createElement("version") - tn = doc.createTextNode(self.version) - e.appendChild(tn) - return e + elem = doc.createElement("version") + txt_node = doc.createTextNode(self.version) + elem.appendChild(txt_node) + return elem def xml_element(self, doc: minidom.Document): """Create openmensa XML tag. @@ -32,20 +32,20 @@ class OpenMensaXML: Returns: _type_: _description_ """ - om = doc.createElement("openmensa") - om.setAttribute("version", "2.1") - om.setAttribute("xmlns", "http://openmensa.org/open-mensa-v2") - om.setAttribute( + open_mensa = doc.createElement("openmensa") + open_mensa.setAttribute("version", "2.1") + open_mensa.setAttribute("xmlns", "http://openmensa.org/open-mensa-v2") + open_mensa.setAttribute( "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance" ) - om.setAttribute( + open_mensa.setAttribute( "xsi:schemaLocation", "http://openmensa.org/open-mensa-v2 " + "http://openmensa.org/open-mensa-v2.xsd", ) version = self.__create_version_node(doc) - om.appendChild(version) + open_mensa.appendChild(version) canteen = self.canteen.xml_element(doc) - om.appendChild(canteen) - return om + open_mensa.appendChild(canteen) + return open_mensa diff --git a/stw_potsdam/xml_types/times_xml.py b/stw_potsdam/xml_types/times_xml.py index 363e148..210034c 100644 --- a/stw_potsdam/xml_types/times_xml.py +++ b/stw_potsdam/xml_types/times_xml.py @@ -35,12 +35,12 @@ class TimesXML: raise KeyError() def __create_node(self, doc: minidom.Document, tag: str, value: str): - e = doc.createElement(tag) + elem = doc.createElement(tag) if value == "geschlossen": - e.setAttribute("closed", "true") + elem.setAttribute("closed", "true") else: - e.setAttribute("open", value) - return e + elem.setAttribute("open", value) + return elem def xml_element(self, doc: minidom.Document): """Return the XML representation.