"""A more or less complete user-defined wrapper around list objects.""" class UserList: def __init__(self, initlist=None): self.data = [] if initlist is not None: # XXX should this accept an arbitrary sequence? if type(initlist) == type(self.data): self.data[:] = initlist elif isinstance(initlist, UserList): self.data[:] = initlist.data[:] else: self.data = list(initlist) def __repr__(self): return repr(self.data) def __lt__(self, other): return self.data < self.__cast(other) def __le__(self, other): return self.data <= self.__cast(other) def __eq__(self, other): return self.data == self.__cast(other) def __ne__(self, other): return self.data != self.__cast(other) def __gt__(self, other): return self.data > self.__cast(other) def __ge__(self, other): return self.data >= self.__cast(other) def __cast(self, other): if isinstance(other, UserList): return other.data else: return other def __cmp__(self, other): return cmp(self.data, self.__cast(other)) def __contains__(self, item): return item in self.data def __len__(self): return len(self.data) def __getitem__(self, i): return self.data[i] def __setitem__(self, i, item): self.data[i] = item def __delitem__(self, i): del self.data[i] def __getslice__(self, i, j): i = max(i, 0); j = max(j, 0) return self.__class__(self.data[i:j]) def __setslice__(self, i, j, other): i = max(i, 0); j = max(j, 0) if isinstance(other, UserList): self.data[i:j] = other.data elif isinstance(other, type(self.data)): self.data[i:j] = other else: self.data[i:j] = list(other) def __delslice__(self, i, j): i = max(i, 0); j = max(j, 0) del self.data[i:j] def __add__(self, other): if isinstance(other, UserList): return self.__class__(self.data + other.data) elif isinstance(other, type(self.data)): return self.__class__(self.data + other) else: return self.__class__(self.data + list(other)) def __radd__(self, other): if isinstance(other, UserList): return self.__class__(other.data + self.data) elif isinstance(other, type(self.data)): return self.__class__(other + self.data) else: return self.__class__(list(other) + self.data) def __iadd__(self, other): if isinstance(other, UserList): self.data += other.data elif isinstance(other, type(self.data)): self.data += other else: self.data += list(other) return self def __mul__(self, n): return self.__class__(self.data*n) __rmul__ = __mul__ def __imul__(self, n): self.data *= n return self def append(self, item): self.data.append(item) def insert(self, i, item): self.data.insert(i, item) def pop(self, i=-1): return self.data.pop(i) def remove(self, item): self.data.remove(item) def count(self, item): return self.data.count(item) def index(self, item, *args): return self.data.index(item, *args) def reverse(self): self.data.reverse() def sort(self, *args, **kwds): self.data.sort(*args, **kwds) def extend(self, other): if isinstance(other, UserList): self.data.extend(other.data) else: self.data.extend(other) lass='commitgraph'> * [3.7] bpo-33041: Add tests for jumps in/out of 'async with' blocks. (GH-6110)...Serhiy Storchaka2018-03-181-0/+117 * [3.7] bpo-17288: Prevent jumps from 'return' and 'exception' trace events. (G...xdegaye2018-03-131-11/+57 * [3.7] bpo-33026: Fix jumping out of "with" block by setting f_lineno. (GH-602...Serhiy Storchaka2018-03-111-0/+28 * bpo-32416: Add two new tests in test_sys_settrace. (#5072)Serhiy Storchaka2018-01-011-8/+30 * Fix minor spelling error in test_sys_settrace.py. (#5025)gfyoung2017-12-281-1/+1 * bpo-32416: Refactor tests for the f_lineno setter and add new tests. (#4991)Serhiy Storchaka2017-12-261-248/+405 * bpo-32297: Few misspellings found in Python source code comments. (#4803)Mike2017-12-141-1/+1 * bpo-31344: Per-frame control of trace events (GH-3417)Nick Coghlan2017-09-081-4/+52 * Issue #20041: Fixed TypeError when frame.f_trace is set to None.Serhiy Storchaka2016-06-041-0/+9 |\ | * Issue #20041: Fixed TypeError when frame.f_trace is set to None.Serhiy Storchaka2016-06-04