Saravanan666/pypi-org huggingface dataset:
Package: polygon-pascalvoc-writer
Polygon Pascal VOC WriterA simple python module to generate Pascal VOC XML image annotation files.Currently only supports bounding-boxes and polygons.Improved upon AndrewCarterUK'sPascal VOC Writer.Installation$pipinstallpolygon-pascalvoc-writerImporting:frompolygon_pascalvoc_writerimportVocWriterTable of ContentsPolygon Pascal VOC WriterTable of ContentsExample ExecutionFor a single imageFor a folder of imagesExample ExecutionFor a single imageback toContentsWrite annotation formyImage.png(width: 100, height: 150):frompolygon_pascalvoc_writerimportVocWriterimages_dir="dir/images/"annotations_dir="dir/annotations/"image_name="myImage.png"writer=VocWriter(images_dir,annotations_dir,image_name)# Rectangular bounding boxbox_name="myLabelBox"xmin,ymin,xmax,ymax=1,2,3,4writer.addBndBox(box_name,xmin,ymin,xmax,ymax)# 1st polygonpolygon_1_name="myPolygon"vertices_1=[[1,2],[3,4],[5,6]]writer.addPolygon(polygon_1_name,vertices_1)# 2nd polygonpolygon_2_name="myPolygon"vertices_2=[[10,20],[30,40],[50,60]]writer.addPolygon(polygon_2_name,vertices_2)# Write to XML file in VOC formatwriter.save()Output file,dir/annotation/myImage.xml:<annotation><folder>images</folder><filename>myImage.png</filename><path>absolutePathTo/dir/images/myImage.png</path><source><database>Unknown</database></source><size><width>100</width><height>150</height><depth>3</depth></size><segmented>0</segmented><object><name>myLabelBox</name><pose>Unspecified</pose><truncated>0</truncated><difficult>0</difficult><bndbox><xmin>1</xmin><ymin>2</ymin><xmax>3</xmax><ymax>4</ymax></bndbox></object><object><name>myPolygon</name><pose>Unspecified</pose><truncated>0</truncated><difficult>0</difficult><polygon><x1>1</x1><y1>2</y1><x2>3</x2><y2>4</y2><x3>5</x3><y3>6</y3></polygon><bndbox><xmin>1</xmin><ymin>2</ymin><xmax>5</xmax><ymax>6</ymax></bndbox></object><object><name>myPolygon</name><pose>Unspecified</pose><truncated>0</truncated><difficult>0</difficult><polygon><x1>10</x1><y1>20</y1><x2>30</x2><y2>40</y2><x3>50</x3><y3>60</y3></polygon><bndbox><xmin>10</xmin><ymin>20</ymin><xmax>50</xmax><ymax>60</ymax></bndbox></object></annotation>For a folder of imagesback toContentsWrite annotation forimage1.pngandimage2.png:frompolygon_pascalvoc_writerimportVocWriterimages_dir="dir/images/"annotations_dir="dir/annotations/"writer=VocWriter(images_dir,annotations_dir,"")list_of_annotations=[{"image_name":"image1.png","polygons":[[[1,2],[3,4],[5,6]],[[10,20],[30,40],[50,60]]]},{"image_name":"image2.png","polygons":[[[7,8],[9,10],[11,12]],[[70,80],[90,100],[110,120]]]}]forannotationinlist_of_annotations:# Clears the label data, then sets the image with# name matching annotation["image_name"] as the current working image.# Doesn't save the label data. Saving is done by writer.save()writer.nextImage(annotation["image_name"])forpolygon_verticesinannotation["polygons"]:writer.addPolygon("polygon_name",polygon_vertices)# Write to XML file in VOC formatwriter.save()Resulting directories:dir
├── images
|   ├── image1.png
|   └── image2.png
└── annotations
    ├── image1.xml
    ├── image2.xml
Package: polygon-protection
Installationpip install polygon_protectionGet Startedfrompolygon_protectionimportPolygonProtection# A dictionary defining the set of currency pairs we will be pulling data for# WARNING: portfolio class can never be found# it is a self created class which is not publishedcurrency_pairs=[["AUD","USD",[],portfolio("AUD","USD")],["GBP","EUR",[],portfolio("GBP","EUR")],["USD","CAD",[],portfolio("USD","CAD")],["USD","JPY",[],portfolio("USD","JPY")],["USD","MXN",[],portfolio("USD","MXN")],["EUR","USD",[],portfolio("EUR","USD")],["USD","CNY",[],portfolio("USD","CNY")],["USD","CZK",[],portfolio("USD","CZK")],["USD","PLN",[],portfolio("USD","PLN")],["USD","INR",[],portfolio("USD","INR")]]# Run the main data collection loopPolygonProtection.main(currency_pairs=currency_pairs)
Package: polygons
Polygons: Fast points-in-polygon test and distances to polygonsComputes distances to polygon edges and vertices and can check whether
points are inside/outside.This library is optimized to perform well with hundreds or thousands of
polygons and thousands or millions of points.Example timings (190 polygons, 1 M reference points, run on i7-10710U):distances to nearest edges: 0.7 sdistances to nearest vertices: 0.6 scheck whether points are inside or outside: 0.1 sInstallation using pip$ pip install polygonsSupported versionsPython: 3.8 - 3.12Operating systems: Linux, macOS, and WindowsCapabilitiesCheck whether points are inside or outside polygonsNearest distances to edgesNearest distances to verticesRecommended citationIf you use this tool in a program or publication, please acknowledge its
author(s):@misc{polygons,author={Bast, Radovan},title={Polygons: Fast points-in-polygon test and distances to polygons},month={2},year={2021},publisher={Zenodo},version={v0.2.0},doi={10.5281/zenodo.3825616},url={https://doi.org/10.5281/zenodo.3825616}}Python exampleimportpolygons# polygon_points is a list of lists# the library has been developed to perform# with very many polygons - this is just to have a simple example# in this example the polygons have the same number of points but there# is no restriction like this, this is only an examplepolygon_points=[[(0.0,0.0),(1.0,0.0),(1.0,1.0),(0.0,1.0)],[(0.0,2.0),(1.0,2.0),(1.0,3.0),(0.0,3.0)],]# the more points you compute in one go, the better# here using two points to make a simple example but if you have many points# then compute a thousand or a million in one go# so that the library can parallelize over the pointspoints=[(0.5,0.5),(0.5,-0.5)]# parameters for the tree construction:#  - each tree node has 4 children nodes#  - each leaf collects 4 edges# you can try different parameters and check the timing# they (should) have no effect on the results apart from timingnum_edges_children=4num_nodes_children=4tree=polygons.build_search_tree(polygon_points,num_edges_children,num_nodes_children)inside=polygons.points_are_inside(tree,points)print(inside)# [True, False]# indices are the indices of the nearest polygon vertices (counted# consecutively)indices,distances=polygons.distances_nearest_vertices(tree,points)print(indices)# [0, 0]print(distances)# [0.7071067811865476, 0.7071067811865476]distances=polygons.distances_nearest_edges(tree,points)print(distances)# [0.5, 0.5]indices,distances=polygons.distances_nearest_vertices(tree,[(0.6,0.6),(0.5,-0.5)])print(indices)# [2, 0]print(distances)# [0.5656854249492381, 0.7071067811865476]References which were used during codinghttp://geomalgorithms.com/a03-_inclusion.htmlhttps://en.wikipedia.org/wiki/Point_in_polygonhttps://en.wikipedia.org/wiki/Binary_space_partitioningDevelopment notesRunning the benchmark:$ cargo test --release -- --ignored --nocapturePython interface inspired byhttps://github.com/dev-cafe/rustafarian.Building and testing the Python interface:$ maturin developImageSocial media preview generated usinghttps://github.com/qrohlf/trianglify.
Package: polygon-sdk
A terminal is being built:polygonsdksWelcome to the Polygon.io toolkitThis is a tool-kit designed for polygon.io users as well as anyone looking to integrate real-time data feeds into their personal Discord servers.I'll be automating the creation process over-time, such as webhook and channel creation, as well as incorporating a stream-lined way to recieveDiscord feeds based upon your personal preference.To view more in-depth README - please see theread-mefolder.Any questions can be sent tochuckdustin12@gmail.comand I'll do my best to reply promptly.Here's a general walkthrough:STEP 1:Visithttps://www.polygon.ioif you're wanting to work with their robust real-time data. Use code FUDSTOP at checkout to recieve a 10% discount.Once you have your API key, you can place it in "cfg.py" after downloading or cloning the repo. Replace "YOUR POLYGON API KEY GOES HERE" with your API KEY.STEP 2:You'll see five files in the root directory -get_latest_crypto_data.pyget_latest_forex_data.pyget_latest_indices_data.pyget_latest_options_data.pyget_latest_ticker_data.pyOnce you have your key, and depending on the service you chose - you can select the corresponding file and run it to generate a fresh spreadsheet of market-wide data.For example - if you chose the stocks subscription - you would selectget_latest_ticker_data.pyand run it after placing your APIKEY into "cfg.py".Once you have the file - you can then immediately utilize thesimulated_marketssub-folder found in theexamplesfolder to run a simulated options market or stock market data-stream using the latest data.You can find real-time market stream examples in therealtime_marketsfolder.If interested in the Discord aspect of this project - please see the discord readme inside of theread-mefolder.
Package: polygon-uploader
Polygon Uploaderuploader of tasks to polygon.codeforces.comInstallationpip install polygon-uploaderUsage, usaco moduleusacoimport <usaco_cp_id> <usaco_name> <polygon id>usacoimport 1020 deleg_platinum_feb20 123123usaco_cp_idis taken from the problem description link, for example:http://usaco.org/index.php?page=viewproblem2&cpid=1020, in this exampleusaco_cp_idis1020usaco_idis taken from testdata link, for example:http://usaco.org/current/data/deleg_platinum_feb20.zip, in this exampleusaco_idisdeleg_platinum_feb20Config fileConfig file is located in<user dir>/.config/polygon-uploaderUploads tohttps://polygon.codeforces.comby default, change the config file to upload to a different instace of polygon
Package: polygot
polygotTranslate documents and webpages to various markup languages and document formats (html, epub, mobi ..).Usage*CLtoolforpolygot*:Author:DavidYoung:DateCreated:September28,2015Usage:polygoturl<urlToParse><destinationFolder>[-s<pathToSettingsFile>]-h,--helpshowthishelpmessage-v,--versionshowversion-s,--settingsthesettingsfileurlToParsetheurlofthearticletoparseandconverttoPDFdestinationFolderthefoldertoaddtheparsedPDFtoDocumentationDocumentation for polygot is hosted byRead the Docs(laststable versionandlatest version).InstallationThe easiest way to install polygot us to usepip:pipinstallpolygotOr you can clone thegithub repoand install from a local version of the code:gitclonegit@github.com:thespacedoctor/polygot.gitcdpolygotpythonsetup.pyinstallTo upgrade to the latest version of polygot use the command:pipinstallpolygot--upgradeDevelopmentIf you want to tinker with the code, then install in development mode.
This means you can modify the code from your cloned repo:gitclonegit@github.com:thespacedoctor/polygot.gitcdpolygotpythonsetup.pydevelopPull requestsare welcomed!IssuesPlease report any issueshere.LicenseCopyright (c) 2016 David YoungPermission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
“Software”), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Package: polygraphy-trtexec
Extendingpolygraphy runto supporttrtexecIntroductionpolygraphy runallows you to run inference with multiple backends, including TensorRT and ONNX-Runtime, and compare outputs.
This extension adds support to run inference withtrtexec.InstallationFollow the steps below to install the extension module. After installation, you should see thetrtexecoptions in the help
output ofpolygraphy run:Build usingsetup.py:python3setup.pybdist_wheelInstall the wheel: The wheel is installed in thedistdirectory. Install the wheel by running the following commandpython3 -m pip install dist/polygraphy_trtexec-*.whl \
    --extra-index-url https://pypi.ngc.nvidia.comNOTE: You may have to update the above command to install the appropriate version of the wheelAfter the installation, you can run it on the trtexec backend by using the--trtexecflag as follows:polygraphyrunsample.onnx--trtexec
Package: polyhorner
polyhornerThis package will:build univariate polynomials using an optimized Horner's method and fast numba loopsbuild multivariate polynomials using a somewhat optimized Horner's method and fast numba loopsunivariate polynomial exampleSuppose you have x, and y data, and you want to model y = a0 + a1 x + a2 x^2 + a3 x^3 + a4 x^4
Let Mat be a numpy matrix of size (N,1), where N is the number of data points.
X = polyhorner.horner(Mat, 4) will build your X matrix ready for the regression (optimized using Horner's method)multivaraite polynomial exampleSuppose you have x, y, and z data, and you want to model using apolynomial of order 3 in x, and 2 in y, with cross-products
z = a0 + a1 x + a2 x^2 + a3 x^3 + a4 y + a5 y^2 + a6 xy + a7 x^2y + a8 x^3y + a9 xy^2 + a10 x^2y^2 + a11 x^3y^2
let Mat be a numpy matrix of size (N,2), where N is the number of data points.
let Expo be a numpy matrix of size (2,1) = (3,2)
X = polyhorner.horner(Mat, Expo) will build your X matrix ready for the regression (semi-optimized using Horner's method)I use some functions distributed under the GNU LGPL license fromhttps://people.sc.fsu.edu/~jburkardt/py_src/monomialThanks to Pssolanki for helping fix issues
Package: polyid
PolyIDTMprovides a framework for building, training, and predicting polymer properities using graph neural networks. The codes leveragesnfp, for building tensorflow-based message-passing neural networ, andm2p, for building polymer structures.  The notebooks have been provided that demonstrate how to: (1) build polymer structures from a polymer database and split into a training/validation and test set, (2) train a message passing neural network from using the trainining/validation set, and (3) evaluate the trained network on the test set. These three notebooks follow the methodology used in the forthcoming publication.Building polymer structures:examples/1_generate_polymer_structures.ipynbTraining a message passing neural network:examples/2_generate_and_train_models.ipynbPredicting and evaluating a trained network:examples/3_evaluate_model_performance_and_DoV.ipynbAdditional notebooks have been provided to provide more examples and capabilities of the PolyID code base.Checking domain of validity:examples/example_determine_domain-of-validity.ipynbGenerating hierarchical fingerprints for performance comparison:examples/example_hierarchical_fingerprints.ipynbPredicting with the trained model:examples/example_predict_with_trained_models.ipynbDetails for the methods are forthcoming in an upcoming manuscript.
Package: polyjuice
Polyjuice ⚗️🧙‍♂️SQLAlchemy tables disguised as Django models.UsagePolyjuiceallows you to define your database tables withSQLAlchemy Coreand use them
as legit Django models.You could findPolyjuicerelevant in situations where you want manage your table without the Django constraints, but still
take advantage of all the goodness of Django integration and tooling when needed.I haven't tried every use case yet, but I imagine it could suits many:Use other database management tools (ex: migrations withalembic)Take advantage of the async world (ex: build RabbitMQ consummers withaio-pika)Build complex SQL queries with the SQLAlchemy API and execute them through the Django database connectionTransition to another web framework¯\(ツ)/¯ExampleIn an python package calledmy_tables.py"""Here, define your table schemas with the SQLAlchemy core API."""importpolyjuicefromsqlalchemyimportColumn,ForeignKey,Integer,MetaData,String,Tablemetadata=MetaData()ProfessorTable=Table("hogwarts__professor",metadata,Column("id",Integer,primary_key=True),Column("name",String(30),nullable=False))PotionTable=Table('hogwarts__potion',metadata,Column("id",Integer,primary_key=True),Column("name",String(100),nullable=False),Column('made_by',Integer,ForeignKey(ProfessorTable.c.id),django_on_delete="CASCADE",django_related_name="personal_potions"))In your Django projectfrommy_tablesimportPotionTable,ProfessorTableimportpolyjuice@polyjuice.mimic(ProfessorTable)classProfessor:"""The Polyjuice decorator will turn this class into a legit Django model."""defwelcome(self):print(f"Welcome to my class, I am Pr.{self.name}🧙‍♂️")@polyjuice.mimic(PotionTable)classPotion:"""This class too"""defboil(self):print(f"*The{self.name}potion is blurping* ⚗️")# And you are ready to go !severus_snape=Professor.objects.create(name="Severus Snape")veritaserum=Professor.objects.create(name="Veritaserum",made_by=severus_snape)assertseverus_snape.personal_potions.count()==1RequirementsPolyjuiceis currently built on top of SQLAlchemy 1.3 and Django 2.2, and requires Python 3.6.LicensePolyjuiceis released into the Public Domain. 🎉🍻
Package: polykin
PolyKinPolyKin is an open-source polymerization kinetics library for Python. It is still at an early
development stage, but the following modules can already be used:CopolymerizationImplicit penultimate modelPenultimate modelTerminal modelMayo-Lewis equation (binary, ternary and multicomponent)Monomer dift equation (multicomponent)Fitting methodsEquations of state[50%] Cubic (Redlich-Kwong, Soave, Peng-Robinson)Ideal gasSanchez-LacombeVirial equationDatabaseDistributionsFloryGoldLog-normalPoisonSchulz-ZimmKineticsArrheniusEyringPropagation half-lengthTermination composite modelModelsPhysical property correlationsAntoineDIPPRWagnerYawsTransport properties (estimation methods, mixing rules, etc.)DiffusivityBinary gas mixturesBinary liquid mixturesBinary polymer solutionsMulticomponent polymer solutionsThermal conductivityGasesLiquidsPolymer solutionsViscosityGasesLiquidsPolymer solutionsDocumentationPlease refer to the packagehomepage.TutorialsThe main features of PolyKin are explained and illustrated through a series oftutorialsbased on Jupyternotebooks,
which can be launched online via Binder.InstallationPolyKin currently runs on Python 3.9+. You can install it from PyPI viapip(orpoetry):pip install polykin#poetryaddpolykinAlternatively, you may install it directly from the source code repository:git clone https://github.com/HugoMVale/polykin.gitcd polykinpip install .#poetryinstall
Package: polylabel-pyo3
polylabel-pyo3polylabel-pyo3lets you calculate thepole of inaccessibilityin Python. It's apyo3wrapper ofpolylabel-rs.Installpip install polylabel-pyo3Usefrompolylabel_pyo3importpolylabel_ext,polylabel_ext_np# define an open L-shapeL=[(0,0),(1,0),(1,1),(2,1),(2,2),(0,2)]polylabel_ext(L,1.0)# (0.5, 0.5)# A version for numpy.ndarray only is slightly fasterimportnumpyasnppolylabel_ext_np(np.array(L,dtype=np.float),1.0)# (0.5, 0.5)# Note that the optional polylabel center for an L-shape# is in between its mean of exterior vertices and originnp.mean(L,axis=0)# array([1., 1.])GUI Examplepip install -r examples/requirements.txt
python examples/polylabel_gui.pyDrag your shape with the mouse and observe amomentumbased center in grey andpolylabelcenter in green:DevelopRequirements:Rust ToolchainPython >=3.7In avenvor condaenv:pip install maturin -r requirements.txt
pre-commit installTestmaturin develop
pytest -vBenchmarkmaturin develop --release
pyest benchmark
Package: polylatlib
PolyLatLibBy Rex GreenwayThis project aims to allow for the investigation of shapes in the R x R Cartesian Plane and their lattices. This Python library provides the functionality to generate, work with, view, and manipulate polygons in the 2D space and, for applciable shapes, generate the corresponding lattice.The image above shows three seperate, 5-layer, circular lattices displaying equilateral triangles, squares, and regular hexagons.Features so far:Basic class structure for Polygons.Methods to generate and draw Regular Polygons, with preset regular polygons classes.Lattice generation for Equilateral Triangles, Squares, and Hexagons.To Install:You can install the library usingpip:pip install polylatlib
Package: polylearner
PolylearnerThePolylearneralgorithm is a learning algorithm that, given a set of polyhedraP1, .., Pn, learns
aminimal parametrized polyhedronPwith parametrizationsθ1, .., θnsuch thatP[θ1]yields the same
solution set ofθ1.
In simple terms,PgeneralizesP1, .., Pnby learning ahigher-levelpolyhedron and its groundings to
thelower-levelpolyhedra.We represent polyhedra as linear systems of the formAx <= b, whereAis a coefficient matrix, andbis vector
of coefficients.
Take the following parametrized systemdefined by a systemP:x + y <= c
    y <= b
    x <= aby settinga, b, cto1we obtain the triangle on the left, while by settinga, bto1andcto2, we
obtain the square on the left; that is,Pgeneralized both the triangle and rectangle.QuickstartInstallationmkvirtualenv-ppython3.11polylearner
pipinstall-rrequirements.txtPython interfacePolyhedra  are defined as systems (Systemobjects) representing systems of linear inequalities.
ThePolylearnerclass provides afit(Iterable[System]) -> Optional[SymbolicParametricSystem]learning method
to learn the generalizing parametric polyhedron.Note that not all collections of low-level polyhedra admit a solution, hencefitmay also returnNone.fromhyperplanes.planesimportHyperplanefromhyperplanes.systemsimportSystemfromlearner.polylearnerimportPolylearner# [-X =< 0, X =< 3, -Y =< 0, Y =< 2]h1=Hyperplane([-1.,0.],0.)h2=Hyperplane([1.,0.],3.)h3=Hyperplane([0.,-1.],0.)h4=Hyperplane([0.,1.],2.)s1=System([h1,h2,h3,h4])# [-X =< 0, X =< 2, -Y =< 0, Y =< 3]h5=Hyperplane([-1.,0.],0.)h6=Hyperplane([1.,0.],2.)h7=Hyperplane([0.,-1.],0.)h8=Hyperplane([0.,1.],3.)s2=System([h5,h6,h7,h8])learner=Polylearner()learned_system=learner.fit([s1,s2])Thelearned_systemis an instance ofSymbolicParametrizedSystem, a system ofSymbolicInequality, which
can be grounded into aSymbolicGroundedSystem:grounding_0=learned_system.solutions[0]grounded_system=learned_system.ground(grounding_0)ExamplesExamples onPolylearnerusage can be found in thenotebooks/folder.CiteWork based on theoriginal implementationof the
"Learning from Polyhedral Sets" by S. Ruggieri.
Cite as@inproceedings{DBLP:conf/ijcai/Ruggieri13,
  author    = {Salvatore Ruggieri},
  editor    = {Francesca Rossi},
  title     = {Learning from Polyhedral Sets},
  booktitle = {{IJCAI} 2013, Proceedings of the 23rd International Joint Conference
               on Artificial Intelligence, Beijing, China, August 3-9, 2013},
  pages     = {1069--1075},
  publisher = {{IJCAI/AAAI}},
  year      = {2013},
  url       = {http://www.aaai.org/ocs/index.php/IJCAI/IJCAI13/paper/view/6700},
  timestamp = {Tue, 08 Mar 2022 17:41:51 +0100},
  biburl    = {https://dblp.org/rec/conf/ijcai/Ruggieri13.bib},
  bibsource = {dblp computer science bibliography, https://dblp.org}
}