4
4
import re
5
5
import sys
6
6
import textwrap
7
- import typing
8
7
from ast import FunctionDef , Module , stmt
9
8
from typing import Any , AnyStr , Callable , NewType , TypeVar , get_type_hints
10
9
@@ -499,11 +498,6 @@ def process_docstring(
499
498
lines .insert (insert_index , f":rtype: { formatted_annotation } " )
500
499
501
500
502
- def builder_ready (app : Sphinx ) -> None :
503
- if app .config .set_type_checking_flag :
504
- typing .TYPE_CHECKING = True
505
-
506
-
507
501
def validate_config (app : Sphinx , env : BuildEnvironment , docnames : list [str ]) -> None : # noqa: U100
508
502
valid = {None , "comma" , "braces" , "braces-after" }
509
503
if app .config .typehints_defaults not in valid | {False }:
@@ -515,14 +509,12 @@ def validate_config(app: Sphinx, env: BuildEnvironment, docnames: list[str]) ->
515
509
516
510
517
511
def setup (app : Sphinx ) -> dict [str , bool ]:
518
- app .add_config_value ("set_type_checking_flag" , False , "html" )
519
512
app .add_config_value ("always_document_param_types" , False , "html" )
520
513
app .add_config_value ("typehints_fully_qualified" , False , "env" )
521
514
app .add_config_value ("typehints_document_rtype" , True , "env" )
522
515
app .add_config_value ("typehints_defaults" , None , "env" )
523
516
app .add_config_value ("simplify_optional_unions" , True , "env" )
524
517
app .add_config_value ("typehints_formatter" , None , "env" )
525
- app .connect ("builder-inited" , builder_ready )
526
518
app .connect ("env-before-read-docs" , validate_config ) # config may be changed after “config-inited” event
527
519
app .connect ("autodoc-process-signature" , process_signature )
528
520
app .connect ("autodoc-process-docstring" , process_docstring )
0 commit comments