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

zostera / django-icons / 3649953237

pending completion
3649953237

push

github

GitHub
Bump actions/setup-python from 4.3.0 to 4.3.1

47 of 51 branches covered (92.16%)

Branch coverage included in aggregate %.

212 of 215 relevant lines covered (98.6%)

3.92 hits per line

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

100.0
/src/django_icons/core.py
1
import warnings
4✔
2

3
from django.utils.functional import keep_lazy_text
4✔
4

5
from .utils import get_icon_kwargs, get_icon_renderer
4✔
6

7

8
def icon(name, *args, **kwargs):
4✔
9
    """
10
    Render an icon.
11

12
    Deprecated because of frequent name collisions.
13
    """
14
    warnings.warn("The `icon` function is deprecated, user `render_icon` instead.", DeprecationWarning)
4✔
15
    return render_icon(name, *args, **kwargs)
4✔
16

17

18
@keep_lazy_text
4✔
19
def render_icon(name, *args, **kwargs):
3✔
20
    """
21
    Render an icon.
22

23
    **Parameters**:
24

25
        name
26
            The name of the icon to be rendered
27

28
        title
29
            The title attribute for the icon
30

31
            :default: None (no title attribute rendered)
32

33
        renderer
34
            The renderer to use for the icon
35

36
            :default: The default renderer as per ``settings.py``, or ultimately `IconRenderer`.
37

38
    **Usage**::
39

40
        render_icon(name)
41

42
    **Example**::
43

44
        render_icon('pencil')
45
        render_icon('trash', title='Delete')
46
    """
47
    icon_kwargs = get_icon_kwargs(name, *args, **kwargs)
4✔
48
    renderer_class = get_icon_renderer(icon_kwargs.get("renderer", None))
4✔
49
    renderer = renderer_class(**icon_kwargs)
4✔
50
    return renderer.render()
4✔
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