1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-25 17:36:13 +01:00

Add core.File.from_xml_node() class method

This commit is contained in:
Daniel Mach 2022-10-12 14:01:38 +02:00
parent 298a1fba4b
commit e03cafa99a

View File

@ -264,6 +264,18 @@ class File:
def __str__(self):
return self.name
@classmethod
def from_xml_node(cls, node):
assert node.tag == "entry"
kwargs = {
"name": node.get("name"),
"md5": node.get("md5"),
"size": int(node.get("size")),
"mtime": int(node.get("mtime")),
"skipped": "skipped" in node,
}
return cls(**kwargs)
class Serviceinfo:
"""Source service content