sentence
stringclasses
28 values
label
int64
0
2
def first_with_given_key(iterable, key=lambda x: x):\n keys_in_list = []\n for it in iterable:\n if key(it) not in keys_in_list:\n keys_in_list.append(key(it))\n yield it
0
def first_with_given_key(iterable, key=lambda value: value):\n it = iter(iterable)\n saved_keys = []\n while True:\n try:\n value = next(it)\n if key(value) not in saved_keys:\n saved_keys.append(key(value))\n yield value\n except StopIteration:\n break
0
def first_with_given_key(iterable, key=None):\n if key is None:\n key = lambda x: x\n item_list = []\n key_set = set()\n for item in iterable:\n generated_item = key(item)\n if generated_item not in item_list:\n item_list.append(generated_item)\n yield item
0
def first_with_given_key(iterable, key=lambda k: k):\n used = []\n it = iter(iterable)\n while True:\n try:\n val = next(it)\n if key(val) not in used:\n yield val\n used.append(key(val))\n except StopIteration:\n break
0
def first_with_given_key(iterable, key=None):\n result, existing = [], []\n for x in iterable:\n if x not in result and (not key or not key(x) in existing):\n if key:\n existing.append(key(x))\n result.append(x)\n return result
0
def first_with_given_key(iterable, key=lambda value: value):\n it = iter(iterable)\n saved_keys = []\n while True:\n try:\n value = next(it)\n if key(value) not in saved_keys:\n saved_keys.append(key(value))\n yield value\n except StopIteration:\n break
0
def first_with_given_key(iterable, key=None):\n if key is None:\n key = id\n d = []\n for val in iterable:\n hashed_val = hash(key(val))\n val_key = key(val)\n if val_key not in d:\n d.append(val_key)\n yield val
0
def first_with_given_key(iterable, key=None):\n if key is None:\n key = id\n d = []\n for val in iterable:\n val_key = key(val)\n if val_key not in d:\n d.append(val_key)\n yield val
0
def first_with_given_key(iterable, key=lambda x: x):\n keys=[]\n for i in iterable:\n if key(i) not in keys:\n yield i\n keys.append(key(i))
0
def first_with_given_key(iterable, key=lambda y: y):\n done=list() \n it=iter(iterable) \n while not False: \n try:\n val=next(it) \n if key(val) not in done: \n yield val \n done.insert(-1,key(val)) \n except StopIteration: \n break
0
def first_with_given_key(iterable, key=lambda x: x):\n keys = []\n for i in iterable:\n try:\n val = hash(key(i))\n except TypeError:\n val = repr(key(i))\n if val in keys:\n continue\n keys.append(val)\n yield i
0
def first_with_given_key(the_iterable, key=lambda x: x):\n temp_keys=[]\n for i in range(len(the_iterable)):\n if (key(the_iterable[i]) not in temp_keys):\n temp_keys.append(key(the_iterable[i]))\n yield the_iterable[i]\n del temp_keys
0
def first_with_given_key(iterable, key = lambda x: x):\n tmp=[]\n for i in range(len(iterable)):\n if (key(iterable[i]) not in tmp):\n yield iterable[i]\n tmp.append(key(iterable[i]))\n del tmp
0
def first_with_given_key(iterable, key=repr):\n prev_keys = {}\n lamb_key = lambda item: key(item)\n for obj in iterable:\n obj_key = lamb_key(obj)\n if(obj_key) in prev_keys.keys():\n continue\n try:\n prev_keys[hash(obj_key)] = repr(obj)\n except TypeError:\n prev_keys[repr(obj_key)] = repr(obj)\n yield obj
2
def first_with_given_key(iterable, key=repr):\n used_keys = dict()\n get_key = lambda index: key(index)\n for index in iterable:\n index_key = get_key(index)\n if index_key in used_keys.keys():\n continue\n try:\n used_keys[hash(index_key)] = repr(index)\n except TypeError:\n used_keys[repr(index_key)] = repr(index)\n yield index
2
def first_with_given_key(iterable, key=lambda x: x):\n keys_used = {}\n for item in iterable:\n rp = repr(key(item))\n if rp not in keys_used.keys():\n keys_used[rp] = repr(item)\n yield item
2
def first_with_given_key(iterable, key=repr):\n used_keys = dict()\n get_key = return_key(key)\n for index in iterable:\n index_key = get_key(index)\n if index_key in used_keys.keys():\n continue\n try:\n used_keys[hash(index_key)] = repr(index)\n except TypeError:\n used_keys[repr(index_key)] = repr(index)\n yield index
2
def first_with_given_key(iterable, key = lambda x: x):\n found_keys={}\n for i in iterable:\n if key(i) not in found_keys.keys():\n found_keys[key(i)]=i\n yield i
2
def first_with_given_key(iterable, key=repr):\n used_keys = {}\n get_key = return_key(key)\n for item in iterable:\n item_key = get_key(item)\n if item_key in used_keys.keys():\n continue\n try:\n used_keys[hash(item_key)] = repr(item)\n except TypeError:\n used_keys[repr(item_key)] = repr(item)\n yield item
2
def first_with_given_key(iterable, key=lambda x: x):\n gotkeys = {}\n for i in iterable:\n k = repr(key(i))\n if gotkeys.get(k, None) is None:\n gotkeys[k] = k\n yield i
2
def first_with_given_key(iterable, key = repr):\n first_items = {}\n for item in iterable:\n new_key = (lambda x, func: func(x))(item, key)\n if new_key in first_items:\n continue\n try:\n first_items[hash(new_key)] = repr(item)\n except TypeError:\n first_items[repr(new_key)] = repr(item)\n yield item
2
def first_with_given_key(lst, key = lambda x: x):\n res = set()\n for i in lst:\n if repr(key(i)) not in res:\n res.add(repr(key(i)))\n yield i
1
def first_with_given_key(iterable, key=repr):\n set_of_keys = set()\n lambda_key = (lambda x: key(x))\n for item in iterable:\n key = lambda_key(item)\n try:\n key_for_set = hash(key)\n except TypeError:\n key_for_set = repr(key)\n if key_for_set in set_of_keys:\n continue\n set_of_keys.add(key_for_set)\n yield item
1
def first_with_given_key(iterable, key=None):\n if key is None:\n key = identity\n appeared_keys = set()\n for item in iterable:\n generated_key = key(item)\n if not generated_key.__hash__:\n generated_key = repr(generated_key)\n if generated_key not in appeared_keys:\n appeared_keys.add(generated_key)\n yield item
1
def first_with_given_key(iterable, key=repr):\n found_keys = set()\n lambda_func = lambda x: key(x)\n for item in iterable:\n key_of_item = lambda_func(item)\n try:\n new_key = hash(key_of_item)\n except TypeError:\n new_key = repr(key_of_item)\n if new_key in found_keys:\n continue\n found_keys.add(new_key)\n yield item
1
def first_with_given_key(iterable, key=repr):\n keys = {}\n found_keys = set()\n lambda_func = lambda x: key(x)\n for item in iterable:\n key_of_item = lambda_func(item)\n try:\n new_key = hash(key_of_item)\n except TypeError:\n new_key = repr(key_of_item)\n if new_key in found_keys:\n continue\n found_keys.add(new_key)\n yield item
1
def first_with_given_key(iterable, key=lambda item: item):\n returned_keys = set()\n for item in iterable:\n key_val = key(item)\n if key_val not in returned_keys:\n try:\n returned_keys.add(key_val)\n except TypeError:\n returned_keys.add(repr(key_val))\n yield item
1
def first_with_given_key(iterable, key=lambda item: item):\n returned_keys = set()\n used = list()\n for item in iterable:\n key_val = key(item)\n if key_val not in returned_keys:\n try:\n returned_keys.add(key_val)\n except TypeError:\n returned_keys.add(repr(key_val))\n yield item
1
def first_with_given_key(iterable, key = lambda x: x):\n cache = set()\n for iteration_obj in iterable:\n iteration_key = key(iteration_obj)\n if iteration_key not in cache:\n cache.add(iteration_key)\n yield iteration_obj
1
README.md exists but content is empty. Use the Edit dataset card button to edit it.
Downloads last month
38
Edit dataset card

Models trained or fine-tuned on hojzas/proj8-lab2