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
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)
+4 -4
View File
@@ -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
+6 -6
View File
@@ -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
+12 -12
View File
@@ -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
+4 -4
View File
@@ -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.