From 03f3c7c05b5c8b837b3db2784fd579ca554326cd Mon Sep 17 00:00:00 2001 From: Nehal J Wani Date: Tue, 7 Dec 2021 16:32:53 -0500 Subject: [PATCH] Improve speed of get_task_family() * Use f-string instead of str.format() * Save duplicate call to get_task_namespace() --- luigi/task_register.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/luigi/task_register.py b/luigi/task_register.py index 5d61df36c7..f49b453c07 100644 --- a/luigi/task_register.py +++ b/luigi/task_register.py @@ -118,10 +118,11 @@ def task_family(cls): """ Internal note: This function will be deleted soon. """ - if not cls.get_task_namespace(): + task_namespace = cls.get_task_namespace() + if not task_namespace: return cls.__name__ else: - return "{}.{}".format(cls.get_task_namespace(), cls.__name__) + return f"{task_namespace}.{cls.__name__}" @classmethod def _get_reg(cls):