MCPcopy Create free account
hub / github.com/FSoft-AI4Code/CodeText-parser / remove_unrelevant

Function remove_unrelevant

src/codetext/clean/noise_removal.py:335–362  ·  view source on GitHub ↗
(docstring: str)

Source from the content-addressed store, hash-verified

333
334
335def remove_unrelevant(docstring: str) -> str:
336 flag = True
337 while flag:
338 flag = False
339 docstring_ = docstring
340
341 removing_functions = [
342 remove_specific_pattern,
343 remove_link_in_brackets,
344 # remove_everything_after_an_url, # Overlap
345 # remove_everything_after_a_pattern, # Noticeable wrong catch
346 remove_patterns_at_any_positions,
347 remove_lines_contain_only_a_single_char,
348 remove_lines_start_and_end_with_the_same_char,
349 remove_patterns_at_the_start_and_end_of_a_line,
350 remove_function_name_at_the_beginning,
351 ]
352 for removing_function in removing_functions:
353 docstring = removing_function(docstring)
354 # print(removing_function.__name__)
355 # print(docstring)
356 # print('\n\n')
357
358 if docstring != docstring_:
359 flag = True
360
361 docstring = remove_patterns_at_the_end_of_a_docstring(docstring)
362 return docstring
363
364
365# =================== Check code ======================

Callers 1

clean_docstringFunction · 0.85

Tested by

no test coverage detected