Added lru_cache and range support for operations
This commit is contained in:
@ -737,6 +737,8 @@ class ListOperation(Sequence):
|
||||
flattened_list.extend(item.evaluated_values)
|
||||
else:
|
||||
flattened_list.append(filter_operation(item))
|
||||
elif isinstance(item, Range):
|
||||
flattened_list.extend(list(item.evaluate(options)))
|
||||
elif isinstance(item, (Event, RandomInteger, Integer, Cyclic)):
|
||||
flattened_list.append(item)
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
""" Module for the parser """
|
||||
from pathlib import Path
|
||||
from functools import lru_cache
|
||||
from lark import Lark
|
||||
from .classes import Ziffers
|
||||
from .mapper import ZiffersTransformer
|
||||
@ -29,7 +30,7 @@ def parse_expression(expr: str) -> Ziffers:
|
||||
"""
|
||||
return ziffers_parser.parse(expr)
|
||||
|
||||
|
||||
@lru_cache
|
||||
def zparse(expr: str, **opts) -> Ziffers:
|
||||
"""Parses ziffers expression with options
|
||||
|
||||
|
||||
Reference in New Issue
Block a user