MCPcopy
hub / github.com/celery/celery / remove_repeating_from_task

Function remove_repeating_from_task

celery/utils/text.py:141–153  ·  view source on GitHub ↗

Given task name, remove repeating module names. Example: >>> remove_repeating_from_task( ... 'tasks.add', ... 'tasks.add(2, 2), tasks.mul(3), tasks.div(4)') 'tasks.add(2, 2), mul(3), div(4)'

(task_name: str, s: str)

Source from the content-addressed store, hash-verified

139
140
141def remove_repeating_from_task(task_name: str, s: str) -> str:
142 """Given task name, remove repeating module names.
143
144 Example:
145 >>> remove_repeating_from_task(
146 ... 'tasks.add',
147 ... 'tasks.add(2, 2), tasks.mul(3), tasks.div(4)')
148 'tasks.add(2, 2), mul(3), div(4)'
149 """
150 # This is used by e.g. repr(chain), to remove repeating module names.
151 # - extract the module part of the task name
152 module = str(task_name).rpartition('.')[0] + '.'
153 return remove_repeating(module, s)
154
155
156def remove_repeating(substr: str, s: str) -> str:

Callers 3

__repr__Method · 0.90
__repr__Method · 0.90
__repr__Method · 0.90

Calls 1

remove_repeatingFunction · 0.85

Tested by

no test coverage detected