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

renatahodovan / grammarinator / 17641750025

11 Sep 2025 10:30AM UTC coverage: 41.767% (-42.8%) from 84.585%
17641750025

push

github

web-flow
Remove the unused LibFuzzerTool::blackbox method (#317)

The recent version prefers using GrammarinatorGenerator from grlf.

1073 of 2569 relevant lines covered (41.77%)

0.42 hits per line

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

53.85
/grammarinator/runtime/dispatching_model.py
1
# Copyright (c) 2020-2025 Renata Hodovan, Akos Kiss.
2
#
3
# Licensed under the BSD 3-Clause License
4
# <LICENSE.rst or https://opensource.org/licenses/BSD-3-Clause>.
5
# This file may not be copied, modified, or distributed except
6
# according to those terms.
7

8
from typing import Union
1✔
9

10
from .default_model import DefaultModel
1✔
11
from .rule import Rule
1✔
12

13

14
class DispatchingModel(DefaultModel):
1✔
15
    """
16
    Base class of custom models that aim to override the decisions in
17
    specific rules. To override a decision point, the subclass must
18
    define methods in the form of ``choice_{rule_name}``, ``quantify_{rule_name}``
19
    or ``charset_{rule_name}`` - with the same signature as their counterparts
20
    in :class:`DefaultModel` - in case of overriding an alternation, quantifier
21
    or charset decision, respectively.
22
    """
23

24
    def choice(self, node: Rule, idx: int, weights: list[float]) -> int:
1✔
25
        """
26
        Trampoline to the ``choice_{node.name}`` method of the subclassed model, if it exists.
27
        Otherwise, it calls the default implementation (:meth:`DefaultModel.choice`).
28
        """
29
        name = 'choice_' + node.name
×
30
        return (getattr(self, name) if hasattr(self, name) else super().choice)(node, idx, weights)
×
31

32
    def quantify(self, node: Rule, idx: int, cnt: int, start: int, stop: Union[int, float]) -> bool:
1✔
33
        """
34
        Trampoline to the ``quantify_{node.name}`` method of the subclassed model, if it exists.
35
        Otherwise, it calls the default implementation (:meth:`DefaultModel.quantify`).
36
        """
37
        name = 'quantify_' + node.name
×
38
        return (getattr(self, name) if hasattr(self, name) else super().quantify)(node, idx, cnt, start, stop)
×
39

40
    def charset(self, node: Rule, idx: int, chars: tuple[int, ...]) -> str:
1✔
41
        """
42
        Trampoline to the ``charset_{node.name}`` method of the subclassed model, if it exists.
43
        Otherwise, it calls the default implementation (:meth:`DefaultModel.charset`).
44
        """
45
        name = 'charset_' + node.name
×
46
        return (getattr(self, name) if hasattr(self, name) else super().charset)(node, idx, chars)
×
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