message_type
stringclasses 2
values | message
stringlengths 2
232
⌀ | message_id
int64 0
1
| conversation_id
int64 0
2.38k
|
---|---|---|---|
instruction
|
unpack hexadecimal string `s` to a list of integer values
| 0 | 2,350 |
output
|
struct.unpack('11B', s)
| 1 | 2,350 |
instruction
|
finding the index of an item 'foo' given a list `['foo', 'bar', 'baz']` containing it
| 0 | 2,351 |
output
|
[i for i, j in enumerate(['foo', 'bar', 'baz']) if j == 'foo']
| 1 | 2,351 |
instruction
|
generate all permutations of list `[1, 2, 3]` and list `[4, 5, 6]`
| 0 | 2,352 |
output
|
print(list(itertools.product([1, 2, 3], [4, 5, 6])))
| 1 | 2,352 |
instruction
|
generate all permutations of a list `[1, 2, 3]`
| 0 | 2,353 |
output
|
itertools.permutations([1, 2, 3])
| 1 | 2,353 |
instruction
|
substitute occurrences of unicode regex pattern u'\\p{P}+' with empty string '' in string `text`
| 0 | 2,354 |
output
|
return re.sub('\\p{P}+', '', text)
| 1 | 2,354 |
instruction
|
manually throw/raise a `ValueError` exception with the message 'A very specific bad thing happened'
| 0 | 2,355 |
output
|
raise ValueError('A very specific bad thing happened')
| 1 | 2,355 |
instruction
|
throw an exception "I know Python!"
| 0 | 2,356 |
output
|
raise Exception('I know Python!')
| 1 | 2,356 |
instruction
|
Manually throw an exception "I know python!"
| 0 | 2,357 |
output
|
raise Exception('I know python!')
| 1 | 2,357 |
instruction
|
throw a ValueError with message 'represents a hidden bug, do not catch this'
| 0 | 2,358 |
output
|
raise ValueError('represents a hidden bug, do not catch this')
| 1 | 2,358 |
instruction
|
throw an Exception with message 'This is the exception you expect to handle'
| 0 | 2,359 |
output
|
raise Exception('This is the exception you expect to handle')
| 1 | 2,359 |
instruction
|
throw a value error with message 'A very specific bad thing happened', 'foo', 'bar', 'baz'
| 0 | 2,360 |
output
|
raise ValueError('A very specific bad thing happened')
| 1 | 2,360 |
instruction
|
throw a runtime error with message 'specific message'
| 0 | 2,361 |
output
|
raise RuntimeError('specific message')
| 1 | 2,361 |
instruction
|
throw an assertion error with message "Unexpected value of 'distance'!", distance
| 0 | 2,362 |
output
|
raise AssertionError("Unexpected value of 'distance'!", distance)
| 1 | 2,362 |
instruction
|
if Selenium textarea element `foo` is not empty, clear the field
| 0 | 2,363 |
output
|
driver.find_element_by_id('foo').clear()
| 1 | 2,363 |
instruction
|
clear text from textarea 'foo' with selenium
| 0 | 2,364 |
output
|
driver.find_element_by_id('foo').clear()
| 1 | 2,364 |
instruction
|
convert a number 2130706433 to ip string
| 0 | 2,365 |
output
|
socket.inet_ntoa(struct.pack('!L', 2130706433))
| 1 | 2,365 |
instruction
|
Rearrange the columns 'a','b','x','y' of pandas DataFrame `df` in mentioned sequence 'x' ,'y','a' ,'b'
| 0 | 2,366 |
output
|
df = df[['x', 'y', 'a', 'b']]
| 1 | 2,366 |
instruction
|
call base class's __init__ method from the child class `ChildClass`
| 0 | 2,367 |
output
|
super(ChildClass, self).__init__(*args, **kwargs)
| 1 | 2,367 |
instruction
|
sum of all values in a python dict `d`
| 0 | 2,368 |
output
|
sum(d.values())
| 1 | 2,368 |
instruction
| null | 0 | 2,369 |
output
|
sum(d.values())
| 1 | 2,369 |
instruction
|
convert python dictionary `your_data` to json array
| 0 | 2,370 |
output
|
json.dumps(your_data, ensure_ascii=False)
| 1 | 2,370 |
instruction
|
assign an array of floats in range from 0 to 100 to a variable `values`
| 0 | 2,371 |
output
|
values = np.array([i for i in range(100)], dtype=np.float64)
| 1 | 2,371 |
instruction
|
sort a list of dictionaries `list_of_dct` by values in an order `order`
| 0 | 2,372 |
output
|
sorted(list_of_dct, key=lambda x: order.index(list(x.values())[0]))
| 1 | 2,372 |
instruction
|
change the case of the first letter in string `s`
| 0 | 2,373 |
output
|
return s[0].upper() + s[1:]
| 1 | 2,373 |
instruction
|
join list of numbers `[1,2,3,4] ` to string of numbers.
| 0 | 2,374 |
output
|
"""""".join([1, 2, 3, 4])
| 1 | 2,374 |
instruction
|
delete every non `utf-8` characters from a string `line`
| 0 | 2,375 |
output
|
line = line.decode('utf-8', 'ignore').encode('utf-8')
| 1 | 2,375 |
instruction
|
execute a command `command ` in the terminal from a python script
| 0 | 2,376 |
output
|
os.system(command)
| 1 | 2,376 |
instruction
|
MySQL execute query 'SELECT * FROM foo WHERE bar = %s AND baz = %s' with parameters `param1` and `param2`
| 0 | 2,377 |
output
|
c.execute('SELECT * FROM foo WHERE bar = %s AND baz = %s', (param1, param2))
| 1 | 2,377 |
instruction
|
Parse string `datestr` into a datetime object using format pattern '%Y-%m-%d'
| 0 | 2,378 |
output
|
dateobj = datetime.datetime.strptime(datestr, '%Y-%m-%d').date()
| 1 | 2,378 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.