Hackfut Security File Manager
Current Path:
/opt/alt/python27/lib64/python2.7/site-packages/guppy/etc
opt
/
alt
/
python27
/
lib64
/
python2.7
/
site-packages
/
guppy
/
etc
/
📁
..
📄
Cat.py
(3.31 KB)
📄
Cat.pyc
(6.63 KB)
📄
Cat.pyo
(6.63 KB)
📄
Code.py
(1.09 KB)
📄
Code.pyc
(1.53 KB)
📄
Code.pyo
(1.53 KB)
📄
Compat.py
(922 B)
📄
Compat.pyc
(1.11 KB)
📄
Compat.pyo
(1.11 KB)
📄
ExecfileWithModuleInfo.py
(1.71 KB)
📄
ExecfileWithModuleInfo.pyc
(2.62 KB)
📄
ExecfileWithModuleInfo.pyo
(2.62 KB)
📄
FSA.py
(4.92 KB)
📄
FSA.pyc
(7.35 KB)
📄
FSA.pyo
(7.35 KB)
📄
Glue.py
(10.84 KB)
📄
Glue.pyc
(14.6 KB)
📄
Glue.pyo
(14.57 KB)
📄
Help.py
(7.39 KB)
📄
Help.pyc
(9.76 KB)
📄
Help.pyo
(9.71 KB)
📄
IterPermute.py
(1.79 KB)
📄
IterPermute.pyc
(2.65 KB)
📄
IterPermute.pyo
(2.22 KB)
📄
KanExtension.py
(16.47 KB)
📄
KanExtension.pyc
(24.4 KB)
📄
KanExtension.pyo
(24.3 KB)
📄
KnuthBendix.py
(7.58 KB)
📄
KnuthBendix.pyc
(10.37 KB)
📄
KnuthBendix.pyo
(9.7 KB)
📄
OutputHandling.py
(6.68 KB)
📄
OutputHandling.pyc
(13.06 KB)
📄
OutputHandling.pyo
(13.06 KB)
📄
RE.py
(18.49 KB)
📄
RE.pyc
(32.58 KB)
📄
RE.pyo
(32.53 KB)
📄
RE_Rect.py
(8.47 KB)
📄
RE_Rect.pyc
(11.5 KB)
📄
RE_Rect.pyo
(11.41 KB)
📄
Unpack.py
(1.9 KB)
📄
Unpack.pyc
(2.91 KB)
📄
Unpack.pyo
(2.91 KB)
📄
__init__.py
(163 B)
📄
__init__.pyc
(791 B)
📄
__init__.pyo
(791 B)
📄
cmd.py
(14.66 KB)
📄
cmd.pyc
(14.43 KB)
📄
cmd.pyo
(14.43 KB)
📄
etc.py
(1.4 KB)
📄
etc.pyc
(2.14 KB)
📄
etc.pyo
(2.14 KB)
📄
textView.py
(3.04 KB)
📄
textView.pyc
(3.46 KB)
📄
textView.pyo
(3.46 KB)
📄
tkcursors.py
(1.57 KB)
📄
tkcursors.pyc
(2.39 KB)
📄
tkcursors.pyo
(2.39 KB)
📄
xterm.py
(2.03 KB)
📄
xterm.pyc
(2.29 KB)
📄
xterm.pyo
(2.29 KB)
Editing: IterPermute.py
#._cv_part guppy.etc.IterPermute def iterpermute(*args): args = [iter(a) for a in args] la = len(args) stopped = [0] * la lens = [0] * la bufs = [[] for i in range(la)] nexts = [None] * la n = 0 while 1: anynew = 0 for i in range(la): if stopped[i]: next = bufs[i][n%lens[i]] else: try: next = args[i].next() except StopIteration: if lens[i] == 0: # raise ValueError, 'The iterator passed in arg %d did not return any item'%i return stopped[i] = 1 next = bufs[i][n%lens[i]] else: anynew = 1 bufs[i].append(next) lens[i] += 1 nexts[i] = next if anynew: n += 1 yield tuple(nexts) else: break wanted = reduce(lambda x, y: x*y, lens, 1) if n >= wanted: assert n == wanted return ixs = list(enumerate(lens)) ixs.sort(lambda (ixa, lna), (ixb, lnb) : cmp(lna, lnb)) ixs = [ix for (ix,ln) in ixs] jxs = [0] * la seen = dict([(tuple([j%lens[i] for i in ixs]), 1) for j in range(n)]) while n < wanted: t = tuple([jxs[i] for i in ixs]) if t not in seen: yield tuple([bufs[i][jxs[i]] for i in range(la)]) n += 1 for i in ixs: j = jxs[i] j = (j + 1)%lens[i] jxs[i] = j if j != 0: break def test_iterpermute(): import itertools repeat = itertools.repeat assert list(iterpermute()) == [()] assert list(iterpermute(repeat(1, 2))) == [(1,), (1,)] assert list(iterpermute(repeat(1, 1), repeat(2, 1))) == [(1,2)] assert list(iterpermute(range(0,2), range(2,3))) == [(0, 2), (1, 2)] assert list(iterpermute(range(0,2), range(2,4))) == [(0, 2), (1, 3), (1, 2), (0, 3)] print list(iterpermute(range(0,2), range(0,3))) print list(iterpermute(range(0,3), range(0,2))) if __name__ == '__main__': test_iterpermute()
Upload File
Create Folder