@@ -183,74 +183,74 @@ def setup_logging(
183183
184184def normalize_file_path_for_comparison (file_path : str ) -> str :
185185 """Normalize a file path for conflict detection.
186-
186+
187187 This function normalizes file paths to help detect potential conflicts:
188188 - Converts to lowercase for case-insensitive comparison
189189 - Normalizes Unicode characters
190190 - Handles path separators consistently
191-
191+
192192 Args:
193193 file_path: The file path to normalize
194-
194+
195195 Returns:
196196 Normalized file path for comparison purposes
197197 """
198198 import unicodedata
199-
199+
200200 # Convert to lowercase for case-insensitive comparison
201201 normalized = file_path .lower ()
202-
202+
203203 # Normalize Unicode characters (NFD normalization)
204- normalized = unicodedata .normalize (' NFD' , normalized )
205-
204+ normalized = unicodedata .normalize (" NFD" , normalized )
205+
206206 # Replace path separators with forward slashes
207- normalized = normalized .replace (' \\ ' , '/' )
208-
207+ normalized = normalized .replace (" \\ " , "/" )
208+
209209 # Remove multiple slashes
210- normalized = re .sub (r'/+' , '/' , normalized )
211-
210+ normalized = re .sub (r"/+" , "/" , normalized )
211+
212212 return normalized
213213
214214
215215def detect_potential_file_conflicts (file_path : str , existing_paths : List [str ]) -> List [str ]:
216216 """Detect potential conflicts between a file path and existing paths.
217-
217+
218218 This function checks for various types of conflicts:
219219 - Case sensitivity differences
220220 - Unicode normalization differences
221221 - Path separator differences
222222 - Permalink generation conflicts
223-
223+
224224 Args:
225225 file_path: The file path to check
226226 existing_paths: List of existing file paths to check against
227-
227+
228228 Returns:
229229 List of existing paths that might conflict with the given file path
230230 """
231231 conflicts = []
232-
232+
233233 # Normalize the input file path
234234 normalized_input = normalize_file_path_for_comparison (file_path )
235235 input_permalink = generate_permalink (file_path )
236-
236+
237237 for existing_path in existing_paths :
238238 # Skip identical paths
239239 if existing_path == file_path :
240240 continue
241-
241+
242242 # Check for case-insensitive path conflicts
243243 normalized_existing = normalize_file_path_for_comparison (existing_path )
244244 if normalized_input == normalized_existing :
245245 conflicts .append (existing_path )
246246 continue
247-
247+
248248 # Check for permalink conflicts
249249 existing_permalink = generate_permalink (existing_path )
250250 if input_permalink == existing_permalink :
251251 conflicts .append (existing_path )
252252 continue
253-
253+
254254 return conflicts
255255
256256
0 commit comments