source
stringclasses 2
values | version
stringclasses 2
values | module
stringclasses 53
values | function
stringclasses 318
values | input
stringlengths 3
496
| expected
stringlengths 0
876
| signature
stringclasses 41
values |
|---|---|---|---|---|---|---|
cpython
|
3.10
|
subprocess
|
Handle.check_output
|
>>> check_output(["ls", "-l", "/dev/null"])
|
b'crw-rw-rw- 1 root root 1, 3 Oct 18 2007 /dev/null\n'
| null |
cpython
|
3.10
|
subprocess
|
Handle.check_output
|
>>> check_output(["/bin/sh", "-c",
... "ls -l non_existent_file ; exit 0"],
... stderr=STDOUT)
|
b'ls: non_existent_file: No such file or directory\n'
| null |
cpython
|
3.10
|
subprocess
|
Handle.check_output
|
>>> check_output(["sed", "-e", "s/foo/bar/"],
... input=b"when in the course of fooman events\n")
|
b'when in the course of barman events\n'
| null |
cpython
|
3.10
|
subprocess
|
CompletedProcess.getstatusoutput
|
>>> import subprocess
| null |
|
cpython
|
3.10
|
subprocess
|
CompletedProcess.getstatusoutput
|
>>> subprocess.getstatusoutput('ls /bin/ls')
|
(0, '/bin/ls')
| null |
cpython
|
3.10
|
subprocess
|
CompletedProcess.getstatusoutput
|
>>> subprocess.getstatusoutput('cat /bin/junk')
|
(1, 'cat: /bin/junk: No such file or directory')
| null |
cpython
|
3.10
|
subprocess
|
CompletedProcess.getstatusoutput
|
>>> subprocess.getstatusoutput('/bin/junk')
|
(127, 'sh: /bin/junk: not found')
| null |
cpython
|
3.10
|
subprocess
|
CompletedProcess.getstatusoutput
|
>>> subprocess.getstatusoutput('/bin/kill $$')
|
(-15, '')
| null |
cpython
|
3.10
|
subprocess
|
CompletedProcess.getoutput
|
>>> import subprocess
| null |
|
cpython
|
3.10
|
subprocess
|
CompletedProcess.getoutput
|
>>> subprocess.getoutput('ls /bin/ls')
|
'/bin/ls'
| null |
cpython
|
3.10
|
pickle
|
_Unframer.encode_long
|
>>> encode_long(0)
|
b''
| null |
cpython
|
3.10
|
pickle
|
_Unframer.encode_long
|
>>> encode_long(255)
|
b'\xff\x00'
| null |
cpython
|
3.10
|
pickle
|
_Unframer.encode_long
|
>>> encode_long(32767)
|
b'\xff\x7f'
| null |
cpython
|
3.10
|
pickle
|
_Unframer.encode_long
|
>>> encode_long(-256)
|
b'\x00\xff'
| null |
cpython
|
3.10
|
pickle
|
_Unframer.encode_long
|
>>> encode_long(-32768)
|
b'\x00\x80'
| null |
cpython
|
3.10
|
pickle
|
_Unframer.encode_long
|
>>> encode_long(-128)
|
b'\x80'
| null |
cpython
|
3.10
|
pickle
|
_Unframer.encode_long
|
>>> encode_long(127)
|
b'\x7f'
| null |
cpython
|
3.10
|
pickle
|
_Unframer.encode_long
|
>>>
| null |
|
cpython
|
3.10
|
pickle
|
_Unframer.decode_long
|
>>> decode_long(b'')
|
0
| null |
cpython
|
3.10
|
pickle
|
_Unframer.decode_long
|
>>> decode_long(b"\xff\x00")
|
255
| null |
cpython
|
3.10
|
pickle
|
_Unframer.decode_long
|
>>> decode_long(b"\xff\x7f")
|
32767
| null |
cpython
|
3.10
|
pickle
|
_Unframer.decode_long
|
>>> decode_long(b"\x00\xff")
|
-256
| null |
cpython
|
3.10
|
pickle
|
_Unframer.decode_long
|
>>> decode_long(b"\x00\x80")
|
-32768
| null |
cpython
|
3.10
|
pickle
|
_Unframer.decode_long
|
>>> decode_long(b"\x80")
|
-128
| null |
cpython
|
3.10
|
pickle
|
_Unframer.decode_long
|
>>> decode_long(b"\x7f")
|
127
| null |
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_uint1
|
>>> import io
| null |
|
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_uint1
|
>>> read_uint1(io.BytesIO(b'\xff'))
|
255
| null |
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_uint2
|
>>> import io
| null |
|
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_uint2
|
>>> read_uint2(io.BytesIO(b'\xff\x00'))
|
255
| null |
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_uint2
|
>>> read_uint2(io.BytesIO(b'\xff\xff'))
|
65535
| null |
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_int4
|
>>> import io
| null |
|
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_int4
|
>>> read_int4(io.BytesIO(b'\xff\x00\x00\x00'))
|
255
| null |
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_int4
|
>>> read_int4(io.BytesIO(b'\x00\x00\x00\x80')) == -(2**31)
|
True
| null |
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_uint4
|
>>> import io
| null |
|
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_uint4
|
>>> read_uint4(io.BytesIO(b'\xff\x00\x00\x00'))
|
255
| null |
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_uint4
|
>>> read_uint4(io.BytesIO(b'\x00\x00\x00\x80')) == 2**31
|
True
| null |
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_uint8
|
>>> import io
| null |
|
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_uint8
|
>>> read_uint8(io.BytesIO(b'\xff\x00\x00\x00\x00\x00\x00\x00'))
|
255
| null |
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_uint8
|
>>> read_uint8(io.BytesIO(b'\xff' * 8)) == 2**64-1
|
True
| null |
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_stringnl
|
>>> import io
| null |
|
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_stringnl
|
>>> read_stringnl(io.BytesIO(b"'abcd'\nefg\n"))
|
'abcd'
| null |
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_stringnl
|
>>> read_stringnl(io.BytesIO(b"\n"))
|
Traceback (most recent call last):
...
ValueError: no string quotes around b''
| null |
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_stringnl
|
>>> read_stringnl(io.BytesIO(b"\n"), stripquotes=False)
|
''
| null |
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_stringnl
|
>>> read_stringnl(io.BytesIO(b"''\n"))
|
''
| null |
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_stringnl
|
>>> read_stringnl(io.BytesIO(b'"abcd"'))
|
Traceback (most recent call last):
...
ValueError: no newline found when trying to read stringnl
| null |
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_stringnl
|
>>> read_stringnl(io.BytesIO(br"'a\n\\b\x00c\td'" + b"\n'e'"))
|
'a\n\\b\x00c\td'
| null |
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_stringnl_noescape_pair
|
>>> import io
| null |
|
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_stringnl_noescape_pair
|
>>> read_stringnl_noescape_pair(io.BytesIO(b"Queue\nEmpty\njunk"))
|
'Queue Empty'
| null |
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_string1
|
>>> import io
| null |
|
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_string1
|
>>> read_string1(io.BytesIO(b"\x00"))
|
''
| null |
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_string1
|
>>> read_string1(io.BytesIO(b"\x03abcdef"))
|
'abc'
| null |
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_string4
|
>>> import io
| null |
|
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_string4
|
>>> read_string4(io.BytesIO(b"\x00\x00\x00\x00abc"))
|
''
| null |
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_string4
|
>>> read_string4(io.BytesIO(b"\x03\x00\x00\x00abcdef"))
|
'abc'
| null |
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_string4
|
>>> read_string4(io.BytesIO(b"\x00\x00\x00\x03abcdef"))
|
Traceback (most recent call last):
...
ValueError: expected 50331648 bytes in a string4, but only 6 remain
| null |
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_bytes1
|
>>> import io
| null |
|
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_bytes1
|
>>> read_bytes1(io.BytesIO(b"\x00"))
|
b''
| null |
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_bytes1
|
>>> read_bytes1(io.BytesIO(b"\x03abcdef"))
|
b'abc'
| null |
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_bytes4
|
>>> import io
| null |
|
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_bytes4
|
>>> read_bytes4(io.BytesIO(b"\x00\x00\x00\x00abc"))
|
b''
| null |
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_bytes4
|
>>> read_bytes4(io.BytesIO(b"\x03\x00\x00\x00abcdef"))
|
b'abc'
| null |
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_bytes4
|
>>> read_bytes4(io.BytesIO(b"\x00\x00\x00\x03abcdef"))
|
Traceback (most recent call last):
...
ValueError: expected 50331648 bytes in a bytes4, but only 6 remain
| null |
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_bytes8
|
>>> import io, struct, sys
| null |
|
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_bytes8
|
>>> read_bytes8(io.BytesIO(b"\x00\x00\x00\x00\x00\x00\x00\x00abc"))
|
b''
| null |
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_bytes8
|
>>> read_bytes8(io.BytesIO(b"\x03\x00\x00\x00\x00\x00\x00\x00abcdef"))
|
b'abc'
| null |
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_bytes8
|
>>> bigsize8 = struct.pack("<Q", sys.maxsize//3)
| null |
|
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_bytes8
|
>>> read_bytes8(io.BytesIO(bigsize8 + b"abcdef")) #doctest: +ELLIPSIS
|
Traceback (most recent call last):
...
ValueError: expected ... bytes in a bytes8, but only 6 remain
| null |
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_bytearray8
|
>>> import io, struct, sys
| null |
|
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_bytearray8
|
>>> read_bytearray8(io.BytesIO(b"\x00\x00\x00\x00\x00\x00\x00\x00abc"))
|
bytearray(b'')
| null |
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_bytearray8
|
>>> read_bytearray8(io.BytesIO(b"\x03\x00\x00\x00\x00\x00\x00\x00abcdef"))
|
bytearray(b'abc')
| null |
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_bytearray8
|
>>> bigsize8 = struct.pack("<Q", sys.maxsize//3)
| null |
|
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_bytearray8
|
>>> read_bytearray8(io.BytesIO(bigsize8 + b"abcdef")) #doctest: +ELLIPSIS
|
Traceback (most recent call last):
...
ValueError: expected ... bytes in a bytearray8, but only 6 remain
| null |
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_unicodestringnl
|
>>> import io
| null |
|
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_unicodestringnl
|
>>> read_unicodestringnl(io.BytesIO(b"abc\\uabcd\njunk")) == 'abc\uabcd'
|
True
| null |
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_unicodestring1
|
>>> import io
| null |
|
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_unicodestring1
|
>>> s = 'abcd\uabcd'
| null |
|
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_unicodestring1
|
>>> enc = s.encode('utf-8')
| null |
|
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_unicodestring1
|
>>> enc
|
b'abcd\xea\xaf\x8d'
| null |
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_unicodestring1
|
>>> n = bytes([len(enc)]) # little-endian 1-byte length
| null |
|
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_unicodestring1
|
>>> t = read_unicodestring1(io.BytesIO(n + enc + b'junk'))
| null |
|
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_unicodestring1
|
>>> s == t
|
True
| null |
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_unicodestring1
|
>>> read_unicodestring1(io.BytesIO(n + enc[:-1]))
|
Traceback (most recent call last):
...
ValueError: expected 7 bytes in a unicodestring1, but only 6 remain
| null |
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_unicodestring4
|
>>> import io
| null |
|
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_unicodestring4
|
>>> s = 'abcd\uabcd'
| null |
|
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_unicodestring4
|
>>> enc = s.encode('utf-8')
| null |
|
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_unicodestring4
|
>>> enc
|
b'abcd\xea\xaf\x8d'
| null |
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_unicodestring4
|
>>> n = bytes([len(enc), 0, 0, 0]) # little-endian 4-byte length
| null |
|
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_unicodestring4
|
>>> t = read_unicodestring4(io.BytesIO(n + enc + b'junk'))
| null |
|
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_unicodestring4
|
>>> s == t
|
True
| null |
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_unicodestring4
|
>>> read_unicodestring4(io.BytesIO(n + enc[:-1]))
|
Traceback (most recent call last):
...
ValueError: expected 7 bytes in a unicodestring4, but only 6 remain
| null |
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_unicodestring8
|
>>> import io
| null |
|
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_unicodestring8
|
>>> s = 'abcd\uabcd'
| null |
|
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_unicodestring8
|
>>> enc = s.encode('utf-8')
| null |
|
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_unicodestring8
|
>>> enc
|
b'abcd\xea\xaf\x8d'
| null |
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_unicodestring8
|
>>> n = bytes([len(enc)]) + b'\0' * 7 # little-endian 8-byte length
| null |
|
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_unicodestring8
|
>>> t = read_unicodestring8(io.BytesIO(n + enc + b'junk'))
| null |
|
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_unicodestring8
|
>>> s == t
|
True
| null |
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_unicodestring8
|
>>> read_unicodestring8(io.BytesIO(n + enc[:-1]))
|
Traceback (most recent call last):
...
ValueError: expected 7 bytes in a unicodestring8, but only 6 remain
| null |
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_decimalnl_short
|
>>> import io
| null |
|
cpython
|
3.10
|
pickletools
|
ArgumentDescriptor.read_decimalnl_short
|
>>> read_decimalnl_short(io.BytesIO(b"1234\n56"))
|
1234
| null |
End of preview. Expand
in Data Studio
No dataset card yet
- Downloads last month
- 12