prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <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
  
  ```
  
  </issue>
  <code>
  [start of mitmproxy/script/concurrent.py]
  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 of mitmproxy/script/concurrent.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
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"}]}