Python configargparse.ArgumentTypeError() Examples
The following are 5
code examples of configargparse.ArgumentTypeError().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
configargparse
, or try the search function
.
Example #1
Source File: app.py From marge-bot with BSD 3-Clause "New" or "Revised" License | 5 votes |
def time_interval(str_interval): try: quant, unit = re.match(r'\A([\d.]+) ?(h|m(?:in)?|s)?\Z', str_interval).groups() translate = {'h': 'hours', 'm': 'minutes', 'min': 'minutes', 's': 'seconds'} return timedelta(**{translate[unit or 's']: float(quant)}) except (AttributeError, ValueError): raise configargparse.ArgumentTypeError('Invalid time interval (e.g. 12[s|min|h]): %s' % str_interval)
Example #2
Source File: opts.py From ITDD with MIT License | 5 votes |
def __call__(self, parser, namespace, values, flag_name): help = self.help if self.mdhelp is not None else "" msg = "Flag '%s' is deprecated. %s" % (flag_name, help) raise configargparse.ArgumentTypeError(msg)
Example #3
Source File: opts.py From encoder-agnostic-adaptation with MIT License | 5 votes |
def __call__(self, parser, namespace, values, flag_name): help = self.help if self.help is not None else "" msg = "Flag '%s' is deprecated. %s" % (flag_name, help) raise configargparse.ArgumentTypeError(msg)
Example #4
Source File: opts.py From OpenNMT-py with MIT License | 5 votes |
def __call__(self, parser, namespace, values, flag_name): help = self.help if self.help is not None else "" msg = "Flag '%s' is deprecated. %s" % (flag_name, help) raise configargparse.ArgumentTypeError(msg)
Example #5
Source File: opts.py From OpenNMT-kpg-release with MIT License | 5 votes |
def __call__(self, parser, namespace, values, flag_name): help = self.help if self.help is not None else "" msg = "Flag '%s' is deprecated. %s" % (flag_name, help) raise configargparse.ArgumentTypeError(msg)