We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Deprecation warning due to invalid escape sequences
## Description

Deprecation warning due to invalid escape sequences. Using raw strings or escaping them again helps in resolving this. Check https://github.com/asottile/pyupgrade/ for automatic fix of this.

## To Reproduce

```
find . -iname '*.py' | grep -Ev 'rdf4|doc|benchmark|tool' | xargs -P4 -I{} python3.8 -Wall -m py_compile {}
./ci/batch/submit-job.py:95: DeprecationWarning: invalid escape sequence \-
  jobName = re.sub('[^A-Za-z0-9_\-]', '', args.name)[:128]  # Enforce AWS Batch jobName rules
```

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `ci/batch/submit-job.py`
Content:
```
1 import argparse
2 import random
3 import re
4 import sys
5 import time
6 from datetime import datetime
7 
8 import boto3
9 from botocore.compat import total_seconds
10 
11 parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
12 
13 parser.add_argument('--profile', help='profile name of aws account.', type=str,
14                     default=None)
15 parser.add_argument('--region', help='Default region when creating new connections', type=str,
16                     default=None)
17 parser.add_argument('--name', help='name of the job', type=str, default='dummy')
18 parser.add_argument('--job-queue', help='name of the job queue to submit this job', type=str,
19                     default='gluon-nlp-jobs')
20 parser.add_argument('--job-definition', help='name of the job job definition', type=str,
21                     default='gluon-nlp-jobs:8')
22 parser.add_argument('--source-ref',
23                     help='ref in GluonNLP main github. e.g. master, refs/pull/500/head',
24                     type=str, default='master')
25 parser.add_argument('--work-dir',
26                     help='working directory inside the repo. e.g. scripts/sentiment_analysis',
27                     type=str, default='scripts/bert')
28 parser.add_argument('--saved-output',
29                     help='output to be saved, relative to working directory. '
30                          'it can be either a single file or a directory',
31                     type=str, default='.')
32 parser.add_argument('--save-path',
33                     help='s3 path where files are saved.',
34                     type=str, default='batch/temp/{}'.format(datetime.now().isoformat()))
35 parser.add_argument('--conda-env',
36                     help='conda environment preset to use.',
37                     type=str, default='gpu/py3')
38 parser.add_argument('--command', help='command to run', type=str,
39                     default='git rev-parse HEAD | tee stdout.log')
40 parser.add_argument('--remote',
41                     help='git repo address. https://github.com/dmlc/gluon-nlp',
42                     type=str, default="https://github.com/dmlc/gluon-nlp")
43 parser.add_argument('--wait', help='block wait until the job completes. '
44                     'Non-zero exit code if job fails.', action='store_true')
45 parser.add_argument('--timeout', help='job timeout in seconds', default=None, type=int)
46 
47 args = parser.parse_args()
48 
49 session = boto3.Session(profile_name=args.profile, region_name=args.region)
50 batch, cloudwatch = [session.client(service_name=sn) for sn in ['batch', 'logs']]
51 
52 def printLogs(logGroupName, logStreamName, startTime):
53     kwargs = {'logGroupName': logGroupName,
54               'logStreamName': logStreamName,
55               'startTime': startTime,
56               'startFromHead': True}
57 
58     lastTimestamp = 0
59     while True:
60         logEvents = cloudwatch.get_log_events(**kwargs)
61 
62         for event in logEvents['events']:
63             lastTimestamp = event['timestamp']
64             timestamp = datetime.utcfromtimestamp(lastTimestamp / 1000.0).isoformat()
65             print('[{}] {}'.format((timestamp + '.000')[:23] + 'Z', event['message']))
66 
67         nextToken = logEvents['nextForwardToken']
68         if nextToken and kwargs.get('nextToken') != nextToken:
69             kwargs['nextToken'] = nextToken
70         else:
71             break
72     return lastTimestamp
73 
74 
75 def getLogStream(logGroupName, jobName, jobId):
76     response = cloudwatch.describe_log_streams(
77         logGroupName=logGroupName,
78         logStreamNamePrefix=jobName + '/' + jobId
79     )
80     logStreams = response['logStreams']
81     if not logStreams:
82         return ''
83     else:
84         return logStreams[0]['logStreamName']
85 
86 def nowInMillis():
87     endTime = long(total_seconds(datetime.utcnow() - datetime(1970, 1, 1))) * 1000
88     return endTime
89 
90 
91 def main():
92     spin = ['-', '/', '|', '\\', '-', '/', '|', '\\']
93     logGroupName = '/aws/batch/job'
94 
95     jobName = re.sub('[^A-Za-z0-9_\-]', '', args.name)[:128]  # Enforce AWS Batch jobName rules
96     jobQueue = args.job_queue
97     jobDefinition = args.job_definition
98     command = args.command.split()
99     wait = args.wait
100 
101     parameters={
102         'SOURCE_REF': args.source_ref,
103         'WORK_DIR': args.work_dir,
104         'SAVED_OUTPUT': args.saved_output,
105         'SAVE_PATH': args.save_path,
106         'CONDA_ENV': args.conda_env,
107         'COMMAND': args.command,
108         'REMOTE': args.remote
109     }
110     kwargs = dict(
111         jobName=jobName,
112         jobQueue=jobQueue,
113         jobDefinition=jobDefinition,
114         parameters=parameters,
115     )
116     if args.timeout is not None:
117         kwargs['timeout'] = {'attemptDurationSeconds': args.timeout}
118     submitJobResponse = batch.submit_job(**kwargs)
119 
120     jobId = submitJobResponse['jobId']
121     print('Submitted job [{} - {}] to the job queue [{}]'.format(jobName, jobId, jobQueue))
122 
123     spinner = 0
124     running = False
125     status_set = set()
126     startTime = 0
127 
128     while wait:
129         time.sleep(random.randint(5, 10))
130         describeJobsResponse = batch.describe_jobs(jobs=[jobId])
131         status = describeJobsResponse['jobs'][0]['status']
132         if status == 'SUCCEEDED' or status == 'FAILED':
133             print('=' * 80)
134             print('Job [{} - {}] {}'.format(jobName, jobId, status))
135 
136             sys.exit(status == 'FAILED')
137 
138         elif status == 'RUNNING':
139             logStreamName = getLogStream(logGroupName, jobName, jobId)
140             if not running:
141                 running = True
142                 print('\rJob [{} - {}] is RUNNING.'.format(jobName, jobId))
143                 if logStreamName:
144                     print('Output [{}]:\n {}'.format(logStreamName, '=' * 80))
145             if logStreamName:
146                 startTime = printLogs(logGroupName, logStreamName, startTime) + 1
147         elif status not in status_set:
148             status_set.add(status)
149             print('\rJob [%s - %s] is %-9s... %s' % (jobName, jobId, status, spin[spinner % len(spin)]),)
150             sys.stdout.flush()
151             spinner += 1
152 
153 if __name__ == '__main__':
154     main()
155
```
--- 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/ci/batch/submit-job.py b/ci/batch/submit-job.py
--- a/ci/batch/submit-job.py
+++ b/ci/batch/submit-job.py
@@ -92,7 +92,7 @@
     spin = ['-', '/', '|', '\\', '-', '/', '|', '\\']
     logGroupName = '/aws/batch/job'
 
-    jobName = re.sub('[^A-Za-z0-9_\-]', '', args.name)[:128]  # Enforce AWS Batch jobName rules
+    jobName = re.sub(r'[^A-Za-z0-9_\-]', '', args.name)[:128]  # Enforce AWS Batch jobName rules
     jobQueue = args.job_queue
     jobDefinition = args.job_definition
     command = args.command.split()

{"golden_diff": "diff --git a/ci/batch/submit-job.py b/ci/batch/submit-job.py\n--- a/ci/batch/submit-job.py\n+++ b/ci/batch/submit-job.py\n@@ -92,7 +92,7 @@\n     spin = ['-', '/', '|', '\\\\', '-', '/', '|', '\\\\']\n     logGroupName = '/aws/batch/job'\n \n-    jobName = re.sub('[^A-Za-z0-9_\\-]', '', args.name)[:128]  # Enforce AWS Batch jobName rules\n+    jobName = re.sub(r'[^A-Za-z0-9_\\-]', '', args.name)[:128]  # Enforce AWS Batch jobName rules\n     jobQueue = args.job_queue\n     jobDefinition = args.job_definition\n     command = args.command.split()\n", "issue": "Deprecation warning due to invalid escape sequences\n## Description\r\n\r\nDeprecation warning due to invalid escape sequences. Using raw strings or escaping them again helps in resolving this. Check https://github.com/asottile/pyupgrade/ for automatic fix of this.\r\n\r\n## To Reproduce\r\n\r\n```\r\nfind . -iname '*.py' | grep -Ev 'rdf4|doc|benchmark|tool' | xargs -P4 -I{} python3.8 -Wall -m py_compile {}\r\n./ci/batch/submit-job.py:95: DeprecationWarning: invalid escape sequence \\-\r\n  jobName = re.sub('[^A-Za-z0-9_\\-]', '', args.name)[:128]  # Enforce AWS Batch jobName rules\r\n```\n", "before_files": [{"content": "import argparse\nimport random\nimport re\nimport sys\nimport time\nfrom datetime import datetime\n\nimport boto3\nfrom botocore.compat import total_seconds\n\nparser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)\n\nparser.add_argument('--profile', help='profile name of aws account.', type=str,\n                    default=None)\nparser.add_argument('--region', help='Default region when creating new connections', type=str,\n                    default=None)\nparser.add_argument('--name', help='name of the job', type=str, default='dummy')\nparser.add_argument('--job-queue', help='name of the job queue to submit this job', type=str,\n                    default='gluon-nlp-jobs')\nparser.add_argument('--job-definition', help='name of the job job definition', type=str,\n                    default='gluon-nlp-jobs:8')\nparser.add_argument('--source-ref',\n                    help='ref in GluonNLP main github. e.g. master, refs/pull/500/head',\n                    type=str, default='master')\nparser.add_argument('--work-dir',\n                    help='working directory inside the repo. e.g. scripts/sentiment_analysis',\n                    type=str, default='scripts/bert')\nparser.add_argument('--saved-output',\n                    help='output to be saved, relative to working directory. '\n                         'it can be either a single file or a directory',\n                    type=str, default='.')\nparser.add_argument('--save-path',\n                    help='s3 path where files are saved.',\n                    type=str, default='batch/temp/{}'.format(datetime.now().isoformat()))\nparser.add_argument('--conda-env',\n                    help='conda environment preset to use.',\n                    type=str, default='gpu/py3')\nparser.add_argument('--command', help='command to run', type=str,\n                    default='git rev-parse HEAD | tee stdout.log')\nparser.add_argument('--remote',\n                    help='git repo address. https://github.com/dmlc/gluon-nlp',\n                    type=str, default=\"https://github.com/dmlc/gluon-nlp\")\nparser.add_argument('--wait', help='block wait until the job completes. '\n                    'Non-zero exit code if job fails.', action='store_true')\nparser.add_argument('--timeout', help='job timeout in seconds', default=None, type=int)\n\nargs = parser.parse_args()\n\nsession = boto3.Session(profile_name=args.profile, region_name=args.region)\nbatch, cloudwatch = [session.client(service_name=sn) for sn in ['batch', 'logs']]\n\ndef printLogs(logGroupName, logStreamName, startTime):\n    kwargs = {'logGroupName': logGroupName,\n              'logStreamName': logStreamName,\n              'startTime': startTime,\n              'startFromHead': True}\n\n    lastTimestamp = 0\n    while True:\n        logEvents = cloudwatch.get_log_events(**kwargs)\n\n        for event in logEvents['events']:\n            lastTimestamp = event['timestamp']\n            timestamp = datetime.utcfromtimestamp(lastTimestamp / 1000.0).isoformat()\n            print('[{}] {}'.format((timestamp + '.000')[:23] + 'Z', event['message']))\n\n        nextToken = logEvents['nextForwardToken']\n        if nextToken and kwargs.get('nextToken') != nextToken:\n            kwargs['nextToken'] = nextToken\n        else:\n            break\n    return lastTimestamp\n\n\ndef getLogStream(logGroupName, jobName, jobId):\n    response = cloudwatch.describe_log_streams(\n        logGroupName=logGroupName,\n        logStreamNamePrefix=jobName + '/' + jobId\n    )\n    logStreams = response['logStreams']\n    if not logStreams:\n        return ''\n    else:\n        return logStreams[0]['logStreamName']\n\ndef nowInMillis():\n    endTime = long(total_seconds(datetime.utcnow() - datetime(1970, 1, 1))) * 1000\n    return endTime\n\n\ndef main():\n    spin = ['-', '/', '|', '\\\\', '-', '/', '|', '\\\\']\n    logGroupName = '/aws/batch/job'\n\n    jobName = re.sub('[^A-Za-z0-9_\\-]', '', args.name)[:128]  # Enforce AWS Batch jobName rules\n    jobQueue = args.job_queue\n    jobDefinition = args.job_definition\n    command = args.command.split()\n    wait = args.wait\n\n    parameters={\n        'SOURCE_REF': args.source_ref,\n        'WORK_DIR': args.work_dir,\n        'SAVED_OUTPUT': args.saved_output,\n        'SAVE_PATH': args.save_path,\n        'CONDA_ENV': args.conda_env,\n        'COMMAND': args.command,\n        'REMOTE': args.remote\n    }\n    kwargs = dict(\n        jobName=jobName,\n        jobQueue=jobQueue,\n        jobDefinition=jobDefinition,\n        parameters=parameters,\n    )\n    if args.timeout is not None:\n        kwargs['timeout'] = {'attemptDurationSeconds': args.timeout}\n    submitJobResponse = batch.submit_job(**kwargs)\n\n    jobId = submitJobResponse['jobId']\n    print('Submitted job [{} - {}] to the job queue [{}]'.format(jobName, jobId, jobQueue))\n\n    spinner = 0\n    running = False\n    status_set = set()\n    startTime = 0\n\n    while wait:\n        time.sleep(random.randint(5, 10))\n        describeJobsResponse = batch.describe_jobs(jobs=[jobId])\n        status = describeJobsResponse['jobs'][0]['status']\n        if status == 'SUCCEEDED' or status == 'FAILED':\n            print('=' * 80)\n            print('Job [{} - {}] {}'.format(jobName, jobId, status))\n\n            sys.exit(status == 'FAILED')\n\n        elif status == 'RUNNING':\n            logStreamName = getLogStream(logGroupName, jobName, jobId)\n            if not running:\n                running = True\n                print('\\rJob [{} - {}] is RUNNING.'.format(jobName, jobId))\n                if logStreamName:\n                    print('Output [{}]:\\n {}'.format(logStreamName, '=' * 80))\n            if logStreamName:\n                startTime = printLogs(logGroupName, logStreamName, startTime) + 1\n        elif status not in status_set:\n            status_set.add(status)\n            print('\\rJob [%s - %s] is %-9s... %s' % (jobName, jobId, status, spin[spinner % len(spin)]),)\n            sys.stdout.flush()\n            spinner += 1\n\nif __name__ == '__main__':\n    main()\n", "path": "ci/batch/submit-job.py"}], "after_files": [{"content": "import argparse\nimport random\nimport re\nimport sys\nimport time\nfrom datetime import datetime\n\nimport boto3\nfrom botocore.compat import total_seconds\n\nparser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)\n\nparser.add_argument('--profile', help='profile name of aws account.', type=str,\n                    default=None)\nparser.add_argument('--region', help='Default region when creating new connections', type=str,\n                    default=None)\nparser.add_argument('--name', help='name of the job', type=str, default='dummy')\nparser.add_argument('--job-queue', help='name of the job queue to submit this job', type=str,\n                    default='gluon-nlp-jobs')\nparser.add_argument('--job-definition', help='name of the job job definition', type=str,\n                    default='gluon-nlp-jobs:8')\nparser.add_argument('--source-ref',\n                    help='ref in GluonNLP main github. e.g. master, refs/pull/500/head',\n                    type=str, default='master')\nparser.add_argument('--work-dir',\n                    help='working directory inside the repo. e.g. scripts/sentiment_analysis',\n                    type=str, default='scripts/bert')\nparser.add_argument('--saved-output',\n                    help='output to be saved, relative to working directory. '\n                         'it can be either a single file or a directory',\n                    type=str, default='.')\nparser.add_argument('--save-path',\n                    help='s3 path where files are saved.',\n                    type=str, default='batch/temp/{}'.format(datetime.now().isoformat()))\nparser.add_argument('--conda-env',\n                    help='conda environment preset to use.',\n                    type=str, default='gpu/py3')\nparser.add_argument('--command', help='command to run', type=str,\n                    default='git rev-parse HEAD | tee stdout.log')\nparser.add_argument('--remote',\n                    help='git repo address. https://github.com/dmlc/gluon-nlp',\n                    type=str, default=\"https://github.com/dmlc/gluon-nlp\")\nparser.add_argument('--wait', help='block wait until the job completes. '\n                    'Non-zero exit code if job fails.', action='store_true')\nparser.add_argument('--timeout', help='job timeout in seconds', default=None, type=int)\n\nargs = parser.parse_args()\n\nsession = boto3.Session(profile_name=args.profile, region_name=args.region)\nbatch, cloudwatch = [session.client(service_name=sn) for sn in ['batch', 'logs']]\n\ndef printLogs(logGroupName, logStreamName, startTime):\n    kwargs = {'logGroupName': logGroupName,\n              'logStreamName': logStreamName,\n              'startTime': startTime,\n              'startFromHead': True}\n\n    lastTimestamp = 0\n    while True:\n        logEvents = cloudwatch.get_log_events(**kwargs)\n\n        for event in logEvents['events']:\n            lastTimestamp = event['timestamp']\n            timestamp = datetime.utcfromtimestamp(lastTimestamp / 1000.0).isoformat()\n            print('[{}] {}'.format((timestamp + '.000')[:23] + 'Z', event['message']))\n\n        nextToken = logEvents['nextForwardToken']\n        if nextToken and kwargs.get('nextToken') != nextToken:\n            kwargs['nextToken'] = nextToken\n        else:\n            break\n    return lastTimestamp\n\n\ndef getLogStream(logGroupName, jobName, jobId):\n    response = cloudwatch.describe_log_streams(\n        logGroupName=logGroupName,\n        logStreamNamePrefix=jobName + '/' + jobId\n    )\n    logStreams = response['logStreams']\n    if not logStreams:\n        return ''\n    else:\n        return logStreams[0]['logStreamName']\n\ndef nowInMillis():\n    endTime = long(total_seconds(datetime.utcnow() - datetime(1970, 1, 1))) * 1000\n    return endTime\n\n\ndef main():\n    spin = ['-', '/', '|', '\\\\', '-', '/', '|', '\\\\']\n    logGroupName = '/aws/batch/job'\n\n    jobName = re.sub(r'[^A-Za-z0-9_\\-]', '', args.name)[:128]  # Enforce AWS Batch jobName rules\n    jobQueue = args.job_queue\n    jobDefinition = args.job_definition\n    command = args.command.split()\n    wait = args.wait\n\n    parameters={\n        'SOURCE_REF': args.source_ref,\n        'WORK_DIR': args.work_dir,\n        'SAVED_OUTPUT': args.saved_output,\n        'SAVE_PATH': args.save_path,\n        'CONDA_ENV': args.conda_env,\n        'COMMAND': args.command,\n        'REMOTE': args.remote\n    }\n    kwargs = dict(\n        jobName=jobName,\n        jobQueue=jobQueue,\n        jobDefinition=jobDefinition,\n        parameters=parameters,\n    )\n    if args.timeout is not None:\n        kwargs['timeout'] = {'attemptDurationSeconds': args.timeout}\n    submitJobResponse = batch.submit_job(**kwargs)\n\n    jobId = submitJobResponse['jobId']\n    print('Submitted job [{} - {}] to the job queue [{}]'.format(jobName, jobId, jobQueue))\n\n    spinner = 0\n    running = False\n    status_set = set()\n    startTime = 0\n\n    while wait:\n        time.sleep(random.randint(5, 10))\n        describeJobsResponse = batch.describe_jobs(jobs=[jobId])\n        status = describeJobsResponse['jobs'][0]['status']\n        if status == 'SUCCEEDED' or status == 'FAILED':\n            print('=' * 80)\n            print('Job [{} - {}] {}'.format(jobName, jobId, status))\n\n            sys.exit(status == 'FAILED')\n\n        elif status == 'RUNNING':\n            logStreamName = getLogStream(logGroupName, jobName, jobId)\n            if not running:\n                running = True\n                print('\\rJob [{} - {}] is RUNNING.'.format(jobName, jobId))\n                if logStreamName:\n                    print('Output [{}]:\\n {}'.format(logStreamName, '=' * 80))\n            if logStreamName:\n                startTime = printLogs(logGroupName, logStreamName, startTime) + 1\n        elif status not in status_set:\n            status_set.add(status)\n            print('\\rJob [%s - %s] is %-9s... %s' % (jobName, jobId, status, spin[spinner % len(spin)]),)\n            sys.stdout.flush()\n            spinner += 1\n\nif __name__ == '__main__':\n    main()\n", "path": "ci/batch/submit-job.py"}]}