OLD | NEW |
1 # Copyright 2013 The LUCI Authors. All rights reserved. | 1 # Copyright 2013 The LUCI Authors. All rights reserved. |
2 # Use of this source code is governed by the Apache v2.0 license that can be | 2 # Use of this source code is governed under the Apache License, Version 2.0 |
3 # found in the LICENSE file. | 3 # that can be found in the LICENSE file. |
4 | 4 |
5 import os | 5 import os |
6 import re | 6 import re |
7 | 7 |
8 from third_party import colorama | 8 from third_party import colorama |
9 | 9 |
10 | 10 |
11 UNITS = ('', 'k', 'm', 'g', 't', 'p', 'e', 'z', 'y') | 11 UNITS = ('', 'k', 'm', 'g', 't', 'p', 'e', 'z', 'y') |
12 | 12 |
13 | 13 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 if actual is None: | 111 if actual is None: |
112 parser.error('Invalid value \'%s\' for %s' % (value, opt)) | 112 parser.error('Invalid value \'%s\' for %s' % (value, opt)) |
113 setattr(parser.values, option.dest, actual) | 113 setattr(parser.values, option.dest, actual) |
114 | 114 |
115 | 115 |
116 def unit_option(parser, *args, **kwargs): | 116 def unit_option(parser, *args, **kwargs): |
117 """Add an option that uses unit_arg().""" | 117 """Add an option that uses unit_arg().""" |
118 parser.add_option( | 118 parser.add_option( |
119 *args, type='str', metavar='N', action='callback', callback=unit_arg, | 119 *args, type='str', metavar='N', action='callback', callback=unit_arg, |
120 nargs=1, **kwargs) | 120 nargs=1, **kwargs) |
OLD | NEW |