Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def index(self, elem):
"""Find the index of elem in the range."""
if elem not in self._xrange: raise _coconut.ValueError(_coconut.repr(elem) + " is not in range")
start, _, step = self._xrange.__reduce_ex__(2)[1]
return (elem - start) // step
def __repr__(self):
def index(self, elem):
"""Find the index of elem in the count."""
if elem not in self:
raise _coconut.ValueError(_coconut.repr(elem) + " not in " + _coconut.repr(self))
return (elem - self.start) // self.step if self.step else 0
def __reversed__(self):
def __repr__(self):
return _coconut.repr(self._xrange)[1:]
@property
def __repr__(self):
return "map(%r, %s)" % (self.func, ", ".join((_coconut.repr(i) for i in self.iters)))
def __reduce__(self):
def __repr__(self):
args = []
for i in _coconut.range(self._arglen):
if i in self._argdict:
args.append(_coconut.repr(self._argdict[i]))
else:
args.append("?")
for arg in self._stargs:
args.append(_coconut.repr(arg))
return _coconut.repr(self.func) + "$(" + ", ".join(args) + ")"
def consume(iterable, keep_last=0):
def __repr__(self):
return _coconut.repr(self.func) + " " + " ".join(("..*> " if star else "..> ") + _coconut.repr(f) for f, star in self.funcstars)
def __reduce__(self):
def __repr__(self):
args = []
for i in _coconut.range(self._arglen):
if i in self._argdict:
args.append(_coconut.repr(self._argdict[i]))
else:
args.append("?")
for arg in self._stargs:
args.append(_coconut.repr(arg))
return _coconut.repr(self.func) + "$(" + ", ".join(args) + ")"
def consume(iterable, keep_last=0):
def __repr__(self):
args = []
for i in _coconut.range(self._arglen):
if i in self._argdict:
args.append(_coconut.repr(self._argdict[i]))
else:
args.append("?")
for arg in self._stargs:
args.append(_coconut.repr(arg))
return _coconut.repr(self.func) + "$(" + ", ".join(args) + ")"
def consume(iterable, keep_last=0):