当前位置: 首页>>代码示例>>Python>>正文


Python grammar.pluralize函数代码示例

本文整理汇总了Python中webkitpy.tool.grammar.pluralize函数的典型用法代码示例。如果您正苦于以下问题:Python pluralize函数的具体用法?Python pluralize怎么用?Python pluralize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了pluralize函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _print_counts

    def _print_counts(self, counters_by_email):
        def counter_cmp(a_tuple, b_tuple):
            # split the tuples
            # the second element is the "counter" structure
            _, a_counter = a_tuple
            _, b_counter = b_tuple

            count_result = cmp(a_counter['count'], b_counter['count'])
            if count_result:
                return -count_result
            return cmp(a_counter['latest_name'].lower(), b_counter['latest_name'].lower())

        for author_email, counter in sorted(counters_by_email.items(), counter_cmp):
            if author_email != counter['latest_email']:
                continue
            contributor = self._committer_list.contributor_by_email(author_email)
            author_name = counter['latest_name']
            patch_count = counter['count']
            counter['names'] = counter['names'] - set([author_name])
            counter['emails'] = counter['emails'] - set([author_email])

            alias_list = []
            for alias in counter['names']:
                alias_list.append(alias)
            for alias in counter['emails']:
                alias_list.append(alias)
            if alias_list:
                print "CONTRIBUTOR: %s (%s) has %s %s" % (author_name, author_email, grammar.pluralize(patch_count, "reviewed patch"), "(aliases: " + ", ".join(alias_list) + ")")
            else:
                print "CONTRIBUTOR: %s (%s) has %s" % (author_name, author_email, grammar.pluralize(patch_count, "reviewed patch"))
        return
开发者ID:AndriyKalashnykov,项目名称:webkit,代码行数:31,代码来源:suggestnominations.py

示例2: print_one_line_summary

    def print_one_line_summary(self, total, expected, unexpected):
        """Print a one-line summary of the test run to stdout.

        Args:
          total: total number of tests run
          expected: number of expected results
          unexpected: number of unexpected results
        """
        if self.disabled('one-line-summary'):
            return

        incomplete = total - expected - unexpected
        incomplete_str = ''
        if incomplete:
            self._write("")
            incomplete_str = " (%d didn't run)" % incomplete

        if unexpected == 0:
            if expected == total:
                if expected > 1:
                    self._write("All %d tests ran as expected." % expected)
                else:
                    self._write("The test ran as expected.")
            else:
                self._write("%s ran as expected%s." % (grammar.pluralize('test', expected), incomplete_str))
        else:
            self._write("%s ran as expected, %d didn't%s:" % (grammar.pluralize('test', expected), unexpected, incomplete_str))
        self._write("")
开发者ID:kseo,项目名称:webkit,代码行数:28,代码来源:printing.py

示例3: print_workers_and_shards

 def print_workers_and_shards(self, num_workers, num_shards):
     driver_name = self._port.driver_name()
     if num_workers == 1:
         self._print_default("Running 1 %s." % driver_name)
         self._print_debug("(%s)." % grammar.pluralize(num_shards, "shard"))
     else:
         self._print_default("Running %s in parallel." % (grammar.pluralize(num_workers, driver_name)))
         self._print_debug("(%d shards)." % num_shards)
     self._print_default('')
开发者ID:edcwconan,项目名称:webkit,代码行数:9,代码来源:printing.py

示例4: check_arguments_and_execute

 def check_arguments_and_execute(self, options, args, tool=None):
     if len(args) < len(self.required_arguments):
         log("%s required, %s provided.  Provided: %s  Required: %s\nSee '%s help %s' for usage." % (
             pluralize("argument", len(self.required_arguments)),
             pluralize("argument", len(args)),
             "'%s'" % " ".join(args),
             " ".join(self.required_arguments),
             tool.name(),
             self.name))
         return 1
     return self.execute(options, args, tool) or 0
开发者ID:achellies,项目名称:WinCEWebKit,代码行数:11,代码来源:multicommandtool.py

示例5: print_workers_and_shards

    def print_workers_and_shards(self, num_workers, num_shards):
        driver_name = self._port.driver_name()

        device_suffix = ' for device "{}"'.format(self._options.device_class) if self._options.device_class else ''
        if num_workers == 1:
            self._print_default('Running 1 {}{}.'.format(driver_name, device_suffix))
            self._print_debug('({}).'.format(grammar.pluralize(num_shards, "shard")))
        else:
            self._print_default('Running {} in parallel{}.'.format(grammar.pluralize(num_workers, driver_name), device_suffix))
            self._print_debug('({} shards).'.format(num_shards))
        self._print_default('')
开发者ID:Comcast,项目名称:WebKitForWayland,代码行数:11,代码来源:printing.py

示例6: _fetch_list_of_patches_to_process

 def _fetch_list_of_patches_to_process(self, options, args, tool):
     all_patches = []
     for bug_id in args:
         patches = tool.bugs.fetch_bug(bug_id).reviewed_patches()
         log("%s found on bug %s." % (pluralize("reviewed patch", len(patches)), bug_id))
         all_patches += patches
     return all_patches
开发者ID:Andersbakken,项目名称:check-coding-style,代码行数:7,代码来源:download.py

示例7: print_found

 def print_found(self, num_all_test_files, num_to_run, repeat_each, iterations):
     num_unique_tests = num_to_run / (repeat_each * iterations)
     found_str = 'Found %s; running %d' % (grammar.pluralize('test', num_all_test_files), num_unique_tests)
     if repeat_each * iterations > 1:
         found_str += ' (%d times each: --repeat-each=%d --iterations=%d)' % (repeat_each * iterations, repeat_each, iterations)
     found_str += ', skipping %d' % (num_all_test_files - num_unique_tests)
     self._print_default(found_str + '.')
开发者ID:kcomkar,项目名称:webkit,代码行数:7,代码来源:printing.py

示例8: feed

 def feed(self):
     ids_needing_review = set(self._tool.bugs.queries.fetch_attachment_ids_from_review_queue())
     new_ids = ids_needing_review.difference(self._ids_sent_to_server)
     log("Feeding EWS (%s, %s new)" % (pluralize("r? patch", len(ids_needing_review)), len(new_ids)))
     for attachment_id in new_ids:  # Order doesn't really matter for the EWS.
         self._tool.status_server.submit_to_ews(attachment_id)
         self._ids_sent_to_server.add(attachment_id)
开发者ID:Moondee,项目名称:Artemis,代码行数:7,代码来源:feeders.py

示例9: _print_one_line_summary

    def _print_one_line_summary(self, total_time, run_results):
        if self._options.timing:
            parallel_time = sum(result.total_run_time for result in run_results.results_by_name.values())

            # There is serial overhead in layout_test_runner.run() that we can't easily account for when
            # really running in parallel, but taking the min() ensures that in the worst case
            # (if parallel time is less than run_time) we do account for it.
            serial_time = total_time - min(run_results.run_time, parallel_time)

            speedup = (parallel_time + serial_time) / total_time
            timing_summary = ' in %.2fs (%.2fs in rwt, %.2gx)' % (total_time, serial_time, speedup)
        else:
            timing_summary = ''

        total = run_results.total - run_results.expected_skips
        expected = run_results.expected - run_results.expected_skips
        unexpected = run_results.unexpected
        incomplete = total - expected - unexpected
        incomplete_str = ''
        if incomplete:
            self._print_default("")
            incomplete_str = " (%d didn't run)" % incomplete

        if self._options.verbose or self._options.debug_rwt_logging or unexpected:
            self.writeln("")

        expected_summary_str = ''
        if run_results.expected_failures > 0:
            expected_summary_str = " (%d passed, %d didn't)" % (
                expected - run_results.expected_failures, run_results.expected_failures)

        summary = ''
        if unexpected == 0:
            if expected == total:
                if expected > 1:
                    summary = "All %d tests ran as expected%s%s." % (expected, expected_summary_str, timing_summary)
                else:
                    summary = "The test ran as expected%s%s." % (expected_summary_str, timing_summary)
            else:
                summary = "%s ran as expected%s%s%s." % (grammar.pluralize(
                    'test', expected), expected_summary_str, incomplete_str, timing_summary)
        else:
            summary = "%s ran as expected%s, %d didn't%s%s:" % (grammar.pluralize(
                'test', expected), expected_summary_str, unexpected, incomplete_str, timing_summary)

        self._print_quiet(summary)
        self._print_quiet("")
开发者ID:mirror,项目名称:chromium,代码行数:47,代码来源:printing.py

示例10: print_workers_and_shards

 def print_workers_and_shards(self, num_workers, num_shards, num_locked_shards):
     driver_name = self._port.driver_name()
     if num_workers == 1:
         self._print_default("Running 1 %s over %s." % (driver_name, grammar.pluralize('shard', num_shards)))
     else:
         self._print_default("Running %d %ss in parallel over %d shards (%d locked)." %
             (num_workers, driver_name, num_shards, num_locked_shards))
     self._print_default('')
开发者ID:kcomkar,项目名称:webkit,代码行数:8,代码来源:printing.py

示例11: _guess_reviewer_from_bug

 def _guess_reviewer_from_bug(self, bug_id):
     patches = self._tool.bugs.fetch_bug(bug_id).reviewed_patches()
     if len(patches) != 1:
         log("%s on bug %s, cannot infer reviewer." % (pluralize("reviewed patch", len(patches)), bug_id))
         return None
     patch = patches[0]
     log("Guessing \"%s\" as reviewer from attachment %s on bug %s." % (patch.reviewer().full_name, patch.id(), bug_id))
     return patch.reviewer().full_name
开发者ID:UIKit0,项目名称:WebkitAIR,代码行数:8,代码来源:updatechangelogswithreviewer.py

示例12: print_workers_and_shards

 def print_workers_and_shards(self, num_workers, num_shards, num_locked_shards):
     driver_name = self._port.driver_name()
     if num_workers == 1:
         self._print_default("Running 1 %s." % driver_name)
         self._print_debug("(%s)." % grammar.pluralize("shard", num_shards))
     else:
         self._print_default("Running %d %ss in parallel." % (num_workers, driver_name))
         self._print_debug("(%d shards; %d locked)." % (num_shards, num_locked_shards))
     self._print_default("")
开发者ID:EQ4,项目名称:h5vcc,代码行数:9,代码来源:printing.py

示例13: run_tests

    def run_tests(
        self,
        expectations,
        test_inputs,
        tests_to_skip,
        num_workers,
        needs_http,
        needs_websockets,
        needs_web_platform_test_server,
        retrying,
    ):
        self._expectations = expectations
        self._test_inputs = test_inputs
        self._needs_http = needs_http
        self._needs_websockets = needs_websockets
        self._needs_web_platform_test_server = needs_web_platform_test_server
        self._retrying = retrying

        # FIXME: rename all variables to test_run_results or some such ...
        run_results = TestRunResults(self._expectations, len(test_inputs) + len(tests_to_skip))
        self._current_run_results = run_results
        self._printer.num_tests = len(test_inputs)
        self._printer.num_started = 0

        if not retrying:
            self._printer.print_expected(run_results, self._expectations.model().get_tests_with_result_type)

        for test_name in set(tests_to_skip):
            result = test_results.TestResult(test_name)
            result.type = test_expectations.SKIP
            run_results.add(result, expected=True, test_is_slow=self._test_is_slow(test_name))

        self._printer.write_update("Sharding tests ...")
        all_shards = self._sharder.shard_tests(
            test_inputs, int(self._options.child_processes), self._options.fully_parallel
        )

        if (self._needs_http and self._options.http) or self._needs_web_platform_test_server:
            self.start_servers()

        num_workers = min(num_workers, len(all_shards))
        self._printer.print_workers_and_shards(num_workers, len(all_shards))

        if self._options.dry_run:
            return run_results

        self._printer.write_update("Starting %s ..." % grammar.pluralize(num_workers, "worker"))

        try:
            with message_pool.get(
                self, self._worker_factory, num_workers, self._port.worker_startup_delay_secs(), self._port.host
            ) as pool:
                pool.run(("test_list", shard.name, shard.test_inputs) for shard in all_shards)
        except TestRunInterruptedException, e:
            _log.warning(e.reason)
            run_results.interrupted = True
开发者ID:fanghongjia,项目名称:JavaScriptCore,代码行数:56,代码来源:layout_test_runner.py

示例14: run

 def run(self, state):
     if not self._options.obsolete_patches:
         return
     bug_id = state["bug_id"]
     patches = self._tool.bugs.fetch_bug(bug_id).patches()
     if not patches:
         return
     log("Obsoleting %s on bug %s" % (pluralize("old patch", len(patches)), bug_id))
     for patch in patches:
         self._tool.bugs.obsolete_attachment(patch.id())
开发者ID:mikezit,项目名称:Webkit_Code,代码行数:10,代码来源:obsoletepatches.py

示例15: _num_workers

 def _num_workers(self, num_shards):
     num_workers = min(int(self._options.child_processes), num_shards)
     driver_name = self._port.driver_name()
     if num_workers == 1:
         self._printer.print_config("Running 1 %s over %s" %
             (driver_name, grammar.pluralize('shard', num_shards)))
     else:
         self._printer.print_config("Running %d %ss in parallel over %d shards" %
             (num_workers, driver_name, num_shards))
     return num_workers
开发者ID:0x4d52,项目名称:JavaScriptCore-X,代码行数:10,代码来源:test_runner.py


注:本文中的webkitpy.tool.grammar.pluralize函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。