@@ -118,39 +118,53 @@ def normalize_book_sets(
118118 print ("Error: The root of the JSON file must be an array." )
119119 return
120120
121- # Find the "All-TODO" and "All" objects
121+ # Find the "All-TODO", "All" objects, and get premium list
122122 all_todo_obj = None
123123 all_obj = None
124+ premium_set = set ()
124125
125126 for obj in data :
126127 if obj .get ("title" ) == "All-TODO" :
127128 all_todo_obj = obj
128129 elif obj .get ("title" ) == "All" :
129130 all_obj = obj
131+ elif "premium" in obj :
132+ # Get premium problems list
133+ premium_set = set (obj .get ("premium" , []))
130134
131135 changes_made = False
132136
133- # Process "All-TODO": Remove problems that have both solution and explanation
137+ # Process "All-TODO": Remove problems that have both solution and explanation or are premium
134138 if all_todo_obj :
135139 original_count = len (all_todo_obj .get ("problems" , []))
136140 problems = all_todo_obj .get ("problems" , [])
137141 removed = []
142+ removed_premium = []
138143
139144 new_problems = []
140145 for problem_num in problems :
141- if has_both_solution_and_explanation (
146+ # Remove if premium
147+ if problem_num in premium_set :
148+ removed_premium .append (problem_num )
149+ # Remove if has both solution and explanation
150+ elif has_both_solution_and_explanation (
142151 problem_num , solutions_path , explanations_path
143152 ):
144153 removed .append (problem_num )
145154 else :
146155 new_problems .append (problem_num )
147156
148- if removed :
157+ if removed or removed_premium :
149158 changes_made = True
150- print (
151- f"\n [All-TODO] Removing { len (removed )} problems with both solution and explanation:"
152- )
153- print (f" Removed: { removed [:10 ]} { '...' if len (removed ) > 10 else '' } " )
159+ print (f"\n [All-TODO] Removing problems:" )
160+ if removed_premium :
161+ print (
162+ f" Removed { len (removed_premium )} premium problems: { removed_premium [:10 ]} { '...' if len (removed_premium ) > 10 else '' } "
163+ )
164+ if removed :
165+ print (
166+ f" Removed { len (removed )} problems with both solution and explanation: { removed [:10 ]} { '...' if len (removed ) > 10 else '' } "
167+ )
154168 all_todo_obj ["problems" ] = sorted (new_problems )
155169 print (f" Updated count: { original_count } -> { len (new_problems )} " )
156170 else :
@@ -170,7 +184,7 @@ def normalize_book_sets(
170184 if d .is_dir () and d .name .isdigit () and not d .name .startswith ("todo-" )
171185 }
172186
173- # Find problems that have both
187+ # Find problems that have both (excluding premium problems)
174188 problems_with_both = sorted (
175189 [
176190 p
@@ -179,6 +193,7 @@ def normalize_book_sets(
179193 and has_both_solution_and_explanation (
180194 p , solutions_path , explanations_path
181195 )
196+ and p not in premium_set # Exclude premium problems
182197 ]
183198 )
184199
0 commit comments