File: keyframe_selector.py

package info (click to toggle)
python-lesscpy 0.13.0%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,436 kB
  • sloc: python: 3,572; sh: 20; makefile: 8
file content (49 lines) | stat: -rw-r--r-- 1,180 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# -*- coding: utf8 -*-
"""
.. module:: lesscpy.plib.keyframe_selector
    :synopsis: Keyframe selector node.

    Copyright (c)
    See LICENSE for details.
"""

from .node import Node


class KeyframeSelector(Node):
    """Keyframe selector node. Represents the keyframe selector in an animation
    sequence. Keyframes can be identified by the keywords "from" or "to", or by
    percentage.

    http://www.w3.org/TR/css3-animations/#keyframes
    """

    def parse(self, scope):
        """Parse node.
        args:
            scope (Scope): Current scope
        raises:
            SyntaxError
        returns:
            self
        """
        self.keyframe, = [e[0] if isinstance(e, tuple) else e
                          for e in self.tokens if str(e).strip()]
        self.subparse = False
        return self

    def copy(self):
        """ Return copy of self
        Returns:
            KeyframeSelector object
        """
        return KeyframeSelector(self.tokens, 0)

    def fmt(self, fills):
        """Format identifier
        args:
            fills (dict): replacements
        returns:
            str (CSS)
        """
        return self.keyframe