File tree Expand file tree Collapse file tree 1 file changed +16
-9
lines changed
graalpython/lib-graalpython Expand file tree Collapse file tree 1 file changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -304,18 +304,12 @@ def __repr__(self):
304
304
maxlen_repr = ', maxlen=%d' % (self .maxlen ,)
305
305
return 'deque(%s%s)' % (list_repr , maxlen_repr )
306
306
307
- def __compare__ (self , w_other , op ):
308
- if not isinstance (w_other , deque ):
307
+ def __compare__ (self , other , op ):
308
+ if not isinstance (other , deque ):
309
309
return NotImplemented
310
310
311
- def _next_or_none (_iter ):
312
- try :
313
- return next (_iter )
314
- except StopIteration :
315
- return None
316
-
317
311
it1 = iter (self )
318
- it2 = iter (w_other )
312
+ it2 = iter (other )
319
313
while True :
320
314
x1 = _next_or_none (it1 )
321
315
x2 = _next_or_none (it2 )
@@ -349,6 +343,12 @@ def _next_or_none(_iter):
349
343
return x1 >= x2
350
344
assert False , "bad value for op"
351
345
346
+ def __contains__ (self , item ):
347
+ for itm in self :
348
+ if itm == item :
349
+ return True
350
+ return False
351
+
352
352
def __lt__ (self , other ):
353
353
return self .__compare__ (other , 'lt' )
354
354
@@ -438,6 +438,13 @@ def maxlen(self):
438
438
return self ._maxlen
439
439
440
440
441
+ def _next_or_none (_iter ):
442
+ try :
443
+ return next (_iter )
444
+ except StopIteration :
445
+ return None
446
+
447
+
441
448
class _DequeIter (object ):
442
449
def __init__ (self , dq ):
443
450
self ._deque = dq
You can’t perform that action at this time.
0 commit comments