prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  devel bug - profile_tasks.py requires CALLBACK_ constants or the display param is not passed
  relates to #11625 and commit a09f623
  
  ```
  $ ansible-playbook plays/test_to_json.yml -vvv
  Using /Users/glynch/vagrant/ansible_foo/ansible.cfg as config file
  1 plays in plays/test_to_json.yml
   [ERROR]: Unexpected Exception: __init__() takes exactly 2 arguments (1 given)
  
  the full traceback was:
  
  Traceback (most recent call last):
    File "/Users/glynch/dev/ansible/bin/ansible-playbook", line 77, in <module>
      sys.exit(cli.run())
    File "/Users/glynch/dev/ansible/lib/ansible/cli/playbook.py", line 162, in run
      results = pbex.run()
    File "/Users/glynch/dev/ansible/lib/ansible/executor/playbook_executor.py", line 128, in run
      self._tqm.load_callbacks()
    File "/Users/glynch/dev/ansible/lib/ansible/executor/task_queue_manager.py", line 154, in load_callbacks
      self._callback_plugins.append(callback_plugin())
  TypeError: __init__() takes exactly 2 arguments (1 given)
  ```
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `lib/ansible/plugins/callback/profile_tasks.py`
  Content:
  ```
  1 # (C) 2015, Tom Paine, <github@aioue.net>
  2 # (C) 2014, Jharrod LaFon, @JharrodLaFon
  3 # (C) 2012-2013, Michael DeHaan, <michael.dehaan@gmail.com>
  4 #
  5 # This file is free software: you can redistribute it and/or modify
  6 # it under the terms of the GNU General Public License as published by
  7 # the Free Software Foundation, either version 3 of the License, or
  8 # (at your option) any later version.
  9 #
  10 # File is distributed in the hope that it will be useful,
  11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13 # GNU General Public License for more details.
  14 #
  15 # See <http://www.gnu.org/licenses/> for a copy of the
  16 # GNU General Public License
  17 
  18 # Provides per-task timing, ongoing playbook elapsed time and
  19 # ordered list of top 20 longest running tasks at end
  20 
  21 import time
  22 
  23 from ansible.plugins.callback import CallbackBase
  24 
  25 # define start time
  26 t0 = tn = time.time()
  27 
  28 def secondsToStr(t):
  29     # http://bytes.com/topic/python/answers/635958-handy-short-cut-formatting-elapsed-time-floating-point-seconds
  30     rediv = lambda ll, b: list(divmod(ll[0], b)) + ll[1:]
  31     return "%d:%02d:%02d.%03d" % tuple(reduce(rediv, [[t * 1000, ], 1000, 60, 60]))
  32 
  33 
  34 def filled(msg, fchar="*"):
  35     if len(msg) == 0:
  36         width = 79
  37     else:
  38         msg = "%s " % msg
  39         width = 79 - len(msg)
  40     if width < 3:
  41         width = 3
  42     filler = fchar * width
  43     return "%s%s " % (msg, filler)
  44 
  45 
  46 def timestamp(self):
  47     if self.current is not None:
  48         self.stats[self.current] = time.time() - self.stats[self.current]
  49 
  50 
  51 def tasktime():
  52     global tn
  53     time_current = time.strftime('%A %d %B %Y  %H:%M:%S %z')
  54     time_elapsed = secondsToStr(time.time() - tn)
  55     time_total_elapsed = secondsToStr(time.time() - t0)
  56     display(filled('%s (%s)%s%s' % (time_current, time_elapsed, ' ' * 7, time_total_elapsed)))
  57     tn = time.time()
  58 
  59 
  60 class CallbackModule(CallbackBase):
  61 
  62     def __init__(self, display):
  63         self.stats = {}
  64         self.current = None
  65 
  66         super(CallbackModule, self).__init__(display)
  67 
  68 
  69     def playbook_on_task_start(self, name, is_conditional):
  70         """
  71         Logs the start of each task
  72         """
  73         tasktime()
  74         timestamp(self)
  75 
  76         # Record the start time of the current task
  77         self.current = name
  78         self.stats[self.current] = time.time()
  79 
  80     def playbook_on_setup(self):
  81         tasktime()
  82 
  83     def playbook_on_stats(self, stats):
  84         tasktime()
  85         display(filled("", fchar="="))
  86 
  87         timestamp(self)
  88 
  89         # Sort the tasks by their running time
  90         results = sorted(
  91             self.stats.items(),
  92             key=lambda value: value[1],
  93             reverse=True,
  94         )
  95 
  96         # Just keep the top 20
  97         results = results[:20]
  98 
  99         # Print the timings
  100         for name, elapsed in results:
  101             self.display.display(
  102                 "{0:-<70}{1:->9}".format(
  103                     '{0} '.format(name),
  104                     ' {0:.02f}s'.format(elapsed),
  105                 )
  106             )
  107
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/lib/ansible/plugins/callback/profile_tasks.py b/lib/ansible/plugins/callback/profile_tasks.py
  --- a/lib/ansible/plugins/callback/profile_tasks.py
  +++ b/lib/ansible/plugins/callback/profile_tasks.py
  @@ -58,7 +58,14 @@
   
   
   class CallbackModule(CallbackBase):
  -
  +    """
  +    This callback module provides per-task timing, ongoing playbook elapsed time 
  +    and ordered list of top 20 longest running tasks at end.
  +    """
  +    CALLBACK_VERSION = 2.0
  +    CALLBACK_TYPE = 'aggregate'
  +    CALLBACK_NAME = 'profile_tasks'
  + 
       def __init__(self, display):
           self.stats = {}
           self.current = None
  
verification_info: {"golden_diff": "diff --git a/lib/ansible/plugins/callback/profile_tasks.py b/lib/ansible/plugins/callback/profile_tasks.py\n--- a/lib/ansible/plugins/callback/profile_tasks.py\n+++ b/lib/ansible/plugins/callback/profile_tasks.py\n@@ -58,7 +58,14 @@\n \n \n class CallbackModule(CallbackBase):\n-\n+    \"\"\"\n+    This callback module provides per-task timing, ongoing playbook elapsed time \n+    and ordered list of top 20 longest running tasks at end.\n+    \"\"\"\n+    CALLBACK_VERSION = 2.0\n+    CALLBACK_TYPE = 'aggregate'\n+    CALLBACK_NAME = 'profile_tasks'\n+ \n     def __init__(self, display):\n         self.stats = {}\n         self.current = None\n", "issue": "devel bug - profile_tasks.py requires CALLBACK_ constants or the display param is not passed\nrelates to #11625 and commit a09f623\n\n```\n$ ansible-playbook plays/test_to_json.yml -vvv\nUsing /Users/glynch/vagrant/ansible_foo/ansible.cfg as config file\n1 plays in plays/test_to_json.yml\n [ERROR]: Unexpected Exception: __init__() takes exactly 2 arguments (1 given)\n\nthe full traceback was:\n\nTraceback (most recent call last):\n  File \"/Users/glynch/dev/ansible/bin/ansible-playbook\", line 77, in <module>\n    sys.exit(cli.run())\n  File \"/Users/glynch/dev/ansible/lib/ansible/cli/playbook.py\", line 162, in run\n    results = pbex.run()\n  File \"/Users/glynch/dev/ansible/lib/ansible/executor/playbook_executor.py\", line 128, in run\n    self._tqm.load_callbacks()\n  File \"/Users/glynch/dev/ansible/lib/ansible/executor/task_queue_manager.py\", line 154, in load_callbacks\n    self._callback_plugins.append(callback_plugin())\nTypeError: __init__() takes exactly 2 arguments (1 given)\n```\n\n", "before_files": [{"content": "# (C) 2015, Tom Paine, <github@aioue.net>\n# (C) 2014, Jharrod LaFon, @JharrodLaFon\n# (C) 2012-2013, Michael DeHaan, <michael.dehaan@gmail.com>\n#\n# This file is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# (at your option) any later version.\n#\n# File is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# See <http://www.gnu.org/licenses/> for a copy of the\n# GNU General Public License\n\n# Provides per-task timing, ongoing playbook elapsed time and\n# ordered list of top 20 longest running tasks at end\n\nimport time\n\nfrom ansible.plugins.callback import CallbackBase\n\n# define start time\nt0 = tn = time.time()\n\ndef secondsToStr(t):\n    # http://bytes.com/topic/python/answers/635958-handy-short-cut-formatting-elapsed-time-floating-point-seconds\n    rediv = lambda ll, b: list(divmod(ll[0], b)) + ll[1:]\n    return \"%d:%02d:%02d.%03d\" % tuple(reduce(rediv, [[t * 1000, ], 1000, 60, 60]))\n\n\ndef filled(msg, fchar=\"*\"):\n    if len(msg) == 0:\n        width = 79\n    else:\n        msg = \"%s \" % msg\n        width = 79 - len(msg)\n    if width < 3:\n        width = 3\n    filler = fchar * width\n    return \"%s%s \" % (msg, filler)\n\n\ndef timestamp(self):\n    if self.current is not None:\n        self.stats[self.current] = time.time() - self.stats[self.current]\n\n\ndef tasktime():\n    global tn\n    time_current = time.strftime('%A %d %B %Y  %H:%M:%S %z')\n    time_elapsed = secondsToStr(time.time() - tn)\n    time_total_elapsed = secondsToStr(time.time() - t0)\n    display(filled('%s (%s)%s%s' % (time_current, time_elapsed, ' ' * 7, time_total_elapsed)))\n    tn = time.time()\n\n\nclass CallbackModule(CallbackBase):\n\n    def __init__(self, display):\n        self.stats = {}\n        self.current = None\n\n        super(CallbackModule, self).__init__(display)\n\n\n    def playbook_on_task_start(self, name, is_conditional):\n        \"\"\"\n        Logs the start of each task\n        \"\"\"\n        tasktime()\n        timestamp(self)\n\n        # Record the start time of the current task\n        self.current = name\n        self.stats[self.current] = time.time()\n\n    def playbook_on_setup(self):\n        tasktime()\n\n    def playbook_on_stats(self, stats):\n        tasktime()\n        display(filled(\"\", fchar=\"=\"))\n\n        timestamp(self)\n\n        # Sort the tasks by their running time\n        results = sorted(\n            self.stats.items(),\n            key=lambda value: value[1],\n            reverse=True,\n        )\n\n        # Just keep the top 20\n        results = results[:20]\n\n        # Print the timings\n        for name, elapsed in results:\n            self.display.display(\n                \"{0:-<70}{1:->9}\".format(\n                    '{0} '.format(name),\n                    ' {0:.02f}s'.format(elapsed),\n                )\n            )\n", "path": "lib/ansible/plugins/callback/profile_tasks.py"}], "after_files": [{"content": "# (C) 2015, Tom Paine, <github@aioue.net>\n# (C) 2014, Jharrod LaFon, @JharrodLaFon\n# (C) 2012-2013, Michael DeHaan, <michael.dehaan@gmail.com>\n#\n# This file is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# (at your option) any later version.\n#\n# File is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# See <http://www.gnu.org/licenses/> for a copy of the\n# GNU General Public License\n\n# Provides per-task timing, ongoing playbook elapsed time and\n# ordered list of top 20 longest running tasks at end\n\nimport time\n\nfrom ansible.plugins.callback import CallbackBase\n\n# define start time\nt0 = tn = time.time()\n\ndef secondsToStr(t):\n    # http://bytes.com/topic/python/answers/635958-handy-short-cut-formatting-elapsed-time-floating-point-seconds\n    rediv = lambda ll, b: list(divmod(ll[0], b)) + ll[1:]\n    return \"%d:%02d:%02d.%03d\" % tuple(reduce(rediv, [[t * 1000, ], 1000, 60, 60]))\n\n\ndef filled(msg, fchar=\"*\"):\n    if len(msg) == 0:\n        width = 79\n    else:\n        msg = \"%s \" % msg\n        width = 79 - len(msg)\n    if width < 3:\n        width = 3\n    filler = fchar * width\n    return \"%s%s \" % (msg, filler)\n\n\ndef timestamp(self):\n    if self.current is not None:\n        self.stats[self.current] = time.time() - self.stats[self.current]\n\n\ndef tasktime():\n    global tn\n    time_current = time.strftime('%A %d %B %Y  %H:%M:%S %z')\n    time_elapsed = secondsToStr(time.time() - tn)\n    time_total_elapsed = secondsToStr(time.time() - t0)\n    display(filled('%s (%s)%s%s' % (time_current, time_elapsed, ' ' * 7, time_total_elapsed)))\n    tn = time.time()\n\n\nclass CallbackModule(CallbackBase):\n    \"\"\"\n    This callback module provides per-task timing, ongoing playbook elapsed time \n    and ordered list of top 20 longest running tasks at end.\n    \"\"\"\n    CALLBACK_VERSION = 2.0\n    CALLBACK_TYPE = 'aggregate'\n    CALLBACK_NAME = 'profile_tasks'\n \n    def __init__(self, display):\n        self.stats = {}\n        self.current = None\n\n        super(CallbackModule, self).__init__(display)\n\n\n    def playbook_on_task_start(self, name, is_conditional):\n        \"\"\"\n        Logs the start of each task\n        \"\"\"\n        tasktime()\n        timestamp(self)\n\n        # Record the start time of the current task\n        self.current = name\n        self.stats[self.current] = time.time()\n\n    def playbook_on_setup(self):\n        tasktime()\n\n    def playbook_on_stats(self, stats):\n        tasktime()\n        display(filled(\"\", fchar=\"=\"))\n\n        timestamp(self)\n\n        # Sort the tasks by their running time\n        results = sorted(\n            self.stats.items(),\n            key=lambda value: value[1],\n            reverse=True,\n        )\n\n        # Just keep the top 20\n        results = results[:20]\n\n        # Print the timings\n        for name, elapsed in results:\n            self.display.display(\n                \"{0:-<70}{1:->9}\".format(\n                    '{0} '.format(name),\n                    ' {0:.02f}s'.format(elapsed),\n                )\n            )\n", "path": "lib/ansible/plugins/callback/profile_tasks.py"}]}