We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Remove unicode_literals import in the CLI code
Looks like this can cause some issues with Click, I've not seen any but we should probably remove it anyway or we will start to get warnings from Click 5.0.

https://github.com/mitsuhiko/click/commit/5f337705f68bdfa66d7c7a9fe7fc5d6bfd48db94


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `mkdocs/__main__.py`
Content:
```
1 #!/usr/bin/env python
2 # coding: utf-8
3 
4 from __future__ import unicode_literals
5 import logging
6 import click
7 import socket
8 
9 from mkdocs import __version__
10 from mkdocs import utils
11 from mkdocs import exceptions
12 from mkdocs.config import load_config
13 from mkdocs.commands import build, gh_deploy, new, serve
14 
15 log = logging.getLogger(__name__)
16 
17 
18 class State(object):
19     ''' Maintain logging level.'''
20 
21     def __init__(self, log_name='mkdocs', level=logging.INFO):
22         self.logger = logging.getLogger(log_name)
23         self.logger.propagate = False
24         stream = logging.StreamHandler()
25         formatter = logging.Formatter("%(levelname)-7s -  %(message)s ")
26         stream.setFormatter(formatter)
27         self.logger.addHandler(stream)
28 
29         self.logger.setLevel(level)
30 
31 
32 pass_state = click.make_pass_decorator(State, ensure=True)
33 
34 
35 def verbose_option(f):
36     def callback(ctx, param, value):
37         state = ctx.ensure_object(State)
38         if value:
39             state.logger.setLevel(logging.DEBUG)
40     return click.option('-v', '--verbose',
41                         is_flag=True,
42                         expose_value=False,
43                         help='Enable verbose output',
44                         callback=callback)(f)
45 
46 
47 def quiet_option(f):
48     def callback(ctx, param, value):
49         state = ctx.ensure_object(State)
50         if value:
51             state.logger.setLevel(logging.ERROR)
52     return click.option('-q', '--quiet',
53                         is_flag=True,
54                         expose_value=False,
55                         help='Silence warnings',
56                         callback=callback)(f)
57 
58 
59 def common_options(f):
60     f = verbose_option(f)
61     f = quiet_option(f)
62     return f
63 
64 
65 clean_help = "Remove old files from the site_dir before building"
66 config_help = "Provide a specific MkDocs config"
67 dev_addr_help = ("IP address and port to serve documentation locally (default: "
68                  "localhost:8000)")
69 strict_help = ("Enable strict mode. This will cause MkDocs to abort the build "
70                "on any warnings.")
71 theme_help = "The theme to use when building your documentation."
72 theme_choices = utils.get_theme_names()
73 site_dir_help = "The directory to output the result of the documentation build."
74 reload_help = "Enable and disable the live reloading in the development server."
75 commit_message_help = ("A commit message to use when commiting to the "
76                        "Github Pages remote branch")
77 remote_branch_help = ("The remote branch to commit to for Github Pages. This "
78                       "overrides the value specified in config")
79 
80 
81 @click.group(context_settings={'help_option_names': ['-h', '--help']})
82 @click.version_option(__version__, '-V', '--version')
83 @common_options
84 def cli():
85     """
86     MkDocs - Project documentation with Markdown.
87     """
88 
89 
90 @cli.command(name="serve")
91 @click.option('-f', '--config-file', type=click.File('rb'), help=config_help)
92 @click.option('-a', '--dev-addr', help=dev_addr_help, metavar='<IP:PORT>')
93 @click.option('-s', '--strict', is_flag=True, help=strict_help)
94 @click.option('-t', '--theme', type=click.Choice(theme_choices), help=theme_help)
95 @click.option('--livereload/--no-livereload', default=True, help=reload_help)
96 @common_options
97 def serve_command(dev_addr, config_file, strict, theme, livereload):
98     """Run the builtin development server"""
99 
100     logging.getLogger('tornado').setLevel(logging.WARNING)
101 
102     try:
103         serve.serve(
104             config_file=config_file,
105             dev_addr=dev_addr,
106             strict=strict,
107             theme=theme,
108             livereload=livereload,
109         )
110     except (exceptions.ConfigurationError, socket.error) as e:
111         # Avoid ugly, unhelpful traceback
112         raise SystemExit('\n' + str(e))
113 
114 
115 @cli.command(name="build")
116 @click.option('-c', '--clean', is_flag=True, help=clean_help)
117 @click.option('-f', '--config-file', type=click.File('rb'), help=config_help)
118 @click.option('-s', '--strict', is_flag=True, help=strict_help)
119 @click.option('-t', '--theme', type=click.Choice(theme_choices), help=theme_help)
120 @click.option('-d', '--site-dir', type=click.Path(), help=site_dir_help)
121 @common_options
122 def build_command(clean, config_file, strict, theme, site_dir):
123     """Build the MkDocs documentation"""
124     try:
125         build.build(load_config(
126             config_file=config_file,
127             strict=strict,
128             theme=theme,
129             site_dir=site_dir
130         ), clean_site_dir=clean)
131     except exceptions.ConfigurationError as e:
132         # Avoid ugly, unhelpful traceback
133         raise SystemExit('\n' + str(e))
134 
135 
136 @cli.command(name="json")
137 @click.option('-c', '--clean', is_flag=True, help=clean_help)
138 @click.option('-f', '--config-file', type=click.File('rb'), help=config_help)
139 @click.option('-s', '--strict', is_flag=True, help=strict_help)
140 @click.option('-d', '--site-dir', type=click.Path(), help=site_dir_help)
141 @common_options
142 def json_command(clean, config_file, strict, site_dir):
143     """Build the MkDocs documentation to JSON files
144 
145     Rather than building your documentation to HTML pages, this
146     outputs each page in a simple JSON format. This command is
147     useful if you want to index your documentation in an external
148     search engine.
149     """
150 
151     log.warning("The json command is deprecated and will be removed in a "
152                 "future MkDocs release. For details on updating: "
153                 "http://www.mkdocs.org/about/release-notes/")
154 
155     try:
156         build.build(load_config(
157             config_file=config_file,
158             strict=strict,
159             site_dir=site_dir
160         ), dump_json=True, clean_site_dir=clean)
161     except exceptions.ConfigurationError as e:
162         # Avoid ugly, unhelpful traceback
163         raise SystemExit('\n' + str(e))
164 
165 
166 @cli.command(name="gh-deploy")
167 @click.option('-c', '--clean', is_flag=True, help=clean_help)
168 @click.option('-f', '--config-file', type=click.File('rb'), help=config_help)
169 @click.option('-m', '--message', help=commit_message_help)
170 @click.option('-b', '--remote-branch', help=remote_branch_help)
171 @click.option('-r', '--remote-name', help=remote_branch_help)
172 @common_options
173 def gh_deploy_command(config_file, clean, message, remote_branch, remote_name):
174     """Deploy your documentation to GitHub Pages"""
175     try:
176         config = load_config(
177             config_file=config_file,
178             remote_branch=remote_branch,
179             remote_name=remote_name
180         )
181         build.build(config, clean_site_dir=clean)
182         gh_deploy.gh_deploy(config, message=message)
183     except exceptions.ConfigurationError as e:
184         # Avoid ugly, unhelpful traceback
185         raise SystemExit('\n' + str(e))
186 
187 
188 @cli.command(name="new")
189 @click.argument("project_directory")
190 @common_options
191 def new_command(project_directory):
192     """Create a new MkDocs project"""
193     new.new(project_directory)
194 
195 if __name__ == '__main__':
196     cli()
197
```
--- 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/mkdocs/__main__.py b/mkdocs/__main__.py
--- a/mkdocs/__main__.py
+++ b/mkdocs/__main__.py
@@ -14,6 +14,11 @@
 
 log = logging.getLogger(__name__)
 
+# Disable the warning that Click displays (as of Click version 5.0) when users
+# use unicode_literals in Python 2.
+# See http://click.pocoo.org/dev/python3/#unicode-literals for more details.
+click.disable_unicode_literals_warning = True
+
 
 class State(object):
     ''' Maintain logging level.'''

{"golden_diff": "diff --git a/mkdocs/__main__.py b/mkdocs/__main__.py\n--- a/mkdocs/__main__.py\n+++ b/mkdocs/__main__.py\n@@ -14,6 +14,11 @@\n \n log = logging.getLogger(__name__)\n \n+# Disable the warning that Click displays (as of Click version 5.0) when users\n+# use unicode_literals in Python 2.\n+# See http://click.pocoo.org/dev/python3/#unicode-literals for more details.\n+click.disable_unicode_literals_warning = True\n+\n \n class State(object):\n     ''' Maintain logging level.'''\n", "issue": "Remove unicode_literals import in the CLI code\nLooks like this can cause some issues with Click, I've not seen any but we should probably remove it anyway or we will start to get warnings from Click 5.0.\n\nhttps://github.com/mitsuhiko/click/commit/5f337705f68bdfa66d7c7a9fe7fc5d6bfd48db94\n\n", "before_files": [{"content": "#!/usr/bin/env python\n# coding: utf-8\n\nfrom __future__ import unicode_literals\nimport logging\nimport click\nimport socket\n\nfrom mkdocs import __version__\nfrom mkdocs import utils\nfrom mkdocs import exceptions\nfrom mkdocs.config import load_config\nfrom mkdocs.commands import build, gh_deploy, new, serve\n\nlog = logging.getLogger(__name__)\n\n\nclass State(object):\n    ''' Maintain logging level.'''\n\n    def __init__(self, log_name='mkdocs', level=logging.INFO):\n        self.logger = logging.getLogger(log_name)\n        self.logger.propagate = False\n        stream = logging.StreamHandler()\n        formatter = logging.Formatter(\"%(levelname)-7s -  %(message)s \")\n        stream.setFormatter(formatter)\n        self.logger.addHandler(stream)\n\n        self.logger.setLevel(level)\n\n\npass_state = click.make_pass_decorator(State, ensure=True)\n\n\ndef verbose_option(f):\n    def callback(ctx, param, value):\n        state = ctx.ensure_object(State)\n        if value:\n            state.logger.setLevel(logging.DEBUG)\n    return click.option('-v', '--verbose',\n                        is_flag=True,\n                        expose_value=False,\n                        help='Enable verbose output',\n                        callback=callback)(f)\n\n\ndef quiet_option(f):\n    def callback(ctx, param, value):\n        state = ctx.ensure_object(State)\n        if value:\n            state.logger.setLevel(logging.ERROR)\n    return click.option('-q', '--quiet',\n                        is_flag=True,\n                        expose_value=False,\n                        help='Silence warnings',\n                        callback=callback)(f)\n\n\ndef common_options(f):\n    f = verbose_option(f)\n    f = quiet_option(f)\n    return f\n\n\nclean_help = \"Remove old files from the site_dir before building\"\nconfig_help = \"Provide a specific MkDocs config\"\ndev_addr_help = (\"IP address and port to serve documentation locally (default: \"\n                 \"localhost:8000)\")\nstrict_help = (\"Enable strict mode. This will cause MkDocs to abort the build \"\n               \"on any warnings.\")\ntheme_help = \"The theme to use when building your documentation.\"\ntheme_choices = utils.get_theme_names()\nsite_dir_help = \"The directory to output the result of the documentation build.\"\nreload_help = \"Enable and disable the live reloading in the development server.\"\ncommit_message_help = (\"A commit message to use when commiting to the \"\n                       \"Github Pages remote branch\")\nremote_branch_help = (\"The remote branch to commit to for Github Pages. This \"\n                      \"overrides the value specified in config\")\n\n\n@click.group(context_settings={'help_option_names': ['-h', '--help']})\n@click.version_option(__version__, '-V', '--version')\n@common_options\ndef cli():\n    \"\"\"\n    MkDocs - Project documentation with Markdown.\n    \"\"\"\n\n\n@cli.command(name=\"serve\")\n@click.option('-f', '--config-file', type=click.File('rb'), help=config_help)\n@click.option('-a', '--dev-addr', help=dev_addr_help, metavar='<IP:PORT>')\n@click.option('-s', '--strict', is_flag=True, help=strict_help)\n@click.option('-t', '--theme', type=click.Choice(theme_choices), help=theme_help)\n@click.option('--livereload/--no-livereload', default=True, help=reload_help)\n@common_options\ndef serve_command(dev_addr, config_file, strict, theme, livereload):\n    \"\"\"Run the builtin development server\"\"\"\n\n    logging.getLogger('tornado').setLevel(logging.WARNING)\n\n    try:\n        serve.serve(\n            config_file=config_file,\n            dev_addr=dev_addr,\n            strict=strict,\n            theme=theme,\n            livereload=livereload,\n        )\n    except (exceptions.ConfigurationError, socket.error) as e:\n        # Avoid ugly, unhelpful traceback\n        raise SystemExit('\\n' + str(e))\n\n\n@cli.command(name=\"build\")\n@click.option('-c', '--clean', is_flag=True, help=clean_help)\n@click.option('-f', '--config-file', type=click.File('rb'), help=config_help)\n@click.option('-s', '--strict', is_flag=True, help=strict_help)\n@click.option('-t', '--theme', type=click.Choice(theme_choices), help=theme_help)\n@click.option('-d', '--site-dir', type=click.Path(), help=site_dir_help)\n@common_options\ndef build_command(clean, config_file, strict, theme, site_dir):\n    \"\"\"Build the MkDocs documentation\"\"\"\n    try:\n        build.build(load_config(\n            config_file=config_file,\n            strict=strict,\n            theme=theme,\n            site_dir=site_dir\n        ), clean_site_dir=clean)\n    except exceptions.ConfigurationError as e:\n        # Avoid ugly, unhelpful traceback\n        raise SystemExit('\\n' + str(e))\n\n\n@cli.command(name=\"json\")\n@click.option('-c', '--clean', is_flag=True, help=clean_help)\n@click.option('-f', '--config-file', type=click.File('rb'), help=config_help)\n@click.option('-s', '--strict', is_flag=True, help=strict_help)\n@click.option('-d', '--site-dir', type=click.Path(), help=site_dir_help)\n@common_options\ndef json_command(clean, config_file, strict, site_dir):\n    \"\"\"Build the MkDocs documentation to JSON files\n\n    Rather than building your documentation to HTML pages, this\n    outputs each page in a simple JSON format. This command is\n    useful if you want to index your documentation in an external\n    search engine.\n    \"\"\"\n\n    log.warning(\"The json command is deprecated and will be removed in a \"\n                \"future MkDocs release. For details on updating: \"\n                \"http://www.mkdocs.org/about/release-notes/\")\n\n    try:\n        build.build(load_config(\n            config_file=config_file,\n            strict=strict,\n            site_dir=site_dir\n        ), dump_json=True, clean_site_dir=clean)\n    except exceptions.ConfigurationError as e:\n        # Avoid ugly, unhelpful traceback\n        raise SystemExit('\\n' + str(e))\n\n\n@cli.command(name=\"gh-deploy\")\n@click.option('-c', '--clean', is_flag=True, help=clean_help)\n@click.option('-f', '--config-file', type=click.File('rb'), help=config_help)\n@click.option('-m', '--message', help=commit_message_help)\n@click.option('-b', '--remote-branch', help=remote_branch_help)\n@click.option('-r', '--remote-name', help=remote_branch_help)\n@common_options\ndef gh_deploy_command(config_file, clean, message, remote_branch, remote_name):\n    \"\"\"Deploy your documentation to GitHub Pages\"\"\"\n    try:\n        config = load_config(\n            config_file=config_file,\n            remote_branch=remote_branch,\n            remote_name=remote_name\n        )\n        build.build(config, clean_site_dir=clean)\n        gh_deploy.gh_deploy(config, message=message)\n    except exceptions.ConfigurationError as e:\n        # Avoid ugly, unhelpful traceback\n        raise SystemExit('\\n' + str(e))\n\n\n@cli.command(name=\"new\")\n@click.argument(\"project_directory\")\n@common_options\ndef new_command(project_directory):\n    \"\"\"Create a new MkDocs project\"\"\"\n    new.new(project_directory)\n\nif __name__ == '__main__':\n    cli()\n", "path": "mkdocs/__main__.py"}], "after_files": [{"content": "#!/usr/bin/env python\n# coding: utf-8\n\nfrom __future__ import unicode_literals\nimport logging\nimport click\nimport socket\n\nfrom mkdocs import __version__\nfrom mkdocs import utils\nfrom mkdocs import exceptions\nfrom mkdocs.config import load_config\nfrom mkdocs.commands import build, gh_deploy, new, serve\n\nlog = logging.getLogger(__name__)\n\n# Disable the warning that Click displays (as of Click version 5.0) when users\n# use unicode_literals in Python 2.\n# See http://click.pocoo.org/dev/python3/#unicode-literals for more details.\nclick.disable_unicode_literals_warning = True\n\n\nclass State(object):\n    ''' Maintain logging level.'''\n\n    def __init__(self, log_name='mkdocs', level=logging.INFO):\n        self.logger = logging.getLogger(log_name)\n        self.logger.propagate = False\n        stream = logging.StreamHandler()\n        formatter = logging.Formatter(\"%(levelname)-7s -  %(message)s \")\n        stream.setFormatter(formatter)\n        self.logger.addHandler(stream)\n\n        self.logger.setLevel(level)\n\n\npass_state = click.make_pass_decorator(State, ensure=True)\n\n\ndef verbose_option(f):\n    def callback(ctx, param, value):\n        state = ctx.ensure_object(State)\n        if value:\n            state.logger.setLevel(logging.DEBUG)\n    return click.option('-v', '--verbose',\n                        is_flag=True,\n                        expose_value=False,\n                        help='Enable verbose output',\n                        callback=callback)(f)\n\n\ndef quiet_option(f):\n    def callback(ctx, param, value):\n        state = ctx.ensure_object(State)\n        if value:\n            state.logger.setLevel(logging.ERROR)\n    return click.option('-q', '--quiet',\n                        is_flag=True,\n                        expose_value=False,\n                        help='Silence warnings',\n                        callback=callback)(f)\n\n\ndef common_options(f):\n    f = verbose_option(f)\n    f = quiet_option(f)\n    return f\n\n\nclean_help = \"Remove old files from the site_dir before building\"\nconfig_help = \"Provide a specific MkDocs config\"\ndev_addr_help = (\"IP address and port to serve documentation locally (default: \"\n                 \"localhost:8000)\")\nstrict_help = (\"Enable strict mode. This will cause MkDocs to abort the build \"\n               \"on any warnings.\")\ntheme_help = \"The theme to use when building your documentation.\"\ntheme_choices = utils.get_theme_names()\nsite_dir_help = \"The directory to output the result of the documentation build.\"\nreload_help = \"Enable and disable the live reloading in the development server.\"\ncommit_message_help = (\"A commit message to use when commiting to the \"\n                       \"Github Pages remote branch\")\nremote_branch_help = (\"The remote branch to commit to for Github Pages. This \"\n                      \"overrides the value specified in config\")\n\n\n@click.group(context_settings={'help_option_names': ['-h', '--help']})\n@click.version_option(__version__, '-V', '--version')\n@common_options\ndef cli():\n    \"\"\"\n    MkDocs - Project documentation with Markdown.\n    \"\"\"\n\n\n@cli.command(name=\"serve\")\n@click.option('-f', '--config-file', type=click.File('rb'), help=config_help)\n@click.option('-a', '--dev-addr', help=dev_addr_help, metavar='<IP:PORT>')\n@click.option('-s', '--strict', is_flag=True, help=strict_help)\n@click.option('-t', '--theme', type=click.Choice(theme_choices), help=theme_help)\n@click.option('--livereload/--no-livereload', default=True, help=reload_help)\n@common_options\ndef serve_command(dev_addr, config_file, strict, theme, livereload):\n    \"\"\"Run the builtin development server\"\"\"\n\n    logging.getLogger('tornado').setLevel(logging.WARNING)\n\n    try:\n        serve.serve(\n            config_file=config_file,\n            dev_addr=dev_addr,\n            strict=strict,\n            theme=theme,\n            livereload=livereload,\n        )\n    except (exceptions.ConfigurationError, socket.error) as e:\n        # Avoid ugly, unhelpful traceback\n        raise SystemExit('\\n' + str(e))\n\n\n@cli.command(name=\"build\")\n@click.option('-c', '--clean', is_flag=True, help=clean_help)\n@click.option('-f', '--config-file', type=click.File('rb'), help=config_help)\n@click.option('-s', '--strict', is_flag=True, help=strict_help)\n@click.option('-t', '--theme', type=click.Choice(theme_choices), help=theme_help)\n@click.option('-d', '--site-dir', type=click.Path(), help=site_dir_help)\n@common_options\ndef build_command(clean, config_file, strict, theme, site_dir):\n    \"\"\"Build the MkDocs documentation\"\"\"\n    try:\n        build.build(load_config(\n            config_file=config_file,\n            strict=strict,\n            theme=theme,\n            site_dir=site_dir\n        ), clean_site_dir=clean)\n    except exceptions.ConfigurationError as e:\n        # Avoid ugly, unhelpful traceback\n        raise SystemExit('\\n' + str(e))\n\n\n@cli.command(name=\"json\")\n@click.option('-c', '--clean', is_flag=True, help=clean_help)\n@click.option('-f', '--config-file', type=click.File('rb'), help=config_help)\n@click.option('-s', '--strict', is_flag=True, help=strict_help)\n@click.option('-d', '--site-dir', type=click.Path(), help=site_dir_help)\n@common_options\ndef json_command(clean, config_file, strict, site_dir):\n    \"\"\"Build the MkDocs documentation to JSON files\n\n    Rather than building your documentation to HTML pages, this\n    outputs each page in a simple JSON format. This command is\n    useful if you want to index your documentation in an external\n    search engine.\n    \"\"\"\n\n    log.warning(\"The json command is deprecated and will be removed in a \"\n                \"future MkDocs release. For details on updating: \"\n                \"http://www.mkdocs.org/about/release-notes/\")\n\n    try:\n        build.build(load_config(\n            config_file=config_file,\n            strict=strict,\n            site_dir=site_dir\n        ), dump_json=True, clean_site_dir=clean)\n    except exceptions.ConfigurationError as e:\n        # Avoid ugly, unhelpful traceback\n        raise SystemExit('\\n' + str(e))\n\n\n@cli.command(name=\"gh-deploy\")\n@click.option('-c', '--clean', is_flag=True, help=clean_help)\n@click.option('-f', '--config-file', type=click.File('rb'), help=config_help)\n@click.option('-m', '--message', help=commit_message_help)\n@click.option('-b', '--remote-branch', help=remote_branch_help)\n@click.option('-r', '--remote-name', help=remote_branch_help)\n@common_options\ndef gh_deploy_command(config_file, clean, message, remote_branch, remote_name):\n    \"\"\"Deploy your documentation to GitHub Pages\"\"\"\n    try:\n        config = load_config(\n            config_file=config_file,\n            remote_branch=remote_branch,\n            remote_name=remote_name\n        )\n        build.build(config, clean_site_dir=clean)\n        gh_deploy.gh_deploy(config, message=message)\n    except exceptions.ConfigurationError as e:\n        # Avoid ugly, unhelpful traceback\n        raise SystemExit('\\n' + str(e))\n\n\n@cli.command(name=\"new\")\n@click.argument(\"project_directory\")\n@common_options\ndef new_command(project_directory):\n    \"\"\"Create a new MkDocs project\"\"\"\n    new.new(project_directory)\n\nif __name__ == '__main__':\n    cli()\n", "path": "mkdocs/__main__.py"}]}