pyupgrade: replace unnecessary lambdas in `collections.defaultdict()` calls
This was rewritten by the `defaultdict_lambda` fixer in `pyupgrade`.
--- a/contrib/perf-utils/subsetmaker.py Mon Jan 06 01:06:59 2025 -0500
+++ b/contrib/perf-utils/subsetmaker.py Mon Jan 06 01:12:54 2025 -0500
@@ -83,7 +83,7 @@
selected = set()
heads = SortedSet()
- children_count = collections.defaultdict(lambda: 0)
+ children_count = collections.defaultdict(int)
parents = repo.changelog._uncheckedparentrevs
baseset = revset.getset(repo, smartset.fullreposet(repo), x)
--- a/contrib/synthrepo.py Mon Jan 06 01:06:59 2025 -0500
+++ b/contrib/synthrepo.py Mon Jan 06 01:12:54 2025 -0500
@@ -76,7 +76,7 @@
def zerodict():
- return collections.defaultdict(lambda: 0)
+ return collections.defaultdict(int)
def roundto(x, k):
--- a/hgext/remotefilelog/basepack.py Mon Jan 06 01:06:59 2025 -0500
+++ b/hgext/remotefilelog/basepack.py Mon Jan 06 01:12:54 2025 -0500
@@ -140,8 +140,8 @@
packsuffixlen = len(self.PACKSUFFIX)
ids = set()
- sizes = collections.defaultdict(lambda: 0)
- mtimes = collections.defaultdict(lambda: [])
+ sizes = collections.defaultdict(int)
+ mtimes = collections.defaultdict(list)
try:
for filename, type, stat in osutil.listdir(self.path, stat=True):
id = None
--- a/hgext/remotefilelog/shallowutil.py Mon Jan 06 01:06:59 2025 -0500
+++ b/hgext/remotefilelog/shallowutil.py Mon Jan 06 01:12:54 2025 -0500
@@ -100,7 +100,7 @@
e.g. [{'a': 4', 'b': 2}, {'b': 3, 'c': 1}] -> {'a': 4, 'b': 5, 'c': 1}
"""
- result = collections.defaultdict(lambda: 0)
+ result = collections.defaultdict(int)
for dict in dicts:
for k, v in dict.items():
result[k] += v
--- a/mercurial/revlogutils/debug.py Mon Jan 06 01:06:59 2025 -0500
+++ b/mercurial/revlogutils/debug.py Mon Jan 06 01:12:54 2025 -0500
@@ -305,9 +305,9 @@
# intermediate snapshot against a prior snapshot
numsemi = 0
# snapshot count per depth
- numsnapdepth = collections.defaultdict(lambda: 0)
+ numsnapdepth = collections.defaultdict(int)
# number of snapshots with a non-ancestor delta
- numsnapdepth_nad = collections.defaultdict(lambda: 0)
+ numsnapdepth_nad = collections.defaultdict(int)
# delta against previous revision
numprev = 0
# delta against prev, where prev is a non-ancestor
--- a/tests/test-pathencode.py Mon Jan 06 01:06:59 2025 -0500
+++ b/tests/test-pathencode.py Mon Jan 06 01:12:54 2025 -0500
@@ -51,7 +51,7 @@
"""Construct and print a table of probabilities for path name
components. The numbers are percentages."""
- counts = collections.defaultdict(lambda: 0)
+ counts = collections.defaultdict(int)
for line in os.popen(cmd).read().splitlines():
if line[-2:] in ('.i', '.d'):
line = line[:-2]