We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
pathoc does not accept `:pa,f` to pause forever at end of message
##### Steps to reproduce the problem:

`pathoc www.example.com 'get:/:pa,f'`
##### What is the expected behavior?

Send request, but pause forever after sending.
##### What went wrong?

I get a stack trace with "a float is required".

```
$ pathoc www.example.com 'get:/:pa,f'
08-09-16 16:59:41: >> 'GET':/:pa,f
Traceback (most recent call last):
  File "/usr/local/bin/pathoc", line 11, in <module>
    sys.exit(go_pathoc())
  File "/usr/local/lib/python2.7/dist-packages/pathod/pathoc_cmdline.py", line 226, in go_pathoc
    pathoc.main(args)
  File "/usr/local/lib/python2.7/dist-packages/pathod/pathoc.py", line 522, in main
    ret = p.request(spec)
  File "/usr/local/lib/python2.7/dist-packages/pathod/pathoc.py", line 452, in request
    return self.http(r)
  File "/usr/local/lib/python2.7/dist-packages/pathod/pathoc.py", line 432, in http
    return resp
  File "/usr/local/lib/python2.7/dist-packages/pathod/pathoc.py", line 411, in http
    req = language.serve(r, self.wfile, self.settings)
  File "/usr/local/lib/python2.7/dist-packages/pathod/language/__init__.py", line 105, in serve
    disconnect = writer.write_values(fp, vals, actions[:])
  File "/usr/local/lib/python2.7/dist-packages/pathod/language/writer.py", line 61, in write_values
    time.sleep(a[2])
TypeError: a float is required
```
##### Any other comments? What have you tried so far?

All other combinations of pause flags work as expected:

```
$ pathoc www.example.com 'get:/:p2,5'
08-09-16 17:05:07: >> 'GET':/:p2,5
<< 200 OK: 1270 bytes
$ pathoc www.example.com 'get:/:pr,5'
08-09-16 17:05:21: >> 'GET':/:pr,5
<< 200 OK: 1270 bytes
$ pathoc www.example.com 'get:/:pa,5'
08-09-16 17:05:41: >> 'GET':/:pa,5
<< 200 OK: 1270 bytes
$ pathoc www.example.com 'get:/:p2,f'
^C08-09-16 17:04:46: >> 'GET':/:p2,f
$ pathoc www.example.com 'get:/:pr,f'
^C08-09-16 17:04:55: >> 'GET':/:pr,f
```

---

pathoc version: 0.17
Operating System: Debian Linux 8.5 "Jessie" x64


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `pathod/language/writer.py`
Content:
```
1 import time
2 from mitmproxy import exceptions
3 
4 BLOCKSIZE = 1024
5 # It's not clear what the upper limit for time.sleep is. It's lower than the
6 # maximum int or float. 1 year should do.
7 FOREVER = 60 * 60 * 24 * 365
8 
9 
10 def send_chunk(fp, val, blocksize, start, end):
11     """
12         (start, end): Inclusive lower bound, exclusive upper bound.
13     """
14     for i in range(start, end, blocksize):
15         fp.write(
16             val[i:min(i + blocksize, end)]
17         )
18     return end - start
19 
20 
21 def write_values(fp, vals, actions, sofar=0, blocksize=BLOCKSIZE):
22     """
23         vals: A list of values, which may be strings or Value objects.
24 
25         actions: A list of (offset, action, arg) tuples. Action may be "inject",
26         "pause" or "disconnect".
27 
28         Both vals and actions are in reverse order, with the first items last.
29 
30         Return True if connection should disconnect.
31     """
32     sofar = 0
33     try:
34         while vals:
35             v = vals.pop()
36             offset = 0
37             while actions and actions[-1][0] < (sofar + len(v)):
38                 a = actions.pop()
39                 offset += send_chunk(
40                     fp,
41                     v,
42                     blocksize,
43                     offset,
44                     a[0] - sofar - offset
45                 )
46                 if a[1] == "pause":
47                     time.sleep(
48                         FOREVER if a[2] == "f" else a[2]
49                     )
50                 elif a[1] == "disconnect":
51                     return True
52                 elif a[1] == "inject":
53                     send_chunk(fp, a[2], blocksize, 0, len(a[2]))
54             send_chunk(fp, v, blocksize, offset, len(v))
55             sofar += len(v)
56         # Remainders
57         while actions:
58             a = actions.pop()
59             if a[1] == "pause":
60                 time.sleep(a[2])
61             elif a[1] == "disconnect":
62                 return True
63             elif a[1] == "inject":
64                 send_chunk(fp, a[2], blocksize, 0, len(a[2]))
65     except exceptions.TcpDisconnect:  # pragma: no cover
66         return True
67
```
--- 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()

```

diff --git a/pathod/language/writer.py b/pathod/language/writer.py
--- a/pathod/language/writer.py
+++ b/pathod/language/writer.py
@@ -57,7 +57,9 @@
         while actions:
             a = actions.pop()
             if a[1] == "pause":
-                time.sleep(a[2])
+                time.sleep(
+                    FOREVER if a[2] == "f" else a[2]
+                )
             elif a[1] == "disconnect":
                 return True
             elif a[1] == "inject":

{"golden_diff": "diff --git a/pathod/language/writer.py b/pathod/language/writer.py\n--- a/pathod/language/writer.py\n+++ b/pathod/language/writer.py\n@@ -57,7 +57,9 @@\n         while actions:\n             a = actions.pop()\n             if a[1] == \"pause\":\n-                time.sleep(a[2])\n+                time.sleep(\n+                    FOREVER if a[2] == \"f\" else a[2]\n+                )\n             elif a[1] == \"disconnect\":\n                 return True\n             elif a[1] == \"inject\":\n", "issue": "pathoc does not accept `:pa,f` to pause forever at end of message\n##### Steps to reproduce the problem:\n\n`pathoc www.example.com 'get:/:pa,f'`\n##### What is the expected behavior?\n\nSend request, but pause forever after sending.\n##### What went wrong?\n\nI get a stack trace with \"a float is required\".\n\n```\n$ pathoc www.example.com 'get:/:pa,f'\n08-09-16 16:59:41: >> 'GET':/:pa,f\nTraceback (most recent call last):\n  File \"/usr/local/bin/pathoc\", line 11, in <module>\n    sys.exit(go_pathoc())\n  File \"/usr/local/lib/python2.7/dist-packages/pathod/pathoc_cmdline.py\", line 226, in go_pathoc\n    pathoc.main(args)\n  File \"/usr/local/lib/python2.7/dist-packages/pathod/pathoc.py\", line 522, in main\n    ret = p.request(spec)\n  File \"/usr/local/lib/python2.7/dist-packages/pathod/pathoc.py\", line 452, in request\n    return self.http(r)\n  File \"/usr/local/lib/python2.7/dist-packages/pathod/pathoc.py\", line 432, in http\n    return resp\n  File \"/usr/local/lib/python2.7/dist-packages/pathod/pathoc.py\", line 411, in http\n    req = language.serve(r, self.wfile, self.settings)\n  File \"/usr/local/lib/python2.7/dist-packages/pathod/language/__init__.py\", line 105, in serve\n    disconnect = writer.write_values(fp, vals, actions[:])\n  File \"/usr/local/lib/python2.7/dist-packages/pathod/language/writer.py\", line 61, in write_values\n    time.sleep(a[2])\nTypeError: a float is required\n```\n##### Any other comments? What have you tried so far?\n\nAll other combinations of pause flags work as expected:\n\n```\n$ pathoc www.example.com 'get:/:p2,5'\n08-09-16 17:05:07: >> 'GET':/:p2,5\n<< 200 OK: 1270 bytes\n$ pathoc www.example.com 'get:/:pr,5'\n08-09-16 17:05:21: >> 'GET':/:pr,5\n<< 200 OK: 1270 bytes\n$ pathoc www.example.com 'get:/:pa,5'\n08-09-16 17:05:41: >> 'GET':/:pa,5\n<< 200 OK: 1270 bytes\n$ pathoc www.example.com 'get:/:p2,f'\n^C08-09-16 17:04:46: >> 'GET':/:p2,f\n$ pathoc www.example.com 'get:/:pr,f'\n^C08-09-16 17:04:55: >> 'GET':/:pr,f\n```\n\n---\n\npathoc version: 0.17\nOperating System: Debian Linux 8.5 \"Jessie\" x64\n\n", "before_files": [{"content": "import time\nfrom mitmproxy import exceptions\n\nBLOCKSIZE = 1024\n# It's not clear what the upper limit for time.sleep is. It's lower than the\n# maximum int or float. 1 year should do.\nFOREVER = 60 * 60 * 24 * 365\n\n\ndef send_chunk(fp, val, blocksize, start, end):\n    \"\"\"\n        (start, end): Inclusive lower bound, exclusive upper bound.\n    \"\"\"\n    for i in range(start, end, blocksize):\n        fp.write(\n            val[i:min(i + blocksize, end)]\n        )\n    return end - start\n\n\ndef write_values(fp, vals, actions, sofar=0, blocksize=BLOCKSIZE):\n    \"\"\"\n        vals: A list of values, which may be strings or Value objects.\n\n        actions: A list of (offset, action, arg) tuples. Action may be \"inject\",\n        \"pause\" or \"disconnect\".\n\n        Both vals and actions are in reverse order, with the first items last.\n\n        Return True if connection should disconnect.\n    \"\"\"\n    sofar = 0\n    try:\n        while vals:\n            v = vals.pop()\n            offset = 0\n            while actions and actions[-1][0] < (sofar + len(v)):\n                a = actions.pop()\n                offset += send_chunk(\n                    fp,\n                    v,\n                    blocksize,\n                    offset,\n                    a[0] - sofar - offset\n                )\n                if a[1] == \"pause\":\n                    time.sleep(\n                        FOREVER if a[2] == \"f\" else a[2]\n                    )\n                elif a[1] == \"disconnect\":\n                    return True\n                elif a[1] == \"inject\":\n                    send_chunk(fp, a[2], blocksize, 0, len(a[2]))\n            send_chunk(fp, v, blocksize, offset, len(v))\n            sofar += len(v)\n        # Remainders\n        while actions:\n            a = actions.pop()\n            if a[1] == \"pause\":\n                time.sleep(a[2])\n            elif a[1] == \"disconnect\":\n                return True\n            elif a[1] == \"inject\":\n                send_chunk(fp, a[2], blocksize, 0, len(a[2]))\n    except exceptions.TcpDisconnect:  # pragma: no cover\n        return True\n", "path": "pathod/language/writer.py"}], "after_files": [{"content": "import time\nfrom mitmproxy import exceptions\n\nBLOCKSIZE = 1024\n# It's not clear what the upper limit for time.sleep is. It's lower than the\n# maximum int or float. 1 year should do.\nFOREVER = 60 * 60 * 24 * 365\n\n\ndef send_chunk(fp, val, blocksize, start, end):\n    \"\"\"\n        (start, end): Inclusive lower bound, exclusive upper bound.\n    \"\"\"\n    for i in range(start, end, blocksize):\n        fp.write(\n            val[i:min(i + blocksize, end)]\n        )\n    return end - start\n\n\ndef write_values(fp, vals, actions, sofar=0, blocksize=BLOCKSIZE):\n    \"\"\"\n        vals: A list of values, which may be strings or Value objects.\n\n        actions: A list of (offset, action, arg) tuples. Action may be \"inject\",\n        \"pause\" or \"disconnect\".\n\n        Both vals and actions are in reverse order, with the first items last.\n\n        Return True if connection should disconnect.\n    \"\"\"\n    sofar = 0\n    try:\n        while vals:\n            v = vals.pop()\n            offset = 0\n            while actions and actions[-1][0] < (sofar + len(v)):\n                a = actions.pop()\n                offset += send_chunk(\n                    fp,\n                    v,\n                    blocksize,\n                    offset,\n                    a[0] - sofar - offset\n                )\n                if a[1] == \"pause\":\n                    time.sleep(\n                        FOREVER if a[2] == \"f\" else a[2]\n                    )\n                elif a[1] == \"disconnect\":\n                    return True\n                elif a[1] == \"inject\":\n                    send_chunk(fp, a[2], blocksize, 0, len(a[2]))\n            send_chunk(fp, v, blocksize, offset, len(v))\n            sofar += len(v)\n        # Remainders\n        while actions:\n            a = actions.pop()\n            if a[1] == \"pause\":\n                time.sleep(\n                    FOREVER if a[2] == \"f\" else a[2]\n                )\n            elif a[1] == \"disconnect\":\n                return True\n            elif a[1] == \"inject\":\n                send_chunk(fp, a[2], blocksize, 0, len(a[2]))\n    except exceptions.TcpDisconnect:  # pragma: no cover\n        return True\n", "path": "pathod/language/writer.py"}]}