linting short variable names

This commit is contained in:
Hadrian Burkhardt
2023-12-03 03:29:50 +01:00
committed by f4lco
parent 46fc6ee87b
commit 2d4399c3db
5 changed files with 30 additions and 30 deletions
+4 -4
View File
@@ -75,10 +75,10 @@ class CanteenXML:
self.days = {} if days is None else days self.days = {} if days is None else days
def __create_node(self, doc: minidom.Document, tag: str, value: str): def __create_node(self, doc: minidom.Document, tag: str, value: str):
e = doc.createElement(tag) elem = doc.createElement(tag)
tn = doc.createTextNode(value) txt_node = doc.createTextNode(value)
e.appendChild(tn) elem.appendChild(txt_node)
return e return elem
def __append_meta(self, doc: minidom.Document, canteen: minidom.Element): def __append_meta(self, doc: minidom.Document, canteen: minidom.Element):
name = self.__create_node(doc, "name", self.canteen_meta.name) name = self.__create_node(doc, "name", self.canteen_meta.name)
+4 -4
View File
@@ -71,12 +71,12 @@ class FeedXML:
feed.appendChild(schedule) feed.appendChild(schedule)
url = doc.createElement("url") url = doc.createElement("url")
tn = doc.createTextNode(self.url) txt_node = doc.createTextNode(self.url)
url.appendChild(tn) url.appendChild(txt_node)
feed.appendChild(url) feed.appendChild(url)
source = doc.createElement("source") source = doc.createElement("source")
tn = doc.createTextNode(self.source) txt_node = doc.createTextNode(self.source)
source.appendChild(tn) source.appendChild(txt_node)
feed.appendChild(source) feed.appendChild(source)
return feed return feed
+6 -6
View File
@@ -26,13 +26,13 @@ class MealXML:
""" """
meal = doc.createElement("meal") meal = doc.createElement("meal")
name = doc.createElement("name") name = doc.createElement("name")
tn = doc.createTextNode(self.name) txt_node = doc.createTextNode(self.name)
name.appendChild(tn) name.appendChild(txt_node)
meal.appendChild(name) meal.appendChild(name)
if self.note is not None: if self.note is not None:
note = doc.createElement("note") note = doc.createElement("note")
tn = doc.createTextNode(self.note) txt_node = doc.createTextNode(self.note)
note.appendChild(tn) note.appendChild(txt_node)
meal.appendChild(note) meal.appendChild(note)
for key, val in self.price.items(): for key, val in self.price.items():
@@ -40,7 +40,7 @@ class MealXML:
continue continue
price = doc.createElement("price") price = doc.createElement("price")
price.setAttribute("role", key) price.setAttribute("role", key)
tn = doc.createTextNode(f"{val:.2f}") txt_node = doc.createTextNode(f"{val:.2f}")
price.appendChild(tn) price.appendChild(txt_node)
meal.appendChild(price) meal.appendChild(price)
return meal return meal
+12 -12
View File
@@ -18,10 +18,10 @@ class OpenMensaXML:
self.canteen = canteen self.canteen = canteen
def __create_version_node(self, doc: minidom.Document): def __create_version_node(self, doc: minidom.Document):
e = doc.createElement("version") elem = doc.createElement("version")
tn = doc.createTextNode(self.version) txt_node = doc.createTextNode(self.version)
e.appendChild(tn) elem.appendChild(txt_node)
return e return elem
def xml_element(self, doc: minidom.Document): def xml_element(self, doc: minidom.Document):
"""Create openmensa XML tag. """Create openmensa XML tag.
@@ -32,20 +32,20 @@ class OpenMensaXML:
Returns: Returns:
_type_: _description_ _type_: _description_
""" """
om = doc.createElement("openmensa") open_mensa = doc.createElement("openmensa")
om.setAttribute("version", "2.1") open_mensa.setAttribute("version", "2.1")
om.setAttribute("xmlns", "http://openmensa.org/open-mensa-v2") open_mensa.setAttribute("xmlns", "http://openmensa.org/open-mensa-v2")
om.setAttribute( open_mensa.setAttribute(
"xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance" "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"
) )
om.setAttribute( open_mensa.setAttribute(
"xsi:schemaLocation", "xsi:schemaLocation",
"http://openmensa.org/open-mensa-v2 " "http://openmensa.org/open-mensa-v2 "
+ "http://openmensa.org/open-mensa-v2.xsd", + "http://openmensa.org/open-mensa-v2.xsd",
) )
version = self.__create_version_node(doc) version = self.__create_version_node(doc)
om.appendChild(version) open_mensa.appendChild(version)
canteen = self.canteen.xml_element(doc) canteen = self.canteen.xml_element(doc)
om.appendChild(canteen) open_mensa.appendChild(canteen)
return om return open_mensa
+4 -4
View File
@@ -35,12 +35,12 @@ class TimesXML:
raise KeyError() raise KeyError()
def __create_node(self, doc: minidom.Document, tag: str, value: str): def __create_node(self, doc: minidom.Document, tag: str, value: str):
e = doc.createElement(tag) elem = doc.createElement(tag)
if value == "geschlossen": if value == "geschlossen":
e.setAttribute("closed", "true") elem.setAttribute("closed", "true")
else: else:
e.setAttribute("open", value) elem.setAttribute("open", value)
return e return elem
def xml_element(self, doc: minidom.Document): def xml_element(self, doc: minidom.Document):
"""Return the XML representation. """Return the XML representation.