Makefile: Include py-topdir.mk

Include py-topdir.mk, which entails loads of fallout from make check. Fix it.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-06-10 13:28:35 +02:00
commit e9845b5a1f
Signed by: Jan Lindemann
GPG key ID: 3750640C9E25DD61
45 changed files with 1796 additions and 1191 deletions

View file

@ -1,29 +1,35 @@
# -*- coding: utf-8 -*-
from collections.abc import Callable
from __future__ import annotations
import xml.etree.ElementTree as ET
from ...log import *
from typing import TYPE_CHECKING
class MapAttr2Shape: # export
if TYPE_CHECKING:
from collections.abc import Callable
from typing import Any
def __init__(self, mappings: dict[str, str|Callable[[dict[str, str]], str]]|None=None) -> None:
class MapAttr2Shape: # export
def __init__(
self,
mappings: dict[str, str | Callable[[dict[str, str]], str]] | None = None
) -> None:
self.__mappings = mappings if mappings is not None else {}
self.__shape_node_key = 'd25'
self.__ns_gml = "http://graphml.graphdrawing.org/xmlns"
self.__ns = {
# -- Standard GraphML
"": self.__ns_gml,
"xsi": "http://www.w3.org/2001/XMLSchema-instance",
"xsi:schemaLocation": "http://graphml.graphdrawing.org/xmlns http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd",
"": self.__ns_gml,
"xsi": "http://www.w3.org/2001/XMLSchema-instance",
"xsi:schemaLocation":
"http://graphml.graphdrawing.org/xmlns http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd",
# -- YWorks GraphML
"java": "http://www.yworks.com/xml/yfiles-common/1.0/java",
"sys": "http://www.yworks.com/xml/yfiles-common/markup/primitives/2.0",
"x": "http://www.yworks.com/xml/yfiles-common/markup/2.0",
"y": "http://www.yworks.com/xml/graphml",
"yed": "http://www.yworks.com/xml/yed/3",
"java": "http://www.yworks.com/xml/yfiles-common/1.0/java",
"sys": "http://www.yworks.com/xml/yfiles-common/markup/primitives/2.0",
"x": "http://www.yworks.com/xml/yfiles-common/markup/2.0",
"y": "http://www.yworks.com/xml/graphml",
"yed": "http://www.yworks.com/xml/yed/3",
}
# https://stackoverflow.com/questions/4997848/
for name, url in self.__ns.items():
@ -72,7 +78,7 @@ class MapAttr2Shape: # export
ns, tag = tag.split(':')
tag = '{' + self.__ns[ns] + '}' + tag
attrib = content.get('a') or {}
el = ET.Element(tag, attrib=attrib)
el = ET.Element(tag, attrib = attrib)
text = content.get('t')
if text is not None:
el.text = text
@ -81,10 +87,7 @@ class MapAttr2Shape: # export
if children is not None:
__add(el, children)
default_values = {
'color': '#FFCC00',
'text': ''
}
default_values = {'color': '#FFCC00', 'text': ''}
values = {}
for key, default in default_values.items():
@ -98,11 +101,11 @@ class MapAttr2Shape: # export
continue
mapped = mapping(self.__attribs(node, keys))
values[key] = mapped or default
except:
except Exception:
pass
color = values['color']
text = values['text']
text = values['text']
has_text = 'true' if text else 'false'
width_text = round(len(text) * 5.75, 5) if text else 0
@ -110,61 +113,89 @@ class MapAttr2Shape: # export
shape = {
'data': {
'a': {'key': self.__shape_node_key},
'a': {
'key': self.__shape_node_key
},
'c': {
'y:ShapeNode': {
'a': {},
'c': {
'y:Geometry': {'a': {'height': '30.0', 'width': str(width_box), 'x': str(-(width_box / 2)), 'y':' -15.0'}},
'y:Fill': {'a': {'color': color, 'transparent': 'false'}},
'y:BorderStyle': {'a': {'color': '#000000', 'raised': 'false', 'type': 'line', 'width': '1.0'}},
'y:Geometry': {
'a': {
'height': '30.0',
'width': str(width_box),
'x': str(-(width_box / 2)),
'y': ' -15.0'
}
},
'y:Fill': {
'a': {
'color': color, 'transparent': 'false'
}
},
'y:BorderStyle': {
'a': {
'color': '#000000',
'raised': 'false',
'type': 'line',
'width': '1.0'
}
},
'y:NodeLabel': {
'a': {
'alignment': 'center',
'autoSizePolicy': 'content',
'fontFamily': 'Dialog',
'fontSize': '12',
'fontStyle': 'plain',
'hasBackgroundColor': 'false',
'hasLineColor': 'false',
'hasText': has_text,
'height': '18',
'horizontalTextPosition': 'center',
'iconTextGap': '4',
'modelName': 'custom',
'textColor': '#000000',
'verticalTextPosition': 'bottom',
'visible': 'true',
'width': str(width_text),
'x': '13.0',
'y': '13.0',
'alignment': 'center',
'autoSizePolicy': 'content',
'fontFamily': 'Dialog',
'fontSize': '12',
'fontStyle': 'plain',
'hasBackgroundColor': 'false',
'hasLineColor': 'false',
'hasText': has_text,
'height': '18',
'horizontalTextPosition': 'center',
'iconTextGap': '4',
'modelName': 'custom',
'textColor': '#000000',
'verticalTextPosition': 'bottom',
'visible': 'true',
'width': str(width_text),
'x': '13.0',
'y': '13.0',
},
'c': {
'y:LabelModel': {
'c': {
'y:SmartNodeLabelModel': {'a': {'distance': '4.0'}}
},
},
'y:ModelParameter': {
'c': {
'y:SmartNodeLabelModelParameter': {
'a': {
'labelRatioX':'0.0',
'labelRatioY': '0.0',
'nodeRatioX': '0.0',
'nodeRatioY': '0.0',
'offsetX': '0.0',
'offsetY': '0.0',
'upX': '0.0',
'upY': '-1.0',
}
}
}
}
'y:LabelModel': {
'c': {
'y:SmartNodeLabelModel': {
'a': {
'distance': '4.0'
}
}
},
},
'y:ModelParameter': {
'c': {
'y:SmartNodeLabelModelParameter': {
'a': {
'labelRatioX': '0.0',
'labelRatioY': '0.0',
'nodeRatioX': '0.0',
'nodeRatioY': '0.0',
'offsetX': '0.0',
'offsetY': '0.0',
'upX': '0.0',
'upY': '-1.0',
}
}
}
}
},
't': text
},
'y:Shape': {'a': {'type': 'rectangle'}}
},
'y:Shape': {
'a': {
'type': 'rectangle'
}
}
}
}
}
@ -175,17 +206,17 @@ class MapAttr2Shape: # export
def __massage_nodes(self, root) -> None:
keys = self.__keys(root)
graph = root.find(f'graph', self.__ns)
graph = root.find('graph', self.__ns)
for node in graph:
self.__massage_node(node, keys)
def run(self, path_in: str, path_out: str) -> None:
parser = ET.XMLParser(encoding="utf-8")
tree = ET.parse(path_in, parser=parser)
parser = ET.XMLParser(encoding = "utf-8")
tree = ET.parse(path_in, parser = parser)
root = tree.getroot()
self.__add_key_nodegraphics(root)
self.__massage_nodes(root)
ET.indent(tree, space=' ', level=0)
tree.write(path_out, xml_declaration=True, encoding='utf-8')
ET.indent(tree, space = ' ', level = 0)
tree.write(path_out, xml_declaration = True, encoding = 'utf-8')