From 6d04fd7041e2cf45836f04858183b453c0b551c3 Mon Sep 17 00:00:00 2001 From: Julian Berman Date: Tue, 30 Aug 2022 11:07:21 +0300 Subject: [PATCH] Remove the incorrect Optional from FormatChecker's formats annotation. See https://docs.python.org/3/library/typing.html#typing.Optional. This is meant to be used only if None is a specifically allowed value, where here it is not, it's an internal sentinel, not part of its public API, which only allows iterables. --- jsonschema/_format.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsonschema/_format.py b/jsonschema/_format.py index 2c07719bc..6a254617b 100644 --- a/jsonschema/_format.py +++ b/jsonschema/_format.py @@ -44,7 +44,7 @@ class FormatChecker: tuple[_FormatCheckCallable, _RaisesType], ] = {} - def __init__(self, formats: typing.Iterable[str] | None = None): + def __init__(self, formats: typing.Iterable[str] = None): if formats is None: formats = self.checkers.keys() self.checkers = {k: self.checkers[k] for k in formats}