Lines Matching refs:self

40     def __init__(self, split):
41 self.split = split
42 def __call__(self, option, opt_str, value, parser):
43 values = value.split(self.split)
51 def __init__(self, *args, **kwargs):
53 self._optparse = optparse.OptionParser(*args, **kwargs)
54 self._optparse.disable_interspersed_args()
56 self._allopts = {}
59 self._group = self._optparse
61 def set_defaults(self, *args, **kwargs):
62 return self._optparse.set_defaults(*args, **kwargs)
64 def set_group(self, *args, **kwargs):
67 self._group = self._optparse
69 self._group = self._optparse.add_option_group(*args, **kwargs)
71 def add_option(self, *args, **kwargs):
84 option = self._group.add_option(*args, **kwargs)
86 if dest not in self._allopts:
87 self._allopts[dest] = option
91 def bool_option(self, name, default, help):
105 topt = self.add_option(tname, action="store_true", default=default,
107 fopt = self.add_option(fname, action="store_false", dest=dest,
112 def __getattr__(self, attr):
114 return super(OptionParser, self).__getattribute__(attr)
116 if attr in self:
117 return self[attr]
119 return super(OptionParser, self).__getattribute__(attr)
121 def __setattr__(self, attr, value):
123 super(OptionParser, self).__setattr__(attr, value)
124 elif attr in self._allopts:
126 self.set_defaults(**defaults)
127 if attr in self:
128 self[attr] = value
130 super(OptionParser, self).__setattr__(attr, value)
132 def parse_args(self):
133 opts,args = self._optparse.parse_args()
136 if val is not None or key not in self:
137 self[key] = val
141 def usage(self, exitcode=None):
142 self._optparse.print_help()