Saravanan666/pypi-org huggingface dataset:
Package: py-dtn7
py-dtn7 (Work in Progress -- don't use yet)A Python wrapper library for the DTN7 REST and WebSocket API ofdtn7-rs.
The library includes a fully spec compliantBundletype (but without fragment and CRC support), which allows full
bundle creation and (de-)serialization.Thebundle.py,dtn_rest_client.py,utils.pymodules/files are Micropython compatible.
But, this requires a bit of manual library management.
Please refer to the Micropython installation guide below.Getting StartedTo usepy-dtn7in your project, simply install it from PyPI with Poetry:$poetryinstall--no-devpy_dtn7DevelopmentThis is very much a work-in-progress and by far not complete. The Bundle
implementation is very rudimentary and does not support any blocks other
than Primary and Payload.To generate the API documentation usepdoc:$pdoc./py_dtn7--output-directory./docs... or check outpy-dtn7.readthedocs.orgQuickstart>>>frompy_dtn7importDTNRESTClient>>>client=DTNRESTClient(host="http://localhost",port=3000)>>>d.peers{'box1': {'eid': [1, '//box1/'], 'addr': {'Ip': '10.0.0.42'}, 'con_type': 'Dynamic', 'period': None, 'cla_list': [['MtcpConvergenceLayer', 16162]], 'services': {}, 'last_contact': 1653316457}}>>>d.info{'incoming': 0, 'dups': 0, 'outgoing': 0, 'delivered': 3, 'broken': 0}When sending a bundle to a known peer, we can simply supply the peer name and endpoint,
otherwise we use the complete URI:>>>d.send(payload={"body":"This will be transferred as json"},peer_name="box1",endpoint="info")<Response [200]>>>>r=d.send(payload="Is there anybody out there?",destination="dtn://greatunkown/incoming")>>>r.content.decode("utf-8")'Sent payload with 27 bytes'Micropython Installation GuideTo be extended:The dummy libraries__future__.py,abc.py,typing.py, themicropython-cborlibrary (specifically thecbor.pymodule/file) andurequestsas well asdatetimeare needed:$mpremotemipinstallurequests
$mpremotemipinstalldatetime
Package: pydtnsim
PyDTNsimIntroductionThis python module contains a simulation environment that allows the simulation of arbitrary Delay Tolerant Networking (DTN) scenarios on a packet (DTN terminology: bundle) level.PyDTNsimprovides users with the ability to evaluate the performance of various routing approaches and to detect possibly occurring overload situations. Currently, the focus lies on deterministic Contact-Graph-based routing approaches, but there might be other
approaches available in the future. The clear modularization allows users to easily implement routing approaches on their own.More InformationPlease refer to the Github repository for a more detailed overview of the module and tutorials on how to get started.
Package: py-dto
Python DTOData Transfer Objects (DTO) with Python.Installpipinstallpy_dtoUsageDefine the object properties with types defined, then pass adictwith data.Basic exampleFor type hintingfrompy_dtoimportDTO# This DTO will be used as a type definitionclassUserProfile(DTO):avatar:str# The DTO with the properties definedclassUser(DTO):profile:UserProfilename:stremail:strage:inttags:list[str]# Create the DTO instanceuser=User({'profile':UserProfile({'avatar':'https://i.pravatar.cc/300'}),'name':'John','email':'john@example.com','age':42,'tags':['developer','python']})print(user.name)# 'John'print(user.profile.avatar)# https://i.pravatar.cc/300TheAnytypeEven DTO are supposed to specify data types, you can use theAnytype to accept literally any type for a property:frompy_dtoimportDTOfromtypingimportAny# The DTO accepts "any" type of data for the "name" propertyclassUser(DTO):name:Any# Create the DTO instanceuser=User({'name':'John',})print(user.name)# 'John'user=User({'name':123,})print(user.name)# 123Dealing withNoneImagine you are retrieving data from a database table where a column is empty for some records.By using python'sOptionaltype on a specific property, the DTO will not raise an exception if aNonevalue is set.frompy_dtoimportDTOfromtypingimportOptional# The DTO "name" property can be a str or a None valueclassUser(DTO):name:Optional[str]# Create the DTO instance with a "str"user=User({'name':'John',})print(user.name)# 'John'# Create the DTO instance with a "None"user=User({'name':None,})print(user.name)# None# Any other type will raise an exceptiontry:user=User({'name':123,})except:print('123 does not have a "str" nor a "None" type')LicenseThis project is open-sourced software licensed under theMIT license.Original idea comes fromspatie/data-transfer-objectpackage for PHP.Icons made byPixel perfectfromwww.flaticon.com
Package: pydtp
Python Dictionary Transfer Protocolpydtpis a package defining a protocol for transparently
accessing a remote server with function calls passing
lightweight arguments.pydtpdefines three classes:aServerclass based onsocketserver.TCPServeran abstractHandlerclass to implement to define the Server-responsesan abstractClientclass to implement to define the Client interfaceThe functions implemented on the Client class are redirected to
the server class encoding the arguments and the return value in
the most transparent way.DependenciesThe package is developed forPython3.The package requiresnumpyplus the standard python libraries
for both the client and server sides.ExampleDefine the client implementing two functions,
that just redirect the functions to thequery:import pydtp 

class SimpleClient (pydtp.Client) :
  def add_one ( self, num ):
    return self.query ( 'add_one', [num] ) 

  def capitalize ( self, *strings):
    return self.query ( 'capitalize', [strings] )Thequeryfunction hides the complexity and allow to
call functions implemented in aHandler:import pydtp 

class SimpleHandler (pydtp.Handler):
  def add_one ( self, num ):
    return num + 1 

  def capitalize ( self, strings ):
    return {k: k.capitalize() for k in strings}The server is then instantiated and started onlocalhostand on a port.server = pydtp.Server ( ('localhost', 12345), SimpleHandler )
server.start()The client class is instantiated indicating the address and the portclient = SimpleClient ( ('localhost', 12345) ) 
client.add_one ( 3 ) ## == 4
client.capitalize ( 'test' ) ## == "Test"
Package: pyd-tpl
pyd_tplPython的C接口模板,安装后使用如下的命令进行生成:pyd_tpl module_name=Animal --class-name=Cat将生成Animal模块Cat类changelog2022-01-15新增函数get_c_string(将Python转换为char)和print(打印PyObject*)调用方法如下:PyObject*a;if(!PyArg_ParseTuple(args,"U",&a)){returnNULL;}constchar*s=get_c_string(a);printf("%s\n",s);print(a);
Package: pydt-range
Python Datetime Rangepydt-rangeis purely python mini library that allows to iterate overdatetimeobjects with a specified step (similar to built-inrange())InstallationPippipinstallpydt-rangePoetrypoetryaddpydt-rangeUsageWith default stepfromdatetimeimportdatetimefrompydt_rangeimportdatetime_rangestart_dt=datetime(2022,1,1)end_dt=datetime(2022,1,10)fordtindatetime_range(start_dt,end_dt):# Default step is timedelta(days=1)print(dt)"""2022-01-01 00:00:002022-01-02 00:00:002022-01-03 00:00:002022-01-04 00:00:002022-01-05 00:00:002022-01-06 00:00:002022-01-07 00:00:002022-01-08 00:00:002022-01-09 00:00:00"""With custom stepfromdatetimeimportdatetimefromdateutil.relativedeltaimportrelativedeltafrompydt_rangeimportdatetime_rangestart_dt=datetime(2022,1,1)end_dt=datetime(2022,1,10)step=relativedelta(hours=6)fordtindatetime_range(start_dt,end_dt,step):print(dt)"""2022-01-01 00:00:002022-01-01 06:00:002022-01-01 12:00:002022-01-01 18:00:002022-01-02 00:00:002022-01-02 06:00:002022-01-02 12:00:002022-01-02 18:00:002022-01-03 00:00:002022-01-03 06:00:002022-01-03 12:00:002022-01-03 18:00:002022-01-04 00:00:002022-01-04 06:00:002022-01-04 12:00:002022-01-04 18:00:002022-01-05 00:00:002022-01-05 06:00:002022-01-05 12:00:002022-01-05 18:00:002022-01-06 00:00:002022-01-06 06:00:002022-01-06 12:00:002022-01-06 18:00:002022-01-07 00:00:002022-01-07 06:00:002022-01-07 12:00:002022-01-07 18:00:002022-01-08 00:00:002022-01-08 06:00:002022-01-08 12:00:002022-01-08 18:00:002022-01-09 00:00:002022-01-09 06:00:002022-01-09 12:00:002022-01-09 18:00:00"""
Package: pydts
Discrete Time Survival AnalysisA Python package for discrete-time survival data analysis with competing risks.Tomer Meir,Rom Gutman,Malka Gorfine2022DocumentationInstallationpip install pydtsQuick Startfrompydts.fittersimportTwoStagesFitterfrompydts.examples_utils.generate_simulations_dataimportgenerate_quick_start_dfpatients_df=generate_quick_start_df(n_patients=10000,n_cov=5,d_times=14,j_events=2,pid_col='pid',seed=0)fitter=TwoStagesFitter()fitter.fit(df=patients_df.drop(['C','T'],axis=1))fitter.print_summary()ExamplesUsage ExampleHospital Length of Stay Simulation ExampleCitationsIf you found PyDTS software useful to your research, please cite the papers:@article{Meir_PyDTS_2022,author={Meir, Tomer and Gutman, Rom, and Gorfine, Malka},doi={10.48550/arXiv.2204.05731},title={{PyDTS: A Python Package for Discrete Time Survival Analysis with Competing Risks}},url={https://arxiv.org/abs/2204.05731},year={2022}}@article{Meir_Gorfine_DTSP_2023,author={Meir, Tomer and Gorfine, Malka},doi={10.48550/arXiv.2303.01186},title={{Discrete-time Competing-Risks Regression with or without Penalization}},url={https://arxiv.org/abs/2303.01186},year={2023}}and please consider starring the projecton GitHubHow to ContributeOpen Github issues to suggest new features or to report bugs\errorsContact Tomer or Rom if you want to add a usage example to the documentationIf you want to become a developer (thank you, we appreciate it!) - please contact Tomer or Rom for developers' on-boardingTomer Meir:tomer1812@gmail.com, Rom Gutman:rom.gutman1@gmail.com
Package: pydtw
pydtwFast Imprementation of the Dynamic Time Warping For Python.installpip install pydtwusageAlignment for two 1-dimensional sequencesfrom pydtw import dtw1d
import numpy as np
a = np.random.rand(10)
b = np.random.rand(15)
cost_matrix, cost, alignmend_a, alignmend_b = dtw1d(a, b)Alignment for two 2-dimensional sequencesfrom pydtw import dtw2d
import numpy as np

a = np.random.rand(10, 4)
b = np.random.rand(15, 4)
cost_matrix, cost, alignmend_a, alignmend_b = dtw2d(a, b)
Package: pyDtwSat
pyDtwSatThis Package is adapted from Victor Maus's R package dtwSat.Dynamic Time Warping and Time-Weighted Dynamic Time Warping (TWDTW) for satellite image time series analysis. pyDtwSat provides visulisation to land use land cover  classification of the time series of satellite images.ReferencesMaus, Victor, Gilberto Camara, Marius Appel, and Edzer Pebesma. 2019.
“dtwSat: Time-Weighted Dynamic Time Warping
for Satellite Image Time Series Analysis in R.”Journal of Statistical
Software88 (5): 1–31.https://doi.org/10.18637/jss.v088.i05.Maus, Victor, Gilberto Camara, Ricardo Cartaxo, Alber Sanchez, Fernando
M. Ramos, and Gilberto R. de Queiroz. 2016. “A Time-Weighted Dynamic
Time Warping Method for Land-Use and Land-Cover Mapping.”IEEE Journal
of Selected Topics in Applied Earth Observations and Remote Sensing9
(8): 3729–39.https://doi.org/10.1109/JSTARS.2016.2517118.
Package: pydtype
pydtypeTranslate data type specifiers between common frameworks.FeaturesThis library provides:Translator of data type spacifier such asformat character in structanddtype in Numpy.InstallationpipinstallpydtypeUsageTo translate struct formath(2-byte integer) to Numpy format, run the following script.>>>importpydtype>>>pydtype.translate("h","struct","numpy")'i16'This library is usingSemantic Versioning.
Package: pydualsense
pydualsensecontrol your dualsense through python. using the hid library this package implements the report features for controlling your PS5 controller.DocumentationYou can find the documentation atdocsInstallationWindowsDownloadhidapiand place the x64 .dll file into your Workspace. After that install the package frompypi.pipinstall--upgradepydualsenseLinuxOn Linux based system you first need to add a udev rule to let the user access the PS5 controller without requiring root privileges.sudocp70-ps5-controller.rules/etc/udev/rules.d
sudoudevadmcontrol--reload-rules
sudoudevadmtriggerThen install the hidapi through your package manager of your system.On an Ubuntu system the packagelibhidapi-devis required.sudoaptinstalllibhidapi-devAfter that install the package frompypi.pipinstall--upgradepydualsenseusagefrompydualsenseimportpydualsense,TriggerModesdefcross_pressed(state):print(state)ds=pydualsense()# open controllerds.init()# initialize controllerds.cross_pressed+=cross_pressedds.light.setColorI(255,0,0)# set touchpad color to redds.triggerL.setMode(TriggerModes.Rigid)ds.triggerL.setForce(1,255)ds.close()# closing the controllerSeeexamplesorexamples docsfolder for some more ideasHelp wantedHelp wanted from people that want to use this and have feature requests. Just open a issue with the correct label.dependecieshidapi-usb >= 0.3CreditsMost stuff for this implementation were provided by and used from:https://www.reddit.com/r/gamedev/comments/jumvi5/dualsense_haptics_leds_and_more_hid_output_report/https://github.com/Ryochan7/DS4WindowsComing soonadd multiple controllersadd documentation using sphinx
Package: pydubbo
python调用dubbo,目前支持dubbo协议，不需要服务端修改成jsonrpc.实现客户端的负载均衡、配合Zookeeper自动发现服务功能等
依赖pyhessian，bitstring示例代码from pydubbo.pydubbo import DubboZK

if __name__ == '__main__':
    d = DubboZK(interface="com.dianwoba.genius.provider.StaffProvider", hosts='192.168.11.29:2185')
    res = d.findByCode([("Ljava/lang/String;", u"00064")]) #根据返回的方法，动态添加.输入的参数只有一个java string类型
    print(res, res.data)#(<com.dianwoba.dubbo.base.result.ResponseDTO object at 0x1035d2a50>, <com.dianwoba.genius.domain.dto.StaffDTO object at 0x1035d2ad0>)
    res = d.findByMobile([("Ljava/lang/String;", u"18657112153")]) #根据返回的方法，动态添加.输入的参数只有一个java string类型
    print(res.data.name)具体参照测test目录，目前支持常用的dubbo协议。1.dubbo协议1.1 请求头intbe:16=-9541,intbe:8=-62,intbe:8=0,uintbe:64=0,uintbe:32=数据包长度总长度16字节。依次是2字节的magic信息 ，一个字节的附加信息 ，一个字节的空信息，8个字节的空信息，4个字节的数据包长度1.2 信息体通过hessian协议序列化的二进制信息1.3 响应头intbe:16,intbe:8,intbe:8,uintbe:64,uintbe:32总长度16个字节依次是2字节的magic信息 ，一个字节的附加信息 ，一个字节的空信息，8个字节的空信息，4个字节的数据包长度
Package: pydublinbus
PyDublinBusPython Interface for the Dublin Bus RTPI API.Example usageTime table:>>> from pydublinbus import DublinBusRTPI
>>> mybus=DublinBusRTPI(stopid='312')
>>> mybus.bus_timetable()
[{'due_in': '6', 'route': '26'},
 {'due_in': '8', 'route': '25B'},
 {'due_in': '15', 'route': '67'},
 {'due_in': '22', 'route': '66B'},
 {'due_in': '23', 'route': '25A'},
 {'due_in': '31', 'route': '66A'},
 {'due_in': '38', 'route': '25B'},
 {'due_in': '39', 'route': '66'},
 {'due_in': '41', 'route': '26'},
 {'due_in': '41', 'route': '25'},
 {'due_in': '45', 'route': '67'},
 {'due_in': '46', 'route': '25A'}]Time table filtered by route>>> from pydublinbus import DublinBusRTPI
>>> mybus=DublinBusRTPI(stopid='312', route='25A')
>>> from pprint import pprint
>>> mybus.bus_timetable()
[{'due_in': '20', 'route': '25A'},
 {'due_in': '43', 'route': '25A'}]Raw json data:>>> from pydublinbus import DublinBusRTPI
>>> mybus=DublinBusRTPI(stopid='312')
>>> mybus.get_rtpi_data()
Package: pydub-stubs
pydub-stubsPydub version:0.25.1pydub-stubsprovides type information forPydub.Only the public interface is guaranteed to be typed, however there
are type definitions for some private and undocumented functions.pip install pydub-stubsAnticipated QuestionsQ: Why isAudioSegment.some_effect(...)missing?You need to import it as a function frompydub.effects.Q: What is_Metadataand_PartialMetadata?These are legacy types that have been replaced by thechannels,frame_rate, andsample_ratekeyword arguments.ChangelogVersion 0.25.1.1Removed literal type fallback overloadsThe fallbacks removed all the advantages of using literals at all.Modernized the type stubsUses new union syntax, and more. (#2and#3- thanks,@Viicos!)AddWavSubChunk,WavData, and undocumented functionsThese previously existed and were available but were untyped. (thanks again,@Viicos!)Previous versionsVersion 0.25.1.0Added v0.25.0 featuresThis includespydub.scipy_effects.eqand new classmethod parameters.Signatures now use literals where possibleOverloaded implementations exist as a fallback.Added missing modulespydub.silenceandpydub.utilsVersion 0.24.1.9Add undocumented parameter ofAudioSegment.from_fileread_ahead_limitis absent from the documentation but is a supported
keyword argument.Version 0.24.1.8Export other modulesAdds exports for effects, exceptions, generators, playback, and scipy_effectsVersion 0.24.1.7AddedAudioSegment._spawn(again)This was accidentally removed in an earlier version.Improvedpydub.effects.invert_phaseThis is technically less accurate as(0, 0)is equivalent to(0, 1).Version 0.24.1.6Removed testing symbols frompydub.audio_segmentVersion 0.24.1.5FixedAudioSegment.exportFirst param is namedout_fand isn't required.Version 0.24.1.4Improved signature ofAudioSegment.from_fileThe keyword arguments for raw/PCM audio don't requireformatto be set to
eitherraworpcm.Fixed package exportsExportsAudioSegmentfrom__init__.py.Version 0.24.1.3Fixed overloads ofAudioSegment.fadeExactly two ofstart,end, anddurationmust be given.Version 0.24.1.2ImprovedAudioSegment.fadeChanged to use overloads to prevent invalid method calls.ImprovedAudioSegment.from_mono_audiosegmentsUse a positional-only parameter to ensure there's at least 1 argument.Version 0.24.1.1FixedAudioSegment.__init__Use overloads to model correct parameters.FixedAudioSegment._spawnParameteroverridesaccepts a partial dictionary.Fixedpydub.scipy_effects.high_pass_filterParameterordershould beint, notfloat.Version 0.24.1.0Released
Package: pyduck
pyduckis a Python utility framework for more effective usage
of language’s defining traits:duck typing. It enhances the
language with several useful features that increase the readability
and reliability of Python code.from pyduck import Interface, expects, Any, overload

class Iterable(Interface):
    def __iter__(self): pass

@expects(Iterable)
def __iterable_as_json(value):
    json_list = map(as_json, value)
    return "[%s]" % str.join(",", json_list)

@expects(basestring)
def __string_as_json(value):
    return '"%s"' % str(value)

@expects(Any)
def __other_as_json(value):
    return str(value)

as_json = overload(__iterable_as_json, __string_as_json, __other_as_json)Featuresinterfaceswhich do not need to be explicitly declared
(similar to Go language)automaticinterface/type checkingfor function argumentsfunction overloadingbased on interfaces/types of argumentsautomatic interface/type checking for function return valuesFor more info & the docs, see theproject’s webpage.
Package: pyduckdb
pyduckdbPython wrapper for DuckDB to add type hinting and more closely mirror SQLite. This is still a rough work in
progress, but should hopefully highlight the utility of thePEP 249abstract base classes.This implementation provides Python type hints, context managers, and more distinct cursor types on top of
DuckDB. This is not intended to be used in production, but as a test bed for some ideas and to demonstrate
the abstract base classes.Installationpython3 -mpip install pyduckdbUsageUses the standard Python database API.frompyduckdbimportconnectdefmain():withconnect(":memory:")asconnection:withconnection.execute("SELECT 1;")ascursor:print(next(cursor))if__name__=="__main__":main()There is a very naive async implementation available, which essentially involves wrapping every call
withasyncio.to_thread:importasynciofrompyduckdb.aiopyduckdbimportconnectasyncdefmain():asyncwithconnect(":memory:")asconnection:asyncwithawaitconnection.execute("SELECT 1;")ascursor:print(awaitcursor.fetchone())if__name__=="__main__":asyncio.run(main())Differences from the PEP:Connections implement theexecute*()functions from the cursor, and return a cursor, as SQLite does.Connections andCursors implementexecutescript()as SQLite does.Cursors implement the same transactional features as theirConnections.
Package: pyduckduckgosearch
websearchwebsearch is a Python library for searching DuckDuckGo, easily. websearch uses requests and BeautifulSoup4 to scrape DuckDuckGo.InstallationTo install, run the following command:python3-mpipinstallpyduckduckgosearchusageTo get results for a search term, simply use the search function in websearch. For example, to get results for "DuckDuckGo" in DuckDuckGo, just run the following program:fromwebsearchimportsearchkeywords='what is machine learning'results=search(keywords,region='wt-wt',safesearch='Moderate',time='y',max_results=2)print(results.__next__().__dict__)
Package: pyducontrol-csongoose
PyducontrolA python package used to send commands from python to an arduino board.What is it?Pyducontrol is a communication form which sends messages over serial to an arduino board. The messages can be easily read by the arduino either as a string or an integer.Included commands and their syntaxesdefArduino(port, baudrate, timeout):This line must be included first in your project, outside of any loops. It defines the arduino and calls for serial communication in python.Arguments:port: This is the name of the port the arduino can be reached on e.g.: 'COM3'. '' symbols must be used. You can get the port name from the arduino IDE.baudrate: Baud rate of the communication. Integer. E.g.: 9600timeout: Defines the timeout value of the serial communication. Float. E.g.: .1writeArduino(msg):Sends themsgmessage over the serial to the board encoded as utf-8. Message is automatically ended with a line break (\n) character.ewriteArduino(msg):Sends themsgmessage over the serial to the board encoded as utf-8.How to use?Import the package to your python project. Include thedefArduinoline at the start of your code.
You will need some code on your arduino setting up the serial communication. Other than that, the messages sent withewriteArduinocan be simply read as a string or integer by the arduino board. Make sure that the baud rates match.Pre built messaging systemIf you want an easier approach, use thewriteArduinofunction. It will close your message with a line break, which the arduino can be configured to detect. See example or template for details.Dependenciespyserial
Package: pyducttape
DuctTapeDuctTape is a tool for packaging, encrypting, and obfuscating your python scripts.
It is a fork ofstickytapewith added encryption and obfuscation features.FeaturesPackage your python scripts into a single fileEncrypt your python scripts using RSAObfuscate your python scriptsInstallationYou can install DuctTape from source:$gitclonehttps://github.com/bpradana/ducttape.git
$cdducttape
$pythonsetup.pyinstallUsageGenerate RSA key pairThis will generateprivate.pemandpublic.pemin your current directory$ducttape--keygenEncrypt$ducttapeentrypoint.py--public-key=your_public_key.pem>encrypted.pyRunning encrypted scriptmake sure you haveprivate.pemin your current directory$pythonencrypted.pyExampleYou can find an example of original scripthereand the ducttaped onehere, but you won't be able to run it because it's encrypted with my public key.To run the example, you need to generate your own key pair and encrypt the script with your public key.$ducttape--keygen
$ducttapeexample/hello/main.py--public-key=public.pem>example/ducttaped.py
$pythonexample/ducttaped.pyLicenseDuctTape is licensed under theBSD 2-Clause LicenseCreditsDuctTape is a fork ofMichael Williamson's amazing project,stickytape
Package: pyduinocli
pyduinoclipyduinocli is a wrapper library around arduino-cli to make the arduino-cli calls easy from a python script.pyduinocli goalsProvide a clear and easy way to use arduino through a python programGive the ability to programmatically flash arduino-like boardsUpdate 3D printer firmwares automaticallyHow to useInstallationTo install the library simply dopipinstallpyduinocliHow to useTo start using the library simply import the module, create a new Arduino instance and enjoy.importpyduinocliarduino=pyduinocli.Arduino("./arduino-cli")print(arduino.version())LicenseSeeLICENSE