Skip to content

Commit

Permalink
Reduce count of grammars
Browse files Browse the repository at this point in the history
  • Loading branch information
KubEF committed May 21, 2024
1 parent 15ba271 commit f2edec0
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tests/autotests/grammars_constants.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from pyformlang.cfg import cfg
from constants import *
from random import sample

GRAMMARS_TABLE: list[dict[str, list[str | cfg.CFG]]] = [
{
Expand Down Expand Up @@ -326,7 +327,7 @@
GRAMMARS_DIFFERENT: list[cfg.CFG] = [
ds[CFG][0] for ds in GRAMMARS_TABLE if len(ds[CFG]) >= 1
]
CFG_EBNF: list[tuple[list[cfg.CFG], list[str]]] = [
(ds[CFG], ds[EBNF]) for ds in GRAMMARS_TABLE
]
REGEXES = [regex_str for ds in GRAMMARS_TABLE for regex_str in ds[REGEXP]]
CFG_EBNF: list[tuple[list[cfg.CFG], list[str]]] = sample(
[(ds[CFG], ds[EBNF]) for ds in GRAMMARS_TABLE], 15
)
REGEXES = sample([regex_str for ds in GRAMMARS_TABLE for regex_str in ds[REGEXP]], 15)

0 comments on commit f2edec0

Please sign in to comment.