Saravanan666/pypi-org huggingface dataset:
Package: html-test-report
'Because testing should help, not constrain.'ExampleSource code:my_bugged_module.pydefmy_bugged_function():my_var={'a':'b'}1/0Test case:test.pyfromloggingimportgetLoggerfrommy_bugged_moduleimportmy_bugged_functionfromunittestimportTestCaseclassMyTestCase(TestCase):deftest(self):"""Test example."""print("Print something")getLogger().info("Log message")my_bugged_function()Result:Use as nose pluginnosetests--with-html-testtest
Package: html-testRunner
HtmlTest runner is a unittest test runner that save test results
in Html files, for human readable presentation of results.This Package was inspired inunittest-xml-reportingandHtmlTestRunner by tungwaiyip.Usage:importHtmlTestRunnerimportunittestclassTestStringMethods(unittest.TestCase):deftest_upper(self):self.assertEqual('foo'.upper(),'FOO')deftest_error(self):""" This test should be marked as error one. """raiseValueErrordeftest_fail(self):""" This test should fail. """self.assertEqual(1,2)@unittest.skip("This is a skipped test.")deftest_skip(self):""" This test should be skipped. """passif__name__=='__main__':unittest.main(testRunner=HtmlTestRunner.HTMLTestRunner(output='example_dir'))As simple as import the class an initialize it, it only have one request
parameter that is output, this one is use to place the report in a sub
direcotry inreportsdirectory.Links:Github
Package: html-testRunner-df
NOTE: This Package fork byhtml-testRunner==1.2.1and fixed some bug.
ifhtml-testRunnerrelease the new version, you should reinstall itpip installhtml-testRunner-UHtmlTest runner is a unittest test runner that save test results
in Html files, for human readable presentation of results.This Package was inspired inunittest-xml-reportingandHtmlTestRunner by tungwaiyip.Usage:importHtmlTestRunnerimportunittestclassTestStringMethods(unittest.TestCase):deftest_upper(self):self.assertEqual('foo'.upper(),'FOO')deftest_error(self):""" This test should be marked as error one. """raiseValueErrordeftest_fail(self):""" This test should fail. """self.assertEqual(1,2)@unittest.skip("This is a skipped test.")deftest_skip(self):""" This test should be skipped. """passif__name__=='__main__':unittest.main(testRunner=HtmlTestRunner.HTMLTestRunner(output='example_dir'))As simple as import the class an initialize it, it only have one request
parameter that is output, this one is use to place the report in a sub
direcotry inreportsdirectory.Links:Github
Package: htmltext
Bug PatchedHome-page: https://github.com/RobinZhangWhyCoding/htmltextAuthor: Robin ZhangAuthor-email: whycoding@outlook.comLicense: UNKNOWNDescription: HTMLText=========HTMLText is a simple tool to get main body text of articles in HTML web pages, such as news,bolg .etc.Installation:-------------pip install htmltextUsage:------from htmltext import HTMLTexttitle, text = HTMLText(html_data)Example:--------import requestsfrom htmltext import HTMLTextr = requests.get(url_of_the_article)title, text = HTMLText(r.content)print(title)print(text)Platform: UNKNOWNClassifier: Intended Audience :: DevelopersClassifier: License :: OSI Approved :: MIT LicenseClassifier: Programming Language :: PythonClassifier: Programming Language :: Python :: 2Classifier: Programming Language :: Python :: 3Classifier: Topic :: Software Development :: Libraries :: Python ModulesClassifier: Operating System :: OS IndependentDescription-Content-Type: text/markdown
Package: htmltextconvert
htmltextconvert renders HTML to plain text, for example to autogenerate a plain
text versions of HTML emails, or to index HTML documents for search.It differs from other packages in these ways:Pure Python, no dependenciesHigh quality, well tested codePermissive license (Apache)Renders the HTML to text suitable for an text/plain email body (it doesn’t
aim to convert to a structured text format like markdown, but rather at giving
a readable text-only representation of the rendered HTML).Usage:>>> import htmltextconvert
>>> print(
...     htmltextconvert.html_to_text(
...         """
...         <p>This is a paragraph.</p>
...         <p>This is another paragraph.</p>
...         """
...     )
... )
This is a paragraph

This is another paragraphhtmltextconvert handles the following HTML tags:Character entity references (&name;,&#nnnn;,&#xhhhh)Unordered lists (<ul>)Ordered lists (<ol>)Paragraphs (<p>)Block quotes (<blockquote>)Linebreaks (<br>)Links (<ahref="…">)Bold (<strong>)Italic (<em>)Code (<code>)
Package: html-to-csv
html2csvhtml2csvis a utility that extracts tables from HTML documents and converts them to CSV format, written in Python.SetupPython 3 is required (version >=3.6).  Installhtml2csvbypip.pip install html-to-csvYes, the package name ishtml-to-csvdue to collision ;-)ExamplesInput from the standard input, and output to the standard output.html2csvInput from a file, and output to the standard output.html2csv example.htmlInput from files, and output to a file.html2csv example1.html example2.html -o output.csvInput from the network, and output to the standard output.html2csv http://example.comUsageusage: html2csv [-h] [-o [OUTPUT]] [-e ENGINE] [-V] [input [input ...]]

Convert HTML table to CSV format.

positional arguments:
  input                 input sources (files, URLs, etc., default: standard
                        input)

optional arguments:
  -h, --help            show this help message and exit
  -o [OUTPUT], --output [OUTPUT]
                        output target (default: standard output)
  -e ENGINE, --engine ENGINE
                        HTML parser engine (default: html.parser or lxml if
                        installed)
  -V, --version         display versionAuthor and ContactWentao Han (wentao.han@gmail.com)
Package: html-to-draftjs
HTML to DraftJSConvert HTML into DraftJS JSON format.Installationpip install html-to-draftjsUsagefromhtml_to_draftjsimporthtml_to_draftjsjson=html_to_draftjs("""<h1>My Page</h1><h2>Introduction</h2><p>Some <em>content</em> that is pretty <strong>interesting</strong></p><p>Don't forget to <a href="https://example.com">follow me!</a></p><h2>Illustration</h2><p><img src="https://example.com/image.png" alt="image" /></p>""")APIhtml_to_draftjs(raw_html_content: str[, features="lxml", strict=False]) -> dictConverts a given HTML input into JSON.featuresthe features for the HTML tree-builder. By default it is set tolxmlwhich is fast and powerful.strict(boolean), if false, it will only warn on invalid operations. If true, it will raise errors.soup_to_draftjs(bs_object: BeautifulSoup[, strict=False]) -> dictConverts a given beautiful soup into JSON. Useful if you have to select a given part of the HTML content to convert it (e.g.#content).strict(boolean), if false, it will only warn on invalid operations. If true, it will raise errors.Supported Tags and AttributesBlocks<div>,<p><h1>...<h6><blockquote><li>and<ol>(doesn't support<ul>grouping)Doesn't support thealignattribute.Inline Styling<strong>,<b><em>,<i>Entities<img src="url" [alt="alt"] [height="123"] [width="123"]><a href="url"><br/>Doesn't support thetitleandalignattributes.Development./setup.py develop
pip install -r requirements_dev.txt
Package: html-to-editorjs
HTML to Editor.js JSONConvert HTML toEditor.jsJSON formatInstallationpip install html_to_editorjsUsagefromhtml_to_editorjsimportparsejson=parse("""<h1>My Page</h1><h2>Introduction</h2><p>Some <em>content</em> that is pretty <strong>interesting</strong></p><p>Don't forget to <a href="https://example.com">follow me!</a></p><h2>Illustration</h2><img src="https://example.com/image.png" alt="image"/>""")Supported blocksParagraph (p)Header (h1, h2, h3, h4, h5)List (ul, ol)Image (img, figure, figcaption)
Package: html-to-etree
=============html to etree=============.. image:: https://img.shields.io/pypi/v/html-to-etree.svg:target: https://pypi.python.org/pypi/html-to-etree.. image:: https://img.shields.io/pypi/pyversions/html-to-etree.svg:target: https://pypi.python.org/pypi/html-to-etree.. image:: https://img.shields.io/travis/fluquid/html-to-etree.svg:target: https://travis-ci.org/fluquid/html-to-etree.. image:: https://codecov.io/github/fluquid/html-to-etree/coverage.svg?branch=master:alt: Coverage Status:target: https://codecov.io/github/fluquid/html-to-etree.. image:: https://requires.io/github/fluquid/html-to-etree/requirements.svg?branch=master:alt: Requirements Status:target: https://requires.io/github/fluquid/html-to-etree/requirements/?branch=masterparse html to lxml etreeconvenience methods for parsing html documents to lxml etree.lxml has limited capabilities for handling different encodings, and thislibrary is intended as a reusable utility parsing byte-code html responsesinto ElementTrees using sane character decoding.* Free software: BSD license* Python versions: 2.7, 3.4+Features--------* parse html to lxml etree* handle character decodingQuickstart----------* `tree = parse_html_bytes(body=body_bytes, content_type='text/html')`* `tree = parse_html_unicode(uni_string=body_unicode)`Credits-------This package was created with Cookiecutter_ and the `codinguncut/cookiecutter-pypackage`_ project template... _Cookiecutter: https://github.com/audreyr/cookiecutter=======History=======0.2.0 (2017-06-07)------------------0.1.0-dev (unreleased)----------------------* First release on PyPI.
Package: html-to-json
HTML to JSONConvert HTML and/or HTML tables to JSON.Installationpip install html-to-jsonUsageHTML to JSONimporthtml_to_jsonhtml_string="""<head><title>Test site</title><meta charset="UTF-8"></head>"""output_json=html_to_json.convert(html_string)print(output_json)When calling thehtml_to_json.convertfunction, you can choose to not capture the text values from the html by passing in the key-word argumentcapture_element_values=False. You can also choose to not capture the attributes of the elements by passingcapture_element_attributes=Falseinto the function.ExampleExample input:<head><title>Floyd Hightower's Projects</title><metacharset="UTF-8"><metaname="description"content="Floyd Hightower&#39;s Projects"><metaname="keywords"content="projects,fhightower,Floyd,Hightower"></head>Example output:{"head":[{"title":[{"_value":"Floyd Hightower's Projects"}],"meta":[{"_attributes":{"charset":"UTF-8"}},{"_attributes":{"name":"description","content":"Floyd Hightower's Projects"}},{"_attributes":{"name":"keywords","content":"projects,fhightower,Floyd,Hightower"}}]}]}HTML Tables to JSONIn addition to converting HTML to JSON, this library can also intelligently convert HTML tables to JSON.Currently, this library can handle three types of tables:A. Those withtable headersin the first row
B. Those with table headers in the first column
C. Those without table headersTables of type A and B are diagrammed below:ExampleThis code:importhtml_to_jsonhtml_string="""<table><tr><th>#</th><th>Malware</th><th>MD5</th><th>Date Added</th></tr><tr><td>25548</td><td><a href="/stats/DarkComet/">DarkComet</a></td><td><a href="/config/034a37b2a2307f876adc9538986d7b86">034a37b2a2307f876adc9538986d7b86</a></td><td>July 9, 2018, 6:25 a.m.</td></tr><tr><td>25547</td><td><a href="/stats/DarkComet/">DarkComet</a></td><td><a href="/config/706eeefbac3de4d58b27d964173999c3">706eeefbac3de4d58b27d964173999c3</a></td><td>July 7, 2018, 6:25 a.m.</td></tr></table>"""tables=html_to_json.convert_tables(html_string)print(tables)will produce this output:[[{"#":"25548","Malware":"DarkComet","MD5":"034a37b2a2307f876adc9538986d7b86","Date Added":"July 9, 2018, 6:25 a.m."},{"#":"25547","Malware":"DarkComet","MD5":"706eeefbac3de4d58b27d964173999c3","Date Added":"July 7, 2018, 6:25 a.m."}]]CreditsThis package was created withCookiecutterand fhightower'sPython project template.
Package: html-to-json-enhanced
HTML to JSONConvert HTML and/or HTML tables to JSON.Installationpip install html-to-jsonUsageHTML to JSONimporthtml_to_json_enhancedhtml_string="""<head><title>Test site</title><meta charset="UTF-8"></head>"""output_json=html_to_json_enhanced.convert(html_string)print(output_json)When calling thehtml_to_json.convertfunction, you can choose to not capture the text values from the html by passing in the key-word argumentcapture_element_values=False. You can also choose to not capture the attributes of the elements by passingcapture_element_attributes=Falseinto the function.ExampleExample input:<head><title>Floyd Hightower's Projects</title><metacharset="UTF-8"><metaname="description"content="Floyd Hightower&#39;s Projects"><metaname="keywords"content="projects,fhightower,Floyd,Hightower"></head>Example output:{"head":[{"title":[{"_value":"Floyd Hightower's Projects"}],"meta":[{"_attributes":{"charset":"UTF-8"}},{"_attributes":{"name":"description","content":"Floyd Hightower's Projects"}},{"_attributes":{"name":"keywords","content":"projects,fhightower,Floyd,Hightower"}}]}]}HTML Tables to JSONIn addition to converting HTML to JSON, this library can also intelligently convert HTML tables to JSON.Currently, this library can handle three types of tables:A. Those withtable headersin the first row
B. Those with table headers in the first column
C. Those without table headersTables of type A and B are diagrammed below:ExampleThis code:importhtml_to_json_enhancedhtml_string="""<table><tr><th>#</th><th>Malware</th><th>MD5</th><th>Date Added</th></tr><tr><td>25548</td><td><a href="/stats/DarkComet/">DarkComet</a></td><td><a href="/config/034a37b2a2307f876adc9538986d7b86">034a37b2a2307f876adc9538986d7b86</a></td><td>July 9, 2018, 6:25 a.m.</td></tr><tr><td>25547</td><td><a href="/stats/DarkComet/">DarkComet</a></td><td><a href="/config/706eeefbac3de4d58b27d964173999c3">706eeefbac3de4d58b27d964173999c3</a></td><td>July 7, 2018, 6:25 a.m.</td></tr></table>"""tables=html_to_json_enhanced.convert_tables(html_string)print(tables)will produce this output:[[{"#":"25548","Malware":"DarkComet","MD5":"034a37b2a2307f876adc9538986d7b86","Date Added":"July 9, 2018, 6:25 a.m."},{"#":"25547","Malware":"DarkComet","MD5":"706eeefbac3de4d58b27d964173999c3","Date Added":"July 7, 2018, 6:25 a.m."}]]CreditsThis package was created withCookiecutterand fhightower'sPython project template.
Package: htmltomd
htmltomdhtmltomd is a simple package for converting HTML to Markdown.Getting Startedpipinstallhtmltomdimporthtmltomdhtml="""<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>Title</title></head><body><div><h1><b>htmltomd</b></h1><br><p><i>htmltomd</i> is a simple package <br>for converting HTML to Markdown.</p><h2>Getting Started</h2><p>pip install htmltomd</p><h2>Source code</h2><p><a href="https://github.com/taptorestart/htmltomd" target="_black">github.com/taptorestart/htmltomd</a></p><p><figure><img src="image.png"><figcaption>Image</figcaption></figure></p></div></body></html>"""result=htmltomd.html_to_md(html)print(result)Result# **htmltomd***htmltomd*isasimplepackageforconvertingHTMLtoMarkdown.## Getting Startedpipinstallhtmltomd## Source code[github.com/taptorestart/htmltomd](https://github.com/taptorestart/htmltomd)![Image](image.png)
Package: html-to-mp3
html2mp3Generatemp3s from html text.A tiny cli I made on a fling.CLIBasic use:# CLI docshtml2mp3# Generate from a filehtml2mp3fileexamples/test1.htmltest1.mp3# Download from URLhtml2mp3urlhttps://text.npr.org/985359064# Download from URL, only generate voice from the text in the selector .paragraphs-containerhtml2mp3urlhttps://text.npr.org/985359064--select".paragraphs-container"Multiple files at once can be done (though the CLI could be improved to make this less verbose):html2mp3urlhttps://text.npr.org/985359064--select".paragraphs-container"&html2mp3urlhttps://text.npr.org/985347984--select".paragraphs-container"&html2mp3urlhttps://text.npr.org/985524494--select".paragraphs-container"&html2mp3urlhttps://text.npr.org/985032748--select".paragraphs-container"&html2mp3urlhttps://text.npr.org/985498425--select".paragraphs-container"&html2mp3urlhttps://text.npr.org/985336036--select".paragraphs-container"&html2mp3urlhttps://text.npr.org/976385244--select".paragraphs-container"&html2mp3urlhttps://text.npr.org/985470204--select".paragraphs-container"&html2mp3urlhttps://text.npr.org/985365621--select".paragraphs-container"&html2mp3urlhttps://text.npr.org/985296354--select".paragraphs-container"&html2mp3urlhttps://text.npr.org/985594759--select".paragraphs-container"&html2mp3urlhttps://text.npr.org/985125653--select".paragraphs-container"&html2mp3urlhttps://text.npr.org/985290016--select".paragraphs-container"&html2mp3urlhttps://text.npr.org/985400141--select".paragraphs-container"&html2mp3urlhttps://text.npr.org/984387402--select".paragraphs-container"&html2mp3urlhttps://text.npr.org/984614649--select".paragraphs-container"&html2mp3urlhttps://text.npr.org/985143101--select".paragraphs-container"&html2mp3urlhttps://text.npr.org/982223967--select".paragraphs-container"&html2mp3urlhttps://text.npr.org/985421813--select".paragraphs-container"&html2mp3urlhttps://text.npr.org/984870694--select".paragraphs-container"Running the above example (20 examples in total) took about 48s on my personal computer (47.72s user 0.74s system 480% cpu 10.094 total)You can do your own tests via:timesh-c'html2mp3 url https://text.npr.org/985359064 & html2mp3 url https://text.npr.org/985347984'TODOTestingMultiple files/urls at onceVoice generation settings
Package: htmltools
htmltoolsTools for creating, manipulating, and writing HTML from Python.InstallationpipinstallhtmltoolsTo install the latest development version from this repository:pipinstallhttps://github.com/rstudio/py-htmltools/tarball/mainDevelopmentIf you want to do development on htmltools for Python:pipinstall-e".[dev,test]"--config-settingseditable_mode=strict
Package: htmltools-hcn1z1
html-entitiesa python lib to encode a whole html src code into entitiesabouthave you ever wondered how to convert a whole html script to entities and yeah still everything works so fine? yes, this small module will help you to achieve your needs.before using the script. please consider readingrulessection to provide successful convertion from ASCII to entities.requirementspython 3.xbs4 (Beautiful Soup 4)usagefrom htmltools.entities import Encrypter,EncryptionHardOne
html = "some html here"
encryptContentOnly = Enctypter(html)
html = encryptContentOnly.encodingLetter()
encryptWholeScript = EncryptionHardOne(html)
html = encryptWholeScript.encodingLetterX()rulesbefore encoding the whole letter, please follow the next rules i setted myself:remove any unnecessary#, it breaks the encryption, for example:href="#".consider removing <style> Content </style> and add it after encryption to make the encryption works.always use base64 or email-embedded images instead of urls.if an image doesnt work when embedded to base64, please remove it from source code then add it later.
Package: htmltopdfy
HTML TO PDFConvert template html to pdfDetailed documentation is in the "docs" directory.Quick startInstall the module:pip install htmltopdfyEXAMPLEImport modulefrom htmltopdfy.job import htmlToPdfLet suppose we have a model like this:class User():
     name = models.CharField(max_length=200)
     age = models.CharField(max_length=20)
     cni = models.FileField(null=True,blank=True)Let's create useruser = User(name="dddd",age="23")
  user.save()We supposed we have a template named cni.html already designed on which we want to display name and agecni_file = htmlToPdf (
     media_root_url=settings.MEDIA_ROOT,
     file_name="cni",
     template_src = "cni.html",
     context_dict = {"name":"dddd","age":"20ans"}
  )
  user.cni.save("cni.pdf",cni_file)After you can print variablecniin console to see result or send url file on  your response view:print(user.cni)orreturn Response({"cni":user.cni.url})
Package: htmltotext
This package was written for a search engine, to allow it to extract the
textual content and metadata from HTML pages.  It tries to cope with
invalid markup and incorrectly specified character sets, and strips out
HTML tags (splitting words at tags appropriately).  It also discards the
contents of script tags and style tags.As well as text from the body of the page, it extracts the page title,
and the content of meta description and keyword tags.  It also parses
meta robots tags to determine whether the page should be indexed.The HTML parser used by this module was extracted from the Xapian search
engine library (and specifically, from the omindex indexing utility in
that library).
Package: html-tree-diff
Structure aware diff of XML and HTML documents.The intended use is to concisely show the edits that have been made in a
document, so that authors of html content can review their work.What do we mean by “HTML Tree Diff”?HTML:
The inputs to the diff function are HTML documentsTree:
It considers the full XML tree structure of the inputs, not just text based changes.Diff:
The output is human-readable HTML, using <ins> and <del> tags to show the changes.Command line interfaceYou can execute htmltreediff.cli directly as a python module, passing it html files to diff:$ python -m htmltreediff.cli one.html two.html
<h1>
  <del>
    one
  </del>
  <ins>
    two
  </ins>
</h1>Python APIYou can also use htmltreediff from within a python program as a library.For HTML Changes:>>> from htmltreediff import diff
>>> print diff('<h1>...one...</h1>', '<h1>...two...</h1>', pretty=True)
<h1>
  ...
  <del>
    one
  </del>
  <ins>
    two
  </ins>
  ...
</h1>And also for text-only changes:>>> print diff(
...     'The quick brown fox jumps over the lazy dog.',
...     'The very quick brown foxes jump over the dog.',
...     html=False,
... )
The <ins>very </ins>quick brown <del>fox jumps</del><ins>foxes jump</ins> over the<del> lazy</del> dog.Running the unit testsThe unit test suite requires the packagesnoseandcoverageto run. Just run therun_tests.shscript, and all the tests will run, with code coverage. Code coverage should always be at 100%.
Package: htmlutils
==========Html utils==========.. image:: https://travis-ci.org/zenwalker/python-htmlutils.svg:target: https://travis-ci.org/zenwalker/python-htmlutils:alt: Build StatusUsage=====tags.tag(content: str, **attrs) -> str--------------------------------------Render HTML tags as ``tags.h1('hello', _class='heading')``.htmlutils.parse_attrs(attrs: str) -> dict-----------------------------------------Parse a string like ``class="input" type="text" required`` into ``dict``.htmlutils.render_attrs(attrs: dict) -> str------------------------------------------Render ``dict`` to string like ``class="input" type="text" required``.Running tests=============::$ python -m unittest tests/test_html.py
Package: html-utils-becothal
HTML utilsRemoving Comments from filesComments are not being removed when:there is a"or a'in the same line.there is a[finalComment]in the Comment.
All other Comments are removed.Usagefile_model.removeComments(<SinglelineComments>,<MultilineCommentStart>,<MultilineCommentEnd>)jsFile.removeComments("//", "/*", "*/")UglifyUglify removes all the\nUsagefile_model.uglify()Change images to base64Replaces the source in<img>-Tags with the Base64 String of the image.
Accepted image types are:bmpgifjpegpngsvgUsagefile_model.imagesToBase64()