diff options
author | shadchin <shadchin@yandex-team.ru> | 2022-02-10 16:44:30 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:30 +0300 |
commit | 2598ef1d0aee359b4b6d5fdd1758916d5907d04f (patch) | |
tree | 012bb94d777798f1f56ac1cec429509766d05181 /contrib/tools/python3/src/Lib/tracemalloc.py | |
parent | 6751af0b0c1b952fede40b19b71da8025b5d8bcf (diff) | |
download | ydb-2598ef1d0aee359b4b6d5fdd1758916d5907d04f.tar.gz |
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/tools/python3/src/Lib/tracemalloc.py')
-rw-r--r-- | contrib/tools/python3/src/Lib/tracemalloc.py | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/contrib/tools/python3/src/Lib/tracemalloc.py b/contrib/tools/python3/src/Lib/tracemalloc.py index cec99c5970..ddb216dd00 100644 --- a/contrib/tools/python3/src/Lib/tracemalloc.py +++ b/contrib/tools/python3/src/Lib/tracemalloc.py @@ -43,8 +43,8 @@ class Statistic: return hash((self.traceback, self.size, self.count)) def __eq__(self, other): - if not isinstance(other, Statistic): - return NotImplemented + if not isinstance(other, Statistic): + return NotImplemented return (self.traceback == other.traceback and self.size == other.size and self.count == other.count) @@ -86,8 +86,8 @@ class StatisticDiff: self.count, self.count_diff)) def __eq__(self, other): - if not isinstance(other, StatisticDiff): - return NotImplemented + if not isinstance(other, StatisticDiff): + return NotImplemented return (self.traceback == other.traceback and self.size == other.size and self.size_diff == other.size_diff @@ -157,13 +157,13 @@ class Frame: return self._frame[1] def __eq__(self, other): - if not isinstance(other, Frame): - return NotImplemented + if not isinstance(other, Frame): + return NotImplemented return (self._frame == other._frame) def __lt__(self, other): - if not isinstance(other, Frame): - return NotImplemented + if not isinstance(other, Frame): + return NotImplemented return (self._frame < other._frame) def __hash__(self): @@ -182,21 +182,21 @@ class Traceback(Sequence): Sequence of Frame instances sorted from the oldest frame to the most recent frame. """ - __slots__ = ("_frames", '_total_nframe') + __slots__ = ("_frames", '_total_nframe') - def __init__(self, frames, total_nframe=None): + def __init__(self, frames, total_nframe=None): Sequence.__init__(self) # frames is a tuple of frame tuples: see Frame constructor for the # format of a frame tuple; it is reversed, because _tracemalloc # returns frames sorted from most recent to oldest, but the # Python API expects oldest to most recent self._frames = tuple(reversed(frames)) - self._total_nframe = total_nframe - - @property - def total_nframe(self): - return self._total_nframe + self._total_nframe = total_nframe + @property + def total_nframe(self): + return self._total_nframe + def __len__(self): return len(self._frames) @@ -213,25 +213,25 @@ class Traceback(Sequence): return hash(self._frames) def __eq__(self, other): - if not isinstance(other, Traceback): - return NotImplemented + if not isinstance(other, Traceback): + return NotImplemented return (self._frames == other._frames) def __lt__(self, other): - if not isinstance(other, Traceback): - return NotImplemented + if not isinstance(other, Traceback): + return NotImplemented return (self._frames < other._frames) def __str__(self): return str(self[0]) def __repr__(self): - s = f"<Traceback {tuple(self)}" - if self._total_nframe is None: - s += ">" - else: - s += f" total_nframe={self.total_nframe}>" - return s + s = f"<Traceback {tuple(self)}" + if self._total_nframe is None: + s += ">" + else: + s += f" total_nframe={self.total_nframe}>" + return s def format(self, limit=None, most_recent_first=False): lines = [] @@ -290,11 +290,11 @@ class Trace: @property def traceback(self): - return Traceback(*self._trace[2:]) + return Traceback(*self._trace[2:]) def __eq__(self, other): - if not isinstance(other, Trace): - return NotImplemented + if not isinstance(other, Trace): + return NotImplemented return (self._trace == other._trace) def __hash__(self): @@ -327,8 +327,8 @@ class _Traces(Sequence): return trace._trace in self._traces def __eq__(self, other): - if not isinstance(other, _Traces): - return NotImplemented + if not isinstance(other, _Traces): + return NotImplemented return (self._traces == other._traces) def __repr__(self): @@ -388,7 +388,7 @@ class Filter(BaseFilter): return self._match_frame(filename, lineno) def _match(self, trace): - domain, size, traceback, total_nframe = trace + domain, size, traceback, total_nframe = trace res = self._match_traceback(traceback) if self.domain is not None: if self.inclusive: @@ -408,7 +408,7 @@ class DomainFilter(BaseFilter): return self._domain def _match(self, trace): - domain, size, traceback, total_nframe = trace + domain, size, traceback, total_nframe = trace return (domain == self.domain) ^ (not self.inclusive) @@ -485,7 +485,7 @@ class Snapshot: tracebacks = {} if not cumulative: for trace in self.traces._traces: - domain, size, trace_traceback, total_nframe = trace + domain, size, trace_traceback, total_nframe = trace try: traceback = tracebacks[trace_traceback] except KeyError: @@ -506,7 +506,7 @@ class Snapshot: else: # cumulative statistics for trace in self.traces._traces: - domain, size, trace_traceback, total_nframe = trace + domain, size, trace_traceback, total_nframe = trace for frame in trace_traceback: try: traceback = tracebacks[frame] |