@@ -310,8 +310,8 @@ def fix_number(n: float) -> str:
310
310
311
311
class XMLClass :
312
312
def __getattr__ (self , tag : str ) -> typing .Callable :
313
- def mk_tag (* contents : str , ** attrs : str ) -> str :
314
- out = f"<{ tag } "
313
+ def mk_tag (* contents : str , ** attrs : str | bool | float | int ) -> str :
314
+ out = f"<{ tag } "
315
315
for k , v in attrs .items ():
316
316
if v is False :
317
317
continue
@@ -323,8 +323,8 @@ def mk_tag(*contents: str, **attrs: str) -> str:
323
323
# elif isinstance(v, str):
324
324
# v = re.sub(r"\b\d+(\.\d+)\b",
325
325
# lambda m: fix_number(float(m.group())), v)
326
- out += f'{ k .removesuffix ("_" ).replace ("__" , "-" )} ="{ v } " '
327
- out = out . rstrip () + ">" + "" .join (contents )
326
+ out += f' { k .removesuffix ("_" ).replace ("__" , "-" )} ="{ v } "'
327
+ out = out + ">" + "" .join (contents )
328
328
return out + f"</{ tag } >"
329
329
330
330
return mk_tag
@@ -393,15 +393,10 @@ def find_dots(points: list[tuple[complex, complex]]) -> list[complex]:
393
393
for p1 , p2 in points :
394
394
if p1 == p2 :
395
395
# Skip zero-length wires
396
+ # XXX: there shouldn't be any of these anymore?
396
397
continue
397
- if p1 not in seen :
398
- seen [p1 ] = 1
399
- else :
400
- seen [p1 ] += 1
401
- if p2 not in seen :
402
- seen [p2 ] = 1
403
- else :
404
- seen [p2 ] += 1
398
+ seen [p1 ] = seen .get (p1 , 0 ) + 1
399
+ seen [p2 ] = seen .get (p2 , 0 ) + 1
405
400
return [pt for pt , count in seen .items () if count > 3 ]
406
401
407
402
0 commit comments