summaryrefslogtreecommitdiff
path: root/sphinx
diff options
context:
space:
mode:
authorAdam Turner <9087854+AA-Turner@users.noreply.github.com>2023-04-27 01:30:40 +0100
committerGitHub <noreply@github.com>2023-04-27 01:30:40 +0100
commit3c4e78e2361b1e155fe7f6d29f1112c036d8e3b2 (patch)
tree84aaa7a5374e8739f9e192255038d1e2913ce97f /sphinx
parentce5ce1ac2d3abd47be494a48edf5320c98f4f3ee (diff)
downloadsphinx-git-3c4e78e2361b1e155fe7f6d29f1112c036d8e3b2.tar.gz
Make ``locale`` required in ``sphinx.util.i18n.format_date()`` (#11366)
Diffstat (limited to 'sphinx')
-rw-r--r--sphinx/util/i18n.py14
1 files changed, 1 insertions, 13 deletions
diff --git a/sphinx/util/i18n.py b/sphinx/util/i18n.py
index 3069b5458..268633200 100644
--- a/sphinx/util/i18n.py
+++ b/sphinx/util/i18n.py
@@ -4,7 +4,6 @@ from __future__ import annotations
import os
import re
-import warnings
from datetime import datetime, timezone
from os import path
from typing import TYPE_CHECKING, Callable, Generator, NamedTuple
@@ -13,7 +12,6 @@ import babel.dates
from babel.messages.mofile import write_mo
from babel.messages.pofile import read_po
-from sphinx.deprecation import RemovedInSphinx70Warning
from sphinx.errors import SphinxError
from sphinx.locale import __
from sphinx.util import logging
@@ -171,11 +169,6 @@ date_format_re = re.compile('(%s)' % '|'.join(date_format_mappings))
def babel_format_date(date: datetime, format: str, locale: str,
formatter: Callable = babel.dates.format_date) -> str:
- if locale is None:
- warnings.warn('The locale argument for babel_format_date() becomes required.',
- RemovedInSphinx70Warning)
- locale = 'en'
-
# Check if we have the tzinfo attribute. If not we cannot do any time
# related formats.
if not hasattr(date, 'tzinfo'):
@@ -193,7 +186,7 @@ def babel_format_date(date: datetime, format: str, locale: str,
def format_date(
- format: str, date: datetime | None = None, language: str | None = None,
+ format: str, *, date: datetime | None = None, language: str,
) -> str:
if date is None:
# If time is not specified, try to use $SOURCE_DATE_EPOCH variable
@@ -204,11 +197,6 @@ def format_date(
else:
date = datetime.now(timezone.utc).astimezone()
- if language is None:
- warnings.warn('The language argument for format_date() becomes required.',
- RemovedInSphinx70Warning)
- language = 'en'
-
result = []
tokens = date_format_re.split(format)
for token in tokens: