Edit File by line
/home/barbar84/www/wp-conte.../plugins/sujqvwi/AnonR/anonr.TX.../usr/lib64/python3....
File: tracemalloc.py
from collections.abc import Sequence, Iterable
[0] Fix | Delete
from functools import total_ordering
[1] Fix | Delete
import fnmatch
[2] Fix | Delete
import linecache
[3] Fix | Delete
import os.path
[4] Fix | Delete
import pickle
[5] Fix | Delete
[6] Fix | Delete
# Import types and functions implemented in C
[7] Fix | Delete
from _tracemalloc import *
[8] Fix | Delete
from _tracemalloc import _get_object_traceback, _get_traces
[9] Fix | Delete
[10] Fix | Delete
[11] Fix | Delete
def _format_size(size, sign):
[12] Fix | Delete
for unit in ('B', 'KiB', 'MiB', 'GiB', 'TiB'):
[13] Fix | Delete
if abs(size) < 100 and unit != 'B':
[14] Fix | Delete
# 3 digits (xx.x UNIT)
[15] Fix | Delete
if sign:
[16] Fix | Delete
return "%+.1f %s" % (size, unit)
[17] Fix | Delete
else:
[18] Fix | Delete
return "%.1f %s" % (size, unit)
[19] Fix | Delete
if abs(size) < 10 * 1024 or unit == 'TiB':
[20] Fix | Delete
# 4 or 5 digits (xxxx UNIT)
[21] Fix | Delete
if sign:
[22] Fix | Delete
return "%+.0f %s" % (size, unit)
[23] Fix | Delete
else:
[24] Fix | Delete
return "%.0f %s" % (size, unit)
[25] Fix | Delete
size /= 1024
[26] Fix | Delete
[27] Fix | Delete
[28] Fix | Delete
class Statistic:
[29] Fix | Delete
"""
[30] Fix | Delete
Statistic difference on memory allocations between two Snapshot instance.
[31] Fix | Delete
"""
[32] Fix | Delete
[33] Fix | Delete
__slots__ = ('traceback', 'size', 'count')
[34] Fix | Delete
[35] Fix | Delete
def __init__(self, traceback, size, count):
[36] Fix | Delete
self.traceback = traceback
[37] Fix | Delete
self.size = size
[38] Fix | Delete
self.count = count
[39] Fix | Delete
[40] Fix | Delete
def __hash__(self):
[41] Fix | Delete
return hash((self.traceback, self.size, self.count))
[42] Fix | Delete
[43] Fix | Delete
def __eq__(self, other):
[44] Fix | Delete
return (self.traceback == other.traceback
[45] Fix | Delete
and self.size == other.size
[46] Fix | Delete
and self.count == other.count)
[47] Fix | Delete
[48] Fix | Delete
def __str__(self):
[49] Fix | Delete
text = ("%s: size=%s, count=%i"
[50] Fix | Delete
% (self.traceback,
[51] Fix | Delete
_format_size(self.size, False),
[52] Fix | Delete
self.count))
[53] Fix | Delete
if self.count:
[54] Fix | Delete
average = self.size / self.count
[55] Fix | Delete
text += ", average=%s" % _format_size(average, False)
[56] Fix | Delete
return text
[57] Fix | Delete
[58] Fix | Delete
def __repr__(self):
[59] Fix | Delete
return ('<Statistic traceback=%r size=%i count=%i>'
[60] Fix | Delete
% (self.traceback, self.size, self.count))
[61] Fix | Delete
[62] Fix | Delete
def _sort_key(self):
[63] Fix | Delete
return (self.size, self.count, self.traceback)
[64] Fix | Delete
[65] Fix | Delete
[66] Fix | Delete
class StatisticDiff:
[67] Fix | Delete
"""
[68] Fix | Delete
Statistic difference on memory allocations between an old and a new
[69] Fix | Delete
Snapshot instance.
[70] Fix | Delete
"""
[71] Fix | Delete
__slots__ = ('traceback', 'size', 'size_diff', 'count', 'count_diff')
[72] Fix | Delete
[73] Fix | Delete
def __init__(self, traceback, size, size_diff, count, count_diff):
[74] Fix | Delete
self.traceback = traceback
[75] Fix | Delete
self.size = size
[76] Fix | Delete
self.size_diff = size_diff
[77] Fix | Delete
self.count = count
[78] Fix | Delete
self.count_diff = count_diff
[79] Fix | Delete
[80] Fix | Delete
def __hash__(self):
[81] Fix | Delete
return hash((self.traceback, self.size, self.size_diff,
[82] Fix | Delete
self.count, self.count_diff))
[83] Fix | Delete
[84] Fix | Delete
def __eq__(self, other):
[85] Fix | Delete
return (self.traceback == other.traceback
[86] Fix | Delete
and self.size == other.size
[87] Fix | Delete
and self.size_diff == other.size_diff
[88] Fix | Delete
and self.count == other.count
[89] Fix | Delete
and self.count_diff == other.count_diff)
[90] Fix | Delete
[91] Fix | Delete
def __str__(self):
[92] Fix | Delete
text = ("%s: size=%s (%s), count=%i (%+i)"
[93] Fix | Delete
% (self.traceback,
[94] Fix | Delete
_format_size(self.size, False),
[95] Fix | Delete
_format_size(self.size_diff, True),
[96] Fix | Delete
self.count,
[97] Fix | Delete
self.count_diff))
[98] Fix | Delete
if self.count:
[99] Fix | Delete
average = self.size / self.count
[100] Fix | Delete
text += ", average=%s" % _format_size(average, False)
[101] Fix | Delete
return text
[102] Fix | Delete
[103] Fix | Delete
def __repr__(self):
[104] Fix | Delete
return ('<StatisticDiff traceback=%r size=%i (%+i) count=%i (%+i)>'
[105] Fix | Delete
% (self.traceback, self.size, self.size_diff,
[106] Fix | Delete
self.count, self.count_diff))
[107] Fix | Delete
[108] Fix | Delete
def _sort_key(self):
[109] Fix | Delete
return (abs(self.size_diff), self.size,
[110] Fix | Delete
abs(self.count_diff), self.count,
[111] Fix | Delete
self.traceback)
[112] Fix | Delete
[113] Fix | Delete
[114] Fix | Delete
def _compare_grouped_stats(old_group, new_group):
[115] Fix | Delete
statistics = []
[116] Fix | Delete
for traceback, stat in new_group.items():
[117] Fix | Delete
previous = old_group.pop(traceback, None)
[118] Fix | Delete
if previous is not None:
[119] Fix | Delete
stat = StatisticDiff(traceback,
[120] Fix | Delete
stat.size, stat.size - previous.size,
[121] Fix | Delete
stat.count, stat.count - previous.count)
[122] Fix | Delete
else:
[123] Fix | Delete
stat = StatisticDiff(traceback,
[124] Fix | Delete
stat.size, stat.size,
[125] Fix | Delete
stat.count, stat.count)
[126] Fix | Delete
statistics.append(stat)
[127] Fix | Delete
[128] Fix | Delete
for traceback, stat in old_group.items():
[129] Fix | Delete
stat = StatisticDiff(traceback, 0, -stat.size, 0, -stat.count)
[130] Fix | Delete
statistics.append(stat)
[131] Fix | Delete
return statistics
[132] Fix | Delete
[133] Fix | Delete
[134] Fix | Delete
@total_ordering
[135] Fix | Delete
class Frame:
[136] Fix | Delete
"""
[137] Fix | Delete
Frame of a traceback.
[138] Fix | Delete
"""
[139] Fix | Delete
__slots__ = ("_frame",)
[140] Fix | Delete
[141] Fix | Delete
def __init__(self, frame):
[142] Fix | Delete
# frame is a tuple: (filename: str, lineno: int)
[143] Fix | Delete
self._frame = frame
[144] Fix | Delete
[145] Fix | Delete
@property
[146] Fix | Delete
def filename(self):
[147] Fix | Delete
return self._frame[0]
[148] Fix | Delete
[149] Fix | Delete
@property
[150] Fix | Delete
def lineno(self):
[151] Fix | Delete
return self._frame[1]
[152] Fix | Delete
[153] Fix | Delete
def __eq__(self, other):
[154] Fix | Delete
return (self._frame == other._frame)
[155] Fix | Delete
[156] Fix | Delete
def __lt__(self, other):
[157] Fix | Delete
return (self._frame < other._frame)
[158] Fix | Delete
[159] Fix | Delete
def __hash__(self):
[160] Fix | Delete
return hash(self._frame)
[161] Fix | Delete
[162] Fix | Delete
def __str__(self):
[163] Fix | Delete
return "%s:%s" % (self.filename, self.lineno)
[164] Fix | Delete
[165] Fix | Delete
def __repr__(self):
[166] Fix | Delete
return "<Frame filename=%r lineno=%r>" % (self.filename, self.lineno)
[167] Fix | Delete
[168] Fix | Delete
[169] Fix | Delete
@total_ordering
[170] Fix | Delete
class Traceback(Sequence):
[171] Fix | Delete
"""
[172] Fix | Delete
Sequence of Frame instances sorted from the oldest frame
[173] Fix | Delete
to the most recent frame.
[174] Fix | Delete
"""
[175] Fix | Delete
__slots__ = ("_frames",)
[176] Fix | Delete
[177] Fix | Delete
def __init__(self, frames):
[178] Fix | Delete
Sequence.__init__(self)
[179] Fix | Delete
# frames is a tuple of frame tuples: see Frame constructor for the
[180] Fix | Delete
# format of a frame tuple; it is reversed, because _tracemalloc
[181] Fix | Delete
# returns frames sorted from most recent to oldest, but the
[182] Fix | Delete
# Python API expects oldest to most recent
[183] Fix | Delete
self._frames = tuple(reversed(frames))
[184] Fix | Delete
[185] Fix | Delete
def __len__(self):
[186] Fix | Delete
return len(self._frames)
[187] Fix | Delete
[188] Fix | Delete
def __getitem__(self, index):
[189] Fix | Delete
if isinstance(index, slice):
[190] Fix | Delete
return tuple(Frame(trace) for trace in self._frames[index])
[191] Fix | Delete
else:
[192] Fix | Delete
return Frame(self._frames[index])
[193] Fix | Delete
[194] Fix | Delete
def __contains__(self, frame):
[195] Fix | Delete
return frame._frame in self._frames
[196] Fix | Delete
[197] Fix | Delete
def __hash__(self):
[198] Fix | Delete
return hash(self._frames)
[199] Fix | Delete
[200] Fix | Delete
def __eq__(self, other):
[201] Fix | Delete
return (self._frames == other._frames)
[202] Fix | Delete
[203] Fix | Delete
def __lt__(self, other):
[204] Fix | Delete
return (self._frames < other._frames)
[205] Fix | Delete
[206] Fix | Delete
def __str__(self):
[207] Fix | Delete
return str(self[0])
[208] Fix | Delete
[209] Fix | Delete
def __repr__(self):
[210] Fix | Delete
return "<Traceback %r>" % (tuple(self),)
[211] Fix | Delete
[212] Fix | Delete
def format(self, limit=None, most_recent_first=False):
[213] Fix | Delete
lines = []
[214] Fix | Delete
if limit is not None:
[215] Fix | Delete
if limit > 0:
[216] Fix | Delete
frame_slice = self[-limit:]
[217] Fix | Delete
else:
[218] Fix | Delete
frame_slice = self[:limit]
[219] Fix | Delete
else:
[220] Fix | Delete
frame_slice = self
[221] Fix | Delete
[222] Fix | Delete
if most_recent_first:
[223] Fix | Delete
frame_slice = reversed(frame_slice)
[224] Fix | Delete
for frame in frame_slice:
[225] Fix | Delete
lines.append(' File "%s", line %s'
[226] Fix | Delete
% (frame.filename, frame.lineno))
[227] Fix | Delete
line = linecache.getline(frame.filename, frame.lineno).strip()
[228] Fix | Delete
if line:
[229] Fix | Delete
lines.append(' %s' % line)
[230] Fix | Delete
return lines
[231] Fix | Delete
[232] Fix | Delete
[233] Fix | Delete
def get_object_traceback(obj):
[234] Fix | Delete
"""
[235] Fix | Delete
Get the traceback where the Python object *obj* was allocated.
[236] Fix | Delete
Return a Traceback instance.
[237] Fix | Delete
[238] Fix | Delete
Return None if the tracemalloc module is not tracing memory allocations or
[239] Fix | Delete
did not trace the allocation of the object.
[240] Fix | Delete
"""
[241] Fix | Delete
frames = _get_object_traceback(obj)
[242] Fix | Delete
if frames is not None:
[243] Fix | Delete
return Traceback(frames)
[244] Fix | Delete
else:
[245] Fix | Delete
return None
[246] Fix | Delete
[247] Fix | Delete
[248] Fix | Delete
class Trace:
[249] Fix | Delete
"""
[250] Fix | Delete
Trace of a memory block.
[251] Fix | Delete
"""
[252] Fix | Delete
__slots__ = ("_trace",)
[253] Fix | Delete
[254] Fix | Delete
def __init__(self, trace):
[255] Fix | Delete
# trace is a tuple: (domain: int, size: int, traceback: tuple).
[256] Fix | Delete
# See Traceback constructor for the format of the traceback tuple.
[257] Fix | Delete
self._trace = trace
[258] Fix | Delete
[259] Fix | Delete
@property
[260] Fix | Delete
def domain(self):
[261] Fix | Delete
return self._trace[0]
[262] Fix | Delete
[263] Fix | Delete
@property
[264] Fix | Delete
def size(self):
[265] Fix | Delete
return self._trace[1]
[266] Fix | Delete
[267] Fix | Delete
@property
[268] Fix | Delete
def traceback(self):
[269] Fix | Delete
return Traceback(self._trace[2])
[270] Fix | Delete
[271] Fix | Delete
def __eq__(self, other):
[272] Fix | Delete
return (self._trace == other._trace)
[273] Fix | Delete
[274] Fix | Delete
def __hash__(self):
[275] Fix | Delete
return hash(self._trace)
[276] Fix | Delete
[277] Fix | Delete
def __str__(self):
[278] Fix | Delete
return "%s: %s" % (self.traceback, _format_size(self.size, False))
[279] Fix | Delete
[280] Fix | Delete
def __repr__(self):
[281] Fix | Delete
return ("<Trace domain=%s size=%s, traceback=%r>"
[282] Fix | Delete
% (self.domain, _format_size(self.size, False), self.traceback))
[283] Fix | Delete
[284] Fix | Delete
[285] Fix | Delete
class _Traces(Sequence):
[286] Fix | Delete
def __init__(self, traces):
[287] Fix | Delete
Sequence.__init__(self)
[288] Fix | Delete
# traces is a tuple of trace tuples: see Trace constructor
[289] Fix | Delete
self._traces = traces
[290] Fix | Delete
[291] Fix | Delete
def __len__(self):
[292] Fix | Delete
return len(self._traces)
[293] Fix | Delete
[294] Fix | Delete
def __getitem__(self, index):
[295] Fix | Delete
if isinstance(index, slice):
[296] Fix | Delete
return tuple(Trace(trace) for trace in self._traces[index])
[297] Fix | Delete
else:
[298] Fix | Delete
return Trace(self._traces[index])
[299] Fix | Delete
[300] Fix | Delete
def __contains__(self, trace):
[301] Fix | Delete
return trace._trace in self._traces
[302] Fix | Delete
[303] Fix | Delete
def __eq__(self, other):
[304] Fix | Delete
return (self._traces == other._traces)
[305] Fix | Delete
[306] Fix | Delete
def __repr__(self):
[307] Fix | Delete
return "<Traces len=%s>" % len(self)
[308] Fix | Delete
[309] Fix | Delete
[310] Fix | Delete
def _normalize_filename(filename):
[311] Fix | Delete
filename = os.path.normcase(filename)
[312] Fix | Delete
if filename.endswith('.pyc'):
[313] Fix | Delete
filename = filename[:-1]
[314] Fix | Delete
return filename
[315] Fix | Delete
[316] Fix | Delete
[317] Fix | Delete
class BaseFilter:
[318] Fix | Delete
def __init__(self, inclusive):
[319] Fix | Delete
self.inclusive = inclusive
[320] Fix | Delete
[321] Fix | Delete
def _match(self, trace):
[322] Fix | Delete
raise NotImplementedError
[323] Fix | Delete
[324] Fix | Delete
[325] Fix | Delete
class Filter(BaseFilter):
[326] Fix | Delete
def __init__(self, inclusive, filename_pattern,
[327] Fix | Delete
lineno=None, all_frames=False, domain=None):
[328] Fix | Delete
super().__init__(inclusive)
[329] Fix | Delete
self.inclusive = inclusive
[330] Fix | Delete
self._filename_pattern = _normalize_filename(filename_pattern)
[331] Fix | Delete
self.lineno = lineno
[332] Fix | Delete
self.all_frames = all_frames
[333] Fix | Delete
self.domain = domain
[334] Fix | Delete
[335] Fix | Delete
@property
[336] Fix | Delete
def filename_pattern(self):
[337] Fix | Delete
return self._filename_pattern
[338] Fix | Delete
[339] Fix | Delete
def _match_frame_impl(self, filename, lineno):
[340] Fix | Delete
filename = _normalize_filename(filename)
[341] Fix | Delete
if not fnmatch.fnmatch(filename, self._filename_pattern):
[342] Fix | Delete
return False
[343] Fix | Delete
if self.lineno is None:
[344] Fix | Delete
return True
[345] Fix | Delete
else:
[346] Fix | Delete
return (lineno == self.lineno)
[347] Fix | Delete
[348] Fix | Delete
def _match_frame(self, filename, lineno):
[349] Fix | Delete
return self._match_frame_impl(filename, lineno) ^ (not self.inclusive)
[350] Fix | Delete
[351] Fix | Delete
def _match_traceback(self, traceback):
[352] Fix | Delete
if self.all_frames:
[353] Fix | Delete
if any(self._match_frame_impl(filename, lineno)
[354] Fix | Delete
for filename, lineno in traceback):
[355] Fix | Delete
return self.inclusive
[356] Fix | Delete
else:
[357] Fix | Delete
return (not self.inclusive)
[358] Fix | Delete
else:
[359] Fix | Delete
filename, lineno = traceback[0]
[360] Fix | Delete
return self._match_frame(filename, lineno)
[361] Fix | Delete
[362] Fix | Delete
def _match(self, trace):
[363] Fix | Delete
domain, size, traceback = trace
[364] Fix | Delete
res = self._match_traceback(traceback)
[365] Fix | Delete
if self.domain is not None:
[366] Fix | Delete
if self.inclusive:
[367] Fix | Delete
return res and (domain == self.domain)
[368] Fix | Delete
else:
[369] Fix | Delete
return res or (domain != self.domain)
[370] Fix | Delete
return res
[371] Fix | Delete
[372] Fix | Delete
[373] Fix | Delete
class DomainFilter(BaseFilter):
[374] Fix | Delete
def __init__(self, inclusive, domain):
[375] Fix | Delete
super().__init__(inclusive)
[376] Fix | Delete
self._domain = domain
[377] Fix | Delete
[378] Fix | Delete
@property
[379] Fix | Delete
def domain(self):
[380] Fix | Delete
return self._domain
[381] Fix | Delete
[382] Fix | Delete
def _match(self, trace):
[383] Fix | Delete
domain, size, traceback = trace
[384] Fix | Delete
return (domain == self.domain) ^ (not self.inclusive)
[385] Fix | Delete
[386] Fix | Delete
[387] Fix | Delete
class Snapshot:
[388] Fix | Delete
"""
[389] Fix | Delete
Snapshot of traces of memory blocks allocated by Python.
[390] Fix | Delete
"""
[391] Fix | Delete
[392] Fix | Delete
def __init__(self, traces, traceback_limit):
[393] Fix | Delete
# traces is a tuple of trace tuples: see _Traces constructor for
[394] Fix | Delete
# the exact format
[395] Fix | Delete
self.traces = _Traces(traces)
[396] Fix | Delete
self.traceback_limit = traceback_limit
[397] Fix | Delete
[398] Fix | Delete
def dump(self, filename):
[399] Fix | Delete
"""
[400] Fix | Delete
Write the snapshot into a file.
[401] Fix | Delete
"""
[402] Fix | Delete
with open(filename, "wb") as fp:
[403] Fix | Delete
pickle.dump(self, fp, pickle.HIGHEST_PROTOCOL)
[404] Fix | Delete
[405] Fix | Delete
@staticmethod
[406] Fix | Delete
def load(filename):
[407] Fix | Delete
"""
[408] Fix | Delete
Load a snapshot from a file.
[409] Fix | Delete
"""
[410] Fix | Delete
with open(filename, "rb") as fp:
[411] Fix | Delete
return pickle.load(fp)
[412] Fix | Delete
[413] Fix | Delete
def _filter_trace(self, include_filters, exclude_filters, trace):
[414] Fix | Delete
if include_filters:
[415] Fix | Delete
if not any(trace_filter._match(trace)
[416] Fix | Delete
for trace_filter in include_filters):
[417] Fix | Delete
return False
[418] Fix | Delete
if exclude_filters:
[419] Fix | Delete
if any(not trace_filter._match(trace)
[420] Fix | Delete
for trace_filter in exclude_filters):
[421] Fix | Delete
return False
[422] Fix | Delete
return True
[423] Fix | Delete
[424] Fix | Delete
def filter_traces(self, filters):
[425] Fix | Delete
"""
[426] Fix | Delete
Create a new Snapshot instance with a filtered traces sequence, filters
[427] Fix | Delete
is a list of Filter or DomainFilter instances. If filters is an empty
[428] Fix | Delete
list, return a new Snapshot instance with a copy of the traces.
[429] Fix | Delete
"""
[430] Fix | Delete
if not isinstance(filters, Iterable):
[431] Fix | Delete
raise TypeError("filters must be a list of filters, not %s"
[432] Fix | Delete
% type(filters).__name__)
[433] Fix | Delete
if filters:
[434] Fix | Delete
include_filters = []
[435] Fix | Delete
exclude_filters = []
[436] Fix | Delete
for trace_filter in filters:
[437] Fix | Delete
if trace_filter.inclusive:
[438] Fix | Delete
include_filters.append(trace_filter)
[439] Fix | Delete
else:
[440] Fix | Delete
exclude_filters.append(trace_filter)
[441] Fix | Delete
new_traces = [trace for trace in self.traces._traces
[442] Fix | Delete
if self._filter_trace(include_filters,
[443] Fix | Delete
exclude_filters,
[444] Fix | Delete
trace)]
[445] Fix | Delete
else:
[446] Fix | Delete
new_traces = self.traces._traces.copy()
[447] Fix | Delete
return Snapshot(new_traces, self.traceback_limit)
[448] Fix | Delete
[449] Fix | Delete
def _group_by(self, key_type, cumulative):
[450] Fix | Delete
if key_type not in ('traceback', 'filename', 'lineno'):
[451] Fix | Delete
raise ValueError("unknown key_type: %r" % (key_type,))
[452] Fix | Delete
if cumulative and key_type not in ('lineno', 'filename'):
[453] Fix | Delete
raise ValueError("cumulative mode cannot by used "
[454] Fix | Delete
"with key type %r" % key_type)
[455] Fix | Delete
[456] Fix | Delete
stats = {}
[457] Fix | Delete
tracebacks = {}
[458] Fix | Delete
if not cumulative:
[459] Fix | Delete
for trace in self.traces._traces:
[460] Fix | Delete
domain, size, trace_traceback = trace
[461] Fix | Delete
try:
[462] Fix | Delete
traceback = tracebacks[trace_traceback]
[463] Fix | Delete
except KeyError:
[464] Fix | Delete
if key_type == 'traceback':
[465] Fix | Delete
frames = trace_traceback
[466] Fix | Delete
elif key_type == 'lineno':
[467] Fix | Delete
frames = trace_traceback[:1]
[468] Fix | Delete
else: # key_type == 'filename':
[469] Fix | Delete
frames = ((trace_traceback[0][0], 0),)
[470] Fix | Delete
traceback = Traceback(frames)
[471] Fix | Delete
tracebacks[trace_traceback] = traceback
[472] Fix | Delete
try:
[473] Fix | Delete
stat = stats[traceback]
[474] Fix | Delete
stat.size += size
[475] Fix | Delete
stat.count += 1
[476] Fix | Delete
except KeyError:
[477] Fix | Delete
stats[traceback] = Statistic(traceback, size, 1)
[478] Fix | Delete
else:
[479] Fix | Delete
# cumulative statistics
[480] Fix | Delete
for trace in self.traces._traces:
[481] Fix | Delete
domain, size, trace_traceback = trace
[482] Fix | Delete
for frame in trace_traceback:
[483] Fix | Delete
try:
[484] Fix | Delete
traceback = tracebacks[frame]
[485] Fix | Delete
except KeyError:
[486] Fix | Delete
if key_type == 'lineno':
[487] Fix | Delete
frames = (frame,)
[488] Fix | Delete
else: # key_type == 'filename':
[489] Fix | Delete
frames = ((frame[0], 0),)
[490] Fix | Delete
traceback = Traceback(frames)
[491] Fix | Delete
tracebacks[frame] = traceback
[492] Fix | Delete
try:
[493] Fix | Delete
stat = stats[traceback]
[494] Fix | Delete
stat.size += size
[495] Fix | Delete
stat.count += 1
[496] Fix | Delete
except KeyError:
[497] Fix | Delete
stats[traceback] = Statistic(traceback, size, 1)
[498] Fix | Delete
return stats
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function