Skip to content

Commit

Permalink
Improve speed of get_task_family()
Browse files Browse the repository at this point in the history
* Use f-string instead of str.format()
* Save duplicate call to get_task_namespace()
  • Loading branch information
nehaljwani committed Dec 7, 2021
1 parent f712c49 commit 430bd58
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions luigi/task_register.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"{cls.task_namespace, cls.__name__}"

@classmethod
def _get_reg(cls):
Expand Down

0 comments on commit 430bd58

Please sign in to comment.