@@ -75,6 +75,14 @@ def filter_unwanted_inherited_methods(path, parent, children):
75
75
return filtered_children
76
76
77
77
78
+ def filter_type_checking (path , parent , children ):
79
+ filtered_children = []
80
+ for name , obj in children :
81
+ if name != 'TYPE_CHECKING' :
82
+ filtered_children .append ((name , obj ))
83
+ return filtered_children
84
+
85
+
78
86
def main (unused_argv ):
79
87
generate_cirq ()
80
88
generate_cirq_google ()
@@ -93,7 +101,11 @@ def generate_cirq():
93
101
code_url_prefix = FLAGS .code_url_prefix + "/cirq-core/cirq" ,
94
102
search_hints = FLAGS .search_hints ,
95
103
site_path = FLAGS .site_path ,
96
- callbacks = [public_api .local_definitions_filter , filter_unwanted_inherited_methods ],
104
+ callbacks = [
105
+ public_api .local_definitions_filter ,
106
+ filter_unwanted_inherited_methods ,
107
+ filter_type_checking ,
108
+ ],
97
109
extra_docs = _doc .RECORDED_CONST_DOCS ,
98
110
)
99
111
doc_controls .decorate_all_class_attributes (
@@ -110,7 +122,11 @@ def generate_cirq_aqt():
110
122
code_url_prefix = FLAGS .code_url_prefix + "/cirq-aqt/cirq_aqt" ,
111
123
search_hints = FLAGS .search_hints ,
112
124
site_path = FLAGS .site_path ,
113
- callbacks = [public_api .local_definitions_filter , filter_unwanted_inherited_methods ],
125
+ callbacks = [
126
+ public_api .local_definitions_filter ,
127
+ filter_unwanted_inherited_methods ,
128
+ filter_type_checking ,
129
+ ],
114
130
extra_docs = _doc .RECORDED_CONST_DOCS ,
115
131
)
116
132
doc_controls .decorate_all_class_attributes (
@@ -128,7 +144,11 @@ def generate_cirq_ionq():
128
144
code_url_prefix = FLAGS .code_url_prefix + "/cirq-ionq/cirq_ionq" ,
129
145
search_hints = FLAGS .search_hints ,
130
146
site_path = FLAGS .site_path ,
131
- callbacks = [public_api .local_definitions_filter , filter_unwanted_inherited_methods ],
147
+ callbacks = [
148
+ public_api .local_definitions_filter ,
149
+ filter_unwanted_inherited_methods ,
150
+ filter_type_checking ,
151
+ ],
132
152
extra_docs = _doc .RECORDED_CONST_DOCS ,
133
153
)
134
154
doc_controls .decorate_all_class_attributes (
@@ -146,7 +166,11 @@ def generate_cirq_pasqal():
146
166
code_url_prefix = FLAGS .code_url_prefix + "/cirq-pasqal/cirq_pasqal" ,
147
167
search_hints = FLAGS .search_hints ,
148
168
site_path = FLAGS .site_path ,
149
- callbacks = [public_api .local_definitions_filter , filter_unwanted_inherited_methods ],
169
+ callbacks = [
170
+ public_api .local_definitions_filter ,
171
+ filter_unwanted_inherited_methods ,
172
+ filter_type_checking ,
173
+ ],
150
174
extra_docs = _doc .RECORDED_CONST_DOCS ,
151
175
)
152
176
doc_controls .decorate_all_class_attributes (
@@ -164,7 +188,11 @@ def generate_cirq_rigetti():
164
188
code_url_prefix = FLAGS .code_url_prefix + "/cirq-rigetti/cirq_rigetti" ,
165
189
search_hints = FLAGS .search_hints ,
166
190
site_path = FLAGS .site_path ,
167
- callbacks = [public_api .local_definitions_filter , filter_unwanted_inherited_methods ],
191
+ callbacks = [
192
+ public_api .local_definitions_filter ,
193
+ filter_unwanted_inherited_methods ,
194
+ filter_type_checking ,
195
+ ],
168
196
extra_docs = _doc .RECORDED_CONST_DOCS ,
169
197
)
170
198
doc_controls .decorate_all_class_attributes (
@@ -182,7 +210,11 @@ def generate_cirq_google():
182
210
code_url_prefix = FLAGS .code_url_prefix + "/cirq-google/cirq_google" ,
183
211
search_hints = FLAGS .search_hints ,
184
212
site_path = FLAGS .site_path ,
185
- callbacks = [public_api .local_definitions_filter , filter_unwanted_inherited_methods ],
213
+ callbacks = [
214
+ public_api .local_definitions_filter ,
215
+ filter_unwanted_inherited_methods ,
216
+ filter_type_checking ,
217
+ ],
186
218
private_map = {
187
219
# Opt to not build docs for these paths for now since they error.
188
220
"cirq_google.cloud.quantum.QuantumEngineServiceClient" : ["enums" ],
@@ -202,7 +234,11 @@ def generate_cirq_web():
202
234
code_url_prefix = FLAGS .code_url_prefix + "/cirq-web/cirq_web" ,
203
235
search_hints = FLAGS .search_hints ,
204
236
site_path = FLAGS .site_path ,
205
- callbacks = [public_api .local_definitions_filter , filter_unwanted_inherited_methods ],
237
+ callbacks = [
238
+ public_api .local_definitions_filter ,
239
+ filter_unwanted_inherited_methods ,
240
+ filter_type_checking ,
241
+ ],
206
242
extra_docs = _doc .RECORDED_CONST_DOCS ,
207
243
)
208
244
doc_controls .decorate_all_class_attributes (
0 commit comments