swh:1:snp:a422b851e16cc4f1262b8bf03a4a48e024193f52
Tip revision: b6c17f583ee932f769c00939ab7f6b4cb6344cf0 authored by Dirk Roorda on 06 December 2016, 17:35:06 UTC
New minor release 1.0.1
New minor release 1.0.1
Tip revision: b6c17f5
layer.py
class Layer(object):
def __init__(self, api):
self.api = api
def u(self, n, otype=None):
Fotype = self.api.F.otype
levUp = self.api.C.levUp.data
if otype == None:
return levUp[n]
else:
return tuple(m for m in levUp[n] if Fotype.v(m) == otype)
def d(self, n, otype=None):
Fotype = self.api.F.otype
Eoslots = self.api.E.oslots
Crank = self.api.C.rank.data
levDown = self.api.C.levDown.data
slotType = Fotype.slotType
maxSlot = Fotype.maxSlot
if n < maxSlot+1: return tuple()
if otype == None:
return sorted(
levDown[n-maxSlot-1]+Eoslots.s(n),
key=lambda n: Crank[n],
)
elif otype == slotType:
return sorted(
Eoslots.s(n),
key=lambda n: Crank[n],
)
else:
return tuple(m for m in levDown[n-maxSlot-1] if Fotype.v(m) == otype)