neulab/odex huggingface dataset:
# Распарсить ini-файл `filepath` в словарь `res`
def f_127208(filepath):
	with open(filepath, 'r') as f:

		lines = [i for i in f.readlines() if not i.startswith('[')]

		p = re.compile('(?P<key>\S*(?==))\S*(?P<znah>(?<==)\S*)')

		res = {}

		for line in lines:

			parsed = re.findall(p, line)[0]

			res[parsed[0]] = parsed[1]

	return res

import re 

def check(candidate):
    filepath = "sample.ini"
    lines = [
        "[[config]]", "controlPort=8900", "idleTimeout=20", 
        "[[admin]]", "login=petrovich", "email=petrovich@zavod.ru", "password=secret"
    ]
    with open(filepath, 'w') as fw:
        for line in lines: fw.write(line + '\n')
    assert candidate(filepath) == {'controlPort': '8900', 
                                   'idleTimeout': '20',
                                   'login': 'petrovich',
                                   'email': 'petrovich@zavod.ru',
                                   'password': 'secret'}

    filepath = "test.ini"
    lines = [
        "[[config]]", "controlPort=8080", "idleTimeout=100", 
        "[[admin]]", "login=admin", "email=admin@email.ru", "password=secret"
    ]
    with open(filepath, 'w') as fw:
        for line in lines: fw.write(line + '\n')
    assert candidate(filepath) == {'controlPort': '8080', 
                                   'idleTimeout': '100',
                                   'login': 'admin',
                                   'email': 'admin@email.ru',
                                   'password': 'secret'}
# Прочитать список чисел `nums` из файла `filepath`
def f_316488(filepath):
	with open(filepath) as f:

		nums = list(map(int, f.read().split()))

	return nums

def check(candidate):
    with open('test.txt', 'w') as fw:
        for s in ['1', '2', '3', '4']:
            fw.write(s + '\n')

    lines = candidate('test.txt')
    assert isinstance(lines, list)

    with open('test.txt', 'w') as fw:
        for s in ['1', '2', '3', '4']:
            fw.write(s + '\n')

    lines = candidate('test.txt')
    assert lines[0] == 1

    with open('test.txt', 'w') as fw:
        for s in ['1', '2', '3', '4']:
            fw.write(s + '\n')

    lines = candidate('test.txt')
    assert len(lines) == 4
# Отправить POST-запрос `res` c JSON данными `data` на `url`
def f_77855(url, data):
	res = requests.post(url, json=data)
	return res

import requests

def check(candidate):
    data = {'key': 'value'}
    url = "http://ptsv2.com/t/6ju5j-1661859736/post"
    res = candidate(url, data)
    assert res.url == url
    assert res.text == "Thank you for this dump. I hope you have a lovely day!"
    assert res.request.body == b'{"key": "value"}'
# Вывести двумерный массив `arrs` на экран
def f_25811(arrs):
	for a in arrs:

		print(a)

	return 

import sys
from io import StringIO

def check(candidate):
    stdout = sys.stdout
    s = StringIO()
    sys.stdout = s
    arrs = [[1,2,3], [4,5,6]]
    candidate(arrs)
    sys.stdout = stdout    
    s.seek(0)
    assert len(s.read()) == 20

    stdout = sys.stdout
    s = StringIO()
    sys.stdout = s
    arrs = [["H", "W"], ["A", "B", "C"]]
    candidate(arrs)
    sys.stdout = stdout    
    s.seek(0)
    assert len(s.read()) == 27
# Вывести двумерный массив `arrs` на экран
def f_25811(arrs):
	
	for a in arrs:
		for i in a:
			print(i, end=" ")
	print()

	return 

import sys
from io import StringIO

def check(candidate):
    stdout = sys.stdout
    s = StringIO()
    sys.stdout = s
    arrs = [[1,2,3], [4,5,6]]
    candidate(arrs)
    sys.stdout = stdout    
    s.seek(0)
    assert len(s.read()) == 13

    stdout = sys.stdout
    s = StringIO()
    sys.stdout = s
    arrs = [["H", "W"], ["A", "B", "C"]]
    candidate(arrs)
    sys.stdout = stdout    
    s.seek(0)
    assert len(s.read()) == 11
# Получить случайное числа `num` в интервале от числа `num_start` до числа `num_end`
def f_54032(num_start, num_end):
	num = random.randint(num_start, num_end)
	return num

import random

def check(candidate):
    random_res = candidate(10, 20)
    assert random_res >= 10 and random_res <= 20

    random_res = candidate(15, 30)
    assert random_res >= 15 and random_res <= 30
# Перемешать список `l` сохранив исходные индексы `indices`
def f_71878(l):
	x = list(enumerate(l))

	random.shuffle(x)

	indices, l = zip(*x)

	return indices, l

import random

def check(candidate):
    l = [1,2,3,4,5]
    indices, res = candidate(l)
    assert set(res) == set(l)
    assert set(indices) == set([0,1,2,3,4])

    l = ["a","b","c","d","e"]
    indices, res = candidate(l)
    assert set(res) == set(l)
    assert set(indices) == set([0,1,2,3,4])
# Сгененировать `n` случайных чисел `nums`, сумма которых равна `total`
def f_197093(n, total):
	my_total = -1

	while my_total != total:

		nums = [random.randint(0,total) for _ in range(n)]

		my_total = sum(nums)

	return nums

import random 

def check(candidate):
    nums = candidate(2, 10) 
    assert len(nums) == 2 and sum(nums) == 10

    nums = candidate(3, 10) 
    assert len(nums) == 3 and sum(nums) == 10
# Создать объект класса `my_obj` по названию в строке `class_name`
def f_295537(class_name):
	my_obj = globals()[class_name]
	return my_obj

import random 

def check(candidate):
    class_name = random.sample(globals().keys(), 1)[0]
    assert candidate(class_name).__class__ == globals()[class_name].__class__
# Преобразовать кортеж кортежей пар ключ-значение `tupels` в словарь `my_dict`
def f_240287(tupels):
	my_dict = dict(tupels)
	return my_dict

def check(candidate):
    tupels = ((0,0),(1,1),(2,2),(100,99))
    assert candidate(tupels) == {0:0, 1:1, 2:2, 100:99}

    tupels = ((0,0),(1,1),(2,2),(1,99))
    assert candidate(tupels) == {0:0, 1:99, 2:2}

    tupels = ((0,0),(1,1),(2,2),(80,None))
    assert candidate(tupels) == {0:0, 1:1, 2:2, 80: None}
# Получить ссылку `url` из BBCode строки `s`
def f_26594(s):
	url = re.findall(r"\[url=(.*)\]", s)[0]
	return url

import re 

def check(candidate):
    s = "[url=http://forum.sibnet.ru/index.php?showuser=xxxxx]"
    assert candidate(s) == "http://forum.sibnet.ru/index.php?showuser=xxxxx"
# Вставить строку `s` после подстроки выделенной регулрным выражением `pattern` в строке `text`
def f_262974(pattern, s, text):
	return re.sub(pattern, r'{}'.format(s), text) 

import re

def check(candidate):
    text= 'Заголовок заголовок заголовок \n Слово слово слово слово слово слово слово.'
    res = '\x01\n Слово слово слово слово слово слово слово.'
    pattern = "^([А-Я]{1}.{,30}\n)"
    assert candidate(pattern, '\1\n', text) == res
# Спарсить HTML-код страницы `code` по ссылке `url`
def f_178993(url):
	with urllib.request.urlopen(url) as res:
	    code = res.read()
	return code

import urllib.request

def check(candidate):
    f = urllib.request.urlopen('http://www.python.org/')
    res = f.read()
    assert candidate('http://www.python.org/') == res
# Вывести число `num` с точностю до `f` знаков
def f_50259(num, f):
	return "{:.{}f}".format(num, f)

def check(candidate):
    assert candidate(500, 2) == '500.00'
# Вывести элементы списков `a1`и `a2` попарно
def f_27963(a1, a2):
	for a in zip(a1, a2):

		print(*a)

	return 

import sys
import io

def check(candidate):
    a1 = [1, 2, 3]
    a2 = [4, 5, 6]
    capturedOutput = io.StringIO() 
    sys.stdout = capturedOutput 
    candidate(a1, a2)
    sys.stdout = sys.__stdout__
    assert capturedOutput.getvalue() == '1 4\n2 5\n3 6\n'
# Найти самое близкое число `n` к числу `target_num` в списке `nums`
def f_61709(nums, target_num):
	delta_nums = [abs(target_num - i) for i in nums]
	num = nums[delta_nums.index(min(delta_nums))]
	return num

def check(candidate):
    assert candidate([34, 65, 95, 37, 573], 84) == 95
# Провериь права на чтение файла `filepath`
def f_111347(filepath):
	return os.access(filepath, os.R_OK)

import os
from unittest.mock import Mock

def check(candidate):
    filepath= '/'
    os.access = Mock(return_value = True)
    assert candidate(filepath) == True

    filepath= '/'
    os.access = Mock(return_value = False)
    assert candidate(filepath) == False
# Распарсить html строку `html` в дерево `root`
def f_37423(html):
	root = etree.HTML(html)
	return root

from lxml import etree

def check(candidate):
    assert etree.tostring(candidate('<p>data</p>')) == b'<html><body><p>data</p></body></html>'
# Скачать файл с сайта `url` показывая прогрессбар
def f_93346(url):
	
	with urllib.request.urlopen(url) as Response:
		Length = Response.getheader('content-length')
		BlockSize = 1000000  # default value

		if Length: 
			Length = int(Length)
			BlockSize = max(4096, Length // 20)
		print("UrlLib len, blocksize: ", Length, BlockSize)
        
		BufferAll = io.BytesIO()
		Size = 0
		while True:
			BufferNow = Response.read(BlockSize)
			if not BufferNow:  break
			BufferAll.write(BufferNow)
			Size += len(BufferNow)
			if Length:
				Percent = int((Size / Length)*100)
				print('download: {Percent}% {Url}')
		print("Buffer All len:", len(BufferAll.getvalue()))

	return Response

import io
import urllib 

def check(candidate):
    response = candidate('https://en.wikipedia.org/wiki/Pratap_Singh_(Raja_of_Satara)')
    assert 'Response' in str(type(response))
# Удалить одинаковые словари из списка словарей `dicts`
def f_319702(dicts):
	dicts = [json.dumps(i) for i in dicts]

	dicts = [json.loads(i) for i in set(dicts)]

	return dicts

import json 

def check(candidate):
    dicts = [{'a': 1}, {"b": 2}, {"c": 3}, {"b": 2}, {"b": '2'}]
    assert sorted(candidate(dicts), key=lambda x: list(x.keys())[0]) ==         [{'a': 1}, {'b': 2}, {'b': '2'}, {'c': 3}]
# Распарсить параметры get запроса url `url` в словарь `query`
def f_151936(url):
	
	parsed_url = urlparse(url)
	query = parsed_url.query

	return query

from urllib.parse import urlparse

def check(candidate):
    assert candidate('https://reqres.in/api/users?page=2') == 'page=2'
# Переименовать файл `filepath` в файл `newfilepath`
def f_306957(filepath, newfilepath):
	os.replace(filepath, newfilepath)
	return 

import os
from unittest.mock import Mock

def check(candidate):
    os.replace = Mock()
    try:
        candidate('abc.txt', 'abc.csv')
        assert True
    except:
        assert False
# Найти пропущенные числа `nums`  в списке `a`
def f_249773(a):
	
	r = range(min(a), max(a) + 1)
	nums = sorted(list(set(r) - set(a)))

	return nums

def check(candidate):
    assert candidate([1, 3, 5]) == ([2, 4])
# Скомпилировать c++ файл `filepath`
def f_122711(filepath):
	return subprocess.check_output(['g++', filepath])

import subprocess
from unittest.mock import Mock

def check(candidate):
    samp_output = '1'
    subprocess.check_output = Mock(return_value = samp_output)
    assert candidate('a.cpp') == samp_output
# Проверить содержит ли строка `s` слова из строки `base_s`
def f_249444(s, base_s):
	return set(s.split()) & set(base_s.split())

def check(candidate):
    s = 'hello hi'
    base_s = 'hello God'
    assert len(candidate(s, base_s)) > 0

    s = 'hello hi'
    base_s = 'llo God'
    assert len(candidate(s, base_s)) == 0
# Посчитать строки в файле `filepath` в словарь line_counts
def f_210480(filepath):
	
	with open(filepath) as f:
		lines = f.readlines()
		line_counts = collections.Counter(lines)

	return line_counts

import collections

def check(candidate):
    lines = ['a\n', 'b\n', 'c\n']
    filepath = 'a.txt'
    with open (filepath, 'a') as f:
        for line in lines:
            f.write(line)
    
    line_counts = candidate(filepath)
    for i in range (0, len(lines)):
        assert line_counts[lines[0]] == 1
# Посчитать несобственный интеграл заданный функцией `f` от числа `n` до бесконечности
def f_51160(f, n):
	return sympy.integrate(f, (sympy.symbols('x'), n, sympy.oo))

import sympy

def check(candidate):
    x = sympy.symbols('x')
    f = ( x * x)
    n = 1
    assert  str(candidate(f, n)) == 'oo'
# Удалить из словаря `dict1` ключи которые есть в словаре `dict2`
def f_560(dict1, dict2):
	for key in dict2:

		if key in dict1:

			del dict1[key]

	return 

def check(candidate):
    x = {'a': 1, 'b': 2}
    y = {'b': 1, 'c': 2}
    candidate(x, y)
    assert x == {'a': 1}
# Создать файл `filepath` с кодировкой utf-8
def f_18892(filepath):
	return open(filepath,"w", encoding="utf-8")

def check(candidate):
    f = candidate("tmp.txt")
    assert f.encoding == "utf-8"
    assert f.name == "tmp.txt"

    f = candidate("sample_100.pkl")
    assert f.encoding == "utf-8"
    assert f.name == "sample_100.pkl"
# Запустить метод c именем `name` объекта `obj`
def f_242841(obj, name):
	return getattr(obj, name)()

def check(candidate):
    assert candidate("hello", "encode") == b'hello'

    assert candidate(100, "conjugate") == 100

    assert candidate([1,2,3], "sort") is None
# Заменить в строке `s` слова из списка `old_words` на слова в списке `new_words` 
def f_265219(s, old_data, new_data):
	
	word_dict = dict(zip(old_data, new_data))
	for word in word_dict:
		s = re.sub(r"\b{}\b".format(word), word_dict[word], s)

	return s

import re

def check(candidate):
    assert candidate("hello, world!", ["happy", "green"], ["angry", "yellow"]) == "hello, world!"

    assert candidate("hello, green!", ["happy", "green"], ["angry", "yellow"]) == "hello, yellow!"

    assert candidate("happy, yellow!", ["happy", "green"], ["angry", "yellow"]) == "angry, yellow!"
# Получить словарь заголовков `headers` с сайта `url`
def f_14314(url):
	
	response = urllib.request.urlopen(url)

	headers = response.headers

	return headers

import urllib

def check(candidate):
    assert str(candidate("https://www.google.com").__class__) == "<class 'http.client.HTTPMessage'>"
# Экранировать спецсимволы в строке `s`
def f_25915(s):
	return s.encode('unicode_escape')

def check(candidate):
    assert candidate("hello, world!") == b'hello, world!'

    assert candidate("") == b''
# Перебрать все возможные способы расположения знака `sign` в строке `s` как в битовом числе
def f_76183(sign, s):
	p = 1 << (len(s)-1)
	l = []
	for i in range(1, p):
		def rf(first, sec):
			c = first[0]
			s1 = sec
			if c & i > 0 :
				s1 = sign+s1
			return (c >> 1, first[1]+s1)
		l.append(functools.reduce(rf, s[1:], (p >> 1, s[0]))[1])
	return l

import functools

def check(candidate):
    assert candidate("-", "101") == ['10-1', '1-01', '1-0-1']

    assert candidate(".", "101") == ['10.1', '1.01', '1.0.1']