Skip to content

Commit c92dac1

Browse files
committed
Create a literal dictionary in tarfile instead of assigning one at a time (NFC)
1 parent 726e8e8 commit c92dac1

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

Lib/tarfile.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,11 +1213,7 @@ def _create_gnu_long_header(cls, name, type, encoding, errors):
12131213
"""
12141214
name = name.encode(encoding, errors) + NUL
12151215

1216-
info = {}
1217-
info["name"] = "././@LongLink"
1218-
info["type"] = type
1219-
info["size"] = len(name)
1220-
info["magic"] = GNU_MAGIC
1216+
info = {"name": "././@LongLink", "type": type, "size": len(name), "magic": GNU_MAGIC}
12211217

12221218
# create extended header + name blocks.
12231219
return cls._create_header(info, USTAR_FORMAT, encoding, errors) + \
@@ -1264,11 +1260,7 @@ def _create_pax_generic_header(cls, pax_headers, type, encoding):
12641260

12651261
# We use a hardcoded "././@PaxHeader" name like star does
12661262
# instead of the one that POSIX recommends.
1267-
info = {}
1268-
info["name"] = "././@PaxHeader"
1269-
info["type"] = type
1270-
info["size"] = len(records)
1271-
info["magic"] = POSIX_MAGIC
1263+
info = {"name": "././@PaxHeader", "type": type, "size": len(records), "magic": POSIX_MAGIC}
12721264

12731265
# Create pax header + record blocks.
12741266
return cls._create_header(info, USTAR_FORMAT, "ascii", "replace") + \

0 commit comments

Comments
 (0)