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