@@ -110,35 +110,33 @@ def read_gallery_order(src_dir: Path):
110110 front = lines [:placeholder_index ]
111111 back = lines [placeholder_index + 1 :]
112112
113- listed_examples = set ( front + back )
114- existing_examples = set (
115- str ( file .name ) for file in src_dir .iterdir () if file .suffix == ".py"
116- )
113+ listed_examples = { * front , * back }
114+ existing_examples = {
115+ file .name for file in src_dir .iterdir () if file .suffix == ".py"
116+ }
117117
118- non_exiting_examples = listed_examples - existing_examples
118+ non_existing_examples = listed_examples - existing_examples
119119 missing_examples = existing_examples - listed_examples
120- print (f"non_exiting_examples : { non_exiting_examples } " )
120+ print (f"non_existing_examples : { non_existing_examples } " )
121121 print (f"missing_examples: { missing_examples } " )
122122
123123 if non_exiting_examples :
124124 raise ValueError (
125125 f"The following examples listed in { gallery_order_txt } do not exist: "
126126 f"{ ', ' .join (non_exiting_examples )} "
127- )
127+ if non_existing_examples :
128+ raise ValueError (
129+ f"The following examples listed in { gallery_order_txt } do not exist: "
130+ f"{ ', ' .join (non_existing_examples )} "
128131 if placeholder_index is None and missing_examples :
129132 raise ValueError (
130133 f"The following examples are not listed in { gallery_order_txt } . "
131- f"Either include them or add a '*' to indicate where not listed"
134+ f"Either include them or add a '*' to indicate where not listed "
132135 f"examples should be placed: "
133136 f"{ ', ' .join (missing_examples )} "
134137 )
135138
136- mid = list (
137- sorted (
138- str (file .name ) for file in src_dir .iterdir ()
139- if file .suffix == ".py" and str (file .name ) not in listed_examples
140- )
141- )
139+ mid = list (sorted (missing_examples ))
142140 return front + mid + back
143141
144142 def __call__ (self , item ):
0 commit comments