Lines Matching refs:self

93     def __init__(self, include, regex):
94 self.include = include
95 self.regex = re.compile(regex)
97 def __str__(self):
98 type_ = 'Include' if self.include else 'Remove'
99 return '%10s: %s' % (type_, self.regex.pattern)
113 def __init__(self):
115 self.__dict__ = self.__shared_dict
117 def _init(self, parser):
118 self._parse_commandline_args(parser)
119 self._run_post_processors()
120 self._initialized = True
122 def _init_with_dicts(self, config, defaults):
123 self._config = config
124 self._defaults = defaults
125 self._initialized = True
127 def _add_post_processor(self, attr, post_processor):
136 if attr not in self._post_processors:
137 self._post_processors[attr] = []
138 self._post_processors[attr].append(post_processor)
140 def _set(self, name, value):
141 self._config[name] = value
143 def _parse_commandline_args(self, parser):
146 self._config_file_args = {}
151 self._config_file_args[attr] = getattr(args, attr)
152 self._config.update(self._config_file_args)
154 def _run_post_processors(self):
155 for attr, callbacks in self._post_processors.items():
156 newval = self._lookup_val(attr)
161 self._set(attr, newval)
164 def _lookup_val(self, attr):
171 if attr in self._config:
172 return (self._config[attr],)
173 elif hasattr(self._defaults, attr):
174 return (getattr(self._defaults, attr),)
176 def __getattr__(self, attr):
177 if attr in dir(super(_Config, self)):
178 return getattr(super(_Config, self), attr)
179 elif not self._initialized:
184 val = self._lookup_val(attr)
191 def get_tags(self):
192 d = {typ: set(self.__getattr__(typ))
193 for typ in self.constants.supported_tags}
372 def __init__(self, *flags, **kwargs):
373 self.flags = flags
374 self.kwargs = kwargs
379 self.name = kwargs['dest']
387 if not hasattr(self, 'name'):
388 self.name = flag.lstrip('-')
390 if not hasattr(self, 'name'):
391 self.name = flags[0].lstrip('-')
392 self.name = self.name.replace('-', '_')
394 def add_to(self, parser):
396 parser.add_argument(*self.flags, **self.kwargs)
398 def copy(self):
400 return copy.deepcopy(self)
412 def __init__(self, val=0):
413 self.val = val
414 self.type = int
415 def __add__(self, other):
416 self.val += other
417 return self
427 def __call__(self, parser, namespace, values, option_string=None):
428 if not self.position_kword in namespace:
429 setattr(namespace, self.position_kword, [])
430 previous = getattr(namespace, self.position_kword)
431 previous.append((self.dest, values))
432 setattr(namespace, self.position_kword, previous)
539 def __init__(self, parser):
543 setattr(self, attr, getattr(parser, attr))
544 self.parser = parser
545 self.add_argument = self.parser.add_argument
556 def __init__(self):
558 super(CommandParser, self).__init__(parser)
559 self.subparser = self.add_subparsers(dest='command')
566 def __init__(self, subparser):
572 super(RunParser, self).__init__(parser)
592 def __init__(self, subparser):
597 super(ListParser, self).__init__(parser)
640 def __init__(self, subparser):
645 super(RerunParser, self).__init__(parser)