From 3656974684a5162b5a38aaa80c654d63dafc7e79 Mon Sep 17 00:00:00 2001 From: Matthias Bussonnier Date: Thu, 9 Jun 2022 08:20:51 +0200 Subject: [PATCH] type annotations --- nbformat/validator.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/nbformat/validator.py b/nbformat/validator.py index 48c9ccc6..581dd325 100644 --- a/nbformat/validator.py +++ b/nbformat/validator.py @@ -7,6 +7,7 @@ import pprint import warnings from copy import deepcopy +from typing import Any, Optional from ._imports import import_item from .corpus.words import generate_corpus_id @@ -247,7 +248,13 @@ def better_validation_error(error, version, version_minor): return NotebookValidationError(error, ref) -def normalize(nbdict, version=None, version_minor=None, *, relax_add_props: bool = False): +def normalize( + nbdict: Any, + version: Optional[int] = None, + version_minor: Optional[int] = None, + *, + relax_add_props: bool = False, +) -> Any: """ Normalise a notebook prior to validation. @@ -414,7 +421,7 @@ def validate( raise error -def _try_fix_error(nbdict, version: int, version_minor: int, relax_add_props: bool) -> int: +def _try_fix_error(nbdict: Any, version: int, version_minor: int, relax_add_props: bool) -> int: """ This function try to extract errors from the validator and fix them if necessary.