Saravanan666/pypi-org huggingface dataset:
Package: primitives
PrimitivesFake objects designed with OOP in mind.Documentation|Source Code|Task TrackerMock objects makes your tests worst. Usage of mock objects is considered an
anti-pattern by many experienced developers. Mock objects blindly respond to any
interaction. Patch function is able to put such objects in any place in your
code. It does not matter if that code was written in a way to be configured or
not. This situation has several consequences.First of all, your tests start making assumptions about implementation of tested
code. This creates high coupling between tests and code. You no more could
easily change your code because 25 tests are aware of the name of the function
in the middle of the call stack.The second unpleasant details about mocks is its fragile blind trust to the
client code. Writing mocks of proper quality is extremely complicated. You need
a ton of assert statements at the end of the test to check that only expected
methods were called. In addition API of the mock library in python is an ugly
procedural code. It requires a 3 lines just to define a dumb method returning
predefined value on mock. This harms readability of tests dramatically.I was upset with mock library for the long time. I decided to design a
collection of strict composable objects without ability to put them at random
place in code. Here is what I came with!ProsFake objects with strict behavior will highlight problems in your code earlierNice composable API makes definition of complex objects short and concreteForce user to use composition instead of patchExampleTheprimitiveslibrary gives you a collection of objects with ability to
define expected behavior as set of short expressions. For example, you could
define a function returningNonelike this:>>>fromprimitivesimportInstance,Callable,Argument>>>func=Callable()>>>func()Let's try to test a function below usingprimitivesfake objects and standardunittest.mocklibrary for comparison.>>>defgreet_many(repo):...foruserinrepo.users():...print(user.greet('Hello'))>>>greet_many(Instance(users=Callable([...Instance(greet=Callable('Hello, John',Argument('Hello'))),...Instance(greet=Callable('Hello, Kate',Argument('Hello'))),...])))Hello, JohnHello, KateWe would leaveunittest.mockimplementation to the reader as a homework.QuestionsIf you have any questions, feel free to create an issue in ourTask Tracker. We have thequestion labelexactly for this purpose.Enterprise supportIf you have an issue with any version of the library, you can apply for a paid
enterprise support contract. This will guarantee you that no breaking changes
will happen to you. No matter how old version you're using at the moment. All
necessary features and bug fixes will be backported in a way that serves your
needs.Please contactproofit404@gmail.comif you're
interested in it.Licenseprimitiveslibrary is offered under the two clause BSD license.— ⭐ —
Package: primordial
primordial:inflationary equation solverAuthor:Will HandleyVersion:0.0.13Homepage:https://github.com/williamjameshandley/primordialDocumentation:http://primordial.readthedocs.io/Descriptionprimordialis a python package for solving cosmological inflationary equations.It is very much in beta stage, and currently being built for research purposes.Example UsagePlot Background evolutionimportnumpyimportmatplotlib.pyplotaspltfromprimordial.solverimportsolvefromprimordial.equations.inflation_potentialsimportChaoticPotentialfromprimordial.equations.t.inflationimportEquations,KD_initial_conditionsfromprimordial.equations.eventsimportInflation,Collapsefig,ax=plt.subplots(3,sharex=True)forKin[-1,0,+1]:m=1V=ChaoticPotential(m)equations=Equations(K,V)events=[Inflation(equations),# Record inflation entry and exitInflation(equations,-1,terminal=True),# Stop on inflation exitCollapse(equations,terminal=True)]# Stop if universe stops expandingN_p=-1.5phi_p=23t_p=1e-5ic=KD_initial_conditions(t_p,N_p,phi_p)t=numpy.logspace(-5,10,1e6)sol=solve(equations,ic,t_eval=t,events=events)ax[0].plot(sol.N(t),sol.phi(t))ax[0].set_ylabel(r'$\phi$')ax[1].plot(sol.N(t),sol.H(t))ax[1].set_yscale('log')ax[1].set_ylabel(r'$H$')ax[2].plot(sol.N(t),1/(sol.H(t)*numpy.exp(sol.N(t))))ax[2].set_yscale('log')ax[2].set_ylabel(r'$1/aH$')ax[-1].set_xlabel('$N$')Plot mode function evolutionimportnumpyimportmatplotlib.pyplotaspltfromprimordial.solverimportsolvefromprimordial.equations.inflation_potentialsimportChaoticPotentialfromprimordial.equations.t.mukhanov_sasakiimportEquations,KD_initial_conditionsfromprimordial.equations.eventsimportInflation,Collapse,ModeExitfig,axes=plt.subplots(3,sharex=True)forax,Kinzip(axes,[-1,0,+1]):ax2=ax.twinx()m=1V=ChaoticPotential(m)k=100equations=Equations(K,V,k)events=[Inflation(equations),# Record inflation entry and exitCollapse(equations,terminal=True),# Stop if universe stops expandingModeExit(equations,+1,terminal=True,value=1e1*k)# Stop on mode exit]N_p=-1.5phi_p=23t_p=1e-5ic=KD_initial_conditions(t_p,N_p,phi_p)t=numpy.logspace(-5,10,1e6)sol=solve(equations,ic,t_eval=t,events=events)N=sol.N(t)ax.plot(N,sol.R1(t),'k-')ax2.plot(N,-numpy.log(sol.H(t))-N,'b-')ax.set_ylabel('$\mathcal{R}$')ax2.set_ylabel('$-\log aH$')ax.text(0.9,0.9,r'$K=%i$'%K,transform=ax.transAxes)axes[-1].set_xlabel('$N$')To do listEventually would like to submit this toJOSS. Here are things to do before then:CosmologySlow roll initial conditionsMukhanov Sazaki evolution in\(N\)add\(\eta\)as independent variableadd\(\phi\)as independent variableCodeDocumentationTests100% coverageinterpolationcosmology
Package: primosalonzo1
#primosalonzo1Es una tarea de maestrÃ­a que demuestra que puedo crear un modulo en PYPI y que el crack soy yo German Alonzo
AdemÃ¡s que se les manda un saluda todos los primos hermanos alonzos.Jaja saludosInstallationCorre lo siguiente para instalarlo:'''python
pip install primosalonzo1
'''Usage'''python
from primosalonzo1 import Primos#Generar n cantidad de primos
Primos(n)
Package: primoseip
Esta libreria contiene el codigo requerido para la practica 4 de la asignatura Fundamentos de Python, en la que se debe integrar una funcion que devuelva los n primeros numeros primos programa en lenguaje r
License
=======PACKAGE-NAME Copyright YEAR, PACKAGE-AUTHORThis program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
Package: primosmarcos
Este es un ejemplo simple de un paquete Python. Este paquete contiene 2 funciones, es_primo(numero) que devuelve True si el nÃºmero es primo y lista_primos(numero) que devuelve una lista con los nÃºmeros primos entre 1 y el nÃºmero.This program is free software: You can redistribute it and/or modify it under the terms of license by the Free Software Foundation, either version 3 of the License(at your option) any other version.
Package: primos-prueba-ezequiel
Este es un ejemplo simple de un paquete Python. Este paquete contiene una funciÃ³n que muestra los nÃºmeros primos que hay hasta un cierto valor.
This program is free software: You can redistribute it and/or modify it under the terms of license by the Free Software Foundation, either version 3 of the License(at your option) any other version.
Package: primosPython
Este es un ejemplo de una funciÃ³n en Python para calcular los nÃºmeros primos entre 1 y n, donde n es un parÃ¡metro de la funciÃ³n.
This program is free software: You can redistribute it and/or modify it under the terms of license by The Free Software Foundation, either version 3 of the license(at your option) any other version.
Package: primpy
primpy:calculations for the primordial UniverseAuthor:Lukas HergtVersion:2.3.9Homepage:https://github.com/lukashergt/primpyDocumentation:https://primpy.readthedocs.ioInstallationprimpycan be installed via pippipinstallprimpyor via the setup.pygitclonehttps://github.com/lukashergt/primpycdprimpypythonsetup.pyinstall--userYou can check that things are working by running the test suite:python-mpytestflake8--max-line-length=99primpytestspydocstyle--convention=numpyprimpyDependenciesBasic requirements:Python 3.7+numpyscipypyoscodeDocumentation:sphinxsphinx_rtd_themenumpydocmatplotlibTests:pytestflake8pydocstyleCitationIf you useprimpyduring your research for a publication, please cite the
following paper:L. T. Hergt, F. J. Agocs, W. J. Handley, M. P. Hobson, and A. N. Lasenby,
"Finite inflation in curved space", Phys. Rev. D 106, 063529 (2022),
https://doi.org/10.1103/PhysRevD.106.063529or using the BibTeX:@article{Hergt2022,archivePrefix={arXiv},arxivId={2205.07374},author={Hergt, L. T. and Agocs, F. J. and Handley, W. J. and Hobson, M. P. and Lasenby, A. N.},doi={10.1103/PhysRevD.106.063529},eprint={2205.07374},issn={2470-0010},journal={Physical Review D},month={sep},number={6},pages={063529},publisher={American Physical Society (APS)},title={{Finite inflation in curved space}},url={https://journals.aps.org/prd/abstract/10.1103/PhysRevD.106.063529},volume={106},year={2022}}ContributingThere are many ways you can contribute via theGitHub repository.You canopen an issueto
report bugs or to propose new features.Pull requests are very welcome. Note that if you are going to propose major
changes, be sure to open an issue for discussion first, to make sure that
your PR will be accepted before you spend effort coding it.
Package: prina
prina: print python variable with the variable name.🦥 打印 Python 变量时，带着变量名称。缘起不知道你有没有这样的烦恼，在没有 IDE 的情况下做调试时，都会写一堆打印信息来查看数据是否准确。比如：a="1"b=2c=Trueprint(a,b,c)# 1 2 True如果直接这样打印，在控制台的输出中就很难区分不同变量的值。因此需要安装下面的方式来书写，其中就有很多变量名需要写两遍。a="1"b=2c=Trueprint("a:{}b:{}c:{}".format(a,b,c))# or (Python3.6+ 支持的语法)print(f"a:{a}b:{b}c:{c}")# a: 1 b: 2 c: True那么有没有一种方法可以打印 Python 变量时，带着变量名称呢？我找了半天 Python 的内置函数，发现都无法完成这一功能，于是就有了prina这个库。prina = print + name使用方法fromprinaimportprinaa="1"b=2c=Trueprina(a,b,c)# a: 1 b: 2 c: True其他在Python 3.8中，你可以使用f-string来调试文档：a="1"b=2c=Trueprint(f"{a=}{b=}{c=}")# a=1 b=2 c=True许可
Package: prince-cr
PriNCe -PropagationincludingNuclearCascadeequationsThis code solves the transport equation for ultra-high energy cosmic rays on cosmological scales.About this versionThe package is numerically accurate for its current purpose (UHECR propagation). Since this the first public version, one should be cautious when deviating from the examples and check if the result makes sense, simply because so far only us (the devs) have been using it and the interfaces aren't sufficiently polished to be usederror-freefor tasks that we didn't foresee. Please file issues for anything strange, unclear, wrong, etc.. It will help us to debug the code and simplify the user interface.Installationis as simple aspipinstallprince-crCheckthe docsfor more details on the requirements.DocumentationThe docs are hosted atreadthedocs. They are stillincompleteand we are working on improvements. Feedback/comments are welcome.ExamplesTo get started check out theexamples repositoryand/or followthe tutorial.CitationIf you are using this code in your work, please cite:A new view on Auger data and cosmogenic neutrinos in light of different nuclear disintegration and air-shower modelsJ. Heinze, A. Fedynitch, D. Boncioli and W. WinterAstrophys.J. 873 (2019) no.1, 88doi:10.3847/1538-4357/ab05ceAuthorsAnatoli FedynitchJonas HeinzeCopyright and licenseCode released underthe BSD 3-clause license (see LICENSE).AcknowledgementsThis code has been initially developed as part of theNEUCOS projectand has received funding from the European Research Council (ERC) under the European Union’s Horizon 2020 research and innovation programme (Grant No. 646623).
Package: princess
Princess is a small module to run a Jupyter notebook containing Python code,
with two specific conditions:The notebook runs in the current Python environment (the one used to load
Princess), regardless of the kernel name in its metadata.Text output from the notebook is displayed directly in your terminal - or
wherever you redirect it - so you can follow the progress of the notebook.Usage:python -m princess Notebook.ipynbOptions:--saveand--save-asResult.ipynbto save the notebook after running.--discard-on-errorcancels--save[-as]if an error occurs.--run-beforebefore.pyruns the code from the Python file in the kernel,
before running the notebook. This can be used to set up things like logging
to behave differently from when the notebook is run interactively.--on-error-resume-nextignores errors from running notebook code and
continues with the next cell. This is usually not a good idea.PRINCESS: Please Run IPython Notebook in the Current Environment with Stdout
and Stderr
Package: princeton-bibreduce
This is a package for reducing LaTeX.bibfiles to include just what you want.Shameless plug: check out ourbook.Made by Alex TaitInstallation$ pip installprinceton-bibreduceUsageThere are three ways to call the same thing1: UNIX command line executable:$ princeton-bibreduce -cu myManuscript.aux2: python command line:$ python -m bibreduce -cu myManuscript.aux3: from python code:import bibreduce
bibreduce.main('myManuscript.aux', coauthors=True, urlLinks=True)BehaviorGenerates a.bibfile. By default, it adds the_procsuffix to the generated.bib. The customizable fields are:title (flag -t)coauthors (flag -c)doiLinks (flag -d)urlLinks (flag -u)abstract (flag -a)Specifying the flag transfers that field. All fields not on this list are transferred over.Get more help with:$ princeton-bibreduce -hSpecial behavior for linksIf a link format is specified, it populates the fieldlink. For urlLinks, it just copies over what is in theurlfield. For doiLinks, it puts “http://dx.doi.org/thedoi” in thelinkfield.Typical TeX workflowThe goal here is to remove titles from references and try to add URLs.(optional) Centralized bib librariesSuppose you have a centralized bib libraryMasterLibrary.bibBib globals should go inOSX:~/Library/texmf/bibtex/bib/local/MasterLibrary.bibLinux:~/texmf/bibtex/bib/local/MasterLibrary.bibWindows:C:\Users\<username>\texmf\bibtex\bib\local\MasterLibrary.bibThe TeX fileSuppose you are then working on a TeX filemyManuscript.texcontaining:\begin{document}
The text of your paper.
...
\bibliography{MasterLibrary}
\end{document}This will pull from your centralized library.FlowCompile it with:$ pdflatex myManuscript.tex
$ bibtex myManuscript.aux
$ pdflatex myManuscript.texYour.auxfile includes everything you need to extract a.bibthat is specific to this manuscript. This is where you use this module:$ princeton-bibreduce myManuscript.aux -cuto generatemyManuscript_proc.bib. Now, go back to the.texfile and change the bibliography to the reduced one:\bibliography{myManuscript_proc}One more time, call:$ pdflatex myManuscript.tex
$ bibtex myManuscript.aux
$ pdflatex myManuscript.tex
Package: princurve
princurvepip install princurveInspired bythis R package, princurve brings principal curves to Python.What  princurve doesprincurve has local and global algorithms for computing principal curves.What is a Principal Curve?A principal curve is a smooth n-dimensional curve that passes through the middle of a dataset. Principal curves are a dimensionality reduction tool analogous to a nonlinear principal component. PCs have uses in GPS data, image recognition, bioinformatics, and so much more.Local AlgorithmsLocal algorithms work on a step-by-step basis. Starting at one end of the curve, it will attempt to make segments that meet an acceptable error threshold as it moves from one end of the curve to the other. Once the algorithm can connect the current point to the end point, the algorithm terminates and a curve is interpolated through the segments. PrinPy currently has two local algorithms:CLPC-g (Greedy Constraint Local Principal Curve)1CLPC-s (One-Dimensional Search Constraint Local Principal Curve)1CLPC-g will be faster and is fine for simpler curves. CLPS-s has the potential to be much more accurate at the expense of speed for more difficult curves. After fitting a curve, prinPy has the ability to project to the curve.Global AlgorithmsGlobal algorithms, unlike local algorithms, are more like minimization problems. Given a dataset, a global algorithm might make an initial guess at a principal curve and adjust it from there.The sole global algorithm as of now performs nonlinear principal component analysis. The global algorithm, called NLPCA in this package, is a neural network implementation.2This algorithm works by creating an autoassociative neural network with a "bottle-neck" layer which forces the network to learn the most important features of the data.Which one should I use?The local algorithms will be better for tightly bunched data, such as digit recogniition or GPS data. The global algorithm is better suited for "clouds" of data or sparsely represented data.Quick-StartView the quickstart notebookhere. Docs will be coming soon!# Example of local PC fittingcl=CLPCG()# Create solver# CLPCG.fit() fits the principal curve. takes x_data, y_data,# and the min allowed error for each step. e_min is acheived# through trial and error, but 1/4 to 1/2 data error is what authors# recommend.cl.fit(xdata,ydata,e_max=.1)cl.plot()# plots curve, optional axes can be passed# Reconstruct curvetcks=cl.spline_ticks# get spline ticksxy=scipy.interpolate.splev(np.linspace(0,1,100),self.spline_ticks)References[1] Dewang Chen, Jiateng Yin, Shiying Yang, Lingxi Li, Peter Pudney,
Constraint local principal curve: Concept, algorithms and applications,
Journal of Computational and Applied Mathematics,
Volume 298,
2016,
Pages 222-235,
ISSN 0377-0427,https://doi.org/10.1016/j.cam.2015.11.041.[2] Mark Kramer, Nonlinear Principal Component Analysis Using
Autoassociative Neural Networks[3] Hastie, T. and Stuetzle, W., Principal Curves, JASA, Vol. 84, No. 406 (Jun., 1989), pp. 502-516, DOI: 10.2307/2289936
Package: prindent
prindentPython module to print with automatic indentationSometimes it is useful to print with indentation to better visualize the data. This is particularly true when multipleforloops andifstatements are nested.prindentcan automatically indent everything for you.Usagefromprindentimportprindentprindent('first loop')foriinrange(2):prindent('i:',i)prindent('second loop')forjinrange(2):prindent('j:',j)ifj==1:prindent('j=1')# first loop#     i: 0#     second loop#         j: 0#         j: 1#             j=1#     i: 1#     second loop#         j: 0#         j: 1#             j=1prindentsupports custom indentation strings:ifTrue:ifTrue:foriinrange(2):prindent('Custom indent',indent='---> ')# ---> ---> ---> Custom indent# ---> ---> ---> Custom indentprindenthandles multiple lines:ifTrue:prindent('String\nwith\nnewline')#     String#     with#     newlineprindentaccepts multipleargsandkwargsjust likeprint():ifTrue:prindent('first','second',end='$')#     first second$
Package: prinder
PrinderPull Request reminder for Github with numerous configurations and templating feature using the powerful Jinja2Installation and ConfigurationOn *nix systems:-Install Prinder using pip.pipinstallprinderCreate a configuration file. The default filename isprinder_config.yamlbut you can name it whatever you want. Fill in all the fields or leave them empty if you don't need them. Copy the config template from here -prinder_config.yaml.templateGet a github auth token with relevant access and assign it to the environment variablePRINDER_GITHUB_API_TOKENor assign it in the configuration file togithub_api_token. (Copying the token to the file is not recommended)Run the command with the file name as argument if required. If no argument is passed, it will try to find prinder_config.yaml in the working directory. The debug parameter can be passed to turn on detailed logging.prinder--config_file=<your-configuration-file-path>
eg-1.prinder2.prinder--config_file=prinder_config.yml3.prinder--debugThe logs of the service can be found at prinder.log in the working directory.Prinder has a number of configurations using which you can configure hooks to Slack or Email. Some important ones are:organization_name: The organization name for which to get pull requests.list_of_repos: Provide a list of repos for which to get pending pull requests.topics: Provide a list of topics attached to repositories for which to get pending pull requests.ignore_repos: List of repos which should be ignored.ignore_labels: List of labels assigned to pull requests to be ignored.slack:post_as_user: The name which will be shown on Slack.initial_message: The text that will appear at the the top in the notification hooks.Formatting the notificationsYou can set your own look and feel of notifications and override the default using the templating files. The templating uses Jinja2 so everything is highly configurable.For SlackCreate a template file. You can have a look at slack_template.template which is the default.Give the path to the template file in your configuration file.For MailCreate a template file. You can have a look at mail_template.html which is the default.Give the path to the template file in your configuration file.List of available information is :-OwnerInitial MessageList of pull request objectA dictionary having pull requests with the repository name as the keytime_deltafunction to calculate the number of days since pull request createdSend pull request reminders to SlackGet a slack token and assign it to the environment variablePRINDER_SLACK_API_TOKENor assign it in the configuration file toslack_api_token. (Copying the token to the file is not recommended)Send pull request reminders in emailConfigure a SMTP on your host and provide the details in the configuration file.CONTRIBUTINGThis started as a side project for a requirement that I had and as a way to improve my Python skills. I would warmly welcome any Pull requests and feature requests that you may have. Thanks
Package: pringles-devs
Pringles - A DEVS model composition PythonPringles is a DEVS model composition library, which makes easy to assemble and link multiple atomic/coupled models. It works as a Python library, and in its road ahead, will easily integrate with the Jupyter environment.RequirementsPython 3.7 (check out pyenv if you have a different python version installed)The library can be installed with pip:pip install pringles-devsExtra RequirementsFor local development, you can install everything through:make installin the repo root directory.After changes are made you can locally check the same things the CI does by executing:make localPringles ExamplesThey can be found inhttps://github.com/colonelpringles/pringles_examples