def run_pytype(self, module, report_errors): """Run pytype over a single module.""" # Create the output subdirectory for this file. target_dir = os.path.join(self.pyi_dir, os.path.dirname(module.target)) try: file_utils.makedirs(target_dir) except OSError: logging.error('Could not create output directory: %s', target_dir) return if report_errors: print('%s' % module.target) else: print('%s*' % module.target) args = self.get_pytype_args(module, report_errors) logging.info('Running: pytype %s %s', ' '.join(args), self.custom_options) # TODO(rechen): Do we want to get rid of the --nofail option and use a # try/except here instead? We'd control the failure behavior (e.g. we could # potentially bring back the .errors file, or implement an "abort on first # error" flag for quick iterative typechecking). with debug.save_logging_level( ): # pytype_config changes the logging level options = pytype_config.Options(args) # TODO(rechen): Do this tweaking in get_pytype_args so it can be tested. if report_errors: options.tweak(**self.custom_options) io.process_one_file(options)
def _run_pytype(options): """Run pytype with the given configuration options.""" if options.generate_builtins: return _generate_builtins_pickle(options) elif options.parse_pyi: return io.parse_pyi(options) else: return io.process_one_file(options)
def run_pytype(self, module, report_errors): """Run pytype over a single module.""" self.create_output_dir(module) args = self.get_pytype_args(module, report_errors) logging.info('Running: pytype %s %s', ' '.join(args), self.custom_options) # TODO(rechen): Do we want to get rid of the --nofail option and use a # try/except here instead? We'd control the failure behavior (e.g. we could # potentially bring back the .errors file, or implement an "abort on first # error" flag for quick iterative typechecking). with debug.save_logging_level( ): # pytype_config changes the logging level options = pytype_config.Options(args) # TODO(rechen): Do this tweaking in get_pytype_args so it can be tested. if report_errors: options.tweak(**self.custom_options) io.process_one_file(options)