Staging
v0.5.1
https://github.com/python/cpython
Revision e3e785180b2d591304d4c817da04131442951567 authored by Barry Warsaw on 01 May 2006, 03:21:25 UTC, committed by Barry Warsaw on 01 May 2006, 03:21:25 UTC
Patch #1464708 from William McVey: fixed handling of nested comments in mail
addresses.  E.g.

"Foo ((Foo Bar)) <foo@example.com>"

Fixes for both rfc822.py and email package.
1 parent dc74e34
Raw File
Tip revision: e3e785180b2d591304d4c817da04131442951567 authored by Barry Warsaw on 01 May 2006, 03:21:25 UTC
Back port from 2.4 branch:
Tip revision: e3e7851
rmpyc.py
# Remove all the .pyc and .pyo files under ../Lib.


def deltree(root):
    import os
    from os.path import join

    npyc = npyo = 0
    for root, dirs, files in os.walk(root):
        for name in files:
            delete = False
            if name.endswith('.pyc'):
                delete = True
                npyc += 1
            elif name.endswith('.pyo'):
                delete = True
                npyo += 1

            if delete:
                os.remove(join(root, name))

    return npyc, npyo

npyc, npyo = deltree("../Lib")
print npyc, ".pyc deleted,", npyo, ".pyo deleted"
back to top