From 3bfb7b41f87f73a54f37304aa86573d9bc037fa1 Mon Sep 17 00:00:00 2001 From: James Addison Date: Fri, 3 Feb 2023 22:48:22 +0000 Subject: [PATCH] Fixup: annotate '_template_basename' method with the correct return type, and add a missing 'return' statement --- sphinx/util/fileutil.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sphinx/util/fileutil.py b/sphinx/util/fileutil.py index 8f898c15b6c..5b217f6a4e9 100644 --- a/sphinx/util/fileutil.py +++ b/sphinx/util/fileutil.py @@ -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 @@ -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( @@ -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,