• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

APN-Pucky / pyfeyn2 / 14318039396

07 Apr 2025 07:42PM UTC coverage: 67.018% (-1.3%) from 68.287%
14318039396

push

github

web-flow
Update gallery (#317)

* Add coment

* Add wikipedia like examples

Closes: #85

* Add feynmf examples

* Update gallery

* Fix serializer config indent

* No more feynml particle access

* dot2tex fixes

* clean

* add xcolor

* old dot2tex

* more fixes

* Fixed versions

* again

* again...

* uff

* Final

* more

* Timeout mermaid requests

* None on timeout

9 of 16 new or added lines in 4 files covered. (56.25%)

108 existing lines in 6 files now uncovered.

2160 of 3223 relevant lines covered (67.02%)

0.67 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

46.88
/pyfeyn2/auto/label.py
1
import copy
1✔
2
from ast import List
1✔
3
from enum import Enum
1✔
4

5
from pylatexenc.latex2text import LatexNodes2Text
1✔
6

7

8
class LabelType(Enum):
1✔
9
    LATEX = 1
1✔
10
    UNICODE = 2
1✔
11
    ASCII = 3
1✔
12

13

14
def auto_label(
1✔
15
    objs: List, replace: bool = False, label_type: LabelType = LabelType.LATEX
16
):
17
    """
18
    Automatically label objects.
19

20
    Parameters
21
    ----------
22
    objs : list
23
        List of objects to label.
24
    replace : bool, optional
25
        Whether to replace existing labels. The default is False.
26

27
    """
28
    for p in objs:
1✔
29
        if (p.label is None or replace) and p.texname is not None:
1✔
30
            if label_type == LabelType.LATEX:
1✔
31
                p.label = "$" + p.texname + "$"
1✔
32
            elif label_type == LabelType.UNICODE:
×
NEW
33
                p.label = LatexNodes2Text().latex_to_text("$" + p.texname + "$")
×
UNCOV
34
            elif label_type == LabelType.ASCII:
×
NEW
35
                p.label = p.name
×
36
            else:
37
                raise Exception("Unknown label type.")
×
38

39

40
def auto_label_propagators(ifd, replace=False):
1✔
41
    """Automatically label propagators."""
42
    # fd = copy.deepcopy(ifd)
43
    fd = ifd
×
44
    objs = fd.propagators
×
45
    for p in objs:
×
46
        if p.label is None or replace:
×
NEW
47
            p.label = "$" + p.texname + "$"
×
48
    return fd
×
49

50

51
def auto_label_legs(ifd, replace=False):
1✔
52
    """Automatically label legs."""
53
    # fd = copy.deepcopy(ifd)
54
    fd = ifd
×
55
    objs = fd.legs
×
56
    for p in objs:
×
NEW
57
        if p.label is None or replace:
×
NEW
58
            p.label = "$" + p.texname + "$"
×
UNCOV
59
    return fd
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc