Saravanan666/pypi-org huggingface dataset:
Package: pyhtmlproofer
pyhtmlprooferCheck for website and static HTML pages for link rot.Featurespyhtmlproofer can be used onStatic HTML pages (typically generated by an SSG). You can specify either files or directories to be checked.Webpages, you can specify a URL/link to be checked.pyhtmlproofer at the moment does the following:Checks for broken internal links in HTML filesChecks if external links in HTML or website link are validCheck for scripts / stylesheets in HTML filesCheck for images in HTML filesYou can read more details below inWhat's Tested?section.RoadmapThe follower features are under development:Check for images and alt-text in HTML filesCheck FaviconsCheck optimal SEO meta tagsCaching resultsConfig fileInstallationInstall pyhtmlproofer with pip:pip install pyhtmlprooferWhat's tested?You can configure pyhtmlproofer to check:a filea directory or list of directoriesa URL / LinkLinks / Hyperlinksa,linkelements: pyhtmlproofer checks-If the internal links are validIf the internal references (#in-page-links) are validIf the external links are validImagesimgelements: pyhtmlproofer checks-if the internal image references are validif the external image references are validScriptsscriptelements: pyhtmlproofer checks-If the internal script references are validIf the external script references are reachableUsagea) To check a file:importpyhtmlprooferasprooferfile="path/to/file1.html"proofer.file(file).check()b) To check a directories:importpyhtmlprooferasprooferdirectory_paths=["path/to/1/file.html","path/to/2/file.html"]proofer.directories(directory_paths).check()c) To validate URL(s):importpyhtmlprooferasprooferlinks=["https://example.com","https://cloudbytes.dev"]proofer.links(links).check()CLIThere is also a CLI that can be used:$pyhtmlproofercheck-F<file_name>Available Config OptionsPROOFER_DEFAULTS={"assume_extension":".html","directory_index_file":"index.html","disable_external":False,"ignore_files":[],"ignore_urls":[],"enforce_https":True,"extensions":[".html"],"log_level":"ERROR","report_to_file":True,"report_filename":"proofer_report",}You can override the default configuration options by passing a dictionary of options.importpyhtmlprooferasprooferoptions={"log_level":"ERROR","disable_external":True}directory_paths=["path/to/1/file.html","path/to/2/file.html"]proofer.directories(directory_paths,,options=options).check()CreditsThe inspiration was by Ruby basedHTMLProoferand lack of Python based alternatives. Although,pyhtmlprooferis not a Python rewrite, instead it focuses on solving problems that I encountered while maintainingCloudBytes/Dev>website.
Package: pyhtmlreport
pyhtmlreportOften open source Test Automation projects lack a good reporting solution, pyhtmlreport solves that by creating HTML reports and represents the output as steps with screenshots.RequirementsRequires Python 3.7 or higher.Access to Internet, materlizecss (https://materializecss.com/) is used to style the html report and accessed via cdn.How to Installpip install pyhtmlreportGetting Started GuideOnce you have installed pyhtmlreport - how do you get started?Import the Report class and create a Report instance.Call the setup method.ParametersReport Folder: Root report folder to contain all test reports.Module Name: Name of the application, a module within the application or a function.Release Name: Application Release cycle.Maximum Screenshots: By default, the number of screenshots for a Report instance is 1000. This parameter can be used to increase the number.Selenium Webdriver: Screenshots are taken using the pillow library. If an instance of Selenium Webdriver is provided, the brower viewport is taken as screenshot using Selenium's save_screenshot method.Start writing to the test report by using the write_step method. The first step should have theStartstatus, it signals the start of a test to the report instance.ParametersStep: Description (Expected or Actual Step Description).Status: Start, Pass, Fail and Warn.Screenshot: Optional flag to capture screenshot for a step.Call the generate_report method at the end to generate the HTML report.frompyhtmlreportimportReportfromselenium.webdriverimportChromefromselenium.webdriver.common.keysimportKeysreport=Report()driver=Chrome()report.setup(report_folder=r'D:\Automation\Reports',module_name='Google',release_name='Release 1',selenium_driver=driver)driver.get('https://www.google.com/')try:# Start of Testreport.write_step('Testing Search functionality',status=report.status.Start,test_number=1)search_box=driver.find_element_by_css_selector('input[aria-label="Search"]')search_box.send_keys('pyhtmlreport is Awesome')search_box.send_keys(Keys.ENTER)# Test Stepsresults=driver.find_elements_by_css_selector('div[id="search"] div[class="g"]')assertlen(results)>1report.write_step('Google Search returned more than 1 results',status=report.status.Pass,screenshot=True)exceptAssertionError:report.write_step('Google Search did not return any result',status=report.status.Fail,screenshot=True)exceptExceptionase:report.write_step(f'Something went wrong during execution!</br>{e}',status=report.status.Warn,screenshot=True)finally:report.generate_report()driver.quit()
Package: py-html-table
py-html-table PackageThis is a simple package which uses beautifulSoup to extract HTML Table data along which has rowspan.Installationpip install py-html-tableDeclareimport py_html_table.py_html_table as pyhtParametersParameterMeaningSample Valuestablepython variable containing html code of tableany variable namebeginNo.of rows to begin scrapping. Starts from 02colTotal No.of columns in the table. Starts from 15outputType of output that you needlist (or) dataframe (or) csvraw'Y' to get exact content inside table cell. 'N' to get only text'Y' or 'N'NOTE: All variable names has to be provided as input to the packageUsage Exampleimport requestsfrom bs4 import BeautifulSoupimport requests_htmlimport lxml.html as lhimport py_html_table.py_html_table as pyhturl = 'https://en.wikipedia.org/wiki/List_of_Presidents_of_the_United_States'session = requests_html.HTMLSession()r = session.get(url)content = BeautifulSoup(r.content, 'lxml')all_tables = content.select(".wikitable")table = all_tables[0]col = 9begin = 2output = 'dataframe'raw = 'N'pyht.extract(table,begin,col,output,raw)
Package: pyhtmltext
pyhtmltextpyhtmltext is a usefull and flexible tool for extracting text from html.HelpSeedocumentationfor more details.Installationpip install pyhtmltextSimple usagefrom pyhtmltext import Extractor


  html_string = '''<h2 class="widget-title"><span aria-hidden="true" class="icon-get-started"></span>Getting Started</h2><p>Python can be easy to pick up whether you're a first time programmer or you're experienced with other languages. The following pages are a useful first step to get on your way writing programs with Python!</p>'''

  extractor = Extractor(html=html_string)

  # Extracting whole text from html with separator
  extractor.extract_text()
  #> "Getting Started|separator|Python can be easy to pick up whether you're a first time programmer or you're experienced with other languages. The following pages are a useful first step to get on your way writing programs with Python!"

  # Extracting sentences from html
  extractor.extract_sentences()
  #> ['Getting Started', "Python can be easy to pick up whether you're a first time programmer or you're experienced with other languages.", 'The following pages are a useful first step to get on your way writing programs with Python!']
Package: pyhtrie
Hash trieIntroductionHash trie is an enhanced Trie
data structure stores keyword indexes for faster keyword lookup. The storage is done in such a way that it does efficient memory usage and faster lookup.UsageImporting and instantiatingfrom pyhtrie.htrie import Trie
trie = Trie()IndexingSyntax : trie.index_text(data,keyword_to_index)data: Data can be any data to indexkeyword_to_index: Keyword associated with thedataindexedtrie.index_text('car','car')
trie.index_text('cat','cat')
trie.index_text('cast','cast')
trie.index_text('Batman', 'batman')
trie.index_text('Bash', 'bash')Prefix matchSyntax : trie.prefix_match(prefix_text_to_search)The function returns all data matching the prefix textprefix_text_to_search: Will be the prefix text on which the search will be performed. If there are no nodes matching the route of the prefix text then it will return an empty arraytrie.prefix_match('ca')Pattern matchSyntax : trie.pattern_match(pattern_text_to_search)This function returns all data associated with the text pattern. When compared to the prefix_match function, this function need not necessarily require thepattern_text_to_searchto match with the prefix of the keyword to be searched for. Thepattern_text_to_searchcan appear anywhere within the keywordpattern_text_to_search: Is the text pattern to be searched.trie.pattern_match('at')Storage detailsThe keywords to be indexed are stored in a Trie data structure as can be seen in the image below. However for faster indexing of pattern match within keywords, each node in the trie is added to the hash-map with the letter corresponding to the node being the key.So if you need to search for any words beginning with 'ca', thenprefix_match('ca')will return[cat, car, cast]as in a regular trie. However, if you want to search for any words with 'at' in them, you can use the functionpattern_match('as')that will return[cat, batman]. The prefix match is done with the help of the hash-map. When a prefix match of'at'is done, the hash-map is checked for the letter'a'in'at'. This returns a list of three a nodes[a,a,a]each pointing to a correspinding'a'node in the tries as shown in the figure above. Then each of them are traversed to see which of them have the next node as't'of'at'. The result will be the't'of'cat'and the't'preceding'm'in'batman'. Then the algorithm performs a collection operation from each of these 't's returned to retrieve keywords stored under those t's. The result, as can be inferred from the figure above, will be[cat, batman]
Package: pyhts
pyhtsA python package for hierarchical forecasting, inspired by thehtspackage in R.FeaturesSupport pupular forecast reconciliation models in the literature, e.g. ols, wls, mint et al. Forecasting with temporal hierarchies will be supported in the future.Multiple methods for the construction of hierarchy.Use different base forecasters for different hierarchical levels.Sklearn-like API.Quick DemoLoad the Australia tourism flows data.frompyhtsimportload_tourismtourism_data=load_tourism()train=tourism_data.iloc[:,4:-12].T.valuestest=tourism_data.iloc[:,-12:].T.valuesDefine the hierarchy.frompyhtsimportHierarchyhierarchy=Hierarchy.new(tourism_data,[('state','region','city')])print(hierarchy.node_name)Create an ols forecasting reconciliation model with sklearn-like API.frompyhtsimportHFModelmodel_ols=HFModel(hierarchy=hierarchy,base_forecasters="arima",hf_method="comb",comb_method="ols")Fit the model and produce forecasts.model_ols.fit(train)ols=model_ols.predict(horizon=12)model.fit()fits thebaseforecastersand computes the weighting matrix used to reconcile the base forecasts.model.predict()calculates the base forecasts for all levels and reconciles the base forecasts.Obtain coherent forecasts of all the hierarchical levels.all_level_ols=hierarchy.aggregate_ts(ols)fit other methods using fitted base forecastersmodel_wlss=HFModel(hierarchy,base_forecasters=model_ols.base_forecasters,hf_method="comb",comb_method="wls",weights="structural")model_wlss.fit(train)wlss=model_wlss.predict(horizon=12)model_wlsv=HFModel(hierarchy,base_forecasters=model_ols.base_forecasters,hf_method="comb",comb_method="mint",weights="variance")model_wlsv.fit(train)wlsv=model_wlsv.predict(horizon=12)model_shrink=HFModel(hierarchy,base_forecasters=model_ols.base_forecasters,hf_method="comb",comb_method="mint",weights="shrinkage")model_shrink.fit(train)shrink=model_shrink.predict(horizon=12)Evaluate the forecasting accuracy.# accuracy of reconciled forecastsaccuracy=[hierarchy.accuracy(test,fcast,hist=train,measure=['mase','rmse'])forfcastin(ols,wlss,wlsv,shrink)]# accuracy of base forecastsbase_forecasts=model_ols.generate_base_forecast(horizon=12)accuracy_base=hierarchy.accuracy_base(test,base_forecasts,hist=train,measure=['mase','rmse'])Because of the incoherence of base forecasts,base_forecastsare forecasts of all time series in the hierarchy, while coherentforecastsare forecasts of the bottom-level time series.DocumentationSee documentationhere.
Package: pyhttpfs
pyhttpfsHave you ever wanted a method of exploring a filesystem from a browser?
Perhaps for a quick development server, or for something more advanced such as a download server.PyHTTPFS is designed to be just that, a filesystem explorer for HTTP.PyHTTPFS is heavily based on the JS modulehttp-server,available here. It is meant to be very lightweight and efficient, while also being robust and configurable.Getting startedIn order to get started, first clone the repository, ensure you have Python 3.7+, and then follow these instructions:Install the requirements fromreqs.txt(pip install -r reqs.txt)Ensure you have python scripts on your PATHTo begin hosting the server, you can simply runpyhttpfsfrom your terminal.
To customize the shared location, pass the-llocation and specify a new one. For example,pyhttpfs -l /homewould share the/homefolder.It is also worth noting that by default,PyHTTPFS runs on port 8080.ConfigurationIn order to fully use PyHTTPFS to it's maximum potential, you'll have to configure it. The following options are available to you:-bor--bind, to bind to a specific address (eg.-b 127.0.0.1)-por--port, to bind to a specific port (eg.-p 80)-lor--dir, to share a specific location (eg.-l /home)
Package: py-https
py-httpsA simple python https serverINSTALLATION:pip install py-httpsUSAGE:As a module from any locationpython3 -m pyhttps [-option value] [port]In scriptfrom pyhttps import startserver

 startServer(host,port,cert,key)
 ##cert : certificate file location
 ##key  : key file locationOPTIONS:--v             Version Info(**)
--help          Help and usage Info(**)
-p              Port Number [Port 443,80 may require sudo or elivated permissions]
-h              Host address
-c              ssl cert file location
-k              ssl key file location
-gencert        Auto Generate SSL Cert and Key(#)
(-gencert [Value]: Target Path for generating certificates)

** [No value needed for these type of options]
#  [Optional value for this type of option]

>>> openssl must be installed and included in PATH for -gencert]
Package: pyhttpstatus-utils
pyhttpstatus-utilsExtension of Python Standard Library’shttp.HTTPStatusproviding mapping of HTTP statuses.BadgesdocsinfotestspackageotherInstallpipinstallpyhttpstatus-utilsFunctionscreate_http_status_dict(override_dict=None): Create HTTP Status Dictionary with Overrides if provided.get_http_status_desc(http_status_code): Get HTTP status code description.get_http_status_name(http_status_code): Get HTTP status code name.get_http_status_phrase(http_status_code): Get HTTP status code phrase.get_http_status_type(http_status_code): Get HTTP status code type.is_http_status_successful(http_status_code): Check if HTTP Status Code is type Successfulis_http_status_type(http_status_code): Match if provided HTTP Status Code is expected HTTP Status Code Type.validate_http_code(http_code, minimum=100, maximum=599, strict=True, default_http_code=0): Validate HTTP code. If strict, throw, else just return default_http_code.DictionariesHTTP_STATUS_DICT: Extracted fromhttp.HTTPStatus, a dictionary of each HTTP Status’ name, code, phrase, and description.HTTP_STATUS_PHRASE_DICT: Phrases of HTTP status codes.HTTP_STATUS_DESC_DICT: Description of HTTP status codes.HTTP_STATUS_TYPE_DICT: Types of HTTP status codes.Enum ClassesHttpStatusCode: Static enumeration of HTTP status mapping names to codesHttpStatusType: Static enumeration of HTTP status mapping types to phraseHttpStatusCodeType: Int enumeration of HTTP status mapping types to codesHTTP Status Code Types100: HttpStatusType.INFORMATIONAL,200: HttpStatusType.SUCCESSFUL,300: HttpStatusType.REDIRECTION,400: HttpStatusType.CLIENT_ERROR,500: HttpStatusType.SERVER_ERRORRequirementspyhttpstatus-utilsmodule is built upon Python 3 and has dependencies upon
several Python modules available withinPython Package Index PyPI.makeinstall-requirementsorpython3-mpipuninstall--yes--no-input-rrequirements.txtpython3-mpipinstall--upgrade-rrequirements.txtRelease History0.3.3 (2018-02-20)Python 2.7 supportedTravis CI testing both Python 2.7 and 3.6.Backport Python 3.6 http.HttpStatus for support in Python 2.7 to Python 3.4.0.3.2 (2018-02-16)migrate to github/TuneLab0.3.1 (2018-01-25)migrate to github/tuneinc0.2.2 (2017-12-10)readthedocs.org0.2.0 (2017-12-05)README.rstTestsTravis CI0.1.1 (2016-11-22)Makefile and yapf cleanup0.1.0 (2016-11-17)Initial CodeCode pulled from TuneLab/tune-mv-integration-python0.0.1 (2016-11-17)Initial commit
Package: pyhttptest
Pissed about writing test scripts against your RESTFul APIs anytime?Describe an HTTP Requests test cases in a simplest and widely used format JSON within a file.Run one command and gain a summary report.📣📣Coverage measuring on Test Cases coming soon📣InstallationRecommended installation method is to usepip:$pipinstallpyhttptestPython version3+is required.Usage$pyhttptestexecuteFILESee alsopyhttptest--help.ExamplesSingle test caseCreate a .json file and define a test case like an example:FILE: HTTP_GET.json{"name":"TEST: List all users","verb":"GET","endpoint":"users","host":"https://github.com","headers":{"Accept-Language":"en-US"},"query_string":{"limit":5}}Execute a test case:$pyhttptestexecuteFILE_PATH/HTTP_GET.jsonResult:Мultiple test casesCreate a .json file and define a test cases like an example:FILE: requests.json[{"name":"TEST: List all users","verb":"GET","endpoint":"api/v1/users","host":"http://localhost:8085/","headers":{"Accept-Language":"en-US"},"query_string":{"limit":1}},{"name":"TEST: Add a new user","verb":"POST","endpoint":"api/v1/users","host":"http://localhost:8085/","payload":{"username":"pyhttptest","email":"admin@pyhttptest.com"}},{"name":"TEST: Modify an existing user","verb":"PUT","endpoint":"api/v1/users/XeEsscGqweEttXsgY","host":"http://localhost:8085/","payload":{"username":"pyhttptest"}},{"name":"TEST: Delete an existing user","verb":"DELETE","endpoint":"api/v1/users/XeEsscGqweEttXsgY","host":"http://localhost:8085/"}]Execute a test case:$pyhttptestexecuteFILE_PATH/requests.jsonResult:DependenciesUnder the hood, pyhttptest uses these amazing libraries:ijson— Iterative JSON parser with a standard Python iterator interfacejsonschema— An implementation of JSON Schema validation for PythonRequests— Python HTTP library for humanstabulate— Pretty-print tabular dataclick— Composable command line interface toolkitContributingSeeCONTRIBUTING.ChangelogSeeCHANGELOG.LicenceBSD-3-Clause:LICENSE.AuthorsIliyan Slavov
Package: pyhtzee
pyhtzeeYahtzee game engine supporting regular Yahtzee rules (maximum 1480), Joker rules
(maximum 1575) and Yatzy aka. Scandinavian Yahtzee rules (maximum 305). Example code:frompyhtzeeimportPyhtzeefrompyhtzee.classesimportCategory,Rulefrompyhtzee.utilsimportcategory_to_action_map,dice_roll_to_action_mappyhtzee=Pyhtzee(rule=Rule.FREE_CHOICE_JOKER)print(pyhtzee.dice)This shows the dice:[2, 5, 6, 1, 6]Next reroll dice 1, 2 and 5:action=dice_roll_to_action_map[(True,True,False,False,True)]pyhtzee.take_action(action)print(pyhtzee.dice)Now we have two pairs:[4, 6, 6, 1, 1]Let's reroll just the first die to see if we can get a full house:action=dice_roll_to_action_map[(True,False,False,False,False)]pyhtzee.take_action(action)print(pyhtzee.dice)Bingo![6, 6, 6, 1, 1]Now let's choose the action for full house and check the scorecard:action=category_to_action_map[Category.FULL_HOUSE]reward=pyhtzee.take_action(action)print(f'Reward:{reward}, Scorecard:{pyhtzee.scores}')This shows that we got a reward of 25, which can be confirmed in the scorecard:Reward: 25, Scorecard: {<Category.FULL_HOUSE: 8>: 25}Developers guidePipenv is recommended for setting up a development environment. Prior to installingpipenv, creating a.envfile with the following contents is recommended:PYTHONPATH=.To install pipenv and the required dependencies run the following commands:pipinstallpipenv
pipenvinstall-rrequirements.txt
pipenvshellUpdating dependenciesrequirements.txtis dynamically generated usingpip-compile. To regenerate therequirements.txtfile run the following command:pip-compile-U--output-filerequirements.txtsetup.pyrequirements-dev.inPre-commit hooksThis project uses Git pre-commit hooks courtesy ofpre-commit. To install run the following:pre-commitinstall
Package: pyhubctl
PyHubCtlPython wrapper for the uhubctl project.Quick StartInstallationpyhubctlrequiresuhubctlto be installed and on PATH for your system. Follow the guide provided
byuhubctlhere:https://github.com/mvp/uhubctl#compilingAttempts to run this library without proper installation ofuhubctlwill result in errors being
thrown.Install from PyPI:pip install pyhubctlInstall from source:git clone https://github.com/DuraTech-Industries/pyhubctl.git
cd pyhubctl
pip install .Quick Startpyhubctlhas two main classes for use:PyHubCtlandConfiguration. They’re both pretty
self-explanatory, butPyHubCtlis what you use to runuhubctl, andConfigurationis what you
use to configure howuhubctlruns.Configurationcontains attributes that correspond directly to the argumentsuhubctlexpects.
Pass an instance of this class to the run method ofPyHubCtl. This run method will return whatuhubctloutputs, or raise an error if something went wrong.As an example, here is how you might toggle all of the ports on a USB-hub:from pyhubctl import Configuration, PyHubCtl

phc = PyHubCtl()
phc.run(Configuration(location="1-4"))Or a specific set of ports:from pyhubctl import Configuration, PyHubCtl

phc = PyHubCtl()
phc.run(Configuration(location="1-4", ports="3,4"))Making Changes & ContributingThis project usespre-commit, please make sure to install it before making any
changes:pip install pre-commit
cd pyhubctl
pre-commit installIt is a good idea to update the hooks to the latest version:pre-commit autoupdate
Package: pyhubio
This library is used to communicate with configuration registers, status registers, AXI4-Stream and BRAM interfaces on Digilent USB104 A7 and Red Pitaya STEMlab boards:https://pavel-demin.github.io/usb104-a7-noteshttps://pavel-demin.github.io/red-pitaya-notesThis library uses thepython-libusb1library to communicate via the USB interface with the AXI4-Stream USB and AXI4-Stream hub modules on the Digilent USB104 A7 board:https://pavel-demin.github.io/usb104-a7-notes/usb-interfaceThis library uses thesocketlibrary to communicate via the Ethernet interface with the AXI4 hub module on the Red Pitaya STEMlab board:https://pavel-demin.github.io/red-pitaya-notes/axi-hub
Package: pyhubitat
pyhubitatA python library for interacting with the Hubitat APIHighlightsThis package is new and rapidly developing.  It currently exposes only the Hubitat "Maker API" which is limited to the functionality of the devices, not the hub.  The official Maker API docs can be foundhere.
Endpoints exposed include:Get All Devices (/devices)Get All Devices with Full Details (/devices/all)Get Device Info (/devices/[device ID])Get Device Event History (/device/[device ID]/events)Get Device Commands (/device/[device ID]/commands)Get Device Capabilities (/device/[device ID]/capabilities)Send Device Command (/device/[device ID]/[Command]/[Secondary Value])Installationpip install pyhubitatUsageInitializationfrom pyhubitat import MakerAPI
import pprint

HUB_TOKEN = os.environ['HUBITAT_TOKEN']
HUB_URL_EXAMPLE = 'https://192.168.1.39/apps/api/24'  # Follow the generic format of 'https://[hub-ip-address-or-hostname]/apps/api/[app-id]'

ph = MakerAPI(HUB_TOKEN, HUB_URL_EXAMPLE)Get Devicesdevices = ph.list_devices()
pprint.pprint(devices)Send Commandresponse1 = ph.send_command(5, "on")
response2 = ph.send_command(6, "setLevel", 50)Note about TLS/SSLThe Hubitat hub uses a self-signed root certificate for https and I see no reasonable way to add your own.  Despite this, it is still recommended that you enable login auth on the hub and use the https API url since your API token is sent with every request.