Saravanan666/pypi-org huggingface dataset:
Package: wtf-tortoise
WTF TortoiseForm generation utilities for Tortoise ORM Model class.
Based on the code found in wtforms.ext and provides a bridge between Tortoise ORM models and wtforms.Packaged fromSinisaos, who did all the work. Please support his efforts.For testing/direct usage, just download repo, unzip and put in root of your project.  Otherwise, just run:pip install wtf-toroise.Now you can import wtftortoise.orm like in edit example below.Example usage:fromtortoise.modelsimportModel
fromtortoiseimportfields


classBook(Model):id=fields.IntField(pk=True)title=fields.CharField(max_length=255)content=fields.TextField()created=fields.DatetimeField(auto_now_add=True)def__str__(self):returnself.titleclassMeta:ordering=["-id"]Generate a form based on the model.BookForm=model_form(Book)Properties from the model can be excluded from the generated form, or it can
include just a set of properties. For example:Generate a form based on the model, excluding 'id' and 'created'.BookForm=model_form(Book,exclude=['id','created'])Generate a form based on the model, only including 'title' and 'content'.BookForm=model_form(Book,only=['title','content'])The form can be generated setting field arguments:BookForm=model_form(Book,only=['title','content'],field_args={'title':{'label':'Your new label',},'content':{'label':'Your new label',}})Example implementation for an edit view using Starlette:# other importsfromwtftortoise.ormimportmodel_form

@app.route("/{id:int}/edit",methods=["GET","POST"])asyncdefedit(request):id=request.path_params.get("id",None)book=awaitBook.get(id=id)data=awaitrequest.form()BookForm=model_form(Book,exclude=["id","created"])form=BookForm(obj=book,formdata=data)ifrequest.method=="POST"andform.validate():form.populate_obj(book)awaitbook.save()returnRedirectResponse(url="/",status_code=302)returntemplates.TemplateResponse("edit.html",{"request":request,"form":form})Example template for above view using Jinja and Bootstrap:{%extends"base.html"%}{%blockcontent%}<mainrole="main"><br><br><divclass="container"><h2>EditBook</h2><br><formmethod="POST">{%forfieldinform%}<divclass="form-group">{{field.label}}:{{field(class="form-control")}}{%forerrorinfield.errors%}<spanstyle="color: red;">*{{error}}</span>{%endfor%}</div>{%endfor%}<p><inputclass="btn btn-primary"type="submit"value="Submit"></p></form></div><!--/container--><hr>
</main>{%endblock%}
Package: wtftz
WTF Timezones?!I can’t convert UTC to PST in my head, and google can’t do it for me either.Every timezone converter website is full of spam and the worst UX imaginable.wtftz assumes you’re trying to convert a UTC timestampprint(wtftz.convert("2012-12-10T18:31:29.214653","pst"))# 2012-12-10 10:31:29.214653unless you’re notNote the embedded timezone in this iso-formatted string.print(wtftz.convert("2012-12-10T18:31:29.214653-08:00","pst"))# 2012-12-10 18:31:29.214653wtftz knows a few common abbreviations for timezonesprint(wtftz.convert("1355236920","est"))# 2012-12-11 01:42:00# Sorry, Australia! EST is most commonly used for US/Eastern!wtftz gives back tzinfo-free timestamps because python’s timezones are broken!print(wtftz.convert(datetime.datetime.now(),from_tz="pst",to_tz="utc"))# 2012-12-11 06:45:04.075608print(wtftz.convert(datetime.datetime.now(),from_tz="pst",to_tz="eastern"))# 2012-12-11 01:45:18.343536wtftz knows that you don’t know if the current time is PST or PDTBut it does the right thing, using PST or PDT when appropriateprint(wtftz.convert(datetime.datetime.now(),"pst"))# 2012-12-11 06:48:39.860947print(wtftz.convert(datetime.datetime.now(),"pdt"))# 2012-12-11 06:48:39.860947wtftz knows that you work with systems with nonstandard timestamp formatsprint(wtftz.convert('2012/10/7 12:25:46','pst'))# 2012-10-07 19:25:46print(wtftz.convert('7 October 2012 12:25:46','pst'))# 2012-10-07 19:25:46wtftz will accept proper timezone names, tooprint(wtftz.convert(datetime.datetime.now(),"US/Pacific"))# 2012-12-10 15:04:03.644934print(wtftz.convert(datetime.datetime.now(),"America/Chicago"))# 2012-12-10 17:04:03.650494But it can’t handle everythingprint(wtftz.convert('2012:10:7:12:25:46','pst'))# ...# ValueError: Cannot parse timestamp 2012:10:7:12:25:46Use it from the shell!$date&&./wtftz"`date`"pst&&./wtftz"`date`"utcMonDec1023:43:06PST20122012-12-1023:43:062012-12-1107:43:06$date+%s&&./wtftz"`date +%s`"utc13552117472012-12-1023:42:27Wtftz can also handle free text stringsprint(wtftz.convert_free("1355236920 to est"))# 2012-12-11 01:42:00print(wtftz.convert_free("2012-12-10T18:31:29.214653-08:00 to est"))# 2012-12-10 21:31:29.214653print(wtftz.convert_free("2012-12-10T18:31:29.214653 from pst to est"))# 2012-12-10 21:31:29.214653print(wtftz.convert_free("2012-12-10T18:31:29.214653 from utc to est"))# 2012-12-10 13:31:29.214653Installationwtftzis in the cheese shop, so just:pipinstallwtftzDevelopmentIssues and Pull Requests are welcome!I’m looking to expand the list of common timezone names to include foreign
(to me) timezones and make the free-text parser smarter.TestingTests are important. Pull requests will not be accepted without them.python-munittestdiscoverReadmeThis README should be updated with examples as new behavior is added. To
ensure that the file is formatted correctly, please check it:pipinstalldocutilspipinstallpygmentspythonsetup.py--long-description|rst2html.py>output.htmlEnsure that the file parses and looks good.
Package: wtfutil
wftutil☤ The BasicsWTF A Python utility / libraryhttps://github.com/vicrack☤ InstallationOf course, the recommended installation method ispipenv <http://pipenv.org>_::pipenvinstallwtfutilorpipinstallwtfutil☤ Featuresfileutilsqlutilnotifyutilhttputilhashutilstrutil☤ Examplefromwtfutilimportutil# 1. get requests session# def requests_session(proxies=False, max_retries=1, timeout=30, debug=False, base_url=None, user_agent=None, use_cache=None):req1=util.requests_session(timeout=30,max_retries=1)req1.post('http://localhost:8080/xxx')req2=util.requests_session(base_url='http://localhost:8080',timeout=30,max_retries=1)req2.post('/xxx/update')fromwtfutilimportutil# send http rawutil.httpraw('''POST /a/bbbb?id=1&type=jsp HTTP/1.1Host: abc.comUser-Agent: Mozilla/5.0 (Windows NT 10.0; rv:88.0) Gecko/20100101 Firefox/88.0Content-Length: 1Accept-Charset: utf-8Content-Type: multipart/; boundary=----WebKitFormBoundaryzxcxzcxzAccept-Encoding: gzip------WebKitFormBoundaryzxcxzcxzContent-Disposition: form-data; name="upload";filename="f.jsp"test------WebKitFormBoundaryzxcxzcxzContent-Disposition: form-data; name="submit"submit------WebKitFormBoundaryzxcxzcxz--''')fromwtfutilimportutil# read and write file# def read_lines(filepath, encoding='utf-8', not_exists_ok: bool = False) -> list:urls=util.read_lines('input_url.txt')# def read_text(filepath, encoding='utf-8', not_exists_ok: bool = False) -> str:data=util.read_text('input.txt')data_bytes=util.read_bytes('input.txt')# def write_text(filepath, content, mode='w', encoding='utf-8'):util.write_text('output.txt','test')util.write_lines('output.txt',['te','st'])...# like py3.9 removesuffixutil.removesuffix('test123456','456')util.removeprefix('test123456','test')util.str_to_bool('yes')util.write_json('/tmp/test.json',{})# encode, decodeutil.base64encodeutil.base64decodeutil.base64urlencodeutil.base64urldecodeutil.uuencode...☤ Thank YouThanks for checking this library out! I hope you find it useful.Of course, there's always room for improvement. Feel free tohttps://github.com/vicrack
Package: wtg-seal
WTG-SEALAWebTrafficGenerator based onSURGE, Statistics andLocustOverviewWTG-SEAL is a web traffic generator based on a statistical approach inspired
by SURGE[1]and implemented usingLocust.In fact, it is expected that the input files for WTG-SEAL are the output files
from SURGE, although one should be able to create their own files.Getting StartedInstalling with pipTo install the latest release of WTG-SEAL, just runpipinstallwtg-sealRequirementsIn order to generate yourlocustfile.pyusing WTG-SEAL, you will need of two
text files formatted as follow:Documents DefinitionsA text file where each line describes a web document, which is defined as a
collection of one or more objects. For instance, adocdef.txtwith the
following content:1
5 8maps to a document represented by a single file1.txtand another document
represented by the files5.txtand8.txt. Each document is identified by a
sequential number (the order it appears on the file, starting from 0).Ideally, this is theobjout.txtfile generated by SURGE.Documents Requests SequenceA text file where each line contains a document identifier (i.ean integer) in
the order they were to be requested to a web server. For instance, adocseq.txtwith the following content:0
0
1
0represents requests to documents 0, 0, 1, 0. This is used by WTG-SEAL to
calculate the weight of each locust task.Ideally, this is thename.txtfile generated by SURGE.Server SideConsidering the previous example, it would be necessary that files named1.txt,5.txtand8.txtexist on a web-server to where the requests will be
made.Generating web trafficOnce you have the appropriate files, just runwtgsealdocdef.txtdocseq.txtThis will create a file in the current directory namedlocustfile.py.From here, you will rely on Locust to generate the web traffic towards a web
server of your choice. Just runlocustand access the URL provided on your screen. For more information,see Locust
documentation.ContributingFor contributing or making your own modifications to the source code, run:gitclonehttps://github.com/mchoji/wtg-seal.gitcdwtg-seal
pipenvinstall-e.
pipenvinstall--devPre-commit hooksIn order to make sure the hooks will run, please don't forget to install thepre-commitpackage:cdwtg-seal
pipenvinstall--dev
pipenvrunpre-commitinstall# update the hooks to the latest versionpipenvrunpre-commitautoupdateVersioningVersions defined according toSemVer. For the versions
available, see thetags on this repository.AuthorsM. Choji -mchojiLicenseWTG-SEAL is licensed under the GNU General Public License v3.0.
SeeLICENSEfor more information.References[1]Barford, P., & Crovella, M. (1998, June). Generating
representative web workloads for network and server performance evaluation.
InProceedings of the 1998 ACM SIGMETRICS joint international conference on
Measurement and modeling of computer systems(pp. 151-160).↩
Package: wthell
wthellwthell is a debugging tool for python to interactively check frame stack when your code did something unexpectedlyInstallYou can installwthellfrom pippip install wthellUsageIt's super easy to use wthell. Just run you script using wthell instead of pythonwthell your_script.py args1 args2In linux shell, you can simply use this right after you command failed:wthell !!Fun, isn't it?Or you can import wthell in your script and run your script normallyimportwthellIf there's an uncaught exception, you will enter an interactive shell like this:/home/gaogaotiantian/programs/wthell/test.py(6)defg(a,b):a+=h(a)b+=3>raiseException("lol")Exceptionraised:<class'Exception'> lolup(u)--gotoouterframe|down(d)--gotoinnerframeclear(cl)--cleartheconsole|reset(r)--backtotriggerframecontinue(c)--resumetheprogram|ctrl+D--quitshow(s)<func>--showsourcecodeoffunction<func>>>>You will be in the frame(function) that raised exceptions in the beginning.Typeupto go to outer frame(its caller).Typedownto go to inner frame(when you already go out).Typeclearto clear the console printsTyperesetto go back to the original frame that triggered wthellTypecontinueto resume the programTypeshow <func_name>to show source code of a functionwthell will record the full call stack so you can check any frame.While you are in a stack, you can type anything that you want to evaluation to help you debug.>>>a13>>>a+114>>>h(a)16>>>Or you can trigger wthell anywhere in your codedefsuspicious_function():# I want to check here!wthell.wth()wthell behaves like an interactive shell.Happy debugging!LicenseCopyright Tian Gao, 2020.Distributed under the terms of theApache 2.0 license.
Package: wtk
Wasserstein Time Series KernelInstallationThe easiest way is to install WTK from the Python Package Index (PyPI) via$ pip install wtkUsageThe package provides functions to transform a set ofntraining time series andotest time series into ann x ndistance matrix for training and ano x ndistance matrix for testing.
Additionally, we provide a way to run a grid search for a krein space SVM.krein_svm_grid_searchruns a5-fold
cross-validation on the training set to determine the best hyperparameters. Then, its classification accuracy is
computed on the test set.from wtk import transform_to_dist_matrix
from wtk.utilities import get_ucr_dataset, krein_svm_grid_search

# Read UCR data
X_train, y_train, X_test, y_test = get_ucr_dataset('../data/UCR/raw_data/', 'DistalPhalanxTW')

# Compute wasserstein distance matrices with subsequent length k=10
D_train, D_test = transform_to_dist_matrix(X_train, X_test, 10)

# Run the grid search
svm_clf = krein_svm_grid_search(D_train, D_test, y_train, y_test)Alternatively, you can get the kernel matrices computed from the distance matrices and train your own classifier.from sklearn.svm import SVC
from wtk import get_kernel_matrix
from sklearn.metrics import accuracy_score

# Get the kernel matrices
K_train = get_kernel_matrix(D_train, psd=True, gamma=0.2)
K_test = get_kernel_matrix(D_test, psd=False, gamma=0.2)

# Train your classifier
clf = SVC(C=5, kernel='precomputed')
clf.fit(K_train, y_train)

y_pred = clf.predict(K_test)
print(accuracy_score(y_test, y_pred))HelpIf you have questions concerning WTK or you encounter problems when
trying to build the tool under your own system, please open an issue inthe issue tracker. Try to
describe the issue in sufficient detail in order to make it possible for
us to help you.ContributorsWTK is developed and maintained by members of theMachine Learning and
Computational Biology LabofProf. Dr.
Karsten Borgwardt:Christian Bock (GitHub)Matteo Togninalli (GitHub)Bastian Rieck (GitHub)
Package: wtm
wtm - what the musicA song downloader for your command line. Enter keywords for songs andwtmwill scrape the internet for you and download the appropriate song.InstallationInstall globally usingpip. You might have to usesudo.$pipinstallwtmUsage$wtm--help
usage:wtm[-h][-sSONG[SONG...]][-t][-v]Downloadssongsfromtheinternet.

optionalarguments:-h,--helpshowthishelpmessageandexit-sSONG[SONG...]songsearchquery-t,--topselectstopsearchresult-v,--versionshowprogram'sversionnumberandexitTo enter keywords, either enter directly from the command line using the-sflag or you'll be prompted to enter the query.If you trust YouTube with your query, you can pass the-tflag to get the first top result. Or else you'll be asked to select
an id from a list of the titles that wtm scraped. Please see the demo for more information.Demo
Package: wtools
SummaryThis package contains a collection of tools for the [waf](https://waf.io) build environment intended for both native- as well cross compilation of C/C++ based projects.Following provides a non-exhausting list of functions provided:C/C++ setup gcc (cross-compile) toolchains (wtools.wcc)C/C++ export to Makefiles (wtools.make)C/C++ export to Eclipse projects using WAF (wtools.eclipse_waf)C/C++ export to Eclipse projects using GNU make (wtools.eclipse_make)C/C++ code formatting (wtools.indent)Display component information as tree (wtools.tree)Package binaries, libraries and files; supports.rpm,.deband.ipk(ipkg/opkg) (wtools.pkg)Take a look at the [wafbook](https://waf.io/book/) For a detailed description of the _waf_ build system.InstallationThewtoolspackage can be installed using pip:pip3 install wtools –upgrade –no-cache-dir –userAs alternative you can also clone the repository and install the latest
revision:cd ~
git clonehttps://bitbucket.org/Moo7/wtools.gitwtools
pip install -e ~/wtools –userSupportIf you have any suggestions for improvements and/or enhancements, please feel free to drop me a note by creating an [issue](https://bitbucket.org/Moo7/wtools/issues) at the [wtools](https://bitbucket.org/Moo7/wtools) projects page.
Package: wtool-utils
wtool utilsfeaturesget nic informationsniffing on interfaceinterpreting / dissecting packetsinstallationsudopip3installwtool_utils# orsudopip3installgit+https://github.com/nbdy/wtool_utils# orcd/tmp/;gitclonehttps://github.com/nbdy/wtool_utils;cdwtool_utils
sudopip3install.usage$wtool_utils--help
usage:wtool_utils[-h][-i][-s][-ifINTERFACE][-sfSNIFF_FILTERS][-scSNIFF_COUNT][-sp][-soSNIFF_OUTPUT]optionalarguments:-h,--helpshowthishelpmessageandexit-i,--interfacesReturnNICinformation-s,--sniffSniffoninterface.-irequired-ifINTERFACE,--interfaceINTERFACESpecifyNICfor-i&-s-sfSNIFF_FILTERS,--sniff-filtersSNIFF_FILTERSSpecifyBPFfiltersforthesniffer-scSNIFF_COUNT,--sniff-countSNIFF_COUNTOnlycapturethisamountofpackets-sp,--sniff-promiscEnablepromiscuousmodeforsniffer-soSNIFF_OUTPUT,--sniff-outputSNIFF_OUTPUTAlsowritesniffeddatatospecifiedfile
Package: wtoolzargs
wtoolzargswtoolzargs contains core filtering and ordering logic for web applicationsInstallation|Getting Up And Running|Examples|API|See Alsowtoolzargs contains core filtering and ordering logic for web applications. The main feature are:Filtering andordering for SQLAlchemy models.InstallationpipinstallwtoolzargsGetting Up and Runningnox-lExamplesimportwtoolzargs# sqlalchemy modelclassHacker(Base):__tablename__="hacker"id=Column(Integer,primary_key=True)a=Column(String)b=Column(String)c=Column(String)d=Column(String)e=Column(String)f=wtoolzargs.filter_(Hacker,"a eq 'a' and b eq 'b'")res=Hacker.query.filter(f).all()o=wtoolzargs.order(Hacker,"a asc, b desc")res=Hacker.query.filter(f).order_by(*o).all()APIFIXMESee AlsoFIXME
Package: wtoolzexceptions
wtoolzexceptionswtoolzexceptions contains core exception logic for web applicationsInstallation|Getting Up And Running|Examples|API|See Alsowtoolzexceptions contains core exception logic for web applications. The main feature are:Contains error and exception classes andabort function.InstallationpipinstallwtoolzexceptionsGetting Up and Runningnox-lExamplesimportflaskfromwtoolzexceptionsimportexceptionsapp=flask.Flask(__name__)@app.errorhandler(exceptions.HTTPException)defhandle_it(e):res=flask.jsonify(self.to_dict())res.status_code=self.http_status_codereturnres@app.route("/me")defboom_me():raiseexceptions.Forbidden()# When calling /me you will now get 404 status code and JSON response# as {"error": {"code": "XY", "message": "xy"}}.APIFIXMESee AlsoFIXME
Package: wtop
Overviewwtop for running statisticswtop is like “top” for your web server. How many searches or sign-ups are
happening per second? What is the response time histogram for your static
files? wtop shows you at a glance.logrep for webserver log analysislogrep is a powerful command-line program for ad-hoc analysis and filtering.
Spot-check page performance, errors, aggregate statistics, etc.Spot-check page performance, errors, aggregate statistics, etc:$ logrep -o 'status,count(*),avg(msec),min(msec),max(msec)' access.log
200 4196    244.58  3   589
302 5   79.75   17  42
404 1   9.00    9   9
304 798 158.76  0   694See how robot traffic rises and falls by day:$ logrep --robots-only --output \
    'botname,month,day,count(*),avg(msec),dev(msec)' --sort '30:1,2,3:asc'
Googlebot   7   20  1090    1045.97 1.65
Googlebot   7   21  771 3082.58 2.08
Googlebot   7   22  1177    1278.14 1.89
Googlebot   7   23  1134    1841.48 2.59
Googlebot   7   24  1057    1636.69 2.81
Googlebot   7   25  536 1210.78 2.10
...Query for specific strings and conditions:$ logrep -f "status=200,bytes>1000,msec<1000,url~Paris" \
    -o ts,msec,bytes,url
1213574430      125     47396   /Paris-Hilton
1213574892      126     47391   /Paris-Hilton
1213579556      393     23028   /Diane-Parish
1213582392      402     19757   /Paris-Kanellakis
1213582651      530     23751   /Paris-Bennett
1213584996      366     19295   /Tristan-Paris
1213586358      114     47295   /Paris-Hilton
1213587075      227     22424   /Steve-Pariso
...SeeCookbookLogrep - wtop wikifor additional examples.Python CompatibilityThis library currently requires compatibility with:2.62.7However, additional versions are tested automatically:InstallationThis will put logrep and wtop in your executable path, and drop the
defaultwtop.cfginto a location appropriate to the installation
(platform appropriate path separaters are used). It searches for the
config in the following order:VirtualEnv + /etc/wtop.cfgPYTHONUSERBASE + /etc/wtop.cfgUSER_BASE + /etc/wtop.cfgPython Lib + /etc/wtop.cfg/etc/wtop.cfgInvokelogrep -dto see which location it used.wtop/logrep require Python version 2.6 or greater.From from PyPIwtop can be installed from PyPI viapiplike so:sudo pip install wtopInstall from SourceThe wtop source can be downloaded from the GitHubreleases.This is a Python source distribution. Install it like so:sudo python setup.py installDebian, Ubuntu, Windows, etc.SeeInstall - wtop wiki.Testing Quick StartChange directory into repository (into same directory as where this README
resides).Install virtual environment:mkvirtualenv -a . -r tests/requirements.txt wtop_testIf installing requirements errors, updatepip:pip install --upgrade pipInstall requirements:pip install -r tests/requirements.txtRun pytest:py.testTo test against alternate Python versions, it may be useful to create virtual
environments with an interpreter other than the one with whichvirtualenvwas installed, e.g. for non-default python3:mkvirtualenv -a $(pwd) -p $(which python3) -r tests/requirements.txt wtop_test3ChangelogSeeCHANGELOG.rst.ContributorsSeeCONTRIBUTORS.rst.LicenseSeeLICENSE.txt(BSD 3-Clause License).
Package: wtprogress
wtprogressA python library for showing progress in windows terminal.When you are running a long-running task in python in background, such as training a neural network, you may switch to your terminal frequently to check the progress. With this library, your python script can show progress in your taskbar, and you can easily see it without switching to your terminal.Note: this library only supportsWindows Terminal. Conhost doesn't have this feature.Exampleimportwtprogress,timedefmain():foriinrange(1,101):print("\rProgress:{}%".format(i),end="",flush=True)wtprogress.show(i)time.sleep(0.1)print("\nTask finished")wtprogress.close()main()
Package: wtrobot
IntroductionThe web automation framework inspired frombehaveandrobotframework. Its an No-Code testing framework.Learn moreSetupInstall$pipinstallwtrobotNOTESelenium_drivers folders have your selenium webdrivers geckodrivers(for firefox) and chromedrivers(for chrome and chromium)If script fails due to drivers issue, you need to find appropriate selenium webdriver according to your browser versionfirefox&chrome/chromiumUnzip or untar the executable and place in selenium_drivers dir.Package Maintainers GuideInstall all dependencies to build & push package to pypi$pipinstall-rdev-requirements.txtalso installmakeNOTE: password less login to pypi creare .pypirc as mentioned inhttps://packaging.python.org/en/latest/specifications/pypirc/Build & Push to pypi$makebuild-push(defaultpushtopypirepo)$makebuild-pushPUSH_TO=testpypi(onecanspecifywheretopushpackage)Executing ScriptWrite all your test cases into test.yaml and execute$wtrobotNOTE : On initial run script will ask you for few configuration question and create config.json file.Syntax of test.yaml fileWrite your WTRobot test cases in test.yaml filesdetailed syntaxexampleScenario and name are just detailed text description about your test case scenario and steps, they are useful for detailed loggingThere are only three important section to be considered while writing this script fileaction: what to perform (e.g. click, input and etc)target: on what to perform (e.g. Text widget on web page, xpath of widget and etc)value: with what data (e.g. if an input field then what value to input)LicenseThis application is licensed under the MIT License.
Please read fileLICENSEfor details.CreditsPlease read fileCONTRIBUTORSfor list of contributors.Happy Testing :)