Datasets:
question_id
stringlengths 7
12
| nl
stringlengths 4
200
| cmd
stringlengths 2
232
| oracle_man
sequence | canonical_cmd
stringlengths 2
228
| cmd_name
stringclasses 1
value |
---|---|---|---|---|---|
348196-52 | Create list `instancelist` containing 29 objects of type MyClass | instancelist = [MyClass() for i in range(29)] | [
"python.library.functions#range"
] | VAR_STR = [MyClass() for i in range(29)] | conala |
5744980-30 | Taking the results of a bash command "awk '{print $10, $11}' test.txt > test2.txt" | os.system("awk '{print $10, $11}' test.txt > test2.txt") | [
"python.library.os#os.system"
] | os.system('VAR_STR') | conala |
16739319-24 | selenium wait for driver `driver` 60 seconds before throwing a NoSuchElementExceptions exception | driver.implicitly_wait(60) | [] | VAR_STR.implicitly_wait(60) | conala |
16739319-56 | selenium webdriver switch to frame 'frameName' | driver.switch_to_frame('frameName') | [] | driver.switch_to_frame('VAR_STR') | conala |
39870642-93 | Save plot `plt` as png file 'filename.png' | plt.savefig('filename.png') | [
"matplotlib.figure_api#matplotlib.figure.Figure.savefig"
] | VAR_STR.savefig('VAR_STR') | conala |
39870642-22 | Save matplotlib graph to image file `filename.png` at a resolution of `300 dpi` | plt.savefig('filename.png', dpi=300) | [
"matplotlib.figure_api#matplotlib.figure.Figure.savefig"
] | plt.savefig('VAR_STR', dpi=300) | conala |
20062565-45 | search for regex pattern 'Test(.*)print' in string `testStr` including new line character '\n' | re.search('Test(.*)print', testStr, re.DOTALL) | [
"python.library.re#re.search"
] | re.search('VAR_STR', VAR_STR, re.DOTALL) | conala |
42364992-94 | Enclose numbers in quotes in a string `This is number 1 and this is number 22` | re.sub('(\\d+)', '"\\1"', 'This is number 1 and this is number 22') | [
"python.library.re#re.sub"
] | re.sub('(\\d+)', '"\\1"', 'VAR_STR') | conala |
4383571-75 | Importing file `file` from folder '/path/to/application/app/folder' | sys.path.insert(0, '/path/to/application/app/folder')
import file | [
"numpy.reference.generated.numpy.insert"
] | sys.path.insert(0, 'VAR_STR')
import VAR_STR | conala |
11703064-52 | append the sum of each tuple pair in the grouped list `list1` and list `list2` elements to list `list3` | list3 = [(a + b) for a, b in zip(list1, list2)] | [
"python.library.functions#zip"
] | VAR_STR = [(a + b) for a, b in zip(VAR_STR, VAR_STR)] | conala |
25540259-67 | remove frame of legend in plot `plt` | plt.legend(frameon=False) | [
"matplotlib.legend_api#matplotlib.legend.Legend"
] | VAR_STR.legend(frameon=False) | conala |
16050952-62 | remove the punctuation '!', '.', ':' from a string `asking` | out = ''.join(c for c in asking if c not in ('!', '.', ':')) | [
"python.library.stdtypes#str.join"
] | out = ''.join(c for c in VAR_STR if c not in ('VAR_STR', 'VAR_STR', 'VAR_STR')) | conala |
12096252-61 | use a list of values `[3,6]` to select rows from a pandas dataframe `df`'s column 'A' | df[df['A'].isin([3, 6])] | [
"numpy.reference.generated.numpy.isin"
] | VAR_STR[VAR_STR['A'].isin([3, 6])] | conala |
1179305-61 | Parse a file `sample.xml` using expat parsing in python 3 | parser.ParseFile(open('sample.xml', 'rb')) | [
"python.library.urllib.request#open"
] | parser.ParseFile(open('VAR_STR', 'rb')) | conala |
22229255-65 | match zero-or-more instances of lower case alphabet characters in a string `f233op ` | re.findall('([a-z]*)', 'f233op') | [
"python.library.re#re.findall"
] | re.findall('([a-z]*)', 'VAR_STR') | conala |
22229255-56 | match zero-or-more instances of lower case alphabet characters in a string `f233op ` | re.findall('([a-z])*', 'f233op') | [
"python.library.re#re.findall"
] | re.findall('([a-z])*', 'VAR_STR') | conala |
209513-92 | Convert hex string "deadbeef" to integer | int('deadbeef', 16) | [
"python.library.functions#int"
] | int('VAR_STR', 16) | conala |
209513-93 | Convert hex string "a" to integer | int('a', 16) | [
"python.library.functions#int"
] | int('VAR_STR', 16) | conala |
209513-94 | Convert hex string "0xa" to integer | int('0xa', 16) | [
"python.library.functions#int"
] | int('VAR_STR', 16) | conala |
209513-47 | Convert hex string `s` to integer | int(s, 16) | [
"python.library.functions#int"
] | int(VAR_STR, 16) | conala |
209513-79 | Convert hex string `hexString` to int | int(hexString, 16) | [
"python.library.functions#int"
] | int(VAR_STR, 16) | conala |
1400608-13 | empty a list `lst` | del lst[:] | [] | del VAR_STR[:] | conala |
1400608-91 | empty a list `lst` | del lst1[:] | [] | del lst1[:] | conala |
1400608-86 | empty a list `lst` | lst[:] = [] | [] | VAR_STR[:] = [] | conala |
1400608-67 | empty a list `alist` | alist[:] = [] | [] | VAR_STR[:] = [] | conala |
15740236-74 | encode unicode string '\xc5\xc4\xd6' to utf-8 code | print('\xc5\xc4\xd6'.encode('UTF8')) | [
"python.library.stdtypes#str.encode"
] | print('VAR_STR'.encode('UTF8')) | conala |
41648246-16 | solve for the least squares' solution of matrices `a` and `b` | np.linalg.solve(np.dot(a.T, a), np.dot(a.T, b)) | [
"numpy.reference.generated.numpy.dot",
"numpy.reference.generated.numpy.linalg.solve"
] | np.linalg.solve(np.dot(VAR_STR.T, VAR_STR), np.dot(VAR_STR.T, VAR_STR)) | conala |
3820312-13 | create a file 'filename' with each tuple in the list `mylist` written to a line | open('filename', 'w').write('\n'.join('%s %s' % x for x in mylist)) | [
"python.library.urllib.request#open",
"python.library.stdtypes#str.join",
"python.library.os#os.write"
] | open('VAR_STR', 'w').write('\n'.join('%s %s' % x for x in VAR_STR)) | conala |
7351270-100 | print numbers in list `list` with precision of 3 decimal places | print('[%s]' % ', '.join('%.3f' % val for val in list)) | [
"python.library.stdtypes#str.join"
] | print('[%s]' % ', '.join('%.3f' % val for val in VAR_STR)) | conala |
7351270-60 | format print output of list of floats `l` to print only up to 3 decimal points | print('[' + ', '.join('%5.3f' % v for v in l) + ']') | [
"python.library.stdtypes#str.join"
] | print('[' + ', '.join('%5.3f' % v for v in VAR_STR) + ']') | conala |
7351270-62 | print a list of floating numbers `l` using string formatting | print([('%5.3f' % val) for val in l]) | [] | print([('%5.3f' % val) for val in VAR_STR]) | conala |
14750675-12 | delete letters from string '12454v' | """""".join(filter(str.isdigit, '12454v')) | [
"python.library.functions#filter",
"python.library.stdtypes#str.join"
] | """""".join(filter(str.isdigit, 'VAR_STR')) | conala |
4508155-69 | Get a md5 hash from string `thecakeisalie` | k = hashlib.md5('thecakeisalie').hexdigest() | [
"python.library.hashlib#hashlib.hash.hexdigest"
] | k = hashlib.md5('VAR_STR').hexdigest() | conala |
36296993-71 | replace string 'in.' with ' in. ' in dataframe `df` column 'a' | df['a'] = df['a'].str.replace('in.', ' in. ') | [
"python.library.stdtypes#str.replace"
] | VAR_STR['VAR_STR'] = VAR_STR['VAR_STR'].str.replace('VAR_STR', ' in. ') | conala |
1246444-16 | convert string `x' to dictionary splitted by `=` using list comprehension | dict([x.split('=') for x in s.split()]) | [
"python.library.stdtypes#dict",
"python.library.stdtypes#str.split"
] | dict([x.split('=') for x in s.split()]) | conala |
12168648-98 | add a column 'new_col' to dataframe `df` for index in range | df['new_col'] = list(range(1, len(df) + 1)) | [
"python.library.functions#len",
"python.library.functions#range",
"python.library.functions#list"
] | VAR_STR['VAR_STR'] = list(range(1, len(VAR_STR) + 1)) | conala |
1790520-32 | apply logical operator 'AND' to all elements in list `a_list` | all(a_list) | [
"python.library.functions#all"
] | all(VAR_STR) | conala |
32996293-30 | get a list of booleans `z` that shows wether the corresponding items in list `x` and `y` are equal | z = [(i == j) for i, j in zip(x, y)] | [
"python.library.functions#zip"
] | VAR_STR = [(i == j) for i, j in zip(VAR_STR, VAR_STR)] | conala |
32996293-89 | create a list which indicates whether each element in `x` and `y` is identical | [(x[i] == y[i]) for i in range(len(x))] | [
"python.library.functions#len",
"python.library.functions#range"
] | [(VAR_STR[i] == VAR_STR[i]) for i in range(len(VAR_STR))] | conala |
3887469-9 | convert currency string `dollars` to decimal `cents_int` | cents_int = int(round(float(dollars.strip('$')) * 100)) | [
"python.library.functions#float",
"python.library.functions#int",
"python.library.functions#round",
"python.library.stdtypes#str.strip"
] | VAR_STR = int(round(float(VAR_STR.strip('$')) * 100)) | conala |
17734779-42 | sort list `users` using values associated with key 'id' according to elements in list `order` | users.sort(key=lambda x: order.index(x['id'])) | [
"pandas.reference.api.pandas.index.sort"
] | VAR_STR.sort(key=lambda x: VAR_STR.index(x['VAR_STR'])) | conala |
17734779-50 | sort a python list of dictionaries `users` by a given list `order` of ids 'id' with the desired order | users.sort(key=lambda x: order.index(x['id'])) | [
"pandas.reference.api.pandas.index.sort"
] | VAR_STR.sort(key=lambda x: VAR_STR.index(x['VAR_STR'])) | conala |
7658932-91 | Get all indexes of a letter `e` from a string `word` | [index for index, letter in enumerate(word) if letter == 'e'] | [
"python.library.functions#enumerate"
] | [index for index, letter in enumerate(VAR_STR) if letter == 'VAR_STR'] | conala |
18609153-66 | format parameters 'b' and 'a' into plcaeholders in string "{0}\\w{{2}}b{1}\\w{{2}}quarter" | """{0}\\w{{2}}b{1}\\w{{2}}quarter""".format('b', 'a') | [
"python.library.functions#format"
] | """VAR_STR""".format('VAR_STR', 'VAR_STR') | conala |
845058-51 | get line count of file 'myfile.txt' | sum((1 for line in open('myfile.txt'))) | [
"python.library.functions#sum",
"python.library.urllib.request#open"
] | sum(1 for line in open('VAR_STR')) | conala |
845058-70 | get line count of file `filename` | def bufcount(filename):
f = open(filename)
lines = 0
buf_size = (1024 * 1024)
read_f = f.read
buf = read_f(buf_size)
while buf:
lines += buf.count('\n')
buf = read_f(buf_size)
return lines | [
"python.library.urllib.request#open"
] | def bufcount(VAR_STR):
f = open(VAR_STR)
lines = 0
buf_size = 1024 * 1024
read_f = f.read
buf = read_f(buf_size)
while buf:
lines += buf.count('\n')
buf = read_f(buf_size)
return lines | conala |
6714826-24 | Determine the byte length of a utf-8 encoded string `s` | return len(s.encode('utf-8')) | [
"python.library.functions#len",
"python.library.stdtypes#str.encode"
] | return len(VAR_STR.encode('utf-8')) | conala |
5373474-77 | specify multiple positional arguments with argparse | parser.add_argument('input', nargs='+') | [
"python.library.argparse#argparse.ArgumentParser.add_argument"
] | parser.add_argument('input', nargs='+') | conala |
28925267-60 | delete every 8th column in a numpy array 'a'. | np.delete(a, list(range(0, a.shape[1], 8)), axis=1) | [
"numpy.reference.generated.numpy.delete",
"python.library.functions#range",
"python.library.functions#list"
] | np.delete(VAR_STR, list(range(0, VAR_STR.shape[1], 8)), axis=1) | conala |
3878555-86 | Replace repeated instances of a character '*' with a single instance in a string 'text' | re.sub('\\*\\*+', '*', text) | [
"python.library.re#re.sub"
] | re.sub('\\*\\*+', 'VAR_STR', VAR_STR) | conala |
3878555-86 | replace repeated instances of "*" with a single instance of "*" | re.sub('\\*+', '*', text) | [
"python.library.re#re.sub"
] | re.sub('\\*+', 'VAR_STR', text) | conala |
23145240-59 | split elements of a list `l` by '\t' | [i.partition('\t')[-1] for i in l if '\t' in i] | [
"python.library.stdtypes#str.partition"
] | [i.partition('VAR_STR')[-1] for i in VAR_STR if 'VAR_STR' in i] | conala |
1731346-40 | get two random records from model 'MyModel' in Django | MyModel.objects.order_by('?')[:2] | [] | VAR_STR.objects.order_by('?')[:2] | conala |
317413-56 | get value of first child of xml node `name` | name[0].firstChild.nodeValue | [] | VAR_STR[0].firstChild.nodeValue | conala |
10618586-67 | Convert a hex string `437c2123 ` according to ascii value. | """437c2123""".decode('hex') | [
"python.library.stdtypes#bytearray.decode"
] | """VAR_STR""".decode('hex') | conala |
2755950-13 | Get all `a` tags where the text starts with value `some text` using regex | doc.xpath("//a[starts-with(text(),'some text')]") | [] | doc.xpath("//a[starts-with(text(),'some text')]") | conala |
10974932-69 | split string `str1` on one or more spaces with a regular expression | re.split(' +', str1) | [
"python.library.re#re.split"
] | re.split(' +', VAR_STR) | conala |
10974932-59 | python split string based on regular expression | re.findall('\\S+', str1) | [
"python.library.re#re.findall"
] | re.findall('\\S+', str1) | conala |
3774571-10 | BeautifulSoup find all tags with attribute 'name' equal to 'description' | soup.findAll(attrs={'name': 'description'}) | [
"python.library.re#re.findall"
] | soup.findAll(attrs={'VAR_STR': 'VAR_STR'}) | conala |
23566515-25 | get the dot product of two one dimensional numpy arrays | np.dot(a[:, (None)], b[(None), :]) | [
"numpy.reference.generated.numpy.dot"
] | np.dot(a[:, (None)], b[(None), :]) | conala |
23566515-22 | multiplication of two 1-dimensional arrays in numpy | np.outer(a, b) | [
"numpy.reference.generated.numpy.outer"
] | np.outer(a, b) | conala |
8785554-77 | insert a list `k` at the front of list `a` | a.insert(0, k) | [
"numpy.reference.generated.numpy.insert"
] | VAR_STR.insert(0, VAR_STR) | conala |
8785554-42 | insert elements of list `k` into list `a` at position `n` | a = a[:n] + k + a[n:] | [] | VAR_STR = VAR_STR[:VAR_STR] + VAR_STR + VAR_STR[VAR_STR:] | conala |
17106819-22 | get values from a dictionary `my_dict` whose key contains the string `Date` | [v for k, v in list(my_dict.items()) if 'Date' in k] | [
"python.library.functions#list",
"python.library.stdtypes#dict.items"
] | [v for k, v in list(VAR_STR.items()) if 'VAR_STR' in k] | conala |
9969684-48 | Print variable `count` and variable `conv` with space string ' ' in between | print(str(count) + ' ' + str(conv)) | [
"python.library.stdtypes#str"
] | print(str(VAR_STR) + ' ' + str(VAR_STR)) | conala |
10805589-34 | convert JSON string '2012-05-29T19:30:03.283Z' into a DateTime object using format '%Y-%m-%dT%H:%M:%S.%fZ' | datetime.datetime.strptime('2012-05-29T19:30:03.283Z', '%Y-%m-%dT%H:%M:%S.%fZ') | [
"python.library.datetime#datetime.datetime.strptime"
] | datetime.datetime.strptime('VAR_STR', 'VAR_STR') | conala |
17577727-88 | decode string `content` to UTF-8 code | print(content.decode('utf8')) | [
"python.library.stdtypes#bytearray.decode"
] | print(VAR_STR.decode('utf8')) | conala |
17757450-20 | convert list `data` into a string of its elements | print(''.join(map(str, data))) | [
"python.library.functions#map",
"python.library.stdtypes#str.join"
] | print(''.join(map(str, VAR_STR))) | conala |
11584773-84 | sort list `lst` in descending order based on the second item of each tuple in it | lst.sort(key=lambda x: x[2], reverse=True) | [
"python.library.stdtypes#list.sort"
] | VAR_STR.sort(key=lambda x: x[2], reverse=True) | conala |
20078816-77 | Replace non-ASCII characters in string `text` with a single space | re.sub('[^\\x00-\\x7F]+', ' ', text) | [
"python.library.re#re.sub"
] | re.sub('[^\\x00-\\x7F]+', ' ', VAR_STR) | conala |
34338341-12 | get all digits in a string `s` after a '[' character | re.findall('\\d+(?=[^[]+$)', s) | [
"python.library.re#re.findall"
] | re.findall('\\d+(?=[^[]+$)', VAR_STR) | conala |
38251245-5 | create a list of tuples which contains number 9 and the number before it, for each occurrence of 9 in the list 'myList' | [(x, y) for x, y in zip(myList, myList[1:]) if y == 9] | [
"python.library.functions#zip"
] | [(x, y) for x, y in zip(VAR_STR, VAR_STR[1:]) if y == 9] | conala |
2186656-7 | remove all instances of [1, 1] from list `a` | a[:] = [x for x in a if x != [1, 1]] | [] | VAR_STR[:] = [x for x in VAR_STR if x != [1, 1]] | conala |
2186656-86 | remove all instances of `[1, 1]` from a list `a` | [x for x in a if x != [1, 1]] | [] | [x for x in VAR_STR if x != [VAR_STR]] | conala |
716477-33 | Convert nested list `x` into a flat list | [j for i in x for j in i] | [] | [j for i in VAR_STR for j in i] | conala |
716477-54 | get each value from a list of lists `a` using itertools | print(list(itertools.chain.from_iterable(a))) | [
"python.library.itertools#itertools.chain.from_iterable",
"python.library.functions#list"
] | print(list(itertools.chain.from_iterable(VAR_STR))) | conala |
2917372-41 | get the indices of tuples in list of tuples `L` where the first value is 53 | [i for i, v in enumerate(L) if v[0] == 53] | [
"python.library.functions#enumerate"
] | [i for i, v in enumerate(VAR_STR) if v[0] == 53] | conala |
5882405-43 | convert string '2011221' into a DateTime object using format '%Y%W%w' | datetime.strptime('2011221', '%Y%W%w') | [
"python.library.datetime#datetime.datetime.strptime"
] | datetime.strptime('VAR_STR', 'VAR_STR') | conala |
4627981-39 | Create a dictionary from string `e` separated by `-` and `,` | dict((k, int(v)) for k, v in (e.split(' - ') for e in s.split(','))) | [
"python.library.functions#int",
"python.library.stdtypes#dict",
"python.library.stdtypes#str.split"
] | dict((k, int(v)) for k, v in (VAR_STR.split(' - ') for VAR_STR in s.split('VAR_STR'))
) | conala |
24492327-75 | insert directory './path/to/your/modules/' to current directory | sys.path.insert(0, './path/to/your/modules/') | [
"numpy.reference.generated.numpy.insert"
] | sys.path.insert(0, 'VAR_STR') | conala |
17608210-91 | Sort a list of strings 'words' such that items starting with 's' come first. | sorted(words, key=lambda x: 'a' + x if x.startswith('s') else 'b' + x) | [
"python.library.functions#sorted",
"python.library.stdtypes#str.startswith"
] | sorted(VAR_STR, key=lambda x: 'a' + x if x.startswith('VAR_STR') else 'b' + x) | conala |
21804935-73 | execute a mv command `mv /home/somedir/subdir/* somedir/` in subprocess | subprocess.call('mv /home/somedir/subdir/* somedir/', shell=True) | [
"python.library.subprocess#subprocess.call"
] | subprocess.call('VAR_STR', shell=True) | conala |
21804935-87 | How to use the mv command in Python with subprocess | subprocess.call('mv /home/somedir/subdir/* somedir/', shell=True) | [
"python.library.subprocess#subprocess.call"
] | subprocess.call('mv /home/somedir/subdir/* somedir/', shell=True) | conala |
40273313-48 | use regex pattern '^12(?=.{4}$)' to remove digit 12 if followed by 4 other digits in column `c_contofficeID` of dataframe `df` | df.c_contofficeID.str.replace('^12(?=.{4}$)', '') | [
"pandas.reference.api.pandas.dataframe.replace"
] | VAR_STR.VAR_STR.str.replace('VAR_STR', '') | conala |
30015665-50 | get the platform OS name | platform.system() | [
"python.library.platform#platform.system"
] | platform.system() | conala |
31650399-37 | find all digits between two characters `\xab` and `\xbb`in a string `text` | print(re.findall('\\d+', '\n'.join(re.findall('\xab([\\s\\S]*?)\xbb', text)))) | [
"python.library.re#re.findall",
"python.library.stdtypes#str.join"
] | print(re.findall('\\d+', '\n'.join(re.findall('«([\\s\\S]*?)»', VAR_STR)))) | conala |
8898294-36 | convert utf-8 with bom string `s` to utf-8 with no bom `u` | u = s.decode('utf-8-sig') | [
"python.library.stdtypes#bytearray.decode"
] | VAR_STR = VAR_STR.decode('utf-8-sig') | conala |
11174790-90 | convert unicode string '\xd0\xbc\xd0\xb0\xd1\x80\xd0\xba\xd0\xb0' to byte string | '\xd0\xbc\xd0\xb0\xd1\x80\xd0\xba\xd0\xb0'.encode('latin-1') | [
"python.library.stdtypes#str.encode"
] | """VAR_STR""".encode('latin-1') | conala |
4843158-40 | get a list of items from the list `some_list` that contain string 'abc' | matching = [s for s in some_list if 'abc' in s] | [] | matching = [s for s in VAR_STR if 'VAR_STR' in s] | conala |
4605439-78 | swap each pair of characters in string `s` | """""".join([s[x:x + 2][::-1] for x in range(0, len(s), 2)]) | [
"python.library.functions#len",
"python.library.functions#range",
"python.library.stdtypes#str.join"
] | """""".join([VAR_STR[x:x + 2][::-1] for x in range(0, len(VAR_STR), 2)]) | conala |
7503241-31 | django return a QuerySet list containing the values of field 'eng_name' in model `Employees` | Employees.objects.values_list('eng_name', flat=True) | [] | VAR_STR.objects.values_list('VAR_STR', flat=True) | conala |
11280536-19 | sum elements at the same index of each list in list `lists` | map(sum, zip(*lists)) | [
"python.library.functions#zip",
"python.library.functions#map"
] | map(sum, zip(*VAR_STR)) | conala |
899103-24 | writing items in list `thelist` to file `thefile` | for item in thelist:
thefile.write(('%s\n' % item)) | [
"python.library.os#os.write"
] | for item in VAR_STR:
VAR_STR.write('%s\n' % item) | conala |
899103-78 | writing items in list `thelist` to file `thefile` | for item in thelist:
pass | [] | for item in VAR_STR:
pass | conala |
899103-57 | serialize `itemlist` to file `outfile` | pickle.dump(itemlist, outfile) | [
"python.library.pickle#pickle.dump"
] | pickle.dump(VAR_STR, VAR_STR) | conala |
899103-77 | writing items in list `itemlist` to file `outfile` | outfile.write('\n'.join(itemlist)) | [
"python.library.stdtypes#str.join",
"python.library.os#os.write"
] | VAR_STR.write('\n'.join(VAR_STR)) | conala |
13295735-56 | replace all the nan values with 0 in a pandas dataframe `df` | df.fillna(0) | [
"pandas.reference.api.pandas.dataframe.fillna"
] | VAR_STR.fillna(0) | conala |
12575421-53 | convert a 1d `A` array to a 2d array `B` | B = np.reshape(A, (-1, 2)) | [
"numpy.reference.generated.numpy.reshape"
] | VAR_STR = np.reshape(VAR_STR, (-1, 2)) | conala |
23612271-34 | a sequence of empty lists of length `n` | [[] for _ in range(n)] | [
"python.library.functions#range"
] | [[] for _ in range(VAR_STR)] | conala |
10592674-55 | update a list `l1` dictionaries with a key `count` and value from list `l2` | [dict(d, count=n) for d, n in zip(l1, l2)] | [
"python.library.functions#zip",
"python.library.stdtypes#dict"
] | [dict(d, VAR_STR=n) for d, n in zip(VAR_STR, VAR_STR)] | conala |
End of preview. Expand
in Dataset Viewer.
Dataset Summary
This is the re-split of CoNaLa dataset.
For each code snippet in the dev and test set, at least one function is held out from the training set.
This split aims at testing a code generation model's capacity in generating unseen functions
We further make sure that examples from the same StackOverflow post (same question_id
before -
) are in the same split.
Supported Tasks and Leaderboards
This dataset is used to evaluate code generations.
Languages
English - Python code.
Dataset Structure
dataset = load_dataset("neulab/docpromting-conala")
DatasetDict({
train: Dataset({
features: ['nl', 'cmd', 'question_id', 'cmd_name', 'oracle_man', 'canonical_cmd'],
num_rows: 2135
})
test: Dataset({
features: ['nl', 'cmd', 'question_id', 'cmd_name', 'oracle_man', 'canonical_cmd'],
num_rows: 543
})
validation: Dataset({
features: ['nl', 'cmd', 'question_id', 'cmd_name', 'oracle_man', 'canonical_cmd'],
num_rows: 201
})
})
})
code_docs = load_dataset("neulab/docprompting-conala", "docs")
DatasetDict({
train: Dataset({
features: ['doc_id', 'doc_content'],
num_rows: 34003
})
})
Data Fields
train/dev/test:
- nl: The natural language intent
- cmd: The reference code snippet
- question_id:
x-y
wherex
is the StackOverflow post ID - oracle_man: The
doc_id
of the functions used in the reference code snippet. The corresponding contents are indoc
split - canonical_cmd: The canonical version reference code snippet
docs:
- doc_id: the id of a doc
- doc_content: the content of the doc
Dataset Creation
The dataset was crawled from Stack Overflow, automatically filtered, then curated by annotators. For more details, please refer to the original paper
Citation Information
@article{zhou2022doccoder,
title={DocCoder: Generating Code by Retrieving and Reading Docs},
author={Zhou, Shuyan and Alon, Uri and Xu, Frank F and JIang, Zhengbao and Neubig, Graham},
journal={arXiv preprint arXiv:2207.05987},
year={2022}
}
- Downloads last month
- 228