Lines Matching refs:self

35     def __init__(self, name, desc, **kwargs):
36 self.name = name
37 self.desc = desc
38 self.__dict__.update(kwargs)
40 def update(self, obj):
48 if key not in self.__dict__:
49 self.__dict__[key] = val
53 if self.__dict__[key] == val:
58 (key, self.__dict__[key], val))
60 d = self.__dict__[key]
67 if hasattr(self, 'system') and hasattr(obj, 'system'):
68 if self.system != obj.system:
71 (self.system, obj.system))
73 def printinfo(self):
74 if self.name:
75 print('name: %s' % self.name)
76 if self.desc:
77 print('desc: %s' % self.desc)
79 if self.system:
80 print('system: %s' % self.system)
84 def printverbose(self):
85 for key in self:
86 val = self[key]
93 def __contains__(self, attr):
96 return attr in self.__dict__
98 def __getitem__(self, key):
101 return self.__dict__[key]
103 def __iter__(self):
104 keys = list(self.__dict__.keys())
110 def optiondict(self):
113 for key in self:
114 result[key] = self[key]
117 def __repr__(self):
119 for key,value in self.__dict__.items():
123 return "<%s: %s>" % (type(self).__name__, d)
125 def __str__(self):
126 return self.name
129 def __init__(self, options):
130 super(Job, self).__init__('', '')
138 self._config = config
139 self._groups = [ opt._group for opt in options ]
140 self._options = options
142 self.update(self._config)
143 for group in self._groups:
144 self.update(group)
146 self._is_checkpoint = True
148 for option in self._options:
149 self.update(option)
151 self._is_checkpoint = False
154 self.update(option._suboption)
155 self._is_checkpoint = False
158 for opt in self._options:
161 self.name = ':'.join(names)
164 for opt in self._options:
167 self.desc = ', '.join(descs)
169 self._checkpoint = None
170 if not self._is_checkpoint:
184 self._checkpoint = Job(opts)
186 def clone(self):
187 return Job(self._options)
189 def printinfo(self):
190 super(Job, self).printinfo()
191 if self._checkpoint:
192 print('checkpoint: %s' % self._checkpoint.name)
193 print('config: %s' % self._config.name)
194 print('groups: %s' % [ g.name for g in self._groups ])
195 print('options: %s' % [ o.name for o in self._options ])
196 super(Job, self).printverbose()
199 def __init__(self, name, desc, **kwargs):
200 super(SubOption, self).__init__(name, desc, **kwargs)
201 self._number = None
204 def __init__(self, name, desc, **kwargs):
205 super(Option, self).__init__(name, desc, **kwargs)
206 self._suboptions = []
207 self._suboption = None
208 self._number = None
210 def __getattribute__(self, attr):
212 name = self.__dict__[attr]
213 if self._suboption is not None:
214 name = '%s:%s' % (name, self._suboption.name)
218 desc = [ self.__dict__[attr] ]
219 if self._suboption is not None and self._suboption.desc:
220 desc.append(self._suboption.desc)
223 return super(Option, self).__getattribute__(attr)
225 def suboption(self, name, desc, **kwargs):
227 subo._config = self._config
228 subo._group = self._group
229 subo._option = self
230 subo._number = len(self._suboptions)
231 self._suboptions.append(subo)
234 def clone(self, suboptions=True):
235 option = Option(self.__dict__['name'], self.__dict__['desc'])
236 option.update(self)
237 option._group = self._group
238 option._config = self._config
239 option._number = self._number
241 option._suboptions.extend(self._suboptions)
242 option._suboption = self._suboption
245 def subopts(self):
246 if not self._suboptions:
247 return [ self ]
250 for subo in self._suboptions:
251 option = self.clone()
257 def printinfo(self):
258 super(Option, self).printinfo()
259 print('config: %s' % self._config.name)
260 super(Option, self).printverbose()
263 def __init__(self, name, desc, **kwargs):
264 super(Group, self).__init__(name, desc, **kwargs)
265 self._options = []
266 self._number = None
267 self._checkpoint = False
269 def option(self, name, desc, **kwargs):
271 opt._config = self._config
272 opt._group = self
273 opt._number = len(self._options)
274 self._options.append(opt)
277 def options(self):
278 return self._options
280 def subopts(self):
282 for opt in self._options:
287 def printinfo(self):
288 super(Group, self).printinfo()
289 print('config: %s' % self._config.name)
290 print('options: %s' % [ o.name for o in self._options ])
291 super(Group, self).printverbose()
294 def __init__(self, name, desc, **kwargs):
295 super(Configuration, self).__init__(name, desc, **kwargs)
296 self._groups = []
297 self._posfilters = []
298 self._negfilters = []
300 def group(self, name, desc, **kwargs):
302 grp._config = self
303 grp._number = len(self._groups)
304 self._groups.append(grp)
307 def groups(self):
308 return self._groups
310 def checkchildren(self, kids):
312 if kid._config != self:
315 def sortgroups(self, groups):
320 def options(self, groups=None, checkpoint=False):
322 groups = self._groups
323 self.checkchildren(groups)
324 groups = self.sortgroups(groups)
346 def addfilter(self, filt, pos=True):
350 self._posfilters.append(filt)
352 self._negfilters.append(filt)
354 def jobfilter(self, job):
355 for filt in self._negfilters:
359 if not self._posfilters:
362 for filt in self._posfilters:
368 def checkpoints(self, groups=None):
369 for options in self.options(groups, True):
371 if self.jobfilter(job):
374 def jobs(self, groups=None):
375 for options in self.options(groups, False):
377 if self.jobfilter(job):
380 def alljobs(self, groups=None):
381 for options in self.options(groups, True):
383 for options in self.options(groups, False):
386 def find(self, jobname):
387 for job in self.alljobs():
393 def job(self, options):
394 self.checkchildren(options)
401 def printinfo(self):
402 super(Configuration, self).printinfo()
403 print('groups: %s' % [ g.name for g in self._groups ])
404 super(Configuration, self).printverbose()