Saravanan666/pypi-org huggingface dataset:
Package: pythrel
pythrelAbstract relational ORM systemWARNING:This is a small project I built mainly to learn how to interface with a few different kinds of SQL database. If you would like to use this in production, no you don't!Documentation:Installation:python3 -m pip install pythrelBasic Usage:frompythrelimportSqliteDatabase,Pythrel,Recordimportsecretsimportrandom# Create database adapterdb=SqliteDatabase(path="test.db")db.create_table("customers",{"id":"INTEGER","customerName":"TEXT","favorite_number":"REAL"})db.commit()# Generate some dataCUSTOMERS={}forcinrange(500):CUSTOMERS[c]={"id":c,"customerName":secrets.token_urlsafe(8),"favorite_number":random.randint(0,10000)}# Insert datadb.query().insert("customers",list(CUSTOMERS.values())).execute()db.commit()# Connect DB instance to ORMorm=Pythrel(db)# Use database table rows as objectsprint(orm.load_columns(Customer,"customers","*")[0].dict())orm.create(Customer,"customers",id=-10,customerName="John",favorite_number=-69)john=orm.load_columns(Customer,"customers","*",where="id < 0")[0]print(john)john.favorite_number=1000orm.save(john,key="id")print(orm.load_query(Customer,orm.query().select("customers","*").where("id < 0"))[0])
Package: pythril
pythrilPython data science tools for large data sets.The name is a play on mithril, a precious ore in Middle-earth, and data mining.ExampleExtensions of the builtincollections.countersfor counting faceted data.frompythril.countersimportDictCountercounter=Dictcounter(header=['x','y'])counter.add(dict(x=1,y=2,z=3))counter[(1,2)]==1# TrueMIT LicenseCopyright (c) 2019 Public Data SciencePermission 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: pythrottle
This project offers some convenient tools for throttling and controlling
the execution timing of functions or iterative blocks of Python code.Key FeaturesSimple and time-accurate loop iterations.Support for synchronous and asynchronous programming.Rate limiting consecutive function calls.Rate measurement for loops.Installation$pipinstallpythrottleGetting startedThrottleA basic use for throttling the execution of a code block is usingThrottle.loop()(orThrottle.aloop()for asynchronous mode).
This will allow execution of the code every1 / rateseconds:fromthrottleimportThrottlerate=2.0# Target ratet=Throttle(interval=(1/rate))foriint.loop():# Do somethingprint(f"Iteration{i}")The next example code records a 15-seconds video file from the default
video source at an accurate frame rate of 24 fps usingOpenCV.importcv2fromthrottleimportThrottlerate=24.0# Target frame ratecap=cv2.VideoCapture(0)out=cv2.VideoWriter('output.avi',cv2.VideoWriter_fourcc(*'XVID'),rate,(640,480))t=Throttle(interval=(1/rate))for_int.loop(duration=15.0):ret,frame=cap.read()# Frame captureout.write(frame)# Save frame to output file# Display the resulting framecv2.imshow('frame',frame)ifcv2.waitKey(1)&0xFF==ord('q'):breakIf you simplysleep()for1 / 24seconds between frame capture, there would be a
difference between the capture rate and the output video rate because of
the time required for frame capture. If you also add image processing
(motion detection, text overlay…), the delay could cause the output to
be completely out of sync.Throttle decoratorsYou can also usethrottle.throttle()andthrottle.athrottle()decorators to limit the number of calls to a function. In the next
example, the functionhello()is decorated to rate-limit the/throttledendpoint, using aFlaskserver. Only 2 requests
will be served every 5 seconds.fromflaskimportFlaskfromthrottleimportthrottleapp=Flask(__name__)@app.route("/throttled")@throttle(limit=2,interval=5,on_fail=("Limit reached :(",429))defhello():return"Hi, Throttle!"if__name__=='__main__':app.run()Decorators can be nested to create more complex throttling rules.Rate MeterRateMeterclass is useful for measuring the rate of an iterative
code taking into account only the last few seconds, so the measured
value is kept updated.The next code block prints the execution rate of a loop that starts
looping at 10 ips (iterations per second) and decreases up to 5 ips. In
each iteration, the rate is displayed and updated taking into account
the iterations history of the last 2 seconds.importtimefromrate_meterimportRateMeterrate_meter=RateMeter(interval=2.0)foriinrange(100):rate_meter.update()measured_rate=rate_meter.rate()print(f"Rate:{rate_meter.rate()}")time.sleep(0.1+i*0.001)LicenseDistributed under the terms of theMIT License.
Package: pythrust
pythrustOfficial Python bindings library forThrustGetting StartedpythrustrequiresPython3as it relies on theasynciomodule.pip3 install pythrust [--user]At install, pythrust’ssetup.pyautomatically downloads a binary
distribution of Thrust for the current platform.import pythrust
import asyncio

loop = asyncio.get_event_loop()
api = pythrust.API(loop)

asyncio.async(api.spawn())

window = api.window({})
asyncio.async(window.show())

loop.run_forever()StatusSupport is only limited to thewindowobject for now. Contributions are
welcomedSupport tested on Linux and MacOSX. Still a few bugs on Windows.DocumentationPending specific pythrust documentation, full API reference is available
in theThrust DocumentationNews0.7.5Release date: UNRELEASEDBase API mechanismWindow bindings
Package: pythttp
This project is aimed at gaining an understanding of the communication methods and interactions between clients and servers within the HTTP protocol,
which is one of the commonly used communication protocols. The project has been implemented using Python,
and its primary goal is to provide a basic HTTP protocol implementation.  Going forward,
there are plans to add additional features and continue to enhance its capabilities.At present, the project is capable of handling both GET and POST requests. However,
there are plans to further develop the project to include more advanced functionalities.
Package: pythum
pythumSimple minimalist quantum computing simalation for pythonimportpythumUsageQubitClass for qubit manipulation and instanciation by notationfrompythumimportQubitqubit=Qubit()|0>Public MethodsQubit.from_notation(cls, value: str) -> 'Qubit'Instanciate a qubit by the formal notation.The following are possible values:"|0>": 0"|1>": 1"|10>", "|01>": super positionfrompythumimportQubitqubit1=Qubit.from_notation("|0>")# 0qubit2=Qubit.from_notation("|1>")# 1qubit3=Qubit.from_notation("|10>")# Super position|0>
|1>
|01>Qubit.from_qubit(cls, qubit: 'Qubit') -> 'Qubit'Instanciate a copy of another qubit.frompythumimportQubitqubit1=Qubit.from_notation("|1>")# 1qubit2=Qubit.from_qubit(qubit1)# 1|1>
|1>up(self) -> 'self'Points up the eletron.The outcome of any measure will always be 1frompythumimportQubitqubit=Qubit()# 0qubit.up()# 1|1>down(self) -> 'self'Points down the eletron.The outcome of any measure will always be 0frompythumimportQubitqubit=Qubit()# 0qubit.up()# 1|0>left(self) -> 'self'Points the eletronto the left.The outcome of a measure may be 0 or 1frompythumimportQubitqubit=Qubit().left()# Super position|01>right(self) -> 'self'Points the eletronto the right.The outcome of a measure may be 0 or 1frompythumimportQubitqubit=Qubit().left()# Super position|01>PropertiesalphaAlpha probability for mesuring 0.The returned probability is a number between 0 and 1.frompythumimportQubitQubit().alphaQubit().up().alphaQubit().left().alphaQubit().right().alpha1
0
0.5
0.5betaBeta probability for mesuring 1The returned probability is a number between 0 and 1.frompythumimportQubitQubit().betaQubit().up().betaQubit().left().betaQubit().right().beta0
1
0.5
0.5QublockPublic methodsinit(self, value: Union[int, 'Qublock', List[Qubit]])
Package: pythumb
PyThumbSimple command line utility and API for downloading YouTube thumbnails.Supports JPEG and WebP formats in all sizes.
Previews (animated thumbnails) are not supported due to the lack of direct URL or API access.Requires Python 3.6+Table of contentsInstallationFrom sourceUsageCLIAPIThumbnail sizesLicenseInstallationInstall via pip:$pipinstallpythumbOr get binaries from thelatest release.From sourceUsepythoninstead ofpython3on WindowsDownload source code from thelatest release, extract andcdinto it.(Optional) Create avirtual environmentto manage packages easier.Update pip and setuptools:$python3-mpipinstall-UpipsetuptoolsInstall this package:$python3-mpipinstall.Optionally you can build a standalone executable.Prerequisites:Git Bash(Windows)On Linux install python3-dev:$sudoaptinstallpython3-devInstall PyInstaller:$python3-mpipinstallpyinstallerRun the build script for your OS:$chmod+x./scripts/build.sh
$./scripts/build.sh<win/linux>You can find the executable in./pyi-dist/.UsageCLI$pythumb[options]<input>To save a thumbnail to the current directory, simply pass the video URL or 11-character ID (recommended quoted):$pythumb"https://youtu.be/aqz-KE-bpKQ"# or$pythumb"aqz-KE-bpKQ"Use--helpfor more details.APIExamplefrompythumbimportThumbnailt=Thumbnail('https://youtu.be/aqz-KE-bpKQ')t.fetch()t.save('.')# ./aqz-KE-bpKQ.jpgThumbnail sizesNameSizemaxresdefault1280x720sddefault640x480hqdefault480x360mqdefault320x180default120x90Auto-generated previews (start, middle and end of the video)NameSizemaxres11280x720maxres21280x720maxres31280x720sd1640x480sd2640x480sd3640x480hq1480x360hq2480x360hq3480x360mq1320x180mq2320x180mq3320x1801120x902120x903120x90LicenseMIT license. SeeLICENSEfor more information.
Package: pythumbnail
PythumbnailWhat is Pythumbnail?Pythumbnail is a quick thumbnail creator for python codes. You can get an overview of the available functions, for/while loops and if conditions without even running the code.Suppose you have the following python file:classsomeclass:def__init__(self):self.a=10defdo_something(self):foriinrange(len(self.a)):ifi==2:print(i)defdo_something_else(self,num):whileself.a<100:self.a+=numHere is a small example to show what Pythumbnail could do (Python 3):importpythumbnailfile=pythumbnail.read_file('some_file.py')print(file.tree)The output will look like:'File some_file.py()''class someclass()''def __init__(self)''def do_something(self)''for i in range(len(self.a))''if[i,2] LOGIC: [==]''def do_something_else(self,num)''while[self.a,100] LOGIC: [<]'Quick StartTo install Pythumbnail, you need python version 3.6.0 or above. Pythumbnail could be installed from pypi:$ python3 -m pip install pythumbnailRunning Pythumbnail:importpythumbnailDocumentationFull documentation is availablehereContributingPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.LicenseApache License 2.0
Package: pythumbnailer
pythumbnailerCreate static HTML galleries with thumbnails.Supports:Many types of imagesMany types of videos (usingffpmegfor convertion and thumbnailing)GPS Tracks in GPX formatThe architecture should it make it relatively simple to add more types.InstallationThis is available on PyPI:https://pypi.org/project/pythumbnailer/$pipinstallpythumbnailerIt's also available on AUR:https://aur.archlinux.org/packages/python-pythumbnailerDependenciesThis is only tested on Linux, but it should work on Windows.The Python dependencies are shown onrequirements.txt.This also requires a non-Python dependency.FFMPEGBothffmpegandffprobeshould be available. Install the version that comes
with your operating system.HTMLThe generated HTML should be mostly self-contained and standards-compliant. For
advanced features it is needed to use Javascript libraries, bundled on the
repository itself (see thepythumbnailer/static/lib/folder.Here is the list of all dependencies:LeafletThe library that supports slippy maps:https://leafletjs.com/http://github.com/Leaflet/LeafletThis uses some plugins, installed as other dependencies.Leaflet ElevationLeaflet plugin. Show the elevation graph.https://github.com/Raruto/leaflet-elevationLeaflet GPXLeaflet plugin. Support GPX files in-browser.https://github.com/mpetazzoni/leaflet-gpxD3.jsDependency forleaflet-elevation.https://d3js.org/https://github.com/d3/d3DevelopmentSee theHACKINGdocument.
Package: py_thumbnailer
Main idea was taken fromhttps://github.com/FelixSchwarz/anythumbnailer.
Code rewriten from zero.A CLI utility/Python library to create thumbnails for different file types
(including PDF, mp4 videos and Microsoft Office documents aka docx/xlsx/pptx).All the heavy-lifting is done by commonly-used tools such as LibreOffice/unoconv,
ffmpeg, poppler and ImageMagick so format support is limited by what these tools
can process.Program requirementsVideo encoding:ffmpegPdf encoding:poppler-utilsOffice files:unoconvImagemagic external libraries:http://pillow.readthedocs.org/en/3.2.x/installation.html#external-librariesInstallation$ pip install py-thumbnailerUsageFrom command line:$ py-thumbnailer SOURCEFILE [OUTPUTFILE]From python code:from py_thumbnailer.thumbnail import create_thumbnail
output_buffer = create_thumbnail(source_file)
Package: pythunder
ThunderThunder is a high-performance CGRA placement engine. It is uses
multi-processing to speed up the placement. Users can also use AWS
lambda to enable high parallelism if desired (C++ lambda invocation
coming soon).RequirementCMake 3.9+g++-7/clang-6 or aboveInstallTo install from source, simply domkdir build
cd build
cmake .. && make -jThunder also has a complete Python binding available, to use the Python
binding, simply dopip install pythunderYou can see the example code inexamplefolder.
Package: pythutils
pythutilsA collection of utility functions for PythonInstallationTo install the latest release ofpythutils, open a terminal window and enter:pip install pythutilsTo install the latest development version, enter:pip install git+https://github.com/JolleJolles/pythutils.git --upgrade --force-reinstallDependenciespythutilsis both Python 2.7 and 3 compatible and hasnumpy,pyyaml,pandas, andh5pyas dependencies that will be automatically installed. Note that this can take very long (up to an hour) with pip on older machines and python versions and faster will be to manually install withapt-get.UsageTo use the various utility functions, e.g.:from pythutils.timeutils import clock
from pythutils.fileutils import listfiles
from pythutils.mathutils import points_to_angle
from pythutils.sysutils import isrpiDevelopmentpythutilsis developed byDr Jolle Jollesat the Max Planck Institute of Animal Behavior, Konstanz, Germany.For an overview of version changes see theCHANGELOGand for detailed changes see thecommits page.Please submit bugs or feature requests to the GitHub issue trackerhere.LicenseReleased under a Apache 2.0 License. SeeLICENSEfor details.
Package: pythy
pythyA short and sweet Python interface to compiled codeOverviewpythydynamically generates a Python interface for calling
functions in a shared library using the interface exposed by a
C header file.pythy's coolest feature is its ability to run compiled code under
the Valgrind debugger. This allows you to test compiled code for
memory errors directly from Python, for example while running
automated testing.Installationpip install pythyMinimal exampleCreateadd.cwith the following contents:#include"add.h"intadd(inta,intb){returna+b;}andadd.hwithintadd(inta,intb);The compileadd.cinto a Linux shared object with the commandgcc -fPIC -shared funcs.c -o funcs.so.Then run the following Python code, which creates a modulemoduleand populates it with a wrapper for theaddfunction from your C
code, complete with the correct type information:importpythymodule=pythy.create_interface("add.h","add.so")print(module.add(1,2))That's it! You've run your compiled C code directly from Python.pythyalso has the ability to generate docstrings from your header
file and even automatically create classes.Minimal example with ValgrindTODO: Add a minimal example demonstrating usage with Valgrind.Memory spacesTODO: Move this section to a C implementation guide.Strings (i.e., all variables with C typechar*) are passed between Python
and the compiled code by passing the literal bytes in the string (without
the null terminator). All other data types are passed as a numerical value.To take care of allocated memory, when compiled code returns achar*The Python code is not responsible for any direct cleanup, except
for callingdlcloseon the SO.The returned pointer is guaranteed to remain valid until another function
in the same SO is called.This is most easily implemented by the SO maintaining a globalchar*variable that tracks the lastchar*returned from a function. Whenever
anotherchar*must be allocated and returned, the global is realloced
and returned.This doesn't scale well to multi-threaded programs, but for now it seems
like the easiest way to do things.
Package: pyticc
PYTICCPython module to interface with Texas Instruments CC1xxx Sub-1Ghz RF transceivers over SPI.Supported ModelsCC1101Installationpip install pyticcBasic usagefrom pyticc.cc1101 import CC1101

cc = CC1101()
cc.sanity_check()
cc.recv_data()Command Strobescc.reset()
cc.power_down()
cc.sidle()
cc.enable_rx()
cc.enable_tx()
cc.wor_on()
cc.sx_off()
cc.calibrate()
cc.flush_rx_fifo()
cc.flush_tx_fifo()Convenience config methods (get or set)cc.base_frequency(433)
cc.modulation('OOK')
cc.packet_length('PKT_LEN_VARIABLE')
cc.rx_bandwidth(325000)
cc.sync_word('FAFA')
cc.manchester(1)
cc.whitening(1)Read and write raw bytes to registerbyte = cc.read_byte(0x10)
cc.write_byte('MDMCFG4', byte)Easy querying and modification of config register attributesQuery by address, or class attribute name.cc.register_value(0x10)
{
  'CHANBW_E[1:0]': 1,
  'CHANBW_M[1:0]': 3,
  'DRATE_E[3:0]': 8
}

cc.register_write('MDMCFG4', 'CHANBW_M[1:0]', 0x02)

cc.register_write('MDMCFG4', 'CHANBW_M[1:0]', '101')To DoAdd more CCxxxx models.JSON config dump/load would be cool.CONTACTJeff Learysillymonkeysoftware@gmail.com
Package: pyticcom
pyticcom - EDF teléinformation Python libraryThis library allows you to retrieve teleinfo using serial port device (USBTICLCV2).Exampleimport asyncio

from pyticcom import Teleinfo, Mode
from scanner import ComScanner

scanner = ComScanner()
serials = scanner.scan()
for serial in serials:
    print(serial.device)

async def main():
    with Teleinfo('/dev/USB0', mode=Mode.HISTORY) as teleinfo:
        while True:
            frame = await teleinfo.read_frame()
            print("{} groups found".format(len(frame.groups)))
            for group in frame.groups:
                print(group)
            await asyncio.sleep(1)


loop = asyncio.get_event_loop()
result = loop.run_until_complete(main())
Package: pytick
Pytickpytick is a lightweight Python library that provides a simple and intuitive timer class for accurate time interval measurements. It allows you to track elapsed time account for waiting periods, and calculate net time. Ideal for benchmarking, performance analysis, and duration tracking in Python applications.Installationpip3 install pytickUse casesNormal Case:importtimefrompytickimportTickdeffunc():time.sleep(1)if__name__=="__main__":Tick.start()func()Tick.stop()print(Tick.get_seconds())# Output:1.01297269994393Get the actual time excluding part of the codeimporttimefrompytickimportTickdeffunc():Tick.wait()time.sleep(1)Tick.stop_waiting()if__name__=="__main__":Tick.start()func()Tick.stop()print(Tick.get_active_seconds())# Output:1.5600002370774746e-05ContributionFeel free to contribute and open a pull request 😄
Package: pyticker
pytickerTerminal App for Stock Watchlisting and Position Tracking. Uses Yahoo Finance to fetch the real time stock quotes.Features✨ Real time stock quotes.✨ Live position tracking.✨ Fetches latest quotes every second.✨ Stocks/Positions can be added/removed from CLI.How to Usepipinstallpyticker
pytickerTo add/remove stocksAt the bottom of the app, there is an istruction text area. It autosuggests available commands to operate the Pyticker. For example, to add the stock in watchlist an instruction likeadd_to_watchlist SBIN.NS ONGC.NScan be issued.Supported InstructionsInstructionExampleRemarksadd_to_watchlistadd_to_watchlistStock Symbols separate by white spaceremove_from_watchlistremove_from_watchlist <stock-symbolremove_from_watchlist SBIN.NSadd_new_positionadd_new_positionexample: add_new_position SBIN.NS 100 200remove_from_positionremove_from_positionremove_from_position SBIN.NSCreditsprompt_toolkitYahoo FinanceInspired by TickerLicenseMIT
Package: pytickersymbols
pytickersymbolspytickersymbols provides access to google and yahoo ticker symbols for all stocks of the following indices:AEXBEL 20CAC 40DAXDOW JONESFTSE 100IBEX 35MDAXNASDAQ 100OMX Helsinki 15OMX Helsinki 25OMX Stockholm 30S&P 100S&P 500SDAXSMITECDAXMOEXinstallpip3installpytickersymbolsquick startGet all countries, indices and industries as follows:frompytickersymbolsimportPyTickerSymbolsstock_data=PyTickerSymbols()countries=stock_data.get_all_countries()indices=stock_data.get_all_indices()industries=stock_data.get_all_industries()You can select all stocks of an index as follows:frompytickersymbolsimportPyTickerSymbolsstock_data=PyTickerSymbols()german_stocks=stock_data.get_stocks_by_index('DAX')uk_stocks=stock_data.get_stocks_by_index('FTSE 100')print(list(uk_stocks))If you are only interested in ticker symbols, then you should have a look at the following lines:frompytickersymbolsimportPyTickerSymbolsstock_data=PyTickerSymbols()# the naming conversation is get_{index_name}_{exchange_city}_{yahoo or google}_tickersdax_google=stock_data.get_dax_frankfurt_google_tickers()dax_yahoo=stock_data.get_dax_frankfurt_yahoo_tickers()sp100_yahoo=stock_data.get_sp_100_nyc_yahoo_tickers()sp500_google=stock_data.get_sp_500_nyc_google_tickers()dow_yahoo=stock_data.get_dow_jones_nyc_yahoo_tickers()# there are too many combination. Here is a complete list of all gettersall_ticker_getter_names=list(filter(lambdax:(x.endswith('_google_tickers')orx.endswith('_yahoo_tickers')),dir(stock_data),))print(all_ticker_getter_names)issue trackerhttps://github.com/portfolioplus/pytickersymbols/issues
Package: pytickertick
PyTickerTick : An API wrapper for theTickerTick APIin PythonUsageimporttickertickasttimporttickertick.queryasqueryticker1=tt.get_tickers(query='Ama',no=5)# Search for any tickers matching 'Ama'ticker2=tt.get_tickers(query='aa',no=2)# Search for any tickers matching 'aa'feed1=tt.get_feed(query=query.And(query.BroadTicker('aapl'),query.StoryType(query.StoryTypes.SEC)))# SEC filings from Apple Inc.feed2=tt.get_feed(query=query.Or(query.BroadTicker('meta'),query.BroadTicker('aapl'),query.BroadTicker('amzn'),query.BroadTicker('nflx'),query.BroadTicker('goog')))# News stories about FAANG stocksfeed3=tt.get_feed(query=query.And(query.Or(query.BroadTicker('meta'),query.BroadTicker('goog'),),query.Site('reddit')))# News stories about Meta (meta) and Google (goog) from reddit.comfeed4=tt.get_feed(query=query.Diff(query.Or(query.BroadTicker('meta'),query.BroadTicker('goog'),),query.Site('reddit')))# News stories about Meta (meta) and Google (goog) not from reddit.comfeed5=tt.get_feed(query=query.Diff(query.Entity('Elon Musk')query.Site('nytimes')))# Stories with Elon Musk in titles not from NY Times