bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def test_format_int(self): import sys assert '23' == '%d' % 23 assert '17' == '%x' % 23 assert '0x17' == '%#x' % 23 assert '0x0' == '%#x' % 0 assert '23' == '%s' % 23 assert '23' == '%r' % 23 assert ('%d' % (-sys.maxint-1,) == '-' + str(sys.maxint+1) == '-%d' % (sys.maxint+1,)) assert '1C' == '%X' % 28 assert '0X1C' ==... | def test_format_int(self): import sys assert '23' == '%d' % 23 assert '17' == '%x' % 23 assert '0x17' == '%#x' % 23 assert '0x0' == '%#x' % 0 assert '23' == '%s' % 23 assert '23' == '%r' % 23 assert ('%d' % (-sys.maxint-1,) == '-' + str(sys.maxint+1) == '-%d' % (sys.maxint+1,)) assert '1C' == '%X' % 28 assert '0X1C' ==... | 452,800 |
def test_format_list(self): assert '<[1, 2]>' == '<%s>' % [1,2] assert '<[1, 2]-[3, 4]>' == '<%s-%s>' % ([1,2], [3,4]) | def test_format_list(self): assert '<[1, 2]>' == '<%s>' % [1,2] assert '<[1, 2]-[3, 4]>' == '<%s-%s>' % ([1,2], [3,4]) | 452,801 |
def test_format_tuple(self): assert '<(1, 2)>' == '<%s>' % ((1,2),) assert '<(1, 2)-(3, 4)>' == '<%s-%s>' % ((1,2), (3,4)) | def test_format_tuple(self): assert '<(1, 2)>' == '<%s>' % ((1,2),) assert '<(1, 2)-(3, 4)>' == '<%s-%s>' % ((1,2), (3,4)) | 452,802 |
def test_format_dict(self): | def test_format_dict(self): | 452,803 |
def test_format_char(self): import sys assert '%c' % 65 == 'A' assert '%c' % 'e' == 'e' raises(OverflowError, '%c'.__mod__, (256,)) raises(OverflowError, '%c'.__mod__, (-1,)) raises(OverflowError, u'%c'.__mod__, (sys.maxunicode+1,)) raises(TypeError, '%c'.__mod__, ("bla",)) raises(TypeError, '%c'.__mod__, ("",)) raises... | def test_format_char(self): import sys A = 65 e = 'e' assert '%c' % A == 'A' assert '%c' % e == 'e' raises(OverflowError, '%c'.__mod__, (256,)) raises(OverflowError, '%c'.__mod__, (-1,)) raises(OverflowError, u'%c'.__mod__, (sys.maxunicode+1,)) raises(TypeError, '%c'.__mod__, ("bla",)) raises(TypeError, '%c'.__mod__, (... | 452,804 |
def test_width(self): assert "%3s" %'a' == ' a' assert "%-3s"%'a' == 'a ' | def test_width(self): assert "%3s" %'a' == ' a' assert "%-3s"%'a' == 'a ' | 452,805 |
def test_prec_cornercase(self): assert "%.0x" % 0 == '' assert "%.x" % 0 == '' assert "%.0d" % 0 == '' assert "%.i" % 0 == '' assert "%.0o" % 0 == '' assert "%.o" % 0 == '' | def test_prec_cornercase(self): assert "%.0x" % 0 == '' assert "%.x" % 0 == '' assert "%.0d" % 0 == '' assert "%.i" % 0 == '' assert "%.0o" % 0 == '' assert "%.o" % 0 == '' | 452,806 |
def test_prec_string(self): assert "%.3s"%'a' == 'a' assert "%.3s"%'abcde' == 'abc' | def test_prec_string(self): assert "%.3s"%'a' == 'a' assert "%.3s"%'abcde' == 'abc' | 452,807 |
def test_prec_width_string(self): assert "%5.3s" %'a' == ' a' assert "%5.3s" %'abcde' == ' abc' assert "%-5.3s"%'a' == 'a ' assert "%-5.3s"%'abcde' == 'abc ' | def test_prec_width_string(self): assert "%5.3s" %'a' == ' a' assert "%5.3s" %'abcde' == ' abc' assert "%-5.3s"%'a' == 'a ' assert "%-5.3s"%'abcde' == 'abc ' | 452,808 |
def test_zero_pad(self): assert "%02d"%1 == "01" assert "%05d"%1 == "00001" assert "%-05d"%1 == "1 " assert "%04f"%2.25 == "2.250000" assert "%05g"%2.25 == "02.25" assert "%-05g"%2.25 =="2.25 " assert "%05s"%2.25 == " 2.25" | def test_zero_pad(self): assert "%02d"%1 == "01" assert "%05d"%1 == "00001" assert "%-05d"%1 == "1 " assert "%04f"%2.25 == "2.250000" assert "%05g"%2.25 == "02.25" assert "%-05g"%2.25 =="2.25 " assert "%05s"%2.25 == " 2.25" | 452,809 |
def test_star_width(self): assert "%*s" %( 5, 'abc') == ' abc' assert "%*s" %(-5, 'abc') == 'abc ' assert "%-*s"%( 5, 'abc') == 'abc ' assert "%-*s"%(-5, 'abc') == 'abc ' | def test_star_width(self): assert "%*s" %( 5, 'abc') == ' abc' assert "%*s" %(-5, 'abc') == 'abc ' assert "%-*s"%( 5, 'abc') == 'abc ' assert "%-*s"%(-5, 'abc') == 'abc ' | 452,810 |
def test_star_prec(self): assert "%.*s"%( 3, 'abc') == 'abc' assert "%.*s"%( 3, 'abcde') == 'abc' assert "%.*s"%(-3, 'abc') == '' | def test_star_prec(self): assert "%.*s"%( 3, 'abc') == 'abc' assert "%.*s"%( 3, 'abcde') == 'abc' assert "%.*s"%(-3, 'abc') == '' | 452,811 |
def test_star_width_prec(self): assert "%*.*s"%( 5, 3, 'abc') == ' abc' assert "%*.*s"%( 5, 3, 'abcde') == ' abc' assert "%*.*s"%(-5, 3, 'abcde') == 'abc ' | def test_star_width_prec(self): assert "%*.*s"%( 5, 3, 'abc') == ' abc' assert "%*.*s"%( 5, 3, 'abcde') == ' abc' assert "%*.*s"%(-5, 3, 'abcde') == 'abc ' | 452,812 |
def test_unicode_convert(self): assert isinstance("%s" % (u"x"), unicode) | def test_unicode_convert(self): assert isinstance("%s" % (u"x"), unicode) | 452,813 |
def test_unicode_nonascii(self): """ Interpolating a unicode string with non-ascii characters in it into a string format should decode the format string as ascii and return unicode. """ result = "%s" % u'\x80' assert isinstance(result, unicode) assert result == u'\x80' | def test_unicode_nonascii(self): """ Interpolating a unicode string with non-ascii characters in it into a string format should decode the format string as ascii and return unicode. """ u = u'\x80' result = "%s" % u assert isinstance(result, unicode) assert result == u'\x80' | 452,814 |
def test_unicode_nonascii(self): """ Interpolating a unicode string with non-ascii characters in it into a string format should decode the format string as ascii and return unicode. """ result = "%s" % u'\x80' assert isinstance(result, unicode) assert result == u'\x80' | def test_unicode_nonascii(self): """ Interpolating a unicode string with non-ascii characters in it into a string format should decode the format string as ascii and return unicode. """ result = "%s" % u'\x80' assert isinstance(result, unicode) assert result == u'\x80' | 452,815 |
def test_unicode_d(self): assert u"%.1d" % 3 == '3' | def test_unicode_d(self): assert u"%.1d" % 3 == '3' | 452,816 |
def test_unicode_format_a(self): assert u'%x' % 10L == 'a' | def test_unicode_format_a(self): assert u'%x' % 10L == 'a' | 452,817 |
def test_long_no_overflow(self): assert "%x" % 100000000000L == "174876e800" | def test_long_no_overflow(self): assert "%x" % 100000000000L == "174876e800" | 452,818 |
def test_missing_cases(self): print '%032d' % -123456789012345678901234567890L assert '%032d' % -123456789012345678901234567890L == '-0123456789012345678901234567890' | def test_missing_cases(self): print '%032d' % -123456789012345678901234567890L assert '%032d' % -123456789012345678901234567890L == '-0123456789012345678901234567890' | 452,819 |
W_SomeType.typedef = typedef.TypeDef( 'some_type', x=prop) | W_SomeType.typedef = typedef.TypeDef( 'some_type', x=prop) | 452,820 |
def __init__(self, cpu=None, jitdrivers_sd=[]): self.cpu = cpu self.assembler = Assembler() self.callcontrol = CallControl(cpu, jitdrivers_sd) self._seen_files = set() | def __init__(self, cpu=None, jitdrivers_sd=[], debug=False): self.cpu = cpu self.assembler = Assembler() self.callcontrol = CallControl(cpu, jitdrivers_sd) self._seen_files = set() | 452,821 |
def transform_graph_to_jitcode(self, graph, jitcode, verbose): """Transform a graph into a JitCode containing the same bytecode in a different format. """ portal_jd = self.callcontrol.jitdriver_sd_from_portal_graph(graph) graph = copygraph(graph, shallowvars=True) # # step 1: mangle the graph so that it contains the fi... | def transform_graph_to_jitcode(self, graph, jitcode, verbose): """Transform a graph into a JitCode containing the same bytecode in a different format. """ portal_jd = self.callcontrol.jitdriver_sd_from_portal_graph(graph) graph = copygraph(graph, shallowvars=True) # # step 1: mangle the graph so that it contains the fi... | 452,822 |
def descr_compile(self, space, filename="<syntax-tree>"): info = pyparse.CompileInfo(filename, self.mode) ast = ast_from_node(space, self.tree, info) return space.wrap(compile_ast(space, ast, info)) | def descr_compile(self, space, filename="<syntax-tree>"): info = pyparse.CompileInfo(filename, self.mode) ast = ast_from_node(space, self.tree, info) return space.wrap(compile_ast(space, ast, info)) | 452,823 |
def compile_module(modname, **kwds): """ Build an extension module and return the filename of the resulting native code file. modname is the name of the module, possibly including dots if it is a module inside a package. Any extra keyword arguments are passed on to ExternalCompilationInfo to build the module (so spec... | def compile_module(space, modname, **kwds): """ Build an extension module and return the filename of the resulting native code file. modname is the name of the module, possibly including dots if it is a module inside a package. Any extra keyword arguments are passed on to ExternalCompilationInfo to build the module (... | 452,824 |
def compile_module(modname, **kwds): """ Build an extension module and return the filename of the resulting native code file. modname is the name of the module, possibly including dots if it is a module inside a package. Any extra keyword arguments are passed on to ExternalCompilationInfo to build the module (so spec... | def compile_module(modname, **kwds): """ Build an extension module and return the filename of the resulting native code file. modname is the name of the module, possibly including dots if it is a module inside a package. Any extra keyword arguments are passed on to ExternalCompilationInfo to build the module (so spec... | 452,825 |
def compile_module(self, name, **kwds): """ Build an extension module linked against the cpyext api library. """ state = self.space.fromcache(State) api_library = state.api_lib if sys.platform == 'win32': kwds["libraries"] = [api_library] # '%s' undefined; assuming extern returning int kwds["compile_extra"] = ["/we4013... | def compile_module(self, name, **kwds): """ Build an extension module linked against the cpyext api library. """ state = self.space.fromcache(State) api_library = state.api_lib if sys.platform == 'win32': kwds["libraries"] = [api_library] # '%s' undefined; assuming extern returning int kwds["compile_extra"] = ["/we4013... | 452,826 |
def test_p123_array(self): ops = """ [i1, p2, p3] i3 = getarrayitem_gc(p3, 0, descr=arraydescr) escape(i3) p1 = new_array(1, descr=arraydescr) setarrayitem_gc(p1, 0, i1, descr=arraydescr) jump(i1, p1, p2) """ # We cannot track virtuals that survive for more than two iterations. self.optimize_loop(ops, 'Not, Not, Not', ... | def test_p123_array(self): ops = """ [i1, p2, p3] i3 = getarrayitem_gc(p3, 0, descr=arraydescr) escape(i3) p1 = new_array(1, descr=arraydescr) setarrayitem_gc(p1, 0, i1, descr=arraydescr) jump(i1, p1, p2) """ # We cannot track virtuals that survive for more than two iterations. self.optimize_loop(ops, 'Not, Not, Not', ... | 452,827 |
def test_vstruct_1(self): ops = """ [i1, p2] i2 = getfield_gc(p2, descr=adescr) escape(i2) p3 = new(descr=ssize) setfield_gc(p3, i1, descr=adescr) jump(i1, p3) """ expected = """ [i1, i2] escape(i2) jump(i1, i1) """ self.optimize_loop(ops, 'Not, VStruct(ssize, adescr=Not)', expected) | def test_vstruct_1(self): ops = """ [i1, p2] i2 = getfield_gc(p2, descr=adescr) escape(i2) p3 = new(descr=ssize) setfield_gc(p3, i1, descr=adescr) jump(i1, p3) """ preamble = """ [i1, p2] i2 = getfield_gc(p2, descr=adescr) escape(i2) jump(i1, i1) """ self.optimize_loop(ops, 'Not, VStruct(ssize, adescr=Not)', expected) | 452,828 |
def test_vstruct_1(self): ops = """ [i1, p2] i2 = getfield_gc(p2, descr=adescr) escape(i2) p3 = new(descr=ssize) setfield_gc(p3, i1, descr=adescr) jump(i1, p3) """ expected = """ [i1, i2] escape(i2) jump(i1, i1) """ self.optimize_loop(ops, 'Not, VStruct(ssize, adescr=Not)', expected) | def test_vstruct_1(self): ops = """ [i1, p2] i2 = getfield_gc(p2, descr=adescr) escape(i2) p3 = new(descr=ssize) setfield_gc(p3, i1, descr=adescr) jump(i1, p3) """ expected = """ [i1, i2] escape(i2) jump(i1, i1) """ self.optimize_loop(ops, 'Not, VStruct(ssize, adescr=Not)', expected) | 452,829 |
def test_p123_vstruct(self): ops = """ [i1, p2, p3] i3 = getfield_gc(p3, descr=adescr) escape(i3) p1 = new(descr=ssize) setfield_gc(p1, i1, descr=adescr) jump(i1, p1, p2) """ # We cannot track virtuals that survive for more than two iterations. self.optimize_loop(ops, 'Not, Not, Not', ops) | def test_p123_vstruct(self): ops = """ [i1, p2, p3] i3 = getfield_gc(p3, descr=adescr) escape(i3) p1 = new(descr=ssize) setfield_gc(p1, i1, descr=adescr) jump(i1, p1, p2) """ # We cannot track virtuals that survive for more than two iterations. self.optimize_loop(ops, 'Not, Not, Not', ops) | 452,830 |
def _freeze_(self): assert not self.borrowed_objects and not self.borrow_mapping self.py_objects_r2w.clear() # is not valid anymore after translation return False | def _freeze_(self): assert not self.borrowed_objects assert self.borrow_mapping == {None: {}} self.py_objects_r2w.clear() # is not valid anymore after translation return False | 452,831 |
def test_filename_exception(self): for fn in [self.posix.unlink, self.posix.remove, self.posix.chdir, self.posix.mkdir, self.posix.rmdir, self.posix.listdir, self.posix.readlink, self.posix.chroot]: try: fn('qowieuqw/oeiu') except OSError, e: assert e.filename == 'qowieuqw/oeiu' else: assert 0 | def test_filename_exception(self): for fn in [self.posix.unlink, self.posix.remove, self.posix.chdir, self.posix.mkdir, self.posix.rmdir, self.posix.listdir, self.posix.readlink, self.posix.chroot]: try: fn('qowieuqw/oeiu') except OSError, e: assert e.filename == 'qowieuqw/oeiu' else: assert 0 | 452,832 |
def test_chown_exception(self): try: self.posix.chown('qowieuqw/oeiu', 0, 0) except OSError, e: assert e.filename == 'qowieuqw/oeiu' else: assert 0 | def test_chown_exception(self): try: self.posix.chown('qowieuqw/oeiu', 0, 0) except OSError, e: assert e.filename == 'qowieuqw/oeiu' else: assert 0 | 452,833 |
def ll_count(cls, s1, s2, start, end): if start < 0: start = 0 if end > len(s1.chars): end = len(s1.chars) if end - start < 0: return 0 | def ll_count(cls, s1, s2, start, end): if start < 0: start = 0 if end > len(s1.chars): end = len(s1.chars) if end - start < 0: return 0 | 452,834 |
def test_slonglong_args(self): """ long long sum_xy_longlong(long long x, long long y) { return x+y; } """ maxint32 = 2147483647 # we cannot really go above maxint on 64 bits # (and we would not test anything, as there long # is the same as long long) libfoo = self.get_libfoo() func = (libfoo, 'sum_xy_longlong', [types... | def test_slonglong_args(self): """ long long sum_xy_longlong(long long x, long long y) { return x+y; } """ maxint32 = 2147483647 # we cannot really go above maxint on 64 bits # (and we would not test anything, as there long # is the same as long long) libfoo = self.get_libfoo() func = (libfoo, 'sum_xy_longlong', [types... | 452,835 |
def assemble_loop(self, inputargs, operations, looptoken): longevity = compute_vars_longevity(inputargs, operations) regalloc = ARMRegisterManager(longevity, assembler=self, frame_manager=ARMFrameManager()) self.align() loop_start=self.mc.curraddr() self.gen_func_prolog() # Generate NOP as placeholder to patch the inst... | def assemble_loop(self, inputargs, operations, looptoken): longevity = compute_vars_longevity(inputargs, operations) regalloc = ARMRegisterManager(longevity, assembler=self, frame_manager=ARMFrameManager()) self.align() loop_start=self.mc.curraddr() self.gen_func_prolog() # Generate NOP as placeholder to patch the inst... | 452,836 |
def assemble_loop(self, inputargs, operations, looptoken): longevity = compute_vars_longevity(inputargs, operations) regalloc = ARMRegisterManager(longevity, assembler=self, frame_manager=ARMFrameManager()) self.align() loop_start=self.mc.curraddr() self.gen_func_prolog() # Generate NOP as placeholder to patch the inst... | def assemble_loop(self, inputargs, operations, looptoken): longevity = compute_vars_longevity(inputargs, operations) regalloc = ARMRegisterManager(longevity, assembler=self, frame_manager=ARMFrameManager()) self.align() loop_start=self.mc.curraddr() self.gen_func_prolog() # Generate NOP as placeholder to patch the inst... | 452,837 |
def descr_new_zipimporter(space, w_type, name): w = space.wrap w_ZipImportError = space.getattr(space.getbuiltinmodule('zipimport'), w('ZipImportError')) ok = False parts_ends = [i for i in range(0, len(name)) if name[i] == os.path.sep or name[i] == ZIPSEP] parts_ends.append(len(name)) filename = "" # make annotator ha... | def descr_new_zipimporter(space, w_type, name): w = space.wrap w_ZipImportError = space.getattr(space.getbuiltinmodule('zipimport'), w('ZipImportError')) ok = False parts_ends = [i for i in range(0, len(name)) if name[i] == os.path.sep or name[i] == ZIPSEP] parts_ends.append(len(name)) filename = "" # make annotator ha... | 452,838 |
def build_winerror_to_errno(): """Build a dictionary mapping windows error numbers to POSIX errno. The function returns the dict, and the default value for codes not in the dict.""" # Prior to Visual Studio 8, the MSVCRT dll doesn't export the # _dosmaperr() function, which is available only when compiled # against the... | def build_winerror_to_errno(): """Build a dictionary mapping windows error numbers to POSIX errno. The function returns the dict, and the default value for codes not in the dict.""" # Prior to Visual Studio 8, the MSVCRT dll doesn't export the # _dosmaperr() function, which is available only when compiled # against the... | 452,839 |
def finite(x): return not isinf(x) and not isnan(x) | def finite(x): return not isinf(x) and not isnan(x) | 452,840 |
def test_bug_3bis(self): ops = """ [p1] guard_nonnull(p1) [] guard_class(p1, ConstClass(node_vtable2)) [] p2 = getfield_gc(p1, descr=nextdescr) guard_nonnull(12) [] guard_class(p2, ConstClass(node_vtable)) [] p3 = getfield_gc(p1, descr=otherdescr) guard_nonnull(12) [] guard_class(p3, ConstClass(node_vtable)) [] p1a = n... | def test_bug_3bis(self): ops = """ [p1] guard_nonnull(p1) [] guard_class(p1, ConstClass(node_vtable2)) [] p2 = getfield_gc(p1, descr=nextdescr) guard_nonnull(12) [] guard_class(p2, ConstClass(node_vtable)) [] p3 = getfield_gc(p1, descr=otherdescr) guard_nonnull(12) [] guard_class(p3, ConstClass(node_vtable)) [] p1a = n... | 452,841 |
def test_bug_3bis(self): ops = """ [p1] guard_nonnull(p1) [] guard_class(p1, ConstClass(node_vtable2)) [] p2 = getfield_gc(p1, descr=nextdescr) guard_nonnull(12) [] guard_class(p2, ConstClass(node_vtable)) [] p3 = getfield_gc(p1, descr=otherdescr) guard_nonnull(12) [] guard_class(p3, ConstClass(node_vtable)) [] p1a = n... | def test_bug_3bis(self): ops = """ [p1] guard_nonnull(p1) [] guard_class(p1, ConstClass(node_vtable2)) [] p2 = getfield_gc(p1, descr=nextdescr) guard_nonnull(12) [] guard_class(p2, ConstClass(node_vtable)) [] p3 = getfield_gc(p1, descr=otherdescr) guard_nonnull(12) [] guard_class(p3, ConstClass(node_vtable)) [] p1a = n... | 452,842 |
def compile_new_loop(metainterp, old_loop_tokens, greenkey, start, full_preamble_needed=True): """Try to compile a new loop by closing the current history back to the first operation. """ history = metainterp.history loop = create_empty_loop(metainterp) loop.inputargs = history.inputargs for box in loop.inputargs: asse... | def compile_new_loop(metainterp, old_loop_tokens, greenkey, start, full_preamble_needed=True): """Try to compile a new loop by closing the current history back to the first operation. """ history = metainterp.history loop = create_empty_loop(metainterp) loop.inputargs = history.inputargs for box in loop.inputargs: asse... | 452,843 |
def test_duplicate_setfield_residual_guard_1(self): ops = """ [p1, i1, i2, i3] setfield_gc(p1, i1, descr=valuedescr) guard_true(i3) [] i4 = int_neg(i2) setfield_gc(p1, i2, descr=valuedescr) jump(p1, i1, i2, i4) """ self.optimize_loop(ops, 'Not, Not, Not, Not', ops) | def test_duplicate_setfield_residual_guard_1(self): ops = """ [p1, i1, i2, i3] setfield_gc(p1, i1, descr=valuedescr) guard_true(i3) [] i4 = int_neg(i2) setfield_gc(p1, i2, descr=valuedescr) jump(p1, i1, i2, i4) """ self.optimize_loop(ops, 'Not, Not, Not, Not', ops) | 452,844 |
def test_duplicate_setfield_residual_guard_2(self): # the difference with the previous test is that the field value is # a virtual, which we try hard to keep virtual ops = """ [p1, i2, i3] p2 = new_with_vtable(ConstClass(node_vtable)) setfield_gc(p1, p2, descr=nextdescr) guard_true(i3) [] i4 = int_neg(i2) setfield_gc(p... | def test_duplicate_setfield_residual_guard_2(self): # the difference with the previous test is that the field value is # a virtual, which we try hard to keep virtual ops = """ [p1, i2, i3] p2 = new_with_vtable(ConstClass(node_vtable)) setfield_gc(p1, p2, descr=nextdescr) guard_true(i3) [] i4 = int_neg(i2) setfield_gc(p... | 452,845 |
def test_duplicate_setfield_residual_guard_2(self): # the difference with the previous test is that the field value is # a virtual, which we try hard to keep virtual ops = """ [p1, i2, i3] p2 = new_with_vtable(ConstClass(node_vtable)) setfield_gc(p1, p2, descr=nextdescr) guard_true(i3) [] i4 = int_neg(i2) setfield_gc(p... | def test_duplicate_setfield_residual_guard_2(self): # the difference with the previous test is that the field value is # a virtual, which we try hard to keep virtual ops = """ [p1, i2, i3] p2 = new_with_vtable(ConstClass(node_vtable)) setfield_gc(p1, p2, descr=nextdescr) guard_true(i3) [] i4 = int_neg(i2) setfield_gc(p... | 452,846 |
def test_duplicate_setfield_residual_guard_3(self): ops = """ [p1, i2, i3] p2 = new_with_vtable(ConstClass(node_vtable)) setfield_gc(p2, i2, descr=valuedescr) setfield_gc(p1, p2, descr=nextdescr) guard_true(i3) [] i4 = int_neg(i2) setfield_gc(p1, NULL, descr=nextdescr) jump(p1, i2, i4) """ expected = """ [p1, i2, i3] g... | def test_duplicate_setfield_residual_guard_3(self): ops = """ [p1, i2, i3] p2 = new_with_vtable(ConstClass(node_vtable)) setfield_gc(p2, i2, descr=valuedescr) setfield_gc(p1, p2, descr=nextdescr) guard_true(i3) [] i4 = int_neg(i2) setfield_gc(p1, NULL, descr=nextdescr) jump(p1, i2, i4) """ preamble = """ [p1, i2, i3] g... | 452,847 |
def test_duplicate_setfield_residual_guard_4(self): # test that the setfield_gc does not end up between int_eq and # the following guard_true ops = """ [p1, i1, i2, i3] setfield_gc(p1, i1, descr=valuedescr) i5 = int_eq(i3, 5) guard_true(i5) [] i4 = int_neg(i2) setfield_gc(p1, i2, descr=valuedescr) jump(p1, i1, i2, i4) ... | def test_duplicate_setfield_residual_guard_4(self): # test that the setfield_gc does not end up between int_eq and # the following guard_true ops = """ [p1, i1, i2, i3] setfield_gc(p1, i1, descr=valuedescr) i5 = int_eq(i3, 5) guard_true(i5) [] i4 = int_neg(i2) setfield_gc(p1, i2, descr=valuedescr) jump(p1, i1, i2, i4) ... | 452,848 |
from pypy.interpreter.typedef import TypeDef | from pypy.interpreter.typedef import TypeDef | 452,849 |
def array_get_slice_params(self, index): if index.step is not None: raise TypeError("3 arg slices not supported (for no reason)") check_bounds = hasattr(self, '_length_') if index.start is not None: start = index.start if check_bounds and start < 0: start = 0 else: start = 0 if index.stop is not None: stop = index.stop... | def array_get_slice_params(self, index): if hasattr(self, '_length_'): start, stop, step = index.indices(self._length_) else: step = index.step if step is None: step = 1 start = index.start if check_bounds and start < 0: start = 0 else: start = 0 if index.stop is not None: stop = index.stop if check_bounds and stop > s... | 452,850 |
def array_get_slice_params(self, index): if index.step is not None: raise TypeError("3 arg slices not supported (for no reason)") check_bounds = hasattr(self, '_length_') if index.start is not None: start = index.start if check_bounds and start < 0: start = 0 else: start = 0 if index.stop is not None: stop = index.stop... | def array_get_slice_params(self, index): if index.step is not None: raise TypeError("3 arg slices not supported (for no reason)") check_bounds = hasattr(self, '_length_') if index.start is not None: start = index.start stop = index.stop if start is None: if step > 0: start = 0 else: raise ValueError("slice start is req... | 452,851 |
def array_get_slice_params(self, index): if index.step is not None: raise TypeError("3 arg slices not supported (for no reason)") check_bounds = hasattr(self, '_length_') if index.start is not None: start = index.start if check_bounds and start < 0: start = 0 else: start = 0 if index.stop is not None: stop = index.stop... | def array_get_slice_params(self, index): if index.step is not None: raise TypeError("3 arg slices not supported (for no reason)") check_bounds = hasattr(self, '_length_') if index.start is not None: start = index.start if check_bounds and start < 0: start = 0 else: start = 0 if index.stop is not None: stop = index.stop... | 452,852 |
def array_slice_setitem(self, index, value): start, stop = self._get_slice_params(index) if stop - start != len(value): raise ValueError("Can only assign slices of the same length") for i in range(start, stop): self[i] = value[i - start] | def array_slice_setitem(self, index, value): start, stop = self._get_slice_params(index) if stop - start != len(value): raise ValueError("Can only assign slices of the same length") for i, j in enumerate(range(start, stop, step)): self[j] = value[j] | 452,853 |
def array_slice_getitem(self, index): start, stop = self._get_slice_params(index) l = [self[i] for i in range(start, stop)] letter = getattr(self._type_, '_type_', None) if letter == 'c': return "".join(l) if letter == 'u': return u"".join(l) return l | def array_slice_getitem(self, index): start, stop, step = self._get_slice_params(index) l = [self[i] for i in range(start, stop, step)] letter = getattr(self._type_, '_type_', None) if letter == 'c': return "".join(l) if letter == 'u': return u"".join(l) return l | 452,854 |
def _addressof_storage(self): "Returns the storage address as an int" if self._storage is None or self._storage is True: raise ValueError("Not a ctypes allocated structure") return ctypes.cast(self._storage, ctypes.c_void_p).value | def _addressof_storage(self): "Returns the storage address as an int" if self._storage is None or self._storage is True: raise ValueError("Not a ctypes allocated structure") return ctypes.cast(self._storage, ctypes.c_void_p).value | 452,855 |
def test_simple(): serv = RSocket(AF_INET, SOCK_STREAM) serv.bind(INETAddress('127.0.0.1', INADDR_ANY)) serv.listen(1) servaddr = serv.getsockname() events = poll({serv.fileno(): POLLIN}, timeout=100) assert len(events) == 0 cli = RSocket(AF_INET, SOCK_STREAM) cli.setblocking(False) err = cli.connect_ex(servaddr) ass... | def test_simple(): serv = RSocket(AF_INET, SOCK_STREAM) serv.bind(INETAddress('127.0.0.1', INADDR_ANY)) serv.listen(1) servaddr = serv.getsockname() events = poll({serv.fileno(): POLLIN}, timeout=100) assert len(events) == 0 cli = RSocket(AF_INET, SOCK_STREAM) cli.setblocking(False) err = cli.connect_ex(servaddr) ass... | 452,856 |
def w_descr__framestack(space, self): assert isinstance(self, AppCoroutine) f = self.subctx.topframe items = [] if not f: return space.newtuple([]) while f is not None: items.append(space.wrap(f)) f = f.f_backref() items.reverse() return space.newtuple(items) | def w_descr__framestack(space, self): assert isinstance(self, AppCoroutine) f = self.subctx.topframe while f is not None: items.append(space.wrap(f)) f = f.f_backref() items.reverse() return space.newtuple(items) | 452,857 |
def w_descr__framestack(space, self): assert isinstance(self, AppCoroutine) f = self.subctx.topframe items = [] if not f: return space.newtuple([]) while f is not None: items.append(space.wrap(f)) f = f.f_backref() items.reverse() return space.newtuple(items) | def w_descr__framestack(space, self): assert isinstance(self, AppCoroutine) f = self.subctx.topframe items = [] if not f: return space.newtuple([]) while f is not None: counter += 1 f = f.f_backref() items.reverse() return space.newtuple(items) | 452,858 |
def w_descr__framestack(space, self): assert isinstance(self, AppCoroutine) f = self.subctx.topframe items = [] if not f: return space.newtuple([]) while f is not None: items.append(space.wrap(f)) f = f.f_backref() items.reverse() return space.newtuple(items) | def w_descr__framestack(space, self): assert isinstance(self, AppCoroutine) f = self.subctx.topframe items = [] if not f: return space.newtuple([]) while f is not None: items.append(space.wrap(f)) f = f.f_backref() items = [None] * counter f = self.subctx.topframe while f is not None: counter -= 1 assert counter >= 0 i... | 452,859 |
def callinfo_for_oopspec(oopspecindex): """A function that returns the calldescr and the function address (as an int) of one of the OS_XYZ functions defined above. Don't use this if there might be several implementations of the same OS_XYZ specialized by type, e.g. OS_ARRAYCOPY.""" try: return _callinfo_for_oopspec[oop... | def callinfo_for_oopspec(oopspecindex): """A function that returns the calldescr and the function address (as an int) of one of the OS_XYZ functions defined above. Don't use this if there might be several implementations of the same OS_XYZ specialized by type, e.g. OS_ARRAYCOPY.""" try: return _callinfo_for_oopspec[oop... | 452,860 |
def _funcptr_for_oopspec_memo(oopspecindex): from pypy.jit.codewriter import heaptracker _, func_as_int = _callinfo_for_oopspec.get(oopspecindex, (None, 0)) funcadr = heaptracker.int2adr(func_as_int) return funcadr.ptr | def _funcptr_for_oopspec_memo(oopspecindex): from pypy.jit.codewriter import heaptracker _, func_as_int = callinfo_for_oopspec(oopspecindex) funcadr = heaptracker.int2adr(func_as_int) return funcadr.ptr | 452,861 |
def _should_widen_type(tp): from pypy.rpython.lltypesystem import lltype, rffi if tp is lltype.Bool: return True if tp is lltype.Signed: return False r_class = rffi.platform.numbertype_to_rclass[tp] assert issubclass(r_class, base_int) return r_class.BITS < LONG_BIT | def _should_widen_type(tp): from pypy.rpython.lltypesystem import lltype, rffi if tp is lltype.Bool: return True if tp is lltype.Signed: return False r_class = rffi.platform.numbertype_to_rclass[tp] assert issubclass(r_class, base_int) return r_class.BITS < LONG_BIT | 452,862 |
def isinf(space, x): """Return True if x is infinity.""" return space.wrap(rarithmetic.isinf(x)) | def isinf(space, x): """Return True if x is infinity.""" return space.wrap(rarithmetic.isinf(x)) | 452,863 |
def isnan(space, x): """Return True if x is not a number.""" return space.wrap(rarithmetic.isnan(x)) | def isnan(space, x): """Return True if x is not a number.""" return space.wrap(rarithmetic.isnan(x)) | 452,864 |
def test_repr_of_descr(): c0 = GcCache(False) T = lltype.GcStruct('T') S = lltype.GcStruct('S', ('x', lltype.Char), ('y', lltype.Ptr(T)), ('z', lltype.Ptr(T))) descr1 = get_size_descr(c0, S) s = symbolic.get_size(S, False) assert descr1.repr_of_descr() == '<SizeDescr %d>' % s # descr2 = get_field_descr(c0, S, 'y') o, _... | def test_repr_of_descr(): c0 = GcCache(False) T = lltype.GcStruct('T') S = lltype.GcStruct('S', ('x', lltype.Char), ('y', lltype.Ptr(T)), ('z', lltype.Ptr(T))) descr1 = get_size_descr(c0, S) s = symbolic.get_size(S, False) assert descr1.repr_of_descr() == '<SizeDescr %d>' % s # descr2 = get_field_descr(c0, S, 'y') o, _... | 452,865 |
def test_repr_of_descr(): c0 = GcCache(False) T = lltype.GcStruct('T') S = lltype.GcStruct('S', ('x', lltype.Char), ('y', lltype.Ptr(T)), ('z', lltype.Ptr(T))) descr1 = get_size_descr(c0, S) s = symbolic.get_size(S, False) assert descr1.repr_of_descr() == '<SizeDescr %d>' % s # descr2 = get_field_descr(c0, S, 'y') o, _... | def test_repr_of_descr(): c0 = GcCache(False) T = lltype.GcStruct('T') S = lltype.GcStruct('S', ('x', lltype.Char), ('y', lltype.Ptr(T)), ('z', lltype.Ptr(T))) descr1 = get_size_descr(c0, S) s = symbolic.get_size(S, False) assert descr1.repr_of_descr() == '<SizeDescr %d>' % s # descr2 = get_field_descr(c0, S, 'y') o, _... | 452,866 |
def max(space, __args__): """Return the largest item in a sequence. If more than one argument is passed, return the maximum of them. """ return min_max(space, __args__, "max") | def max(space, __args__): """max(iterable[, key=func]) -> value max(a, b, c, ...[, key=func]) -> value With a single iterable argument, return its largest item. With two or more arguments, return the largest argument. """ return min_max(space, __args__, "max") | 452,867 |
W_SomeType.typedef = typedef.TypeDef( 'some_type', x=typedef.GetSetProperty(fget, use_closure=True)) | W_SomeType.typedef = typedef.TypeDef( 'some_type', x=typedef.GetSetProperty(fget, use_closure=True)) | 452,868 |
def compute_result_annotation(self, **kwds_s): from pypy.annotation import model as annmodel | def compute_result_annotation(self, **kwds_s): from pypy.annotation import model as annmodel | 452,869 |
def annotate_hooks(self, **kwds_s): driver = self.instance.im_self s_jitcell = self.bookkeeper.valueoftype(BaseJitCell) h = self.annotate_hook return (h(driver.get_jitcell_at, driver.greens, **kwds_s) and h(driver.set_jitcell_at, driver.greens, [s_jitcell], **kwds_s) and h(driver.get_printable_location, driver.greens, ... | def annotate_hooks(self, **kwds_s): driver = self.instance.im_self s_jitcell = self.bookkeeper.valueoftype(BaseJitCell) h = self.annotate_hook return (h(driver.get_jitcell_at, driver.greens, **kwds_s) and h(driver.set_jitcell_at, driver.greens, [s_jitcell], **kwds_s) and h(driver.get_printable_location, driver.greens, ... | 452,870 |
def annotate_hook(self, func, variables, args_s=[], **kwds_s): if func is None: return True bk = self.bookkeeper s_func = bk.immutablevalue(func) uniquekey = 'jitdriver.%s' % func.func_name args_s = args_s[:] for name in variables: if '.' not in name: s_arg = kwds_s['s_' + name] else: objname, fieldname = name.split('.... | def annotate_hook(self, func, variables, args_s=[], **kwds_s): if func is None: return bk = self.bookkeeper s_func = bk.immutablevalue(func) uniquekey = 'jitdriver.%s' % func.func_name args_s = args_s[:] for name in variables: if '.' not in name: s_arg = kwds_s['s_' + name] else: objname, fieldname = name.split('.') s_... | 452,871 |
def annotate_hook(self, func, variables, args_s=[], **kwds_s): if func is None: return True bk = self.bookkeeper s_func = bk.immutablevalue(func) uniquekey = 'jitdriver.%s' % func.func_name args_s = args_s[:] for name in variables: if '.' not in name: s_arg = kwds_s['s_' + name] else: objname, fieldname = name.split('.... | def annotate_hook(self, func, variables, args_s=[], **kwds_s): if func is None: return True bk = self.bookkeeper s_func = bk.immutablevalue(func) uniquekey = 'jitdriver.%s' % func.func_name args_s = args_s[:] for name in variables: if '.' not in name: s_arg = kwds_s['s_' + name] else: objname, fieldname = name.split('.... | 452,872 |
def annotate_hook(self, func, variables, args_s=[], **kwds_s): if func is None: return True bk = self.bookkeeper s_func = bk.immutablevalue(func) uniquekey = 'jitdriver.%s' % func.func_name args_s = args_s[:] for name in variables: if '.' not in name: s_arg = kwds_s['s_' + name] else: objname, fieldname = name.split('.... | def annotate_hook(self, func, variables, args_s=[], **kwds_s): if func is None: bk = self.bookkeeper s_func = bk.immutablevalue(func) uniquekey = 'jitdriver.%s' % func.func_name args_s = args_s[:] for name in variables: if '.' not in name: s_arg = kwds_s['s_' + name] else: objname, fieldname = name.split('.') s_instanc... | 452,873 |
def test_virtual_adder_pending_fields(): b2s, b4s = [BoxPtr(), BoxPtr()] storage = Storage() memo = ResumeDataLoopMemo(FakeMetaInterpStaticData()) modifier = ResumeDataVirtualAdder(storage, memo) modifier.liveboxes_from_env = {} modifier.liveboxes = {} modifier.vfieldboxes = {} v2 = OptValue(b2s) v4 = OptValue(b4s) mo... | def test_virtual_adder_pending_fields(): b2s, b4s = [BoxPtr(), BoxPtr()] storage = Storage() memo = ResumeDataLoopMemo(FakeMetaInterpStaticData()) modifier = ResumeDataVirtualAdder(storage, memo) modifier.liveboxes_from_env = {} modifier.liveboxes = {} modifier.vfieldboxes = {} v2 = OptValue(b2s) v4 = OptValue(b4s) mo... | 452,874 |
def getinvocation(self, regrtest): fspath = regrtest.getfspath() python = sys.executable pypy_script = pypydir.join('bin', 'py.py') alarm_script = pypydir.join('tool', 'alarm.py') if sys.platform == 'win32': watchdog_name = 'watchdog_nt.py' else: watchdog_name = 'watchdog.py' watchdog_script = pypydir.join('tool', watc... | def getinvocation(self, regrtest): fspath = regrtest.getfspath() python = sys.executable pypy_script = pypydir.join('bin', 'py.py') alarm_script = pypydir.join('tool', 'alarm.py') if sys.platform == 'win32': watchdog_name = 'watchdog_nt.py' else: watchdog_name = 'watchdog.py' watchdog_script = pypydir.join('tool', watc... | 452,875 |
def jump_absolute(self, jumpto, _, ec=None): if we_are_jitted(): f.last_instr = intmask(jumpto) ec.bytecode_trace(f) jumpto = r_uint(f.last_instr) pypyjitdriver.can_enter_jit(frame=f, ec=ec, next_instr=jumpto, pycode=f.getcode()) return jumpto | def jump_absolute(self, jumpto, _, ec=None): if we_are_jitted(): self.last_instr = intmask(jumpto) ec.bytecode_trace(self) jumpto = r_uint(self.last_instr) pypyjitdriver.can_enter_jit(frame=self, ec=ec, next_instr=jumpto, pycode=self.getcode()) return jumpto | 452,876 |
def make_filename(self, fullname): i = fullname.rfind('.') subname = fullname[i+1:] return self.prefix + subname | def make_filename(self, fullname): startpos = fullname.rfind('.') + 1 assert startpos >= 0 subname = fullname[start:] return self.prefix + subname | 452,877 |
def get_from_lifeline(self, w_obj): lifeline = self.lifeline_dict.get(w_obj) if lifeline is not None: # make old PyObject ready for use in C code py_obj = lifeline.pyo assert py_obj.c_ob_refcnt == 0 return py_obj else: lltype.nullptr(PyObject.TO) | def get_from_lifeline(self, w_obj): lifeline = self.lifeline_dict.get(w_obj) if lifeline is not None: # make old PyObject ready for use in C code py_obj = lifeline.pyo assert py_obj.c_ob_refcnt == 0 return py_obj else: lltype.nullptr(PyObject.TO) | 452,878 |
def a2b_uu(space, ascii): "Decode a line of uuencoded data." if len(ascii) == 0: # obscure case, for compability with CPython length = (-0x20) & 0x3f else: length = (ord(ascii[0]) - 0x20) & 0x3f res = StringBuilder(length) for i in range(1, len(ascii), 4): A = _a2b_read(space, ascii, i) B = _a2b_read(space, ascii,... | def a2b_uu(space, ascii): "Decode a line of uuencoded data." if len(ascii) == 0: # obscure case, for compability with CPython length = (-0x20) & 0x3f else: length = (ord(ascii[0]) - 0x20) & 0x3f res = StringBuilder(length) for i in range(1, len(ascii), 4): A = _a2b_read(space, ascii, i) B = _a2b_read(space, ascii,... | 452,879 |
def f(self, op, regalloc, fcond): assert fcond is not None if not inverse: arg0 = op.getarg(0) arg1 = op.getarg(1) else: arg0 = op.getarg(1) arg1 = op.getarg(0) # XXX consider swapping argumentes if arg0 is const imm_a0 = self._check_imm_arg(arg0) imm_a1 = self._check_imm_arg(arg1) if imm_a1 and not imm_a0: l0 = regall... | def f(self, op, regalloc, fcond): assert fcond is not None if not inverse: arg0 = op.getarg(0) arg1 = op.getarg(1) else: arg0 = op.getarg(1) arg1 = op.getarg(0) # XXX consider swapping argumentes if arg0 is const imm_a0 = self._check_imm_arg(arg0) imm_a1 = self._check_imm_arg(arg1) if imm_a1 and not imm_a0: l0 = regall... | 452,880 |
def f(self, op, regalloc, fcond): assert fcond is not None if not inverse: arg0 = op.getarg(0) arg1 = op.getarg(1) else: arg0 = op.getarg(1) arg1 = op.getarg(0) # XXX consider swapping argumentes if arg0 is const imm_a0 = self._check_imm_arg(arg0) imm_a1 = self._check_imm_arg(arg1) if imm_a1 and not imm_a0: l0 = regall... | def f(self, op, regalloc, fcond): assert fcond is not None if not inverse: arg0 = op.getarg(0) arg1 = op.getarg(1) else: arg0 = op.getarg(1) arg1 = op.getarg(0) # XXX consider swapping argumentes if arg0 is const imm_a0 = self._check_imm_arg(arg0) imm_a1 = self._check_imm_arg(arg1) if imm_a1 and not imm_a0: l0 = regall... | 452,881 |
def f(): return gc.collect() | def f(): return gc.collect() | 452,882 |
def f(): return gc.collect(0) | def f(): return gc.collect(0) | 452,883 |
def f(): return gc.collect(0) | def f(): return gc.collect(0) | 452,884 |
def f(i): if i: return rgc.can_move(lltype.malloc(T0)) else: return rgc.can_move(lltype.malloc(T1, 1)) | def f(i): if i: return rgc.can_move(lltype.malloc(T0)) else: return rgc.can_move(lltype.malloc(T1, 1)) | 452,885 |
def f(i): if i: return rgc.can_move(lltype.malloc(T0)) else: return rgc.can_move(lltype.malloc(T1, 1)) | def f(i): if i: return rgc.can_move(lltype.malloc(T0)) else: return rgc.can_move(lltype.malloc(T1, 1)) | 452,886 |
def test_get_referents(): class X(object): __slots__ = ['stuff'] x1 = X() x1.stuff = X() x2 = X() lst = rgc._get_referents(rgc.cast_instance_to_gcref(x1)) lst2 = [rgc.try_cast_gcref_to_instance(X, x) for x in lst] assert x1.stuff in lst2 assert x2 not in lst2 | def test_get_referents(): class X(object): __slots__ = ['stuff'] x1 = X() x1.stuff = X() x2 = X() lst = rgc.get_rpy_referents(rgc.cast_instance_to_gcref(x1)) lst2 = [rgc.try_cast_gcref_to_instance(X, x) for x in lst] assert x1.stuff in lst2 assert x2 not in lst2 | 452,887 |
def test_remove_duplicate_pure_op(self): ops = """ [p1, p2] i1 = ptr_eq(p1, p2) i2 = ptr_eq(p1, p2) i3 = int_add(i1, 1) i3b = int_is_true(i3) guard_true(i3b) [] i4 = int_add(i2, 1) i4b = int_is_true(i4) guard_true(i4b) [] escape(i3) escape(i4) guard_true(i1) [] guard_true(i2) [] jump(p1, p2) """ expected = """ [p1, p2]... | def test_remove_duplicate_pure_op(self): ops = """ [p1, p2] i1 = ptr_eq(p1, p2) i2 = ptr_eq(p1, p2) i3 = int_add(i1, 1) i3b = int_is_true(i3) guard_true(i3b) [] i4 = int_add(i2, 1) i4b = int_is_true(i4) guard_true(i4b) [] escape(i3) escape(i4) guard_true(i1) [] guard_true(i2) [] jump(p1, p2) """ preamble = """ [p1, p2]... | 452,888 |
def test_remove_duplicate_pure_op(self): ops = """ [p1, p2] i1 = ptr_eq(p1, p2) i2 = ptr_eq(p1, p2) i3 = int_add(i1, 1) i3b = int_is_true(i3) guard_true(i3b) [] i4 = int_add(i2, 1) i4b = int_is_true(i4) guard_true(i4b) [] escape(i3) escape(i4) guard_true(i1) [] guard_true(i2) [] jump(p1, p2) """ expected = """ [p1, p2]... | def test_remove_duplicate_pure_op(self): ops = """ [p1, p2] i1 = ptr_eq(p1, p2) i2 = ptr_eq(p1, p2) i3 = int_add(i1, 1) i3b = int_is_true(i3) guard_true(i3b) [] i4 = int_add(i2, 1) i4b = int_is_true(i4) guard_true(i4b) [] escape(i3) escape(i4) guard_true(i1) [] guard_true(i2) [] jump(p1, p2) """ expected = """ [p1, p2]... | 452,889 |
clsdef = s_type.descriptions.keys()[0].getuniqueclassdef() | clsdef = s_type.descriptions.keys()[0].getuniqueclassdef() | 452,890 |
def unpackiterable(self, w_iterable, expected_length=-1): """Unpack an iterable object into a real (interpreter-level) list. Raise a real (subclass of) ValueError if the length is wrong.""" w_iterator = self.iter(w_iterable) items = [] while True: try: w_item = self.next(w_iterator) except OperationError, e: if not e.m... | def unpackiterable(self, w_iterable, expected_length=-1): """Unpack an iterable object into a real (interpreter-level) list. Raise a real (subclass of) ValueError if the length is wrong.""" w_iterator = self.iter(w_iterable) items = [] while True: try: w_item = self.next(w_iterator) except OperationError, e: if not e.m... | 452,891 |
def unpackiterable(self, w_iterable, expected_length=-1): """Unpack an iterable object into a real (interpreter-level) list. Raise a real (subclass of) ValueError if the length is wrong.""" w_iterator = self.iter(w_iterable) items = [] while True: try: w_item = self.next(w_iterator) except OperationError, e: if not e.m... | def unpackiterable(self, w_iterable, expected_length=-1): """Unpack an iterable object into a real (interpreter-level) list. Raise a real (subclass of) ValueError if the length is wrong.""" w_iterator = self.iter(w_iterable) items = [] while True: try: w_item = self.next(w_iterator) except OperationError, e: if not e.m... | 452,892 |
def _make_pkg(self, source, depth): pkg_name = "__runpy_pkg__" init_fname = "__init__"+os.extsep+"py" test_fname = "runpy_test"+os.extsep+"py" pkg_dir = sub_dir = tempfile.mkdtemp() if verbose: print " Package tree in:", sub_dir sys.path.insert(0, pkg_dir) if verbose: print " Updated sys.path:", sys.path[0] for i in ... | def _make_pkg(self, source, depth): pkg_name = "__runpy_pkg__" init_fname = "__init__"+os.extsep+"py" test_fname = "runpy_test"+os.extsep+"py" pkg_dir = sub_dir = tempfile.mkdtemp() if verbose: print " Package tree in:", sub_dir sys.path.insert(0, pkg_dir) if verbose: print " Updated sys.path:", sys.path[0] for i in ... | 452,893 |
def _call_uint(self, space, argchain): # the same comment as above apply. Moreover, we need to be careful # when the return type is ULONG, because the value might not fit into # a signed LONG: this is the only case in which we cast the result to # something different than LONG; as a result, the applevel value will # be... | def _call_uint(self, space, argchain): # the same comment as above apply. Moreover, we need to be careful # when the return type is ULONG, because the value might not fit into # a signed LONG: this is the only case in which we cast the result to # something different than LONG; as a result, the applevel value will # be... | 452,894 |
def _dot(self, seen): if self in seen: return seen.add(self) if self.knownclsbox: name = "Virtual " if isinstance(self.knownclsbox.value, int): name += str(self.knownclsbox.value) else: name += str(self.knownclsbox.value.ptr).rpartition("_vtable")[0].rpartition('.')[2] elif self.structdescr: name = "Struct " + str(self... | def _dot(self, seen): if self in seen: return seen.add(self) if self.knownclsbox: name = "Virtual " if isinstance(self.knownclsbox.value, int): name += str(self.knownclsbox.value) else: name += str(self.knownclsbox.value.adr.ptr).rpartition("_vtable")[0].rpartition('.')[2] elif self.structdescr: name = "Struct " + str(... | 452,895 |
def _prodi(x): x = complex(x, 0) real = -x.imag imag = x.real return complex(real, imag) | def _prodi(x): x = _to_complex(x) real = -x.imag imag = x.real return complex(real, imag) | 452,896 |
def phase(x): x = complex(x) return math.atan2(x.imag, x.real) | def phase(x): x = _to_complex(x) return math.atan2(x.imag, x.real) | 452,897 |
def polar(x): x = complex(x) phi = math.atan2(x.imag, x.real) r = abs(x) return r, phi | def polar(x): x = _to_complex(x) phi = math.atan2(x.imag, x.real) r = abs(x) return r, phi | 452,898 |
def rect(r, phi): r, phi = complex(r), complex(phi) return complex(r * math.cos(phi), r * math.sin(phi)) | def rect(r, phi): return complex(r * math.cos(phi), r * math.sin(phi)) | 452,899 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.