mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Migrate to py3 style type annotation: sphinx.ext.githubpages
This commit is contained in:
parent
d57e338510
commit
4ba8518117
@ -10,18 +10,14 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import urllib
|
import urllib
|
||||||
|
from typing import Any, Dict
|
||||||
|
|
||||||
import sphinx
|
import sphinx
|
||||||
|
from sphinx.application import Sphinx
|
||||||
if False:
|
from sphinx.environment import BuildEnvironment
|
||||||
# For type annotation
|
|
||||||
from typing import Any, Dict # NOQA
|
|
||||||
from sphinx.application import Sphinx # NOQA
|
|
||||||
from sphinx.environment import BuildEnvironment # NOQA
|
|
||||||
|
|
||||||
|
|
||||||
def create_nojekyll_and_cname(app, env):
|
def create_nojekyll_and_cname(app: Sphinx, env: BuildEnvironment) -> None:
|
||||||
# type: (Sphinx, BuildEnvironment) -> None
|
|
||||||
if app.builder.format == 'html':
|
if app.builder.format == 'html':
|
||||||
open(os.path.join(app.builder.outdir, '.nojekyll'), 'wt').close()
|
open(os.path.join(app.builder.outdir, '.nojekyll'), 'wt').close()
|
||||||
|
|
||||||
@ -35,7 +31,6 @@ def create_nojekyll_and_cname(app, env):
|
|||||||
f.write(domain)
|
f.write(domain)
|
||||||
|
|
||||||
|
|
||||||
def setup(app):
|
def setup(app: Sphinx) -> Dict[str, Any]:
|
||||||
# type: (Sphinx) -> Dict[str, Any]
|
|
||||||
app.connect('env-updated', create_nojekyll_and_cname)
|
app.connect('env-updated', create_nojekyll_and_cname)
|
||||||
return {'version': sphinx.__display_version__, 'parallel_read_safe': True}
|
return {'version': sphinx.__display_version__, 'parallel_read_safe': True}
|
||||||
|
Loading…
Reference in New Issue
Block a user