Skip to content

Commit b5a8f62

Browse files
committed
Add hook to base register to control task class attributes.
1 parent 5124502 commit b5a8f62

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

law/task/base.py

+10
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ def __new__(metacls, classname, bases, classdict):
6868
if cls.update_register:
6969
cls.deregister()
7070

71+
# invoke the class-level attribute update hook
72+
cls.update_task_attributes()
73+
7174
# add to register (mimic luigi.task_register.Register.__new__)
7275
cls._namespace_at_class_time = metacls._get_namespace(cls.__module__)
7376
metacls._reg.append(cls)
@@ -120,6 +123,13 @@ def deregister(cls, task_cls=None):
120123

121124
return success
122125

126+
@classmethod
127+
def update_task_attributes(cls):
128+
"""
129+
Hook to update class attributes before the class is added to the register.
130+
"""
131+
return
132+
123133
@classmethod
124134
def modify_param_args(cls, params, args, kwargs):
125135
"""

0 commit comments

Comments
 (0)