Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: third_party/typ/typ/arg_parser.py

Issue 3017623002: Roll typ to the latest version
Patch Set: Created 3 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/typ/setup.py ('k') | third_party/typ/typ/runner.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 Google Inc. All rights reserved. 1 # Copyright 2014 Google Inc. All rights reserved.
2 # 2 #
3 # Licensed under the Apache License, Version 2.0 (the "License"); 3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License. 4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at 5 # You may obtain a copy of the License at
6 # 6 #
7 # http://www.apache.org/licenses/LICENSE-2.0 7 # http://www.apache.org/licenses/LICENSE-2.0
8 # 8 #
9 # Unless required by applicable law or agreed to in writing, software 9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS, 10 # distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 if reporting: 78 if reporting:
79 self.add_argument('--builder-name', 79 self.add_argument('--builder-name',
80 help=('Builder name to include in the ' 80 help=('Builder name to include in the '
81 'uploaded data.')) 81 'uploaded data.'))
82 self.add_argument('-c', '--coverage', action='store_true', 82 self.add_argument('-c', '--coverage', action='store_true',
83 help='Reports coverage information.') 83 help='Reports coverage information.')
84 self.add_argument('--coverage-source', action='append', 84 self.add_argument('--coverage-source', action='append',
85 default=[], 85 default=[],
86 help=('Directories to include when running and ' 86 help=('Directories to include when running and '
87 'reporting coverage (defaults to ' 87 'reporting coverage (defaults to '
88 '--top-level-dir plus --path)')) 88 '--top-level-dirs plus --path)'))
89 self.add_argument('--coverage-omit', action='append', 89 self.add_argument('--coverage-omit', action='append',
90 default=[], 90 default=[],
91 help=('Globs to omit when reporting coverage ' 91 help=('Globs to omit when reporting coverage '
92 '(defaults to %s).' % 92 '(defaults to %s).' %
93 DEFAULT_COVERAGE_OMIT)) 93 DEFAULT_COVERAGE_OMIT))
94 self.add_argument('--coverage-annotate', action='store_true', 94 self.add_argument('--coverage-annotate', action='store_true',
95 help=('Produce an annotate source report.')) 95 help=('Produce an annotate source report.'))
96 self.add_argument('--coverage-show-missing', action='store_true', 96 self.add_argument('--coverage-show-missing', action='store_true',
97 help=('Show missing line ranges in coverage ' 97 help=('Show missing line ranges in coverage '
98 'report.')) 98 'report.'))
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 default=None, 164 default=None,
165 help=argparse.SUPPRESS) 165 help=argparse.SUPPRESS)
166 self.add_argument('--no-overwrite', action='store_false', 166 self.add_argument('--no-overwrite', action='store_false',
167 dest='overwrite', default=None, 167 dest='overwrite', default=None,
168 help=argparse.SUPPRESS) 168 help=argparse.SUPPRESS)
169 169
170 if discovery or running: 170 if discovery or running:
171 self.add_argument('-P', '--path', action='append', default=[], 171 self.add_argument('-P', '--path', action='append', default=[],
172 help=('Adds dir to sys.path (can specify ' 172 help=('Adds dir to sys.path (can specify '
173 'multiple times).')) 173 'multiple times).'))
174 self.add_argument('--top-level-dir', default=None, 174 self.add_argument('--top-level-dir', action='store', default=None,
175 help=argparse.SUPPRESS)
176 self.add_argument('--top-level-dirs', action='append', default=[],
175 help=('Sets the top directory of project ' 177 help=('Sets the top directory of project '
176 '(used when running subdirs).')) 178 '(used when running subdirs).'))
177 179
178 def parse_args(self, args=None, namespace=None): 180 def parse_args(self, args=None, namespace=None):
179 try: 181 try:
180 rargs = super(ArgumentParser, self).parse_args(args=args, 182 rargs = super(ArgumentParser, self).parse_args(args=args,
181 namespace=namespace) 183 namespace=namespace)
182 except _Bailout: 184 except _Bailout:
183 return None 185 return None
184 186
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 if isinstance(action, argparse._CountAction): 333 if isinstance(action, argparse._CountAction):
332 return 'count' 334 return 'count'
333 if isinstance(action, argparse._StoreAction): 335 if isinstance(action, argparse._StoreAction):
334 return 'store' 336 return 'store'
335 if isinstance(action, argparse._StoreTrueAction): 337 if isinstance(action, argparse._StoreTrueAction):
336 return 'store_true' 338 return 'store_true'
337 339
338 340
339 def _argname_from_key(key): 341 def _argname_from_key(key):
340 return '--' + key.replace('_', '-') 342 return '--' + key.replace('_', '-')
OLDNEW
« no previous file with comments | « third_party/typ/setup.py ('k') | third_party/typ/typ/runner.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698