Home
last modified time | relevance | path

Searched refs:memoryview (Results 1 – 25 of 192) sorted by relevance

12345678

/external/python/cpython3/Doc/c-api/
Dmemoryview.rst6 object: memoryview
11 A :class:`memoryview` object exposes the C level :ref:`buffer interface
18 Create a memoryview object from an object that provides the buffer interface.
19 If *obj* supports writable buffer exports, the memoryview object will be
25 Create a memoryview object using *mem* as the underlying buffer.
32 Create a memoryview object wrapping the given buffer structure *view*.
38 Create a memoryview object to a :term:`contiguous` chunk of memory (in either
40 interface. If memory is contiguous, the memoryview object points to the
41 original memory. Otherwise, a copy is made and the memoryview points to a
47 Return true if the object *obj* is a memoryview object. It is not
[all …]
/external/python/cpython3/Lib/test/
Dtest_buffer.py851 m = memoryview(result)
901 self.assertEqual(memoryview(y), memoryview(result))
903 contig_bytes = memoryview(result).tobytes()
906 contig_bytes = memoryview(result).tobytes(order=None)
909 contig_bytes = memoryview(result).tobytes(order='C')
922 self.assertEqual(memoryview(y), memoryview(result))
924 contig_bytes = memoryview(result).tobytes(order='F')
937 self.assertEqual(memoryview(y), memoryview(result))
939 contig_bytes = memoryview(result).tobytes(order='A')
944 m = memoryview(result)
[all …]
Dtest_memoryview.py70 self.assertRaises(TypeError, setitem, memoryview(b"a"))
225 self.m = memoryview(base)
276 self.assertNotEqual(m, memoryview(tp(self._source)))
371 self.assertTrue(memoryview(mm).readonly)
378 x = memoryview(a)
382 d = memoryview(b)
431 return memoryview(obj)
440 m = memoryview(obj)
448 m = memoryview(tp(self._source))
457 m = memoryview(obj)
[all …]
Dtest_audioop.py38 self.assertEqual(audioop.max(memoryview(b''), w), 0)
52 self.assertEqual(audioop.minmax(memoryview(b''), w),
68 self.assertEqual(audioop.maxpp(memoryview(b''), w), 0)
78 self.assertEqual(audioop.avg(memoryview(b''), w), 0)
96 self.assertEqual(audioop.avgpp(memoryview(b''), w), 0)
108 self.assertEqual(audioop.rms(memoryview(b''), w), 0)
124 self.assertEqual(audioop.cross(memoryview(b''), w), -1)
136 self.assertEqual(audioop.add(memoryview(b''), memoryview(b''), w), b'')
155 self.assertEqual(audioop.bias(memoryview(b''), w, bias), b'')
201 self.assertEqual(audioop.lin2lin(memoryview(datas[w]), w, w),
[all …]
Dtest_picklebuffer.py21 with memoryview(pb) as m:
22 with memoryview(equiv) as expected:
39 m = memoryview(b"foo")
47 with memoryview(pb) as m:
52 with memoryview(pb) as m:
61 memoryview(pb)
102 self.assertIsInstance(m, memoryview)
Dtest_getargs2.py803 self.assertRaises(TypeError, getargs_c, memoryview(b'a'))
814 self.assertRaises(TypeError, getargs_y, memoryview(b'memoryview'))
823 self.assertEqual(getargs_y_star(memoryview(b'memoryview')), b'memoryview')
832 self.assertRaises(TypeError, getargs_y_hash, memoryview(b'memoryview'))
841 self.assertRaises(TypeError, getargs_w_star, memoryview(b'bytes'))
846 self.assertEqual(getargs_w_star(memoryview(buf)), b'[emoryvie]')
860 self.assertRaises(TypeError, getargs_C, memoryview(b'a'))
870 self.assertRaises(TypeError, getargs_s, memoryview(b'memoryview'))
879 self.assertEqual(getargs_s_star(memoryview(b'memoryview')), b'memoryview')
888 self.assertRaises(TypeError, getargs_s_hash, memoryview(b'memoryview'))
[all …]
Dtest_int.py311 memoryview,
334 self.assertEqual(int(memoryview(b'123')[1:3]), 23)
335 self.assertEqual(int(memoryview(b'123\x00')[1:3]), 23)
336 self.assertEqual(int(memoryview(b'123 ')[1:3]), 23)
337 self.assertEqual(int(memoryview(b'123A')[1:3]), 23)
338 self.assertEqual(int(memoryview(b'1234')[1:3]), 23)
Dtest_base64.py16 multidimensional = memoryview(b"1234").cast('B', (2, 2))
18 int_data = memoryview(b"1234").cast('I')
36 eq(base64.encodebytes(memoryview(b'abc')), b'YWJj\n')
55 eq(base64.decodebytes(memoryview(b'YWJj\n')), b'abc')
105 eq(f(memoryview(bytes_data)), expected)
115 multidimensional = memoryview(bytes_data).cast('B', shape)
121 int_data = memoryview(bytes_data).cast('I')
144 eq(base64.b64encode(b'\xd3V\xbeo\xf7\x1d', altchars=memoryview(b'*$')),
381 eq(base64.b16decode(memoryview(b"0102abcdef"), True),
Dtest_compile.py474 for filename in bytearray(b'file.py'), memoryview(b'file.py'):
566 compile(memoryview(b"123\x00"), "<dummy>", "eval")
567 code = compile(memoryview(b"123\x00")[1:-1], "<dummy>", "eval")
569 code = compile(memoryview(b"1234")[1:-1], "<dummy>", "eval")
571 code = compile(memoryview(b"$23$")[1:-1], "<dummy>", "eval")
575 self.assertEqual(eval(memoryview(b"1234")[1:-1]), 23)
577 exec(memoryview(b"ax = 123")[1:-1], namespace)
/external/python/cpython2/Lib/ctypes/test/
Dtest_strings.py29 def test_c_buffer_value(self, memoryview=memoryview): argument
35 self.assertRaises(TypeError, setattr, buf, "value", memoryview("Hello, World"))
36 self.assertRaises(TypeError, setattr, buf, "value", memoryview("abc"))
37 self.assertRaises(ValueError, setattr, buf, "raw", memoryview("x" * 100))
39 def test_c_buffer_raw(self, memoryview=memoryview): argument
42 buf.raw = memoryview("Hello, World")
44 self.assertRaises(TypeError, setattr, buf, "value", memoryview("abc"))
45 self.assertRaises(ValueError, setattr, buf, "raw", memoryview("x" * 100))
Dtest_pickling.py31 self.assertEqual(memoryview(src).tobytes(),
32 memoryview(dst).tobytes())
49 self.assertEqual(memoryview(y).tobytes(),
50 memoryview(x).tobytes())
/external/python/cpython2/Lib/test/
Dtest_memoryview.py77 self.assertRaises(TypeError, setitem, memoryview(b"a"))
283 return memoryview(obj)
292 m = memoryview(obj)
300 m = memoryview(tp(self._source))
309 m = memoryview(obj)
324 self.assertTrue(memoryview(ob))
325 self.assertTrue(memoryview(object=ob))
326 self.assertRaises(TypeError, memoryview)
327 self.assertRaises(TypeError, memoryview, ob, ob)
328 self.assertRaises(TypeError, memoryview, argument=ob)
[all …]
Dtest_getargs2.py529 self.assertRaises(TypeError, getargs_c, memoryview('a'))
540 self.assertRaises(TypeError, getargs_w, memoryview('bytes'), 3)
542 memoryview(bytearray('bytes')), 3)
554 self.assertRaises(TypeError, getargs_w_hash, memoryview('bytes'))
556 memoryview(bytearray('bytes')))
568 self.assertRaises(TypeError, getargs_w_star, memoryview('bytes'))
573 self.assertEqual(getargs_w_star(memoryview(buf)), '[emoryvie]')
590 self.assertRaises(TypeError, getargs_s, memoryview('memoryview'))
602 self.assertEqual(getargs_s_star(memoryview('abc\xe9')), 'abc\xe9')
616 self.assertRaises(TypeError, getargs_s_hash, memoryview('memoryview'))
[all …]
/external/python/cpython3/Lib/ctypes/test/
Dtest_pickling.py31 self.assertEqual(memoryview(src).tobytes(),
32 memoryview(dst).tobytes())
49 self.assertEqual(memoryview(y).tobytes(),
50 memoryview(x).tobytes())
Dtest_strings.py34 self.assertRaises(TypeError, setattr, buf, "value", memoryview(b"Hello, World"))
35 self.assertRaises(TypeError, setattr, buf, "value", memoryview(b"abc"))
36 self.assertRaises(ValueError, setattr, buf, "raw", memoryview(b"x" * 100))
41 buf.raw = memoryview(b"Hello, World")
43 self.assertRaises(TypeError, setattr, buf, "value", memoryview(b"abc"))
44 self.assertRaises(ValueError, setattr, buf, "raw", memoryview(b"x" * 100))
Dtest_frombuffer.py34 self.assertIn(a, [obj.obj if isinstance(obj, memoryview) else obj
44 (c_char * 16).from_buffer(memoryview(b"a" * 16))
46 (c_char * 16).from_buffer(memoryview(bytearray(b"a" * 16))[::-1])
61 array = memoryview(array)
80 a = [c_char.from_buffer(memoryview(bytearray(b'a')))]
/external/python/pybind11/tests/
Dtest_pytypes.cpp235 "memoryview"_a=py::memoryview(d["memoryview"]) in TEST_SUBMODULE()
251 "memoryview"_a=d["memoryview"].cast<py::memoryview>() in TEST_SUBMODULE()
366 return py::memoryview(b); in TEST_SUBMODULE()
370 return py::memoryview(b.request()); in TEST_SUBMODULE()
377 return py::memoryview::from_buffer( in TEST_SUBMODULE()
380 return py::memoryview::from_buffer( in TEST_SUBMODULE()
387 return py::memoryview::from_buffer( in TEST_SUBMODULE()
393 return py::memoryview::from_buffer(buf, 1, "B", { }, { }); in TEST_SUBMODULE()
398 return py::memoryview::from_buffer(buf, 1, "B", { 3 }, { }); in TEST_SUBMODULE()
402 return py::memoryview::from_buffer( in TEST_SUBMODULE()
[all …]
Dtest_buffers.py42 assert memoryview(mat).shape == (5, 4)
78 assert memoryview(matrix).shape == (5, 5)
92 view = memoryview(buf)
102 memoryview(buf)[0] = b"d" if env.PY2 else 0x64
110 memoryview(buf)[0] = b"\0" if env.PY2 else 0
Dtest_pytypes.py242 memoryview: b"abc",
423 assert isinstance(view, memoryview)
452 assert isinstance(view, memoryview)
478 assert isinstance(view, memoryview)
/external/flatbuffers/python/flatbuffers/
Dcompat.py32 memoryview_type = memoryview
45 memoryview_type = memoryview
/external/python/cpython2/Doc/c-api/
Dbuffer.rst26 where :class:`memoryview` objects can be constructed from arrays, too.
40 :class:`memoryview`.
43 :class:`memoryview` object has been backported to Python 2.7. It is strongly
300 A :class:`memoryview` object exposes the new C level buffer interface as a
305 Create a memoryview object from an object that defines the new buffer
311 Create a memoryview object wrapping the given buffer-info structure *view*.
312 The memoryview object then owns the buffer, which means you shouldn't
314 memoryview object.
319 Create a memoryview object to a contiguous chunk of memory (in either
321 interface. If memory is contiguous, the memoryview object points to the
[all …]
/external/perfetto/src/trace_processor/python/perfetto/trace_processor/
Dapi.py63 self.__string_cells = memoryview(bytes(batches[0].string_cells, 'utf-8'))
101 self.__string_cells = memoryview(
142 self.__string_cells = memoryview(
/external/tensorflow/tensorflow/python/kernel_tests/
Dbitcast_op_test.py37 buff_after = memoryview(out).tobytes()
38 buff_before = memoryview(x).tobytes()
/external/python/pybind11/include/pybind11/
Dpytypes.h1403 class memoryview : public object {
1405 PYBIND11_OBJECT_CVT(memoryview, object, PyMemoryView_Check, PyMemoryView_FromObject) in PYBIND11_OBJECT_CVT() argument
1416 explicit memoryview(const buffer_info& info) { in PYBIND11_OBJECT_CVT()
1450 static memoryview from_buffer(
1455 static memoryview from_buffer( in from_buffer()
1459 return memoryview::from_buffer( in from_buffer()
1464 static memoryview from_buffer(
1467 return memoryview::from_buffer(
1473 static memoryview from_buffer( in from_buffer()
1476 return memoryview::from_buffer( in from_buffer()
[all …]
/external/python/cpython3/Lib/
Dbase64.py43 return memoryview(s).tobytes()
154 s = memoryview(s).tobytes()
282 b = memoryview(b).tobytes()
510 m = memoryview(s)

12345678