Example #1
0
File: args.py Project: DDMAL/Gamera
 def __init__(self, name=None, choices=[], default=None):
     Arg.__init__(self, name)
     if not util.is_string_or_unicode_list(choices):
         raise TypeError("'choices' must be a list of strings.")
     self.choices = choices
     if default is None:
         self.has_default = False
         self.default = 0
     else:
         self.has_default = True
         self.default = default
     if not isinstance(self.default, CNoneDefault) and type(self.default) != int:
         raise TypeError("'default' must be an int")
Example #2
0
 def __init__(self, name=None, choices=[], default=None):
     Arg.__init__(self, name)
     if not util.is_string_or_unicode_list(choices):
         raise TypeError("'choices' must be a list of strings.")
     self.choices = choices
     if default is None:
         self.has_default = False
         self.default = 0
     else:
         self.has_default = True
         self.default = default
     if not isinstance(self.default, CNoneDefault) and type(self.default) != int:
         raise TypeError("'default' must be an int")
Example #3
0
File: args.py Project: DDMAL/Gamera
 def __init__(self, name=None, choices=[], default=None, strict=True):
     Arg.__init__(self, name)
     if not util.is_string_or_unicode_list(choices):
         raise TypeError("'choices' must be a list of strings.")
     self.choices = choices
     if default is None:
         self.has_default = False
         self.default = choices[0]
     else:
         if type(default) != str:
             raise TypeError("'default' must be a string")
         if default not in choices:
             raise ValueError("Given 'default' must be in available 'choices'")
         self.has_default = True
         self.default = default
     self.strict = strict
Example #4
0
 def __init__(self, name=None, choices=[], default=None, strict=True):
     Arg.__init__(self, name)
     if not util.is_string_or_unicode_list(choices):
         raise TypeError("'choices' must be a list of strings.")
     self.choices = choices
     if default is None:
         self.has_default = False
         self.default = choices[0]
     else:
         if type(default) != str:
             raise TypeError("'default' must be a string")
         if default not in choices:
             raise ValueError("Given 'default' must be in available 'choices'")
         self.has_default = True
         self.default = default
     self.strict = strict