File size: 11,383 Bytes
59000b7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 |
text,set,list,dict,hash,repr,yield
"def first_with_given_key(iterable, key=lambda a : a):
done = list()
for value in iterable:
if key(value) not in done:
done.append(key(value))
yield value",0,1,0,0,0,1
"def first_with_given_key(iterable, key=repr):
used_keys = {}
get_key = return_key(key)
for item in iterable:
item_key = get_key(item)
if item_key in used_keys.keys():
continue
try:
used_keys[hash(item_key)] = repr(item)
except TypeError:
used_keys[repr(item_key)] = repr(item)
yield item",0,0,1,1,1,1
"def first_with_given_key(iterable, key=lambda x: x):
keys = list()
itrbl = iter(iterable)
while not False:
try:
val = next(itrbl)
if key(val) not in keys:
yield val
keys.insert(-1, key(val))
except StopIteration:
break",0,1,0,0,0,1
"def first_with_given_key(iterable, key=repr):
used_keys = {}
uniq_keys = set()
get_key = return_key(key)
for i in iterable:
item_key = get_key(i)
if item_key not in used_keys.keys():
try:
uniq_keys.add(repr(i))
used_keys[hash(item_key)] = repr(i)
except TypeError:
used_keys[repr(item_key)] = repr(i)
yield i",0,0,1,1,1,1
"def first_with_given_key(iterable, key=lambda y: y):
it=iter(iterable)
li=list()
while not False:
try:
hodnota=next(it)
if key(hodnota) not in li:
yield hodnota
li.insert(-1,key(hodnota))
except StopIteration:
break",0,1,0,0,0,1
"def first_with_given_key(iterable, key=lambda x: x):
done=list()
for value in iterable:
if key(value) not in done:
yield value
done.insert(-1,key(value))",0,1,0,0,0,1
"def first_with_given_key(iterable, key=repr):
used_keys = {}
get_key = return_key(key)
for item in iterable:
item_key = get_key(item)
if item_key in used_keys.keys():
continue
try:
used_keys[hash(item_key)] = repr(item)
except TypeError:
used_keys[repr(item_key)] = repr(item)
yield item",0,0,1,1,1,1
"def first_with_given_key(iterable, key=lambda x: x):
it = iter(iterable)
keys = list()
while True:
try:
item = next(it)
if key(item) in keys:
continue
keys.insert(0, key(item))
yield item
except StopIteration:
break",0,1,0,0,0,1
"def first_with_given_key(iterable, key=repr):
get_key = set_key(key)
keys_arr = {}
for x in iterable:
key = get_key(x)
if key in keys_arr.keys():
continue
try:
keys_arr[hash(key)] = repr(x)
except TypeError:
keys_arr[repr(key)] = repr(x)
yield x",0,0,1,1,1,1
"def first_with_given_key(iterable, key=repr):
used_keys = {}
get_key = return_key(key)
for item in iterable:
item_key = get_key(item)
if item_key in used_keys.keys():
continue
try:
used_keys[hash(item_key)] = repr(item)
except TypeError:
used_keys[repr(item_key)] = repr(item)
yield item",0,0,1,1,1,1
"def first_with_given_key(i, key=lambda x: x):
key_tmp = []
for j in range(len(i)):
if (key(i[j]) not in key_tmp):
yield i[j]
key_tmp.append(key(i[j]))",0,1,0,0,0,1
"def first_with_given_key(iterable, key=lambda y: y):
hashed = list()
for value in iterable:
if repr(key(value)) not in hashed:
hashed.append(repr(key(value)))
yield value",0,1,0,1,1,1
"def first_with_given_key(iterable, key=repr):
keys_depleted = {}
key_retreive = return_key(key)
for item in iterable:
item_key = key_retreive(item)
if item_key not in keys_depleted.keys():
try:
keys_depleted[hash(item_key)] = repr(item)
except KeyError:
keys_depleted[repr(item_key)] = repr(item)
yield item",0,0,1,1,1,1
"def first_with_given_key(iterable, key=lambda val: val):
keys = []
for item in iterable:
if key(item) in keys:
pass
else:
keys.append(key(item))
yield item",0,1,0,0,0,1
"def first_with_given_key(iterable, key = lambda k: k):
seen = []
iterator = iter(iterable)
while True:
try:
value = next(iterator)
key_value = key(value)
if key_value not in seen:
seen.append(key_value)
yield value
except StopIteration:
return",0,1,0,0,0,1
"def first_with_given_key(iterable, key=lambda y: y):
done=list()
keys = set()
it=iter(iterable)
while not False:
try:
value=next(it)
if key(value) not in done:
yield value
done.insert(-1,key(value))
except StopIteration:
break",0,1,0,0,0,1
"def first_with_given_key(iterable, key=None):
key = repr if key == None else key
key_value = return_key(key)
already_used = {}
for item in iterable:
item_key = key_value(item)
if item_key in already_used.keys(): continue
try:
already_used[hash(item_key)] = repr(item)
except TypeError:
already_used[repr(item_key)] = repr(item)
yield item",0,0,1,1,1,1
"def first_with_given_key(iterable, key=repr):
get_key = get_key_l(key)
used_keys = []
for item in iterable:
key_item = get_key(item)
if key_item in used_keys:
continue
try:
used_keys.append(hash(key_item))
except TypeError:
used_keys.apppend(repr(key_item))
yield item",0,1,0,1,1,1
"def first_with_given_key(iterable, key = repr):
old_keys = {}
get_key = lam_key(key)
for iter in iterable:
iter_key = get_key(iter)
if iter_key in old_keys.keys():
continue
old_keys[iter_key] = key(iter)
yield iter",0,0,1,0,0,1
"def first_with_given_key(iterable, key=lambda x: x):
stored_key_values = []
for item in iterable:
if key(item) not in stored_key_values:
yield item
stored_key_values.append(key(item))",0,1,0,0,0,1
"def first_with_given_key(iterable, key=repr):
gimme_key = get_key(key)
keys = {}
for item in iterable:
item_key = gimme_key(item)
if (item_key not in keys.keys()):
keys[hash(item_key)] = repr(item)
yield item",0,0,1,1,1,1
"def first_with_given_key(iterable, key=lambda x: x):
keys_yielded = {}
for i in iterable:
k = repr(key(i))
if keys_yielded.get(k, None) is None:
keys_yielded[k] = k
yield i",0,0,1,0,1,1
"def first_with_given_key(iterable, key=lambda y: y):
result = list()
func_it = iter(iterable)
while True:
try:
value = next(func_it)
if key(value) not in result:
yield value
result.insert(-1, key(value))
except StopIteration:
break",0,1,0,0,0,1
"def first_with_given_key(iterable, key = lambda a: a):
added = []
for item in iterable:
rep = repr(key(item))
if not (rep in added):
added.append(rep)
yield item",0,1,0,0,1,1
"def first_with_given_key(iterable, key=lambda x: x):
values = []
unique_keys = []
it = iter(iterable)
while True:
try:
value = next(it)
except StopIteration:
break
if key(value) not in unique_keys:
values.append(value)
unique_keys.append(key(value))
return values",0,1,0,0,0,0
"def first_with_given_key(iterable, key=lambda item : item):
key_list = set()
it = iter(iterable)
while True:
try:
item = next(it)
value = key(item)
try:
value = hash(value)
except TypeError:
value = repr(value)
if value not in key_list:
key_list.add(value)
yield item
except StopIteration:
break",1,0,0,1,1,1
"def first_with_given_key(iterable, key=lambda x: x):
finish = set()
iterator = iter(iterable)
while True:
try:
iterator_value = next(iterator)
size = len(finish)
finish.add(key(iterator_value))
if size != len(finish):
yield iterator_value
except StopIteration:
break",1,0,0,0,0,1
"def first_with_given_key(iterable, key=lambda a: a):
appeared = set()
for item in iterable:
keyed = repr(key(item))
if keyed not in appeared:
appeared.add(keyed)
yield item",1,0,0,0,1,1
"def first_with_given_key(iterable, key=lambda a: a):
appeared = set()
my_list = list()
for item in iterable:
keyed = repr(key(item))
if keyed not in appeared:
appeared.add(keyed)
yield item",1,0,0,0,1,1
"def first_with_given_key(iterable, key=lambda a: a):
appeared = set()
for item in iterable:
keyed = repr(key(item))
if keyed not in appeared:
appeared.add(keyed)
yield item",1,0,0,0,1,1
"def first_with_given_key(iterable, key=repr):
res = []
keys = set()
for item in iterable:
if key(item) not in keys:
keys.add(key(item))
return res",1,0,0,0,0,0
"def first_with_given_key(iterable, key=None):
key = key or (lambda x: x)
keys_found = set()
for item in iterable:
item_key = key(item)
item_key = item_key if item_key.__hash__ is not None else repr(item_key)
if item_key not in keys_found:
keys_found.add(item_key)
yield item",1,0,0,0,1,1
"def first_with_given_key(iterable, key=lambda f:f):
myiter = (i for i in iterable)
save = set()
while 1:
try:
element = next(myiter)
if hash(key(repr(element))) not in save:
save.add((hash(key(repr(element)))))
yield element
except StopIteration:
break",1,0,0,1,1,1
"def first_with_given_key(iterable, key=repr):
set_of_keys = set()
key_lambda = _get_lambda(key)
for item in iterable:
key = key_lambda(item)
try:
key_to_set = hash(key)
except TypeError:
key_to_set = repr(key)
if key_to_set in set_of_keys:
continue
set_of_keys.add(key_to_set)
yield item",1,0,0,1,1,1
"def first_with_given_key(iterable, key=repr):
found_keys = set()
lambda_func = lambda x: key(x)
for item in iterable:
key_of_item = lambda_func(item)
try:
new_key = hash(key_of_item)
except TypeError:
new_key = repr(key_of_item)
if new_key in found_keys:
continue
found_keys.add(new_key)
yield item",1,0,0,1,1,1
"def first_with_given_key(iterable, key=lambda x : x):
keys=set()
for obj in iterable:
key_res=repr(key(obj))
if key_res not in keys:
keys.add(key_res)
yield obj",1,0,0,0,1,1 |