3 __doc__=
"Level 1 specific configuration for L1 Run 3"
5 from .Limits
import Limits
6 from collections.abc
import Iterable
11 this is to support the old functionality of calling and setting statusOn for flags
20 return self.
name in self.
cls.statusOn
23 self.
cls.statusOn.add(self.
name)
25 self.
cls.statusOn.remove(self.
name)
30 def __init__( self, val_type, val_default = None, val_check = None, action = None ):
40 "CTPVersion" :
FlagArgs( int, 4, val_check =
lambda x: x
in range(5), action =
lambda x: Limits.setLimits(x) ),
41 "BunchGroupPartitioning" :
FlagArgs( Iterable, val_check =
lambda x: len(
list(
filter(
lambda y: y
not in range(16), x)))==0 ),
42 "BunchGroupNames" :
FlagArgs( Iterable, val_check =
lambda x: len(
list(
filter(
lambda y:
not isinstance(y, str), x)))==0),
43 "items" :
FlagArgs( Iterable, val_check =
lambda x: len(
list(
filter(
lambda y:
not isinstance(y, str), x)))==0),
45 "legacyBoards" :
FlagArgs( dict, dict() ),
46 "prescales" :
FlagArgs( dict, dict() ),
47 "RemapThresholdsAsListed" :
FlagArgs( bool,
False ),
48 "CtpIdMap" :
FlagArgs( dict, dict() ),
49 "ThresholdMap" :
FlagArgs( dict, dict() ),
50 "ItemMap" :
FlagArgs( dict, dict() ),
55 object.__setattr__(self, attr, value)
56 d = L1MenuFlagsCont.__slots__[attr]
58 if not isinstance(value, d.val_type):
59 raise TypeError(
"L1MenuFlags.%s type check failed for %r. Type needs to be '%s'" % ( attr, value, d.valtype.__name__))
61 if d.val_check
and not d.val_check(value):
62 raise ValueError(
"L1MenuFlags.%s value check failed for %r" % ( attr, value))
66 L1MenuFlagsCont.statusOn.add(attr)
69 if attr
in L1MenuFlagsCont.__slots__:
71 object.__getattribute__(self,attr)
72 except AttributeError:
73 if L1MenuFlagsCont.__slots__[attr].val_default
is not None:
74 object.__setattr__(self, attr, L1MenuFlagsCont.__slots__[attr].val_default)
75 return FlagWrapper(attr, object.__getattribute__(self,attr), L1MenuFlagsCont)
77 return object.__getattribute__(self,attr)