py311-eradicate-3.0.1 3.0.1
“Removes commented-out code”
Bundled Python dependency library pathInstalled CPython standard library module path
SHA-2566c453dd55fddda2003a382844fefb97d1ad86ac1af34ff2e896479b8e6b1fb7e
Evidence
19:12… THERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22"""Removes commented-out Python code."""
23
24import difflib
25import io
26import os
27import sys
28import re
29import tokenize
30
31__version__ = '3.0.1'
32
33
34class Eradicator:
35 """Eradicate comments."""
36 BRACKET_REGEX = re.compile(r'^[()\[\]{}\s]+$')
37 CODING_COMMENT_REGEX = re.compile(r'.*?coding[:=][ \t]*([-_.a-zA-Z0-9]+)')
38 DEF_STATEMENT_REGEX = re. …
47:29… ')', '[', ']', '{', '}', ':', '=', '%',
48 'print', 'return', 'break', 'continue', 'import']
49 CODE_KEYWORDS = [r'elif\s+.*', 'else', 'try', 'finally', r'except\s+.*']
50 CODE_KEYWORDS_AGGR = CODE_KEYWORDS + [r'if\s+.*']
51 WHITESPACE_HASH = ' \t\v\n#'
⋯6 lines
⋯6 lines
106
107 try:
108 compile(line, '<string>', 'exec')
109 except (SyntaxError, TypeError, UnicodeDecodeError):
110 return False
⋯5 lines
247:6… flags=re.IGNORECASE)
248
249
250def main(argv=sys.argv, standard_out=sys.stdout, standard_error=sys.stderr):
251 """Main entry point."""
252 import argparse
253 parser = argparse.ArgumentParser(description=__doc__, prog='eradicate')
254 parser.add_argument('-i', '--in-place', action='store_true',
255 help='make changes to file …
289:19… st(set(args.files))
290 change_or_error = False
291 while filenames:
292 name = filenames.pop(0)
293 if args.recursive and os.path.isdir(name):
294 for root, directories, children in os.walk(f'{name}'):
295 filenames += [os.path.join(root, f) for f in children
296 if f.endswith('.py') and
⋯5 lines
Showing the top 5 files — 1 more file (15 regions) not shown.
No evidence locations were recorded for this file. Raw result