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

zostera / django-icons / 10878644509

16 Sep 2024 06:28AM UTC coverage: 96.869%. First build
10878644509

Pull #545

github

dyve
Fix Django versions and ruff in tox
Pull Request #545: Fix Django versions and ruff in tox

100 of 105 branches covered (95.24%)

Branch coverage included in aggregate %.

395 of 406 relevant lines covered (97.29%)

9.7 hits per line

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

100.0
/src/django_icons/css.py
1
def _merge_css_item(item):
10✔
2
    """Transform argument into a list with a single string value."""
3
    if isinstance(item, (list, tuple)):
10✔
4
        return _merge_css_list(*item)
10✔
5
    item = f"{item}" if item else ""
10✔
6
    return [item]
10✔
7

8

9
def _merge_css_list(*args):
10✔
10
    """Transform arguments into a list of string values."""
11
    css_list = []
10✔
12
    for arg in args:
10✔
13
        css_list += _merge_css_item(arg)
10✔
14
    return css_list
10✔
15

16

17
def merge_css_list(*args):
10✔
18
    """
19
    Combine a series of strings and lists into a single list of unique CSS classes.
20

21
    Removes duplicates. Gives precedence to first class encountered.
22
    """
23
    css_string = " ".join(_merge_css_list(*args))  # Create single string
10✔
24
    css_list = css_string.split()  # Split it to remove all whitespace
10✔
25
    css_list = filter(None, css_list)  # Remove empty strings
10✔
26
    # Remove duplicates, see https://stackoverflow.com/questions/480214/
27
    return list(dict.fromkeys(css_list))
10✔
28

29

30
def merge_css_text(*args):
10✔
31
    """
32
    Combine a series of strings and lists into one space separated string of unique CSS classes.
33

34
    Removes duplicates. Gives precedence to first class encountered.
35
    """
36
    return " ".join(merge_css_list(*args))
10✔
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

© 2025 Coveralls, Inc