44import re
55import sys
66import textwrap
7- import typing
87from ast import FunctionDef , Module , stmt
98from typing import Any , AnyStr , Callable , NewType , TypeVar , get_type_hints
109
@@ -499,11 +498,6 @@ def process_docstring(
499498 lines .insert (insert_index , f":rtype: { formatted_annotation } " )
500499
501500
502- def builder_ready (app : Sphinx ) -> None :
503- if app .config .set_type_checking_flag :
504- typing .TYPE_CHECKING = True
505-
506-
507501def validate_config (app : Sphinx , env : BuildEnvironment , docnames : list [str ]) -> None : # noqa: U100
508502 valid = {None , "comma" , "braces" , "braces-after" }
509503 if app .config .typehints_defaults not in valid | {False }:
@@ -515,14 +509,12 @@ def validate_config(app: Sphinx, env: BuildEnvironment, docnames: list[str]) ->
515509
516510
517511def setup (app : Sphinx ) -> dict [str , bool ]:
518- app .add_config_value ("set_type_checking_flag" , False , "html" )
519512 app .add_config_value ("always_document_param_types" , False , "html" )
520513 app .add_config_value ("typehints_fully_qualified" , False , "env" )
521514 app .add_config_value ("typehints_document_rtype" , True , "env" )
522515 app .add_config_value ("typehints_defaults" , None , "env" )
523516 app .add_config_value ("simplify_optional_unions" , True , "env" )
524517 app .add_config_value ("typehints_formatter" , None , "env" )
525- app .connect ("builder-inited" , builder_ready )
526518 app .connect ("env-before-read-docs" , validate_config ) # config may be changed after “config-inited” event
527519 app .connect ("autodoc-process-signature" , process_signature )
528520 app .connect ("autodoc-process-docstring" , process_docstring )
0 commit comments