prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  @concurrent annotation doesn't work in the OOP script method
  I.E:
  
  ```
  class SomeClass:
      @concurrent [doesn't work, 2 args]
      def request(self, flow):
          pass
  
  ```
  @concurrent annotation doesn't work in the OOP script method
  I.E:
  
  ```
  class SomeClass:
      @concurrent [doesn't work, 2 args]
      def request(self, flow):
          pass
  
  ```
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `mitmproxy/script/concurrent.py`
  Content:
  ```
  1 """
  2 This module provides a @concurrent decorator primitive to
  3 offload computations from mitmproxy's main master thread.
  4 """
  5 
  6 from mitmproxy import eventsequence
  7 from mitmproxy.types import basethread
  8 
  9 
  10 class ScriptThread(basethread.BaseThread):
  11     name = "ScriptThread"
  12 
  13 
  14 def concurrent(fn):
  15     if fn.__name__ not in eventsequence.Events - {"start", "configure", "tick"}:
  16         raise NotImplementedError(
  17             "Concurrent decorator not supported for '%s' method." % fn.__name__
  18         )
  19 
  20     def _concurrent(obj):
  21         def run():
  22             fn(obj)
  23             if obj.reply.state == "taken":
  24                 if not obj.reply.has_message:
  25                     obj.reply.ack()
  26                 obj.reply.commit()
  27         obj.reply.take()
  28         ScriptThread(
  29             "script.concurrent (%s)" % fn.__name__,
  30             target=run
  31         ).start()
  32     return _concurrent
  33
  ```
  --- 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/mitmproxy/script/concurrent.py b/mitmproxy/script/concurrent.py
  --- a/mitmproxy/script/concurrent.py
  +++ b/mitmproxy/script/concurrent.py
  @@ -29,4 +29,8 @@
               "script.concurrent (%s)" % fn.__name__,
               target=run
           ).start()
  -    return _concurrent
  +    # Support @concurrent for class-based addons
  +    if "." in fn.__qualname__:
  +        return staticmethod(_concurrent)
  +    else:
  +        return _concurrent
  
verification_info: {"golden_diff": "diff --git a/mitmproxy/script/concurrent.py b/mitmproxy/script/concurrent.py\n--- a/mitmproxy/script/concurrent.py\n+++ b/mitmproxy/script/concurrent.py\n@@ -29,4 +29,8 @@\n             \"script.concurrent (%s)\" % fn.__name__,\n             target=run\n         ).start()\n-    return _concurrent\n+    # Support @concurrent for class-based addons\n+    if \".\" in fn.__qualname__:\n+        return staticmethod(_concurrent)\n+    else:\n+        return _concurrent\n", "issue": "@concurrent annotation doesn't work in the OOP script method\nI.E:\r\n\r\n```\r\nclass SomeClass:\r\n    @concurrent [doesn't work, 2 args]\r\n    def request(self, flow):\r\n        pass\r\n\r\n```\n@concurrent annotation doesn't work in the OOP script method\nI.E:\r\n\r\n```\r\nclass SomeClass:\r\n    @concurrent [doesn't work, 2 args]\r\n    def request(self, flow):\r\n        pass\r\n\r\n```\n", "before_files": [{"content": "\"\"\"\nThis module provides a @concurrent decorator primitive to\noffload computations from mitmproxy's main master thread.\n\"\"\"\n\nfrom mitmproxy import eventsequence\nfrom mitmproxy.types import basethread\n\n\nclass ScriptThread(basethread.BaseThread):\n    name = \"ScriptThread\"\n\n\ndef concurrent(fn):\n    if fn.__name__ not in eventsequence.Events - {\"start\", \"configure\", \"tick\"}:\n        raise NotImplementedError(\n            \"Concurrent decorator not supported for '%s' method.\" % fn.__name__\n        )\n\n    def _concurrent(obj):\n        def run():\n            fn(obj)\n            if obj.reply.state == \"taken\":\n                if not obj.reply.has_message:\n                    obj.reply.ack()\n                obj.reply.commit()\n        obj.reply.take()\n        ScriptThread(\n            \"script.concurrent (%s)\" % fn.__name__,\n            target=run\n        ).start()\n    return _concurrent\n", "path": "mitmproxy/script/concurrent.py"}], "after_files": [{"content": "\"\"\"\nThis module provides a @concurrent decorator primitive to\noffload computations from mitmproxy's main master thread.\n\"\"\"\n\nfrom mitmproxy import eventsequence\nfrom mitmproxy.types import basethread\n\n\nclass ScriptThread(basethread.BaseThread):\n    name = \"ScriptThread\"\n\n\ndef concurrent(fn):\n    if fn.__name__ not in eventsequence.Events - {\"start\", \"configure\", \"tick\"}:\n        raise NotImplementedError(\n            \"Concurrent decorator not supported for '%s' method.\" % fn.__name__\n        )\n\n    def _concurrent(obj):\n        def run():\n            fn(obj)\n            if obj.reply.state == \"taken\":\n                if not obj.reply.has_message:\n                    obj.reply.ack()\n                obj.reply.commit()\n        obj.reply.take()\n        ScriptThread(\n            \"script.concurrent (%s)\" % fn.__name__,\n            target=run\n        ).start()\n    # Support @concurrent for class-based addons\n    if \".\" in fn.__qualname__:\n        return staticmethod(_concurrent)\n    else:\n        return _concurrent\n", "path": "mitmproxy/script/concurrent.py"}]}