• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python contenttype.get_filetype函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: test_doc_xml

    def test_doc_xml(self):
        assert not is_binary(self.get_test_loc('contenttype/doc/xml/simple.xml'))
        assert 'xml language text' == get_filetype(self.get_test_loc('contenttype/doc/xml/simple.xml'))

        assert not is_binary(self.get_test_loc('contenttype/doc/xml/some.xml'))
        assert 'xml language text' == get_filetype(self.get_test_loc('contenttype/doc/xml/some.xml'))

        assert not is_binary(self.get_test_loc('contenttype/doc/xml/somespring.xml'))
        assert 'xml language text' == get_filetype(self.get_test_loc('contenttype/doc/xml/somespring.xml'))
开发者ID:pombredanne,项目名称:scancode-toolkit,代码行数:9,代码来源:test_contenttype.py


示例2: test_doc_office_word

    def test_doc_office_word(self):
        assert 'microsoft word 2007+' == get_filetype(self.get_test_loc('contenttype/doc/office/document'))

        assert 'microsoft word 2007+' == get_filetype(self.get_test_loc('contenttype/doc/office/document.doc'))

        assert not is_special(self.get_test_loc('contenttype/doc/office/word.doc'))
        assert '' == get_filetype_pygment(self.get_test_loc('contenttype/doc/office/word.doc'))
        assert 'application/msword' == get_mimetype_file(self.get_test_loc('contenttype/doc/office/word.doc'))
        assert get_filetype(self.get_test_loc('contenttype/doc/office/word.doc')).startswith('composite document file v2 document')
        assert get_filetype_file(self.get_test_loc('contenttype/doc/office/word.doc')).startswith('Composite Document File V2 Document')

        assert 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' == get_mimetype_file(self.get_test_loc('contenttype/doc/office/word.docx'))
开发者ID:pombredanne,项目名称:scancode-toolkit,代码行数:12,代码来源:test_contenttype.py


示例3: test_binary_random_data

 def test_binary_random_data(self):
     assert 'data' == get_filetype(self.get_test_loc('contenttype/binary-random/binary_random_0'))
     assert 'data' == get_filetype(self.get_test_loc('contenttype/binary-random/binary_random_1'))
     assert 'data' == get_filetype(self.get_test_loc('contenttype/binary-random/binary_random_2'))
     assert 'data' == get_filetype(self.get_test_loc('contenttype/binary-random/binary_random_3'))
     assert 'data' == get_filetype(self.get_test_loc('contenttype/binary-random/binary_random_4'))
     assert 'data' == get_filetype(self.get_test_loc('contenttype/binary-random/binary_random_5'))
     assert 'data' == get_filetype(self.get_test_loc('contenttype/binary-random/binary_random_6'))
     assert 'data' == get_filetype(self.get_test_loc('contenttype/binary-random/binary_random_7'))
     assert 'data' == get_filetype(self.get_test_loc('contenttype/binary-random/binary_random_8'))
开发者ID:pombredanne,项目名称:scancode-toolkit,代码行数:10,代码来源:test_contenttype.py


示例4: test_code_python_2

 def test_code_python_2(self):
     assert is_source(self.get_test_loc('contenttype/code/python/extract.py'))
     assert is_text(self.get_test_loc('contenttype/code/python/extract.py'))
     assert 'Python' == get_filetype_pygment(self.get_test_loc('contenttype/code/python/extract.py'))
     assert 'python language text' == get_filetype(self.get_test_loc('contenttype/code/python/extract.py'))
     assert 'text/x-python' == get_mimetype_file(self.get_test_loc('contenttype/code/python/extract.py'))
     assert get_filetype_file(self.get_test_loc('contenttype/code/python/extract.py')).startswith('Python script')
开发者ID:pombredanne,项目名称:scancode-toolkit,代码行数:7,代码来源:test_contenttype.py


示例5: test_code_java_non_ascii

 def test_code_java_non_ascii(self):
     assert is_source(self.get_test_loc('contenttype/code/java/ChartTiming1.java'))
     assert is_text(self.get_test_loc('contenttype/code/java/ChartTiming1.java'))
     # FIXME: incorrect
     assert 'application/octet-stream' == get_mimetype_file(self.get_test_loc('contenttype/code/java/ChartTiming1.java'))
     assert 'Java' == get_filetype_pygment(self.get_test_loc('contenttype/code/java/ChartTiming1.java'))
     assert 'java language text' == get_filetype(self.get_test_loc('contenttype/code/java/ChartTiming1.java'))
开发者ID:pombredanne,项目名称:scancode-toolkit,代码行数:7,代码来源:test_contenttype.py


示例6: test_code_c_6

 def test_code_c_6(self):
     assert is_source(self.get_test_loc('contenttype/code/c/pci_v3.c'))
     assert is_text(self.get_test_loc('contenttype/code/c/pci_v3.c'))
     assert 'C source, ASCII text' == get_filetype_file(self.get_test_loc('contenttype/code/c/pci_v3.c'))
     assert 'C' == get_filetype_pygment(self.get_test_loc('contenttype/code/c/pci_v3.c'))
     assert 'c language text' == get_filetype(self.get_test_loc('contenttype/code/c/pci_v3.c'))
     assert 'text/x-c' == get_mimetype_file(self.get_test_loc('contenttype/code/c/pci_v3.c'))
开发者ID:pombredanne,项目名称:scancode-toolkit,代码行数:7,代码来源:test_contenttype.py


示例7: test_build_makefile

 def test_build_makefile(self):
     assert is_source(self.get_test_loc('contenttype/build/Makefile'))
     assert is_text(self.get_test_loc('contenttype/build/Makefile'))
     assert 'Makefile' == get_filetype_pygment(self.get_test_loc('contenttype/build/Makefile'))
     assert 'ASCII text' == get_filetype_file(self.get_test_loc('contenttype/build/Makefile'))
     assert 'makefile language text' == get_filetype(self.get_test_loc('contenttype/build/Makefile'))
     assert 'text/plain' == get_mimetype_file(self.get_test_loc('contenttype/build/Makefile'))
开发者ID:pombredanne,项目名称:scancode-toolkit,代码行数:7,代码来源:test_contenttype.py


示例8: test_compiled_python_4

 def test_compiled_python_4(self):
     test_dir = self.extract_test_zip('contenttype/compiled/python/compiled.zip')
     assert 'python 2.5 byte-compiled' == get_filetype(os.path.join(test_dir, 'extract.pyc'))
     assert not is_source(os.path.join(test_dir, 'extract.pyc'))
     assert not is_text(os.path.join(test_dir, 'extract.pyc'))
     assert 'application/octet-stream' == get_mimetype_file(os.path.join(test_dir, 'extract.pyc'))
     assert '' == get_filetype_pygment(os.path.join(test_dir, 'extract.pyc'))
开发者ID:pombredanne,项目名称:scancode-toolkit,代码行数:7,代码来源:test_contenttype.py


示例9: test_text_log

 def test_text_log(self):
     assert not is_source(self.get_test_loc('contenttype/text/windowserver.log'))
     assert is_text(self.get_test_loc('contenttype/text/windowserver.log'))
     assert '' == get_filetype_pygment(self.get_test_loc('contenttype/text/windowserver.log'))
     assert 'ascii text' == get_filetype(self.get_test_loc('contenttype/text/windowserver.log'))
     assert 'ASCII text' == get_filetype_file(self.get_test_loc('contenttype/text/windowserver.log'))
     assert 'text/plain' == get_mimetype_file(self.get_test_loc('contenttype/text/windowserver.log'))
开发者ID:pombredanne,项目名称:scancode-toolkit,代码行数:7,代码来源:test_contenttype.py


示例10: test_doc_html_3

 def test_doc_html_3(self):
     assert is_source(self.get_test_loc('contenttype/doc/html/Label.html'))
     assert is_text(self.get_test_loc('contenttype/doc/html/Label.html'))
     assert 'HTML' == get_filetype_pygment(self.get_test_loc('contenttype/doc/html/Label.html'))
     assert 'html language text' == get_filetype(self.get_test_loc('contenttype/doc/html/Label.html'))
     assert 'text/html' == get_mimetype_file(self.get_test_loc('contenttype/doc/html/Label.html'))
     assert 'HTML document, ASCII text, with very long lines' == get_filetype_file(self.get_test_loc('contenttype/doc/html/Label.html'))
开发者ID:pombredanne,项目名称:scancode-toolkit,代码行数:7,代码来源:test_contenttype.py


示例11: test_doc_html_2

 def test_doc_html_2(self):
     assert is_source(self.get_test_loc('contenttype/doc/html/allclasses-frame.html'))
     assert is_text(self.get_test_loc('contenttype/doc/html/allclasses-frame.html'))
     assert 'HTML' == get_filetype_pygment(self.get_test_loc('contenttype/doc/html/allclasses-frame.html'))
     assert 'html language text' == get_filetype(self.get_test_loc('contenttype/doc/html/allclasses-frame.html'))
     assert 'text/html' == get_mimetype_file(self.get_test_loc('contenttype/doc/html/allclasses-frame.html'))
     assert 'HTML document, ASCII text' == get_filetype_file(self.get_test_loc('contenttype/doc/html/allclasses-frame.html'))
开发者ID:pombredanne,项目名称:scancode-toolkit,代码行数:7,代码来源:test_contenttype.py


示例12: test_code_groff

 def test_code_groff(self):
     assert not is_special(self.get_test_loc(u'contenttype/code/groff/example.ms'))
     assert is_text(self.get_test_loc(u'contenttype/code/groff/example.ms'))
     assert 'Groff' == get_filetype_pygment(self.get_test_loc(u'contenttype/code/groff/example.ms'))
     assert 'groff language text' == get_filetype(self.get_test_loc(u'contenttype/code/groff/example.ms'))
     assert 'text/troff' == get_mimetype_python(self.get_test_loc(u'contenttype/code/groff/example.ms'))
     assert 'text/troff' == get_mimetype_file(self.get_test_loc(u'contenttype/code/groff/example.ms'))
     assert get_filetype_file(self.get_test_loc(u'contenttype/code/groff/example.ms')).startswith('troff or preprocessor input')
开发者ID:pombredanne,项目名称:scancode-toolkit,代码行数:8,代码来源:test_contenttype.py


示例13: test_contenttype_fifo

 def test_contenttype_fifo(self):
     test_dir = self.get_temp_dir()
     myfifo = os.path.join(test_dir, 'myfifo')
     import subprocess
     if subprocess.call(['mkfifo', myfifo]) != 0:
         self.fail('Unable to create fifo')
     assert os.path.exists(myfifo)
     assert is_special(myfifo)
     assert 'FIFO pipe' == get_filetype(myfifo)
开发者ID:pombredanne,项目名称:scancode-toolkit,代码行数:9,代码来源:test_contenttype.py


示例14: test_text_license_credits

 def test_text_license_credits(self):
     # FIXME
     assert 'css+lasso language text' == get_filetype(self.get_test_loc('contenttype/text/CREDITS'))
     assert is_text(self.get_test_loc('contenttype/text/CREDITS'))
     # FIXME: incorrect
     assert is_source(self.get_test_loc('contenttype/text/CREDITS'))
     # FIXME: incorrect
     assert 'CSS+Lasso' == get_filetype_pygment(self.get_test_loc('contenttype/text/CREDITS'))
     assert 'ISO-8859 text' == get_filetype_file(self.get_test_loc('contenttype/text/CREDITS'))
     assert 'text/plain' == get_mimetype_file(self.get_test_loc('contenttype/text/CREDITS'))
开发者ID:pombredanne,项目名称:scancode-toolkit,代码行数:10,代码来源:test_contenttype.py


示例15: test_code_groff

 def test_code_groff(self):
     assert not is_special(self.get_test_loc(u'contenttype/code/groff/example.ms'))
     assert is_text(self.get_test_loc(u'contenttype/code/groff/example.ms'))
     assert 'Groff' == get_filetype_pygment(self.get_test_loc(u'contenttype/code/groff/example.ms'))
     assert 'groff language text' == get_filetype(self.get_test_loc(u'contenttype/code/groff/example.ms'))
     # the Apache mimes do not have .ms in their types
     # but the type is still mysteriously returnedd on Windows
     assert '' == get_mimetype_python(self.get_test_loc(u'contenttype/code/groff/example.ms'))
     assert 'text/troff' == get_mimetype_file(self.get_test_loc(u'contenttype/code/groff/example.ms'))
     assert get_filetype_file(self.get_test_loc(u'contenttype/code/groff/example.ms')).startswith('troff or preprocessor input')
开发者ID:10imaging,项目名称:scancode-toolkit,代码行数:10,代码来源:test_contenttype.py


示例16: test_package_rubygem

 def test_package_rubygem(self):
     assert 'posix tar archive' == get_filetype(self.get_test_loc('contenttype/package/rubygems-update-1.4.1.gem'))
开发者ID:pombredanne,项目名称:scancode-toolkit,代码行数:2,代码来源:test_contenttype.py


示例17: test_package_rpm

 def test_package_rpm(self):
     assert 'rpm v3.0 bin i386/x86_64' == get_filetype(self.get_test_loc('contenttype/package/wget-1.11.4-3.fc11.i586.rpm'))
开发者ID:pombredanne,项目名称:scancode-toolkit,代码行数:2,代码来源:test_contenttype.py


示例18: test_package_python_egg

 def test_package_python_egg(self):
     assert is_binary(self.get_test_loc('contenttype/package/TicketImport-0.7a-py2.5.egg'))
     assert is_archive(self.get_test_loc('contenttype/package/TicketImport-0.7a-py2.5.egg'))
     assert 'zip archive data, at least v2.0 to extract' == get_filetype(self.get_test_loc('contenttype/package/TicketImport-0.7a-py2.5.egg'))
开发者ID:pombredanne,项目名称:scancode-toolkit,代码行数:4,代码来源:test_contenttype.py


示例19: test_package_java_war

 def test_package_java_war(self):
     assert is_binary(self.get_test_loc('contenttype/package/c.war'))
     assert is_archive(self.get_test_loc('contenttype/package/c.war'))
     assert 'zip archive data, at least v1.0 to extract' == get_filetype(self.get_test_loc('contenttype/package/c.war'))
开发者ID:pombredanne,项目名称:scancode-toolkit,代码行数:4,代码来源:test_contenttype.py


示例20: test_script_install

 def test_script_install(self):
     assert 'ascii text' == get_filetype(self.get_test_loc('contenttype/script/install'))
开发者ID:pombredanne,项目名称:scancode-toolkit,代码行数:2,代码来源:test_contenttype.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python typeguard.check_argument_types函数代码示例发布时间:2022-05-27
下一篇:
Python typecheck.optional函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap