diff options
author | Brett Cannon <bcannon@gmail.com> | 2008-08-04 21:23:07 (GMT) |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2008-08-04 21:23:07 (GMT) |
commit | 132fc540695efd86781496304be299418fe918c1 (patch) | |
tree | bcd1a16eadc3b03fe6ffe896cff9162eaa452fea /Lib/tarfile.py | |
parent | cf297cd73fab50bac9bf143e14b227a33ccbd06e (diff) | |
download | cpython-132fc540695efd86781496304be299418fe918c1.zip cpython-132fc540695efd86781496304be299418fe918c1.tar.gz cpython-132fc540695efd86781496304be299418fe918c1.tar.bz2 |
Remove a dict.has_key() and list.sort(cmp=) usage from tarfile to silence
warnings under -3.
Diffstat (limited to 'Lib/tarfile.py')
-rw-r--r-- | Lib/tarfile.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/tarfile.py b/Lib/tarfile.py index 85abcd8..ab74cc5 100644 --- a/Lib/tarfile.py +++ b/Lib/tarfile.py @@ -51,6 +51,7 @@ import time import struct import copy import re +import operator if sys.platform == 'mac': # This module needs work for MacOS9, especially in the area of pathname @@ -1401,7 +1402,7 @@ class TarInfo(object): next._apply_pax_info(pax_headers, tarfile.encoding, tarfile.errors) next.offset = self.offset - if pax_headers.has_key("size"): + if "size" in pax_headers: # If the extended header replaces the size field, # we need to recalculate the offset where the next # header starts. @@ -2027,7 +2028,7 @@ class TarFile(object): self.extract(tarinfo, path) # Reverse sort directories. - directories.sort(lambda a, b: cmp(a.name, b.name)) + directories.sort(key=operator.attrgetter('name')) directories.reverse() # Set correct owner, mtime and filemode on directories. |