Skip to content

Commit

Permalink
Fixup: annotate '_template_basename' method with the correct return t…
Browse files Browse the repository at this point in the history
…ype, and add a missing 'return' statement
  • Loading branch information
jayaddison committed Feb 3, 2023
1 parent 9400879 commit 3bfb7b4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sphinx/util/fileutil.py
Expand Up @@ -5,7 +5,7 @@
import os
import posixpath
import warnings
from typing import TYPE_CHECKING, Callable
from typing import TYPE_CHECKING, Callable, Optional

from docutils.utils import relative_path

Expand All @@ -17,7 +17,7 @@
from sphinx.util.template import BaseRenderer


def _template_basename(filename: str) -> bool:
def _template_basename(filename: str) -> Optional[str]:
# TODO: remove this method
if filename.lower().endswith('_t'):
warnings.warn(
Expand All @@ -28,6 +28,7 @@ def _template_basename(filename: str) -> bool:
return filename[:-2]
elif filename.lower().endswith(".jinja2"):
return filename[:-7]
return None


def copy_asset_file(source: str, destination: str,
Expand Down

0 comments on commit 3bfb7b4

Please sign in to comment.