neulab/odex huggingface dataset:
# Прочитать файл `file_path` с кодировкой utf-8 в `data`
def f_33868(file_path):
	f = codecs.open(file_path, "r", "utf_8_sig" )
	data = f.read()
	f.close()
	return data

import io
import codecs

def check(candidate):
    with open('test.txt', 'w') as fw:
        fw.write('hello world!')
    assert candidate('test.txt') == 'hello world!'
# Прочитать файл `file_path` с кодировкой utf-8 в `data`
def f_33868(file_path):
	
	with io.open(file_path, encoding='utf-8') as f:
		data = f.read()

	return data

import io
import codecs

def check(candidate):
    with open('test.txt', 'w') as fw:
        fw.write('hello world!')
    assert candidate('test.txt') == 'hello world!'
# Удалить лишние пробелы из строки `s`
def f_248267(s):
	s = ' '.join(s.split())
	return s

def check(candidate):
    assert candidate("x    fe  a") == "x fe a"
# Перевести число `num` из системы числения `from_base` в систему счисления `to_base` 
def f_607802(num, from_base, to_base):
	n = int(str(num), from_base)

	alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"

	new_num = ""

	while n > 0:

		n, m = divmod(n, to_base)

		new_num += alphabet[m]

	num = new_num[::-1]
	return num

def check(candidate):
    assert candidate('AA16342F', 16, 8) == '25205432057'

    assert candidate('111', 2, 10) == '7'

    assert candidate(33, 10, 16) == '21'

    assert candidate(33333, 10, 20) == '436D'

    assert candidate(3333333, 10, 20) == '10GD6D'
# Проверить что число `num` целочисленное
def f_585259(num):
	return isinstance(num, int)

def check(candidate):
    assert candidate(1) == True

    assert candidate("1") == False

    assert candidate(123) == True

    assert candidate([1, 2, 3]) == False
# Очистить строку `s` от лишних символов
def f_446226(s):
	
	reg = re.compile('[^a-zA-Z ]')
	s = reg.sub('', s)

	return s

import re

def check(candidate):
    assert candidate('Hello!@#!%!#&&!*!#$#%@*+_{ world!') == 'Hello world'
# Очистить строку `s` от лишних символов
def f_446226(s):
	good_chars = (ascii_letters + whitespace).encode()

	junk_chars = bytearray(set(range(0x100)) - set(good_chars))

	s = s.encode('ascii', 'ignore').translate(None, junk_chars).decode()
	return s

from string import ascii_letters, whitespace 

def check(candidate):
    assert candidate('Hello!@#!%!#&&!*!#$#%@*+_{ world!') == 'Hello world'
# Прочитать построчно данные из файла `file_path` в список `my_list`
def f_542210(file_path):
	with open(file_path) as file:

		my_list = [row.strip() for row in file]
	return my_list

def check(candidate):
    file_path = 'a.txt'
    arr = ['abc', 'def']
    with open(file_path, 'w') as f:
        for i in range (0, len(arr)):
            f.write(arr[i]+'\n')
    my_list = candidate(file_path)
    for i in range (0, len(arr)):
        assert my_list[i] == arr[i]
# Прочитать построчно данные из файла `file_path` в список `my_list`
def f_542210(file_path):
	with open(file_path, 'r') as f:

		my_list = f.read().splitlines()

	return my_list

def check(candidate):
    file_path = 'a.txt'
    arr = ['abc', 'def']
    with open(file_path, 'w') as f:
        for i in range (0, len(arr)):
            f.write(arr[i]+'\n')
    my_list = candidate(file_path)
    for i in range (0, len(arr)):
        assert my_list[i] == arr[i]
# Прочитать построчно данные из файла `file_path` в список `my_list`
def f_542210(file_path):
	
	with io.open(file_path, encoding='utf-8') as f:
		my_list = f.read().splitlines()

	return my_list

import io

def check(candidate):
    file_path = 'a.txt'
    arr = ['abc', 'def']
    with open(file_path, 'w') as f:
        for i in range (0, len(arr)):
            f.write(arr[i]+'\n')
    my_list = candidate(file_path)
    for i in range (0, len(arr)):
        assert my_list[i] == arr[i]
# Скачать файл по ссылке `link` в `file_path`
def f_60925(link, file_path):
	with urllib.request.urlopen(link) as url:

		downloaded_file = url.read()

		with open(file_path, "wb") as f:

			f.write(downloaded_file)
	return 

import urllib 

def check(candidate):
    file_path = 'a.html'
    candidate('https://en.wikipedia.org/wiki/List_of_national_independence_days', file_path)
    with open(file_path, 'r') as f:
        lines = f.readlines()
        for line in lines:
            if 'Wikipedia' in line:
                assert True
# Найти слово `word` в файле `file_path`
def f_274131(file_path, word):
	return word in open(file_path,'r').read()

def check(candidate):
    file_path = 'a.txt'
    with open(file_path, 'w') as f:
        f.write("abc\ndef\nijk")
    assert candidate(file_path, 'abc') == True
    assert candidate(file_path, 'xyz') == False
# Преобразовать строку `s` в список слов `words` и отсортировать
def f_505115(s):
	words = s.split()
	words.sort()
	return words

def check(candidate):
    s = "The quick fox jumped upon a rat"
    assert candidate(s) == ['The', 'a', 'fox', 'jumped', 'quick', 'rat', 'upon']
# Получить символ `my_symbol` по его коду `char_code` 
def f_565252(char_code):
	my_symbol = chr(char_code)
	return my_symbol

def check(candidate):
    assert candidate(65) == 'A'

    assert candidate(67) == 'C'
# Открыть файл `file_path` для записи с кодировкой utf-8 в переменную f
def f_509576(file_path):
	with open(file_path, mode='a', encoding='utf-8') as f:

		pass
	return f

def check(candidate):
    assert str(type(candidate('a.txt'))) == "<class '_io.TextIOWrapper'>"
# Открыть файл `file_path` для записи с кодировкой utf-8 в переменную f
def f_509576(file_path):
	f = open(file_path,'a', encoding='utf-8')
	return f

def check(candidate):
    file_path = 'a.txt'
    f = candidate(file_path)
    f.write('abc')
    f.close()
    with open (file_path, 'r') as f1:
        lines = f1.readlines()
        assert lines[0] == 'abc'
# Добавить путь `my_path` для поиска модулей
def f_42621(my_path):
	sys.path.append(my_path)
	
	return 

import sys

def check(candidate):
    path = '/home/User/Desktop123/file.txt'
    candidate(path)
    assert path in sys.path
# Проверить есть ли слово `word` в строке `s`
def f_615741(word, s):
	return re.search(r"\b{}\b".format(word), s)

import re

def check(candidate):
    s = "hi my name is sarah and i am 5"
    assert candidate('sarah', s) is not None

    s = "hi my name is sarah and i am 5"
    assert candidate('hello', s) is None

    s = "hi my name is sarah and i am 5"
    assert candidate(5, s) is not None

    s = "hi my name is sarah and i am 5"
    assert candidate('5', s) is not None
# Проверить есть ли слово `word` в строке `s`
def f_615741(word, s):
	return word in s.split()

import re

def check(candidate):
    s = "hi my name is sarah and i am 5"
    assert candidate('sarah', s) == True

    s = "hi my name is sarah and i am 5"
    assert candidate('hello', s) == False

    s = "hi my name is sarah and i am 5"
    assert candidate(5, s) == False

    s = "hi my name is sarah and i am 5"
    assert candidate('5', s) == True
# Транспонировать матрицу `matrix` в матрицу `new_matrix`
def f_500957(matrix):
	new_matrix = matrix.transpose()
	return new_matrix

import numpy as np

def check(candidate):
    a = np.array([[0, 1, 2], [4, 5, 6]])
    resA = np.array([[0, 4], [1, 5], [2, 6]])
    assert np.array_equal(candidate(a), resA)

    b = np.array([['a', 'b', 'c'], ['d', 'e', 'f']])
    resB = np.array([['a', 'd'], ['b', 'e'], ['c', 'f']])
    assert np.array_equal(candidate(b), resB)
# Транспонировать матрицу `matrix` в матрицу `new_matrix`
def f_500957(matrix):
	new_matrix = matrix.T
	return new_matrix

import numpy as np

def check(candidate):
    a = np.array([[0, 1, 2], [4, 5, 6]])
    resA = np.array([[0, 4], [1, 5], [2, 6]])
    assert np.array_equal(candidate(a), resA)

    b = np.array([['a', 'b', 'c'], ['d', 'e', 'f']])
    resB = np.array([['a', 'd'], ['b', 'e'], ['c', 'f']])
    assert np.array_equal(candidate(b), resB)
# Транспонировать матрицу `matrix` в матрицу `new_matrix`
def f_500957(matrix):
	new_matrix = []

	for i in range(len(matrix[0])):

		new_matrix.append(list())

		for j in range(len(matrix)):

			new_matrix[i].append(matrix[j][i])

	return new_matrix

import numpy as np

def check(candidate):
    a = np.array([[0, 1, 2], [4, 5, 6]])
    resA = np.array([[0, 4], [1, 5], [2, 6]])
    assert np.array_equal(candidate(a), resA)

    b = np.array([['a', 'b', 'c'], ['d', 'e', 'f']])
    resB = np.array([['a', 'd'], ['b', 'e'], ['c', 'f']])
    assert np.array_equal(candidate(b), resB)
# Удалить из датафрейма `df` строки по условию `cond`
def f_786730(df, cond):
	df = df.loc[cond]
	return df

import pandas as pd

def check(candidate):
    data = [['abc', 50], ['def', 70], ['hij', 67]]
    df = pd.DataFrame(data, index = ['a', 'b', 'c'])
    assert candidate(df, 'c').to_dict() == {0: 'hij', 1: 67}
# Отсортировать словарь `my_dict` по ключам по возростанию
def f_528474(my_dict):
	return OrderedDict(sorted(my_dict.items(), key=lambda t: t[0]))

from collections import OrderedDict

def check(candidate):
    my_dict = {6 : "abc", 5 : "def", 1: "hij", 2 : "klm"}
    k = OrderedDict([(1, 'hij'), (2, 'klm'), (5, 'def'), (6, 'abc')])
    assert candidate(my_dict) == k
# Установить кодировку utf-8 для файла
def f_229015():
	## -*- coding: utf-8 -*-
	return 

def check(candidate):
    candidate()
    s = "Привет"
    assert s == "Привет"
# Открыть файл `file_path` для записи с кодировкой utf-8 в переменную f
def f_517085(file_path):
	with open(file_path, mode='a', encoding='utf-8') as f:

		pass
	return f

def check(candidate):
    file_path = 'opera.txt'
    f = candidate(file_path)
    assert f.name == file_path
    assert f.encoding == 'utf-8'
# Открыть файл `file_path` для записи с кодировкой utf-8 в переменную f
def f_517085(file_path):
	f = open(file_path,'a', encoding='utf-8')
	return f

def check(candidate):
    file_path = 'opera.txt'
    f = candidate(file_path)
    assert f.name == file_path
    assert f.encoding == 'utf-8'
# Отправить POST-запрос c JSON данными `data` на `url`
def f_690089(url, data):
	return requests.post(url, json=data)

import requests

def check(candidate):
    data_dict = {'name': 'dev', 'role': 'leader'}
    res = candidate('https://reqres.in/api/users', data_dict)
    assert res.url == 'https://reqres.in/api/users'
    for k, v in data_dict.items():
        assert res.json()[k] == v
# Вывести количество строк `count_lines` в файле `file_path`
def f_550742(file_path):
	count_lines = sum(1 for line in open(file_path, 'r'))
	return count_lines

def check(candidate):
    file_path = 'a.txt'
    with open(file_path, mode = 'a') as f:
        f.write('3\n4\n5\n')
    assert candidate(file_path) == 3
# Прочитать построчно данные из файла `file_path` в список `my_list`
def f_928295(file_path):
	with open(file_path) as file:

		my_list = [row.strip() for row in file]
	return my_list

def check(candidate):
    file_path = 'a.txt'
    with open(file_path, mode = 'a') as f:
        f.write('3\n4\n5\n')
    assert candidate(file_path) == ['3', '4', '5']
# Прочитать построчно данные из файла `file_path` в список `my_list`
def f_928295(file_path):
	with open(file_path, 'r') as f:

		my_list = f.read().splitlines()

	return my_list

def check(candidate):
    file_path = 'a.txt'
    with open(file_path, mode = 'a') as f:
        f.write('3\n4\n5\n')
    assert candidate(file_path) == ['3', '4', '5']
# Прочитать построчно данные из файла `file_path` в список `my_list`
def f_928295(file_path):
	
	with io.open(file_path, encoding='utf-8') as f:
		my_list = f.read().splitlines()

	return my_list

import io

def check(candidate):
    file_path = 'a.txt'
    with open(file_path, mode = 'a') as f:
        f.write('3\n4\n5\n')
    assert candidate(file_path) == ['3', '4', '5']
# Установить кодировку utf-8 для файла
def f_255207():
	## -*- coding: utf-8 -*-
	return 

def check(candidate):
    candidate()
    s = "Привет"
    assert s == "Привет"
# Удалить подстроку `sub_s`  из строки `s`
def f_777723(s, sub_s):
	return s.replace(sub_s, "")
	

def check(candidate):
    assert candidate("1;2;3;4;5", ";") == "12345"

    assert candidate("1 2 3 4 5", " ") == "12345"
# Удалить пустые элементы из списка `my_list`
def f_422461(my_list):
	my_list = [value for value in my_list if value]
	
	return my_list

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

    assert candidate(['1', '2', '', '3', '4', '5']) == ['1', '2', '3', '4', '5']
# Удалить пустые элементы из списка `my_list`
def f_422461(my_list):
	my_list = [value for value in my_list if value != [None]]
	
	return my_list

def check(candidate):
    assert candidate([1, 2, [None], 3, 4, 5]) == [1, 2, 3, 4, 5]
# Посчитать элементы в списке `my_list` в `list_value_counts`
def f_533108(my_list):
	list_value_counts = Counter(my_list)
	return list_value_counts

from collections import Counter

def check(candidate):
    my_list = [10, 10, 23, 10, 123, 66, 78, 123] 
    list_value_counts = {10: 3, 23: 1, 123: 2, 66: 1, 78: 1}

    assert candidate(my_list) == list_value_counts
# Посчитать элементы в списке `my_list` в `list_value_counts`
def f_533108(my_list):
	list_value_counts = {i: my_list.count(i) for i in my_list}
	return list_value_counts

def check(candidate):
    my_list = [10, 10, 23, 10, 123, 66, 78, 123] 
    list_value_counts = {10: 3, 23: 1, 123: 2, 66: 1, 78: 1}

    assert candidate(my_list) == list_value_counts
# Зашифровать строку `s` в строку `new_s` шифром Цезаря со сдвигом `shift`
def f_594690(s, shift):
	alpha = ' abcdefghijklmnopqrstuvwxyz'

	new_s = ''

	for c in s:

		new_s += alpha[(alpha.index(c) + shift) % len(alpha)]
	
	return new_s

def check(candidate):
    assert candidate('hello', 3) == 'khoor'

    assert candidate('world', 3) == 'zruog'
# Проверить является ли строка `s` палиндромом
def f_424441(s):
	return s == s[::-1]

def check(candidate):
    assert candidate('racecar') == True

    assert candidate('world') == False
# Проверить является ли строка `s` палиндромом
def f_424441(s):
	return s ==''.join([c for c in reversed(s)])

def check(candidate):
    assert candidate('racecar') == True

    assert candidate('world') == False
# Найти производную `d` функции `my_f`в точке `x`
def f_630116(my_f, x):
	d = derivative(my_f, x)
	return d

from scipy.misc import derivative

def check(candidate):
    def f(x):
        return x**3 + x**2
        
    assert candidate(f, 1.0) == 6.0
# Заменить символ с индексом `n` в строке `s` на `new_char`
def f_577060(s, n, new_char):
	s = s[:n] + new_char + s[n+1:]
	return s

def check(candidate):
    assert candidate("Hello, world!", 0, "y") == "yello, world!"
# Разбить строку `s` на список символов `chars`
def f_458373(s):
	chars = list(s)
	return chars

def check(candidate):
    assert candidate("Hello!") == ["H", "e", "l", "l", "o", "!"]
# Разбить строку `s` на список символов `chars`
def f_458373(s):
	chars = [c for c in s]
	return chars

def check(candidate):
    assert candidate("Hello!") == ["H", "e", "l", "l", "o", "!"]
# Удалить символ с индексом `i` из строки `s`
def f_879670(s, i):
	s = s[:i] + s[i+1:]
	return s

def check(candidate):
    assert candidate("Hello!", 0) == "ello!"

    assert candidate("Hello!", 2) == "Helo!"
# Объединить список словарей `dicts` с одинаковыми ключами в общий словарь `common_dict`
def f_119418(dicts):
	
	common_dict = {}
	for cur_dict in dicts:
		for key in cur_dict:
			if key not in common_dict:
				common_dict[key] = [cur_dict[key]]
				continue
			common_dict[key] += [cur_dict[key]]

	return common_dict

def check(candidate):
    assert candidate([{"key1": "value1"}, {"key2":"value2"}, {"key1":"value3", "key3": "value4"}]) ==         {'key1': ['value1', 'value3'], 'key2': ['value2'], 'key3': ['value4']}
# Подключить dll файл `filepath` в переменную `lib`
def f_60790(filepath):
	lib = CDLL(filepath)
	return lib

from ctypes import CDLL

def check(candidate):
    assert candidate("libc.so.6")._name == "libc.so.6"
# Получить cookie `cookies` с сайта `url`
def f_299217(url):
	
	session = requests.Session()
	response = session.get(url)
	cookies = session.cookies.get_dict()

	return cookies

import requests
from datetime import date

def check(candidate):
    today = date.today().strftime("%Y-%m-%d")
    assert candidate("http://google.com")['1P_JAR'].startswith(today)
# Получить спецификацию аргументов функции `f`
def f_65166(f):
	return  inspect.getargspec(f)

import inspect

def check(candidate):
    def f(x): return 2*x
    assert candidate(f) == inspect.ArgSpec(args=['x'], varargs=None, keywords=None, defaults=None)

    def g(x, y=2): return x*y
    assert candidate(g) == inspect.ArgSpec(args=['x', 'y'], varargs=None, keywords=None, defaults=(2,))
# Получить поток вывода данных консольной команды `cmd` в файловый объект `result`
def f_206151(cmd):
	result = os.popen(cmd, 'r', 1)
	return result

import os
from unittest.mock import Mock

def check(candidate):
    os.popen = Mock(return_value = True)
    assert candidate('python3') == True
# Преобразовать кортеж `my_tuple` в список
def f_118927(my_tuple):
	return list(my_tuple)

def check(candidate):
    assert candidate((1, 2, 3)) == [1, 2, 3]

    assert candidate((1, "222", 3)) == [1, "222", 3]
# Установить кодировку `my_encode` для переменных окружения пользователя `username`
def f_175425(username, my_encode):
	return os.environ(username).decode(my_encode)

import os
from unittest.mock import Mock

def check(candidate):
    os.environ = Mock(return_value = b'abc')
    assert candidate('username', 'utf-8') == 'abc'
# Присвоить переменной `my_var` результат работы функции `my_func`
def f_141157(my_func):
	my_var = my_func()
	return my_var

def check(candidate):
    def my_func(): return -1
    assert candidate(my_func) == -1
# Заменить пробелы в строке `my_string` на символ `my_symbol`
def f_209059(my_symbol, my_string):
	return re.sub(' +', my_symbol, my_string)

import re 

def check(candidate):
    assert candidate('?','abc def  jkl') == 'abc?def?jkl'
# Заменить список слов `old_words` на список слов `new_words` в строке `s`
def f_256777(old_words, new_words, s):
	
	words = dict(zip(old_words, new_words))
	for word in words:
		s = re.sub(r"{}".format(word), words[word], s)

	return s

import re 

def check(candidate):
    s = 'I do not love you anymore. I hate you and shall never pardon for this crime.'
    o = ['love', 'hate', 'pardon']
    n = ['like', 'detest', 'forgive']
    assert candidate(o, n, s) == 'I do not like you anymore. I detest you and shall never forgive for this crime.'
# Найти узел `node` равный значению `val` в бинарном дереве `tree`
def f_112581(tree, val):
	
	def search(root, key):
		if root is None or root.val == key:
			return root
		if root.val < key:
			return search(root.right,key)
		return search(root.left,key)
	node = search(tree, val)

	return node

class Node:
    def __init__(self, val):
        self.val = val
        self.left = None
        self.right = None

def check(candidate):
    root7 = Node(7)
    root3 = Node(3)
    root11 = Node(11)
    root4 = Node(4)
    root7.left = root3
    root7.right = root11
    root3.right = root4
    assert candidate(root7, 4) == root4
# Отсортировать элементы на главной диагонали квадратной матрицы `a` по убыванию
def f_186169(a):
	l = len(a)

	for k in range(l-1): 

		for i in range(l-1):

			if a[i][i] < a[i+1][i+1]:

				a[i][i],a[i+1][i+1] = a[i+1][i+1],a[i][i]

	return a

def check(candidate):
    a = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
    assert(candidate(a) == [[9, 2, 3], [4, 5, 6], [7, 8, 1]])

    b = [[1, 2, 3], [4, 5, 6]]
    assert(candidate(b) == [[5, 2, 3], [4, 1, 6]])
# Отсортировать элементы на главной диагонали квадратной матрицы `a` по убыванию
def f_186169(a):
	l = len(a)

	items = [a[i][i] for i in range(l)]

	items.sort(reverse=True)

	for i in range(l):

		a[i][i] = items[i]

	return a

def check(candidate):
    a = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
    assert(candidate(a) == [[9, 2, 3], [4, 5, 6], [7, 8, 1]])

    b = [[1, 2, 3], [4, 5, 6]]
    assert(candidate(b) == [[5, 2, 3], [4, 1, 6]])
# Экранировать спецсимволы в строке `s`
def f_298270(s):
	return s.encode('unicode_escape')

def check(candidate):
    assert candidate("hello") == b"hello"
# Получить элементы списка `my_list` удовлетворяющие функции `f`
def f_72284(my_list, f):
	return list(filter(f, my_list))

def check(candidate):
    def f(x): return x > 1
    assert candidate([1, 2, 3], f) == [2, 3]

    def g(x): return x%5
    assert candidate([1, 2, 3, 5], g) == [1, 2, 3]
# Отсортировать список словарей `dicts` по ключу `key`
def f_83341(dicts, key):
	dicts.sort(key=lambda x: x[key])
	return dicts

def check(candidate):
    dicts = [
        {'k1': 234, 'f4': 57e6, 'gp': 0}, 
        {'k1': 436, 'f4': 436, 'gp': 45}, 
        {'k1': -33234, 'f4': -2.5, 'gp': 0.0}
    ]
    assert candidate(dicts, 'k1') == [
        {'k1': -33234, 'f4': -2.5, 'gp': 0.0}, 
        {'k1': 234, 'f4': 57e6, 'gp': 0}, 
        {'k1': 436, 'f4': 436, 'gp': 45}, 
    ]
# Получить список нечетных строк `lines` файла `filepath` 
def f_30683(filepath):
	with open(filepath) as f:

		lines = f.readlines()[1::2]
	return lines

def check(candidate):
    filepath = "odd_lines.txt"
    with open(filepath, 'w') as fw: 
        for idx in range(10): fw.write(f"{idx}\n")
    assert candidate(filepath) == [f"{idx}\n" for idx in range(1,10,2)]

    filepath = "odd_lines.txt"
    with open(filepath, 'w') as fw: 
        for idx in range(20): 
            if (idx % 2) == 0: fw.write(f"{idx}\n")
            else: fw.write("\n")
    assert candidate(filepath) == ["\n" for _ in range(10)]
# Получить список нечетных строк `lines` файла `filepath` 
def f_30683(filepath):
	with open(filepath) as file:

		lines = [i.rstrip() for i in itertools.islice(file, 0, None, 2)]
	return lines

import itertools 

def check(candidate):
    filepath = "odd_lines.txt"
    with open(filepath, 'w') as fw: 
        for idx in range(10): fw.write(f"{idx}\n")
    assert candidate(filepath) == [f"{idx}" for idx in range(0,10,2)]

    filepath = "odd_lines.txt"
    with open(filepath, 'w') as fw: 
        for idx in range(20): 
            if idx % 2: fw.write(f"{idx}\n")
            else: fw.write("\n")
    assert candidate(filepath) == ["" for _ in range(10)]
# Преобразовать кириллическую строку `s` в строку спецсимволов для http запроса 
def f_241337(s):
	return urllib.parse.quote(s)

import urllib 

def check(candidate):
    s = "abc def/foo?bar=baz"
    assert candidate(s) == "abc%20def/foo%3Fbar%3Dbaz"
# Преобразовать кириллическую строку `s` в строку спецсимволов для http запроса 
def f_241337(s):
	return urllib.parse.quote_plus(s)

import urllib 

def check(candidate):
    s = "abc def/foo?bar=baz"
    assert candidate(s) == "abc+def%2Ffoo%3Fbar%3Dbaz"
# Сгенерировать открытый ключ `pub` и закрытый ключ `priv` для RSA шифрования
def f_64496():
	(pub, priv) = rsa.newkeys(512)
	return pub, priv

import rsa 

def check(candidate):
    pub, priv = candidate()
    assert pub.__class__ == rsa.key.PublicKey
    assert priv.__class__ == rsa.key.PrivateKey
# Проверить равно ли значение элемента словаря `my_dict` с ключом `key` значению в переменной `my_var`
def f_121512(my_dict, key, my_var):
	return my_dict[key]  ==  my_var

def check(candidate):
    dict1 = {1 : 'abc', 2 : 'def'}
    assert candidate(dict1, 1, 'abc')

    dict1 = {1 : 'abc', 2 : 'def'}
    assert candidate(dict1, 2, 'abc') == False
# Проверить является ли число `n` степенью 2
def f_316065(n):
	return (n & (n-1) == 0) and n != 0

def check(candidate):
   assert candidate(2) == True

   assert candidate(16) == True

   assert candidate(40) == False
# Спарсить HTML-код страницы `code` по ссылке `url`
def f_205664(url):
	with urllib.request.urlopen(url) as res:
	    code = res.read()
	return code

import urllib 

def check(candidate):
    assert 'Wikipedia' in str(candidate('https://www.wikipedia.org'))

    assert 'Google' in str(candidate('https://www.google.com'))
# Преобразовать массив строк `strings` в словарь `strings_dict` по разделителю `sep`
def f_300767(strings, sep):
	strings_dict = dict([x[0].strip().split(sep) for x in strings])
	return strings_dict

def check(candidate):
    strings = [["Hello=world!"], ["Hey=World!"], ["hi=world"]]
    sep = "="
    assert list(candidate(strings, sep).items()) == [("Hello","world!"), ("Hey","World!"), ("hi","world")]

    strings = [["Hello:1!"], ["Hey:2!"], ["hi:3"]]
    sep = ":"
    assert list(candidate(strings, sep).items()) == [("Hello","1!"), ("Hey","2!"), ("hi","3")]