Saravanan666/pypi-org huggingface dataset:
Package: periskop-client
periskop-pythonPeriskoprequires collecting and aggregating exceptions on the client side,
as well as exposing them via an HTTP endpoint using a well defined format.This library provides low level collection and rendering capabilitiesInstallpip install periskop-clientUsage exampleimportjsonfromhttp.serverimportHTTPServerfromperiskop_client.collectorimportExceptionCollectorfromperiskop_client.exporterimportExceptionExporterfromperiskop_client.handlerimportexception_http_handlerfromperiskop_client.modelsimportHTTPContextdeffaulty_json():returnjson.loads('{"id":')if__name__=="__main__":collector=ExceptionCollector()try:faulty_json()exceptExceptionasexception:# Report without contextcollector.report(exception)# Report with HTTP context without request bodycollector.report_with_context(exception,HTTPContext("GET","http://example.com",{"Cache-Control":"no-cache"}),)# Report with HTTP context with request bodycollector.report_with_context(exception,HTTPContext("GET","http://example.com",{"Cache-Control":"no-cache"},"request_body"),)# Expose collected exceptions in localhost:8081/-/exceptionsserver_address=("",8081)handler=exception_http_handler(path="/-/exceptions",exporter=ExceptionExporter(collector))http_server=HTTPServer(server_address,handler)http_server.serve_forever()Using push gatewayYou can also usepushgatewayin case you want to push your metrics
instead of using pull method. Use only in case you really need it (e.g a batch job) as it would degrade the performance
of your application. In the following example, we assume that we deployed an instance of periskop-pushgateway
onhttp://localhost:6767:exporter=ExceptionExporter(collector)exporter.push_to_gateway("http://localhost:6767")Run testsFor running testspytestis needed. A recommended way to run all check is installingtoxand then just typetox. This will runpytesttests,blackformatter andflake8andmypystatic code analyzers.Alternatively you can runpip install -r requirements-tests.txtand then runpytest.
Package: perivale
PerivalePerivale:The name of a stop on the London Underground, which alliterates with "parse buffer"MotivationMost parsers implement a buffer object with methods for matching common text patterns. Some of those methods include:Peeking the next character in the streamChecking for a substring or RegEx matchParsing common tokens (identifiers, numbers, etc.)Skipping whitespace charactersBacktracking to a certain positionIn addition, a custom exception classParseErroris provided for informative error messages with references to lines or strings in the stream.UsageFinishedChecks whether the end of the stream has been reached>>>buffer=Buffer("")>>>buffer.finished()TrueGet PositionGet method for buffer's current position.>>>buffer=Buffer("lorem ipsum")>>>f"{buffer.copy_position()}"'[1:1]'>>>>>>buffer.increment(steps=5)>>>f"{buffer.copy_position()}"'[1:6]'>>>>>>buffer.skip_line()>>>f"{buffer.copy_position()}"'[1:-1]'Note:Direct access to buffer'spositionattribute can result in undefined behaviourColumn and line values start at 1.Newlines are considered the last character of their line, and their index is represented as[n:-1]End-of-file is represented as[-1:-1]Set PositionSets the buffer's position, checking for errors>>>buffer=Buffer("lorem ipsum")>>>buffer.set_position(buffer.position)>>>>>>buffer.set_position(Position(1,1,1))Traceback(mostrecentcalllast):File"<stdin>",line1,in<module>File".../perivale/buffer.py",inset_positionraiseIndexError(f"invalid position:{position}")IndexError:invalidposition:[1:1]ReadReads the next character in the buffer. You can choose to skip that character after reading it>>>buffer=Buffer("lorem ipsum")>>>buffer.read()'l'>>>buffer.read(consume=True)'l'>>>buffer.read()'o'MatchChecks for an exact substring match. You can choose to skip the substring if it matches>>>buffer=Buffer("lorem ipsum")>>>buffer.match("lorem ipsum")True>>>>>>buffer.match("dolor sit amet")False>>>>>>buffer.match("lorem ipsum",consume=True)True>>>buffer.finished()TrueSkip LineSkips an entire line of text>>>buffer=Buffer("lorem ipsum\ndolor sit amet")>>>f"{buffer.position}"'[1:1]'>>>>>>buffer.skip_line()>>>f"{buffer.position}"'[2:1]'Skip WhitespaceSkips whitespace characters (spaces, tabs, and optionally newlines)>>>buffer=Buffer("\t\v\r")>>>buffer.skip_space()>>>buffer.finished()True>>>>>>buffer=Buffer("\t\v\r\n")>>>buffer.skip_space(include_newlines=True)>>>buffer.finished()TrueGet LineGets the text on a given line>>>buffer=Buffer("lorem ipsum\ndolor sit amet")>>>buffer.line_text()'lorem ipsum'>>>buffer.line_text(1)'lorem ipsum'>>>buffer.line_text(2)'dolor sit amet'Note:Line numbers are indexed from 1Get indentationGets the indentation level of a given line>>>text="""lorem ipsumdolor sit amet"""">>>buffer=Buffer(text)>>>buffer.line_indentation()0>>>buffer.line_indentation(1)4Note:Spaces are counted individually, tabs count as four spaces
Package: periwinkle
PeriwinkleA python library with 4 sub-libraries.-Math(math fuctions with polygon solving abilites)Most functions use side A and side B, yet some have a parameter called simplification.simplification can be left as "s" for pi to be simplified to 3.14 or any other string for math.pi-Geography(small geography.py file containing a haversine function)Haversine FunctionInsert all coordinate points, andthe distance type"meters""kilometers""miles""centimeters""inches"-Percents(solve percent problems)Very simple and self-explanitory functions-ColorConvert Hexidecimal to RGB and RGB to Hexidecimal-TypewriterType write with delay in keyboard and countdown, and use a normal instant-type
Package: perke
PerkePerke is a Python keyphrase extraction package for Persian language. It
provides an end-to-end keyphrase extraction pipeline in which each component
can be easily modified or extended to develop new models.InstallationThe easiest way to install is from PyPI:pipinstallperkeAlternatively, you can install directly from GitHub:pipinstallgit+https://github.com/alirezatheh/perke.gitPerke also requires a trained POS tagger model. We useHazm'sPOS tagger model. You can
easily download latestHazm'sPOS
tagger using the following command:python-mperkedownloadAlternatively, you can use another model with same tag names and structure,
and put it in theresourcesdirectory.Simple ExamplePerke provides a standardized API for extracting keyphrases from a text. Start
by typing the 4 lines below to useTextRankkeyphrase extractor.fromperke.unsupervised.graph_basedimportTextRank# 1. Create a TextRank extractor.extractor=TextRank()# 2. Load the text.extractor.load_text(input='text or path/to/input_file')# 3. Build the graph representation of the text and weight the#    words. Keyphrase candidates are composed of the 33 percent#    highest weighted words.extractor.weight_candidates(top_t_percent=0.33)# 4. Get the 10 highest weighted candidates as keyphrases.keyphrases=extractor.get_n_best(n=10)For more in depth examples see theexamplesdirectory.DocumentationDocumentation and references are available atRead The Docs.Implemented ModelsPerke currently, implements the following keyphrase extraction models:Unsupervised modelsGraph-based modelsTextRank:articleby Mihalcea and Tarau, 2004SingleRank:articleby Wan and Xiao, 2008TopicRank:articleby Bougouin, Boudin and Daille, 2013PositionRank:articleby Florescu and Caragea, 2017MultipartiteRank:articleby Boudin, 2018AcknowledgementsPerke is inspired bypke.
Package: perkle
Perkle: A simple Python 3 implementation of Merkle TreesPerkle provides a simple, all python, implementation of Merkle Trees.InstallationThe package can be installed via pip:pipinstallperkleor by cloning this repository.The packagepycryptodomeis in the requirements. Make sure that this will not conflict with an installation of the (deprecated) packagepycrypto.ExampleHere is how to create a Merkle Tree of numbers from 0 to 9:fromCrypto.HashimportSHA256fromperkleimportMerkleTreefrombinasciiimporthexlifydata_list=[b'0',b'1',b'2',b'3',b'4',b'5',b'6',b'7',b'8',b'9']sha256=lambdax:SHA256.new(x).digest()mt=MerkleTree(data_list,sha256,random_padding=False,padding_byte=b'0')print(hexlify(mt.root()))#70cc27c03c0444d1dfc63f58e373a2882a7b9f4f7f6ed1a4dfc1a94a5ac5875cBy default, we add a random padding to the data to have a power of two leaves. You can make the padding non-random with therandom_paddingparameter to make the results consistent.New data can be inserted in the Merkle Tree:data=b'10'mt.insert(data)print(hexlify(mt.root()))#3e32b51c76de4b124f1fedfbb4d5a30d117274bf04b538ca7f10434e2f8a35b9And existing data can be updated:new_data=b'zero'mt.update(0,new_data)print(hexlify(mt.root()))#d485ca0c92d339d2e8495216cdb420f0e215003fffdb62d09da56d8739c94a11Proofs can be easily generated:index,proof_hashes=mt.proof(b'7')and verified:print(MerkleTree.verify(b'7',index,proof_hashes,mt.root(),sha256))#True
Package: perks
This Library provide several methods for the control of the flow of your program.
You can make Recursive a function , change the font color and the background color of your program,
improve yourself with the Simple MultiThreading that this library offer.
You can manage Server and Client in local, there is also a class for the
management of the SQL Database, based on sqlite3.
Server Hacking Tools are provided by this Library.
‘Shell’ class is a Class neededonly for me.
There are also an ‘old_perks’ library,
with the overload of some standard built-in types,
like Int, String, List and Float.
You can also send an e-mail in a very simple way during your program.
There are more and more method to learn so,
Good Luck!
Package: perl
Haven’t you always dreamed of having the power of Perl at your fingertips when writing
Python?Well, this package is proof that dreams can come true:>>> import perl
>>> value = "Hello there"
>>> if value =~ /^hello (.+?)$/i:
...     print("Found greeting:", $1)
...
Found greeting: there
>>> value =~ s/there/world/
>>> print(value)
Hello worldNote: This is very silly and probably shouldn’t go anywhere near production code.Project site:http://radiac.net/projects/python-perl/Source code:https://github.com/radiac/python-perlInstallationThis requires Python 3.7 or later.UsageThe module needs to be loaded before Python tries to read code which uses these
enhancements. There are therefore four different ways to use this module:Pass it to Python on the command line:python3.7 -m perl myscript.pySet it on your script’s shebang:#!/usr/bin/python3.7 -mperlImport it before importing any of your code which uses its syntax - usually in
your__init__.py:import perlNoteYou only need to import it once in your project.However, because Python needs to read the whole file before it can run the
import, you cannot useperl’s functionality in the same file where youimport perl.Use it on the Python interactive shell (REPL):$ python3.7
>>> import perlor:$ python3.7 -m perlFeaturesRegular expression matchingSyntax:val =~ /pattern/flags
# or
val =~ m/pattern/flagswherepatternusesPython’s regex syntax, andflagsis a subset of the
charactersAILMSXG, which map Python’s single character flags, plusgwhich
mimics the global flag from Perl.When run without the global flag, there.Matchobject is returned; any matched
groups will be available as numbered dollar variables, eg$1, and named groups will
be available on$name.When run with the global flag, the list ofre.Matchobjects will be returned. No
dollar variables will be set.Examples:# Case insensitive match
value =~ /^foo (.+?) bar$/i
print(f"Matched {$1}")

# Use in a condition
if value =~ /^foo (.+?) bar$/i:
    return $1

# Use as a global
matches = value =~ /foo (.+?) bar/gi;Regular expression replacementSyntax:val =~ s/pattern/replacement/flagswherepatternusesPython’s regex syntax, andflagsis a subset of the
charactersAILMSXG, which map Python’s single character flags, plusgwhich
mimics the global flag from Perl to replace all occurrences of the match.Examples:# Case insensitive global replacement
value =~ s/foo/bar/giDollar variablesSyntax:$name
$numberDollar variables act like regular variables - they can be set and used as normal. They
are primarily intended for use with regular expressions - each regex will remove all
previous dollar variables, to avoid confusion as to whether they matched or not.ContributingDuring development, install in a virtual environment:mkdir python-perl
cd python-perl
git clone <path-to-repo> repo
virtualenv --python=python3.7 venv
. venv/bin/activate
cd repo
pip install -r requirements.txtTo run tests:cd path/to/repo
. ../venv/bin/activate
pytestTo run the example, use one of the following:$ ./example.py
$ python3.7 -m perl example.py
$ python3.7 example_importer.py
Package: perlcompat
perlcompat Packageperlcompat - Perl-like utility functions such as warn, die, getopt, and require.DESCRIPTIONThis manual page documentsperlcompatmodule, a Python module providing
Perl-like utility functions such as warn, die, getopt, and require.Perl programmers are generally familiar with Perl's useful buil-in functions
such as warn() and die() for displaying debug/error messages as well as its
standard modules such as Getopt::Std for parsing UNIX-style command-line
options.perlcompatmodule provides several utility fucntions with functionarites
similar to Perl's counterparts.EXAMPLEimportosimportsysfromperlcompatimportwarn,die,getopts,require# make sure the Python is no older than version 3.6require('3.6')# display warning messagewarn('starting of sample program in directory{}...'.format(os.getcwd()))# parse command-line options# variables opt.v, opt.f, and opt.o are automatically definedopt=getopts('vf:o:')ordie('usage:{}[-v] [-f config] [-o outfile]'.format(sys.argv[0]))ifopt.v:warn('verbose mode')ifopt.f:conffile=opt.fifopt.felse'config.ini'warn('config file:{}'.format(conffile))ifopt.o:outfile=opt.oifopt.oelse'out.txt'warn('output file:{}'.format(outfile))warn('remaining arguments:{}'.format(sys.argv[1:]))FUNCTIONSperlcompatmodule provides the following functions.warn(astr)Display warning message ASTR to the standard error output.die(astr)Display message ASTR to the standard error output and terminate the program
executiongetopts(spec)Parse UNIX-style command line options.  Options are specified by SPEC.
Parsed options are returned as an object.  A value for option X is
accessible trhough the object attribute X.perlcompatmodule only supports short options (e.g., -v, -f foo.txt).
Log options (e..g, --verbose, --file foo.txt) are not suported.require(version)Abort the program if the current Python interepter does not satisfy version
requirement (i.e., the version is older than VERSION).INSTALLATIONpip3installperlcompatAVAILABILITYThe latest version ofperlcompatmodule is available athttps://github.com/h-ohsaki/perlcompat.git.SEE ALSOperl(1), perlfunc(1), getopt(3), Getopt::Std(3perl)AUTHORHiroyuki Ohsaki <ohsaki[atmark]lsnl.jp>
Package: perlformats
This module has been written for a particular need: to print easily small pieces
of information in a pretty way, such as the output of the UNIX df command.
That’s why the whole page management stuff has been let down.Existing perl formats should be usable as is.>>> from perlformats import PerlFormat
>>> myformat = """
... @<<<<<<<<<<<<<<<<<< @||||||| @<<<<<<@>>>> @>>>> @<<<<<<<<<<<<<<<<<
... name,              $login,  $office,$uid,$gid, $home
... """
>>> pf = PerlFormat(myformat)
>>> mydata = { '$login': 'jsmith', '$office': 'F125',
...             '$uid': '1234', '$gid': '25', '$home': '/home/jsmith' }
>>> person.name   # An object contains a value
'John Smith'
>>> print pf.format(mydata, person) # Values may be searched in several places
John Smith           jsmith  F125    1234    25 /home/jsmith
Package: perlin
perlin======Create perlin noise in 1D, 2D, and 3D!Features1D perlin noise2D perlin noise3D perlin noiseSeed capabilityTestedCompletly written in pythonNo dependenciesUsageThis library can be used for generating random terrain for games or getting perlin noise. This library also supports octaves.Exampleimportperlinp=perlin.Perlin(6789)#6789 is the seedprint(p.one(0))#1D, 0 is the X valueprint(p.two(0,1))#2D, 0 is the X value and 1 is the Y valueprint(p.three(0,1,2))#3D,  0 is the X value, 1 is the Y value, 2 is the Z valueprint(p.one_octave(0))#Use this for octaves, you can ajust the octave variables but this gives you 2 octavesKnow limitationsSlower than noise library
Slower with octaves (Work in progress)
Some bugs on different seedsNew FeaturesNow has octave support!
Package: perlin-cupy
Perlin-CuPy: Perlin-NumPy for GPUInstall|ExamplesPerlin-CuPy is a Perlin-NumPy compatible library for GPU-accelerated Perlin Noise generation.
Perlin-CuPy acts as a drop-in replacement to runexisting Perlin-NumPy codeon NVIDIA CUDA platforms.fromperlin_cupyimport(generate_fractal_noise_2d,generate_fractal_noise_3d,generate_perlin_noise_2d,generate_perlin_noise_3d)InstallationWheel (precompiled binary package) is available for Linux (x86_64). We've currently tested only for CUDA 11.3 platform using CuPy v11.3, but it should work for any CuPy version installed in your environment.PlatformCommandCUDA 11.3pip install perlin-cupyRequirementsNVIDIA CUDA GPUwith the Compute Capability 3.0 or larger.CUDA Toolkit: v10.0 / v10.1 / v10.2 / v11.0 / v11.1 / v11.2 / v11.3Python DependenciesCuPy: v10.0 / v10.1 / v10.2 / v11.0 / v11.1 / v11.2 / v11.3UsageThe usage is exactly the same asPerlin-NumPy code.2D noiseThe functiongenerate_perlin_noise_2dgenerates a 2D texture of perlin noise. Its parameters are:shape: shape of the generated array (tuple of 2 ints)res: number of periods of noise to generate along each axis (tuple of 2 ints)tileable: if the noise should be tileable along each axis (tuple of 2 bools)Note:shapemust be a multiple ofresThe functiongenerate_fractal_noise_2dcombines several octaves of 2D perlin noise to make 2D fractal noise. Its parameters are:shape: shape of the generated array (tuple of 2 ints)res: number of periods of noise to generate along each axis (tuple of 2 ints)octaves: number of octaves in the noise (int)persistence: scaling factor between two octaves (float)lacunarity: frequency factor between two octaves (float)tileable: if the noise should be tileable along each axis (tuple of 2 bools)Note:shapemust be a multiple oflacunarity^(octaves-1)*res3D noiseThe functiongenerate_perlin_noise_3dgenerates a 3D texture of perlin noise. Its parameters are:shape: shape of the generated array (tuple of 3 ints)res: number of periods of noise to generate along each axis (tuple of 3 ints)tileable: if the noise should be tileable along each axis (tuple of 3 bools)Note:shapemust be a multiple ofresThe functiongenerate_fractal_noise_2dcombines several octaves of 3D perlin noise to make 3D fractal noise. Its parameters are:shape: shape of the generated array (tuple of 3 ints)res: number of periods of noise to generate along each axis (tuple of 3 ints)octaves: number of octaves in the noise (int)persistence: scaling factor between two octaves (float)lacunarity: frequency factor between two octaves (float)tileable: if the noise should be tileable along each axis (tuple of 3 bools)Note:shapemust be a multiple oflacunarity^(octaves-1)*resLicenseMIT License (SeeLICENSEfile).Perlin-NumPy is designed based on Perlin-NumPy's API (seeLICENSE_THIRD_PARTYfile).Perlin-CuPy is being maintained and developed byJoão Pedro Vasconcelos.Icon logo made byEucalypfromFlaticon.
Package: perlin-noise
Smooth random noise generatorread morehttps://en.wikipedia.org/wiki/Perlin_noisesource code:https://github.com/salaxieb/perlin_noisenoise = PerlinNoise(octaves=3.5, seed=777)octaves : number of sub rectangles in each [0, 1] rangeseed : specific seed with which you want to initialize random generatorfromperlin_noiseimportPerlinNoisenoise=PerlinNoise()# accepts as argument float and/or list[float]noise(0.5)==noise([0.5])-->True# noise not limited in space dimension and seamless in any space sizenoise([0.5,0.5])==noise([0.5,0.5,0,0,0])-->TrueUsage examples:importmatplotlib.pyplotaspltfromperlin_noiseimportPerlinNoisenoise=PerlinNoise(octaves=10,seed=1)xpix,ypix=100,100pic=[[noise([i/xpix,j/ypix])forjinrange(xpix)]foriinrange(ypix)]plt.imshow(pic,cmap='gray')plt.show()importmatplotlib.pyplotaspltfromperlin_noiseimportPerlinNoisenoise1=PerlinNoise(octaves=3)noise2=PerlinNoise(octaves=6)noise3=PerlinNoise(octaves=12)noise4=PerlinNoise(octaves=24)xpix,ypix=100,100pic=[]foriinrange(xpix):row=[]forjinrange(ypix):noise_val=noise1([i/xpix,j/ypix])noise_val+=0.5*noise2([i/xpix,j/ypix])noise_val+=0.25*noise3([i/xpix,j/ypix])noise_val+=0.125*noise4([i/xpix,j/ypix])row.append(noise_val)pic.append(row)plt.imshow(pic,cmap='gray')plt.show()
Package: perlprocess
A priori, it is a strange idea to execute pieces of perl code from a python
program, unless you have to use an existing perl API and you want to write as
less perl code as possible. In this case (and only it, in my opinion),
perlprocess may help you. See VMPython as an example of use.When a perlprocess object is created, a separate process is launched, running a
small perl script that expects commands on STDIN. If a string is given as
parameter to the perlprocess constructor, it is used as a prolog for the perl
script. It is usefull mainly to declare use clauses or some useful functions.When invoking the run(command) method of the perlprocess object, the command is
sent to the perl process as a string containing eventually several perl
statements, eventually among several lines. This string is evaluated, the result
is printed on stdout. If an error occurs (perl variable $@ not empty),
PerlRuntimeError is raised.
If you define a perl variable of any kind in the perl process, this variable
remains alive until you undefine it.
Package: perlsub
perl-subroutine-wrapperA Python wrapper for Perl subroutines.This module makes it easy to call your Perl subroutines from Python. It is perfect for recycling old Perl code that you are not going to translate to Python.It makes it possible to comunicate objects between the two languages through JSON object representations.Valid Python objects passed as parameters are: dict, list, str, int, float, True, False, None.Valid Perl objects returned are: SCALAR, ARRAY, HASH.InstallationYou can install this module from Pypi:pip install perlsubRequirementsIn order to use this python module you will need to install jinja2, which will help us with generate the Perl intermediary wrapper dinamically when calling subroutines:pip install jinja2You also need Perl installed in your computer. You can check if it is installed and the version with the command:perl -vExample of usageexample.pyandexample.pmshow us how to use the module.
Inexample.pmwe have a Perl subroutine such asjointhat we want to use in our Python script.subjoin{my($list1,$list2)=@_;my@list3;push@list3,@$list1;push@list3,@$list2;print"Joined :)";return@list3;}To wrap this subroutine and use it in Python we have to import the module, create a newModuleinstance passing the path of the Perl module, and call thecallfunction passing the name of the subroutine, the parameters and the expected Perl object returned like I did inexample.py.parametersandreturned_typecan be None.fromperlsubimportModuleexample=Module('example.pm')join=example.call(subroutine='join',parameters=[[2,3],[1,1]],return_type='array')print(join)Output:

PerlCallResult(returned=[2, 3, 1, 1], stdout='Joined :)', error=None)
Package: perma
permaA Wagtail app for keeping records under a unique, permanent URL. Please bear with us while we prepare more detailed documentation.Compatibilityperma' major.minor version number indicates the Wagtail release it is compatible with. Currently this is Wagtail 4.1.xInstallationInstall usingpip:pipinstallpermaAddpermato yourINSTALLED_APPSsetting:INSTALLED_APPS=[# ...'perma'# ...]