From 82f8f1f1d1fd5fcd67b5c4b3d495351bd97d326c Mon Sep 17 00:00:00 2001 From: robcxyz Date: Sun, 7 Jan 2024 21:20:45 -0800 Subject: [PATCH] chore: fix function macro call and render lint --- tackle/macros/hook_macros.py | 8 ++++++-- tackle/render.py | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tackle/macros/hook_macros.py b/tackle/macros/hook_macros.py index b94d2142..2fda244b 100644 --- a/tackle/macros/hook_macros.py +++ b/tackle/macros/hook_macros.py @@ -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'} @@ -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, diff --git a/tackle/render.py b/tackle/render.py index 37057142..37cb3241 100644 --- a/tackle/render.py +++ b/tackle/render.py @@ -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]