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


Python misc.Hasher类代码示例

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


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

示例1: report

    def report(self, morfs, config=None):
        """Generate an HTML report for `morfs`.

        `morfs` is a list of modules or filenames.  `config` is a
        CoverageConfig instance.

        """
        assert config.html_dir, "must provide a directory for html reporting"

        # Read the status data.
        self.status.read(config.html_dir)

        # Check that this run used the same settings as the last run.
        m = Hasher()
        m.update(config)
        these_settings = m.digest()
        if self.status.settings_hash() != these_settings:
            self.status.reset()
            self.status.set_settings_hash(these_settings)

        # Process all the files.
        self.report_files(self.html_file, morfs, config, config.html_dir)

        if not self.files:
            raise CoverageException("No data to report.")

        # Write the index file.
        self.index_file()

        self.make_local_static_report_files()
开发者ID:335969568,项目名称:Blink-1,代码行数:30,代码来源:html.py

示例2: report

    def report(self, morfs):
        """Generate an HTML report for `morfs`.

        `morfs` is a list of modules or filenames.

        """
        assert self.config.html_dir, "must give a directory for html reporting"

        # Read the status data.
        self.status.read(self.config.html_dir)

        # Check that this run used the same settings as the last run.
        m = Hasher()
        m.update(self.config)
        these_settings = m.hexdigest()
        if self.status.settings_hash() != these_settings:
            self.status.reset()
            self.status.set_settings_hash(these_settings)

        # The user may have extra CSS they want copied.
        if self.config.extra_css:
            self.extra_css = os.path.basename(self.config.extra_css)

        # Process all the files.
        self.report_files(self.html_file, morfs, self.config.html_dir)

        if not self.files:
            raise CoverageException("No data to report.")

        # Write the index file.
        self.index_file()

        self.make_local_static_report_files()

        return self.totals.pc_covered
开发者ID:phenoxim,项目名称:coveragepy,代码行数:35,代码来源:html.py

示例3: report

    def report(self, morfs, config=None):
        """Generate an HTML report for `morfs`.

        `morfs` is a list of modules or filenames.  `config` is a
        CoverageConfig instance.

        """
        assert config.html_dir, "must provide a directory for html reporting"

        # Read the status data.
        self.status.read(config.html_dir)

        # Check that this run used the same settings as the last run.
        m = Hasher()
        m.update(config)
        these_settings = m.digest()
        if self.status.settings_hash() != these_settings:
            self.status.reset()
            self.status.set_settings_hash(these_settings)

        # Process all the files.
        self.report_files(self.html_file, morfs, config, config.html_dir)

        if not self.files:
            raise CoverageException("No data to report.")

        # Write the index file.
        self.index_file()

        # Create the once-per-directory files.
        for static in self.STATIC_FILES:
            shutil.copyfile(
                data_filename("htmlfiles/" + static),
                os.path.join(self.directory, static)
                )
开发者ID:GaleDragon,项目名称:intellij-community,代码行数:35,代码来源:html.py

示例4: report

 def report(self, morfs):
     self.status.read(self.config.html_dir)
     m = Hasher()
     m.update(self.config)
     these_settings = m.digest()
     if self.status.settings_hash() != these_settings:
         self.status.reset()
         self.status.set_settings_hash(these_settings)
     if self.config.extra_css:
         self.extra_css = os.path.basename(self.config.extra_css)
     self.report_files(self.html_file, morfs, self.config.html_dir)
     if not self.files:
         raise CoverageException('No data to report.')
     self.index_file()
     self.make_local_static_report_files()
     return self.totals.pc_covered
开发者ID:connoryang,项目名称:dec-eve-serenity,代码行数:16,代码来源:html.py

示例5: file_hash

 def file_hash(self, source, fr):
     """Compute a hash that changes if the file needs to be re-reported."""
     m = Hasher()
     m.update(source)
     self.coverage.data.add_to_hash(fr.filename, m)
     return m.hexdigest()
开发者ID:phenoxim,项目名称:coveragepy,代码行数:6,代码来源:html.py

示例6: test_dict_hashing

 def test_dict_hashing(self):
     h1 = Hasher()
     h1.update({'a': 17, 'b': 23})
     h2 = Hasher()
     h2.update({'b': 23, 'a': 17})
     self.assertEqual(h1.hexdigest(), h2.hexdigest())
开发者ID:jayhetee,项目名称:coveragepy,代码行数:6,代码来源:test_misc.py

示例7: test_bytes_hashing

 def test_bytes_hashing(self):
     h1 = Hasher()
     h1.update(b"Hello, world!")
     h2 = Hasher()
     h2.update(b"Goodbye!")
     self.assertNotEqual(h1.hexdigest(), h2.hexdigest())
开发者ID:jayhetee,项目名称:coveragepy,代码行数:6,代码来源:test_misc.py

示例8: test_string_hashing

 def test_string_hashing(self):
     h1 = Hasher()
     h1.update("Hello, world!")
     h2 = Hasher()
     h2.update("Goodbye!")
     h3 = Hasher()
     h3.update("Hello, world!")
     self.assertNotEqual(h1.hexdigest(), h2.hexdigest())
     self.assertEqual(h1.hexdigest(), h3.hexdigest())
开发者ID:jayhetee,项目名称:coveragepy,代码行数:9,代码来源:test_misc.py

示例9: test_dict_collision

 def test_dict_collision(self):
     h1 = Hasher()
     h1.update({'a': 17, 'b': {'c': 1, 'd': 2}})
     h2 = Hasher()
     h2.update({'a': 17, 'b': {'c': 1}, 'd': 2})
     self.assertNotEqual(h1.hexdigest(), h2.hexdigest())
开发者ID:hugovk,项目名称:coveragepy,代码行数:6,代码来源:test_misc.py

示例10: test_unicode_hashing

 def test_unicode_hashing(self):
     h1 = Hasher()
     h1.update(u"Hello, world! \N{SNOWMAN}")
     h2 = Hasher()
     h2.update(u"Goodbye!")
     self.assertNotEqual(h1.hexdigest(), h2.hexdigest())
开发者ID:hugovk,项目名称:coveragepy,代码行数:6,代码来源:test_misc.py

示例11: file_hash

 def file_hash(self, source, cu):
     m = Hasher()
     m.update(source)
     self.coverage.data.add_to_hash(cu.filename, m)
     return m.digest()
开发者ID:connoryang,项目名称:dec-eve-serenity,代码行数:5,代码来源:html.py


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