Skip to content

Commit

Permalink
chore: fix function macro call and render lint
Browse files Browse the repository at this point in the history
  • Loading branch information
robcxyz committed Jan 8, 2024
1 parent 8117d31 commit 82f8f1f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions tackle/macros/hook_macros.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from ruyaml.constructor import CommentedMap, CommentedSeq, ScalarFloat

from tackle import Context, exceptions
from tackle.macros.function_macros import function_macro
from tackle.models import DCL_HOOK_FIELDS

LITERAL_TYPES = {'list', 'dict', 'str', 'int', 'float', 'bytes', 'bool'}
Expand Down Expand Up @@ -206,8 +207,11 @@ def hook_dict_macro(
# Don't run a macro on any field that is part of base
output[k] = v
elif k.endswith(('<-', '<_')):
# We have a method. Value handled elsewhere
output[k[:-2]] = {k[-2:]: v}
# A method
hook_name, hook_value, methods = function_macro(context, k[:-2], value=v)
if methods: # Can't define functional macros yet
raise NotImplementedError("Haven't implemented functional methods yet.")
output[hook_name] = {k[-2:]: hook_value}
elif k.endswith(('->', '_>')):
output[k[:-2]] = dict_field_hook_macro(
context=context,
Expand Down
4 changes: 2 additions & 2 deletions tackle/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,10 @@ def handle_ambiguous_keys(

def lookup_ambigous_key(context: 'Context', ambiguous_key: Any):
if context.data.temporary and ambiguous_key in context.data.temporary:
return context.temporary_context[ambiguous_key]
return context.data.temporary[ambiguous_key]
elif ambiguous_key in context.data.public:
return context.data.public[ambiguous_key]
elif context.data.private and ambiguous_key in context.private_context:
elif context.data.private and ambiguous_key in context.data.private:
return context.data.private[ambiguous_key]
elif context.data.existing and ambiguous_key in context.data.existing:
return context.data.existing[ambiguous_key]
Expand Down

0 comments on commit 82f8f1f

Please sign in to comment.