66import htmlgenerator
77
88
9- def resolve_lazy (
10- value : typing .Any , context : dict , element : "htmlgenerator.BaseElement"
11- ):
9+ def resolve_lazy (value : typing .Any , context : dict ):
1210 """Shortcut to resolve a value in case it is a Lazy value"""
1311
1412 while isinstance (value , Lazy ):
15- value = value .resolve (context , element )
13+ value = value .resolve (context )
1614 return value
1715
1816
@@ -76,19 +74,15 @@ def resolve_lookup(
7674class Lazy :
7775 """Lazy values will be evaluated at render time via the resolve method."""
7876
79- def resolve (
80- self , context : dict , element : "htmlgenerator.BaseElement"
81- ) -> typing .Any :
77+ def resolve (self , context : dict ) -> typing .Any :
8278 raise NotImplementedError ("Lazy needs to be subclassed" )
8379
8480
8581class ContextValue (Lazy ):
8682 def __init__ (self , value : str ):
8783 self .value = value
8884
89- def resolve (
90- self , context : dict , element : "htmlgenerator.BaseElement"
91- ) -> typing .Any :
85+ def resolve (self , context : dict ) -> typing .Any :
9286 return resolve_lookup (context , self .value )
9387
9488
@@ -101,10 +95,8 @@ def __init__(
10195 assert callable (func ), "ContextFunction needs to be callable"
10296 self .func = func
10397
104- def resolve (
105- self , context : dict , element : "htmlgenerator.BaseElement"
106- ) -> typing .Any :
107- return self .func (context , element )
98+ def resolve (self , context : dict ) -> typing .Any :
99+ return self .func (context )
108100
109101
110102C = ContextValue
0 commit comments