Saravanan666/pypi-org huggingface dataset:
Package: python-mistralclient
MistralMistral is a workflow service. Most business processes consist of multiple
distinct interconnected steps that need to be executed in a particular
order in a distributed environment. A user can describe such a process as a set
of tasks and their transitions. After that, it is possible to upload such a
description to Mistral, which will take care of state management, correct
execution order, parallelism, synchronization and high availability.Mistral also provides flexible task scheduling so that it can run a process
according to a specified schedule (for example, every Sunday at 4.00pm) instead
of running it immediately. In Mistral terminology such a set of tasks and
relations between them is called a workflow.Mistral clientPython client for Mistral REST API. Includes python library for Mistral API and
Command Line Interface (CLI) library.InstallationFirst of all, clone the repo and go to the repo directory:$ git clone https://opendev.org/openstack/python-mistralclient.git
$ cd python-mistralclientThen just run:$ pip install -e .or:$ pip install -r requirements.txt
$ python setup.py installRunning Mistral clientIf Mistral authentication is enabled, provide the information about OpenStack
auth to environment variables. Type:$ export OS_AUTH_URL=http://<Keystone_host>:5000/v2.0
$ export OS_USERNAME=admin
$ export OS_TENANT_NAME=tenant
$ export OS_PASSWORD=secret
$ export OS_MISTRAL_URL=http://<Mistral host>:8989/v2  (optional, by
  default URL=http://localhost:8989/v2)and in the case that you are authenticating against keystone over https:$ export OS_CACERT=<path_to_ca_cert>NoteIn client, we can use both Keystone auth versions - v2.0 and v3. But
server supports only v3.*To make sure Mistral client works, type:$ mistral workbook-listYou can see the list of available commands typing:$ mistral --helpUseful LinksPyPi- package installationLaunchpad project- release managementBlueprints- feature specificationsBugs- issue trackingSourceSpecsHow to Contribute
Package: python-mitto-sdk
python-mitto-sdkPython Mitto SDKOverview:Python library to interact with Mitto's API.Installation:pipinstallpython-mitto-sdkUsage:# What's my Mitto version?frommitto_sdkimportMittoBASE_URL="https://{mitto_url}"API_KEY=""mitto=Mitto(base_url=BASE_URL,api_key=API_KEY)about=mitto.get_about()version=about["version"]print(version)
Package: python-mk-livestatus
Author:Michael FladischerVersion:0.4ContentsUsageAccess the data returned from MK Livestatus queries as Python lists or dictionaries.
It does this by sending queries to the MK Livestatus UNIX socket and parses the returned rows.
Read/write permission to the UNIX socket are required.This package is known to be compatible with Python 2.7, 3.3, 34, pypy and pypy3.UsageHere a simple example to fetch the name and hostgroups for all servers in the UP (0) state:>>> from mk_livestatus import Socket
>>> s = Socket("/var/lib/icinga/rw/live")
>>> q = s.hosts.columns('name', 'groups').filter('state = 0')
>>> print q
GET hosts
Columns: name groups
Filter: state = 0>>> q.call()
[{'name': 'example.com', 'groups': ['ssh', 'snmp', 'smtp-server', 'ping-server', 'http-server', 'debian-server', 'apache2']}]s.hostsreturns a Query to thehostsresources on Nagios. Thecolumnsandfiltermethods modify our query and return it, so we can chain the calls. The call tocallmethod returns the rows as a list of dictionaries.If you use xinetd to bind the Unix socket to a TCP socket (like explainedhere), you can create the socket like :>>> s = Socket(('192.168.1.1', 6557))For more information please visit thepython-mk-livestatus website. Information about MK Livestatus and it’s query syntax is available at themk-livestatus website.
Package: python-mlboardclient
python-mlboardclientPython lib for interacting ml-board component.InstallationFrom PyPipipinstallpython-mlboardclientFrom github (fresh master branch)pipinstall'git+https://github.com/kuberlab/python-mlboardclient.git'Usagefrommlboardclient.apiimportclient# Default url is http://mlboard-v2.kuberlab:8082/api/v2# No need to pass any url if instantiate client from ml-project (Jupyter/Task)ml=client.Client()apps=ml.apps.list()[<mlboardclient.api.v2.apps.Appobjectat0x7f0b554b5f90>]app=apps[0]# Get tasks from configapp.tasks[<Taskname=modelbuild=Nonestatus=undefined>]task=app.tasks[0]# Run & wait tasktask.run()<Taskname=modelbuild=4status=Succeeded># Get tasks from APIapp.get_tasks()[<Taskname=modelbuild=1status=Failed>,<Taskname=modelbuild=2status=Failed>,<Taskname=modelbuild=3status=Failed>,<Taskname=modelbuild=4status=Succeeded>]Model uploadml.model_upload('my-model','1.0.0','/model/dir')# If the model uploading is not executing in scope of project task,# need to specify workspace_name and project_name explicitly:ml.model_upload('my-model','1.0.0','/model/dir',workspace_name='demo',project_name='test-project)# Wait until model is being uploaded.
Package: python-ml-dali
python-ml-daliA Python library to communicate with Dali controllers from Ministry of LightDescriptionThis python libarary can be used to communicate with ML (Ministry of Light) Dali relais on a DALI bus, using the ML DALI USB controller.DocumentationQuickStartimportasynciofrommldaliimportMLDaliLightasyncdefturnOnOff(address):light_fixture=MLDaliLight(address)awaitasyncio.sleep(1)awaitlight_fixture.turn_on()awaitasyncio.sleep(3)awaitlight_fixture.turn_off()asyncdefturnOnOffDelayed(address):awaitasyncio.sleep(2)light_fixture=MLDaliLight(address)awaitasyncio.sleep(1)awaitlight_fixture.turn_on()awaitasyncio.sleep(1)awaitlight_fixture.turn_off()asyncdefmain():awaitasyncio.gather(turnOnOff(12),turnOnOffDelayed(13),asyncio.sleep(20))loop=asyncio.get_event_loop()loop.run_until_complete(main())
Package: python-mmdt
python_mmdtpython_mmdt is a python-based mmdt library implementation. This library allows you to use mmdt through python to calculate sensitive hashes.mmdt is a sensitive hash implementation that can be used to calculate file similarityPre-Installcmake: 2.6 and abovewindows: The current version (0.3.1) requiresminGWto be installed on windowsInstall from Pypi$ pip install python_mmdtInstall by Whl.whldownload fromRelease$ pip install python_mmdt-xxx.whlUsageCommand Line# calculate mmdt sensitive➜mmdt-hash$file_path# calculate file similarity➜mmdt-compare$file_path1$file_path2# use classifier to detected malicious file➜mmdt-classify-h
usage:python_mmdtmaliciousfilescantool[-h][-sSCANS][-tTHRESHOLD][-cCLASSIFY_TYPE]Amaliciousscannertoolbasedonmmdt_hash.Version0.3.1

optionalarguments:-h,--helpshowthishelpmessageandexit-sSCANS,--scansSCANSsetfile/pathtoscan.-tTHRESHOLD,--thresholdTHRESHOLDsetthresholdvaluetodeterminewhetherthefileisamaliciousfile.(default0.95)-cCLASSIFY_TYPE,--classifyCLASSIFY_TYPEsetclassifytype.set1forsimpleclassify,set2forknnclassify.(default1)Uselike:1.usesimpleclassifymmdt-classify-s$sample_path-t0.95-c12.useknnclassifymmdt-classify-s$sample_path-t0.95-c2# submit mmdt_hash➜mmdt-scan-online.\test\2f04b8eb993ca4a3d98607824a10acfb{"sha1":"a5ad744088e2739dc8b6a0622432106158d0abd8","md5":"2f04b8eb993ca4a3d98607824a10acfb","file_name":".\\test\\2f04b8eb993ca4a3d98607824a10acfb","message":"查询任务已添加至查询队列，当前队列中还有0个任务","status":20001,"data":{}}# get check result➜mmdt-scan-online.\test\2f04b8eb993ca4a3d98607824a10acfb{"sha1":"a5ad744088e2739dc8b6a0622432106158d0abd8","md5":"2f04b8eb993ca4a3d98607824a10acfb","file_name":".\\test\\2f04b8eb993ca4a3d98607824a10acfb","message":"success","status":20000,"data":{"label":"APT28","labels":[{"label":"APT28","ratio":"20.00%"},{"label":"virlock","ratio":"50.00%"},{"label":"coinminer","ratio":"30.00%"}],"similars":[{"hash":"a5ad744088e2739dc8b6a0622432106158d0abd8","label":"APT28","sim":1.0},{"hash":"9001f4cfe62367a282efc08b072a13a5e2e403db","label":"APT28","sim":0.9896245046624919},{"hash":"0d3d452a7e8d7d328bfe9862cbcee33ad1ce4cf4","label":"virlock","sim":0.8511449567066024},...}}python code# -*- coding: utf-8 -*-importunittestimportosfrompython_mmdt.mmdt.mmdtimportMMDTclassTestmmdt(unittest.TestCase):deftest_process(self):mmdt=MMDT()test_path=os.path.dirname(__file__)test_samples=os.path.join(test_path,"samples")files=os.listdir(test_samples)forfinfiles:file_path=os.path.join(test_samples,f)r1=mmdt.mmdt_hash(file_path)print(r1)r2=mmdt.mmdt_hash_streaming(file_path)print(r2)sim1=mmdt.mmdt_compare(file_path,file_path)print(sim1)sim2=mmdt.mmdt_compare_hash(r1,r2)print(sim2)Screenshotcalculate file similarityuse classifier to detected malicious filescan online
Package: python-mnist
Simple MNIST and EMNIST data parser written in pure Python.MNIST is a database of handwritten digits available onhttp://yann.lecun.com/exdb/mnist/. EMNIST is an extended MNIST databasehttps://www.nist.gov/itl/iad/image-group/emnist-dataset.RequirementsPython 2 or Python 3Usagegit clonehttps://github.com/sorki/python-mnistcdpython-mnistGet MNIST data:./bin/mnist_get_data.shCheck preview with:PYTHONPATH=. ./bin/mnist_previewInstallationGet the package from PyPi:pip install python-mnistor install withsetup.py:python setup.py installCode sample:from mnist import MNIST
mndata = MNIST('./dir_with_mnist_data_files')
images, labels = mndata.load_training()To enable loading of gzip-ed files use:mndata.gz = TrueLibrary tries to load files named t10k-images-idx3-ubyte
train-labels-idx1-ubyte train-images-idx3-ubyte and
t10k-labels-idx1-ubyte. If loading throws an exception check if these
names match.EMNISTGet EMNIST data:./bin/emnist_get_data.shCheck preview with:PYTHONPATH=. ./bin/emnist_previewTo use EMNIST datasets you need to call:mndata.select_emnist('digits')Where digits is one of the available EMNIST datasets. You can choose
frombalancedbyclassbymergedigitslettersmnistEMNIST loader uses gziped files by default, this can be disabled by by
setting:mndata.gz = FalseYou also need to unpack EMNIST files as bin/emnist_get_data.sh script
won’t do it for you. EMNIST loader also needs to mirror and rotate
images so it is a bit slower (If this is an issue for you, you should
repack the data to avoid mirroring and rotation on each load).NotesThis package doesn’t use numpy by design as when I’ve tried to find a
working implementation all of them were based on some archaic version of
numpy and none of them worked. This loads data files with struct.unpack
instead.Example$ PYTHONPATH=. ./bin/mnist_preview
Showing num: 3

............................
............................
............................
............................
............................
............................
.............@@@@@..........
..........@@@@@@@@@@........
.......@@@@@@......@@.......
.......@@@........@@@.......
.................@@.........
................@@@.........
...............@@@@@........
.............@@@............
.............@.......@......
.....................@......
.....................@@.....
....................@@......
...................@@@......
.................@@@@.......
................@@@@........
....@........@@@@@..........
....@@@@@@@@@@@@............
......@@@@@@................
............................
............................
............................
............................
Package: python-mobile
python-mobileIntroduction:This is a project that aims to be a python module who helps in the development of mobile-based communication software.At the moment this module can:auto detect the mobile devices connected to the computer.read, send, delete SMSread, save phonebook entriessend/receive USSD commandsCreator:Luis Ariel Vega Soliz (ariel.vega@uremix.org)Contact:website:http://uremix.orgwiki:http://wiki.uremix.org/wiki/Python-mobilerepository:https://github.com/arielvega/python-mobileLicense:This project is “software libre”, and is licensed under the terms and conditions of the GPL v3 license.
Package: python-mobilitydb
MobilityDB-pythonMobilityDB-python is a database adapter to accessMobilityDBfrom Python. It supports both thepsycopg2and theasyncpgadapters for PostgreSQL and uses thepostgisadapter for PostGIS.Deprecation Notice :warning:This package is no longer maintained. Instead, we recommend using thePyMEOS package,
which provides a Python interface to the MEOS C library, which is the underlying library of MobilityDB.Installpipinstallpython-mobilitydbRequirementsPython >= 3.0MobilityDBBasic UsageUsing the psycopg2 adapter for PostgreSQLimportpsycopg2frommobilitydb.psycopgimportregisterconnection=Nonetry:# Set the connection parameters to PostgreSQLconnection=psycopg2.connect(host='localhost',database='test',user='user',password='pw')connection.autocommit=True# Register MobilityDB data typesregister(connection)# Open a cursor to perform database operationscursor=connection.cursor()# Query the database and obtain data as Python objectsselect_query="SELECT * FROM tbl_tfloatseq ORDER BY k LIMIT 10"cursor.execute(select_query)rows=cursor.fetchall()# Print the obtained rows and call a method on the instancesforrowinrows:print("key =",row[0])print("tfloatseq =",row[1])ifnotrow[1]:print("")else:print("startTimestamp =",row[1].startTimestamp.isoformat(),"\n")except(Exception,psycopg2.Error)aserror:print("Error while connecting to PostgreSQL",error)finally:# Close the connectionifconnection:connection.close()Using the asyncg adapter for PostgreSQLimportasyncioimportasyncpgfrommobilitydb.asyncpgimportregisterasyncdefrun():# Connect to an existing databaseconnection=awaitasyncpg.connect(host='localhost',database='test',user='user',password='pw')try:# Register MobilityDB data typesawaitregister(connection)# Query the database and obtain data as Python objectsselect_query="SELECT * FROM tbl_tgeompointseq ORDER BY k LIMIT 10"rows=awaitconnection.fetch(select_query)# Print the obtained rows and call a method on the instancesforrowinrows:print("key =",row[0])print("tgeompointseq =",row[1])ifnotrow[1]:print("")else:print("startTimestamp =",row[1].startTimestamp.isoformat(),"\n")finally:# Close the connectionawaitconnection.close()# Launch the processloop=asyncio.get_event_loop()loop.run_until_complete(run())ManualHTML:https://docs.mobilitydb.com/MobilityDB-python/master/PDF:https://docs.mobilitydb.com/MobilityDB-python/master/python-mobilitydb.pdfEPUB:https://docs.mobilitydb.com/MobilityDB-python/master/python-mobilitydb.epubContributingIssuesandPull Requestsare welcome.Related ProjectMobilityDB SQLAlchemyis another package that provides extensions toSQLAlchemyfor interacting withMobilityDB.
Package: python-mock
PyMockMocking in Python made easy!InstallPyMock can be installed with pip$pipinstallpython-mockNote: PyMock require Python version >= 3.7 to work properly.How is it different?The typical way of mocking in Python is withMagicMockor simplyMock(https://docs.python.org/3/library/unittest.mock.html).deftest_something():blog=MagicMock()blog.get_post.return_value=Post()assertisinstance(blog.get_post(1),Post)While this technically work the syntax can be difficult to remember, provides limited
support for when your return values depend on input arguments and even if you're using a decent IDE
there is notype hintingavailable to help with code completion.PyMockattempts to solve all of these issues by offering a simple syntax and full control over how
your mocks should respond in different situations. The same example as above can be written using
PyMock:deftest_something():blog=PyMock.create(Blog)PyMock.setup(blog.get_post(1)).returns(Post())assertisinstance(blog.get_post(1),Post)The benefits here are many, for exampleJust by looking at the first line it's very clear what type of object you intend to mockPyMock support setting different return values for different input arguments. In this case
it'sblog.get_post(1)that should return an instance ofPost, notblog.get_post(2)or any
other call to the same method.Because PyMock know exactly what the mocked type is, code completion work just as if it were an
object of that type.FeedbackPyMock is an early state of development and is likely to contain bugs. Quite possibly lots of them.
Don't let that hold you back from trying it out andlet me knowhow it works for you!
All kinds of feedback are valuable, good and badBug reportsPerformanceSyntaxOverall experienceSuccess storiesAnything else you want to share :)ExamplesBelow are a few examples on how PyMock can be used.fromunittestimportTestCasefrompymockimportPyMock,IsclassPost:defget_title(self)->str:passclassBlog:defget_post(self,id:int)->Post:passclassCustomException(Exception):passclassTestExamples(TestCase):deftest_return_object(self):post=Post()mock=PyMock.create(Blog)PyMock.setup(mock.get_post(123)).returns(post)self.assertEqual(post,mock.get_post(123))deftest_setup_multiple_values(self):post1=Post()post2=Post()mock=PyMock.create(Blog)PyMock.setup(mock.get_post(1)).returns(post1)PyMock.setup(mock.get_post(2)).returns(post2)self.assertEqual(post1,mock.get_post(1))self.assertEqual(post2,mock.get_post(2))deftest_raise_exception(self):mock=PyMock.create(Blog)PyMock.setup(mock.get_post(1)).raises(CustomException())withself.assertRaises(CustomException):mock.get_post(1)deftest_match_instance_type(self):post=Post()mock=PyMock.create(Blog)PyMock.setup(mock.get_post(Is.type(int))).returns(post)self.assertEqual(post,mock.get_post(12345))deftest_recursive_mocking(self):mock=PyMock.create(Blog)PyMock.setup(mock.get_post(123).get_title()).returns("PyMock is awesome")self.assertEqual("PyMock is awesome",mock.get_post(123).get_title())deftest_mock_function(self):defmy_function():passmock=PyMock.create(my_function)PyMock.setup(mock()).returns("my_function return value")self.assertEqual("my_function return value",mock())
Package: python-modelsonic
ModelSonic Python ClientThis is a Python client for the ModelSonic APIs.InstallationUse the package managerpipto install python-modelsonic.pipinstallpython-modelsonicUsagefrommodelsonic.clientimportModelSonicClientfrommodelsonic.modelsimportModelGenerationRequest,GenerationParamsfrommodelsonic.enumsimportModelsEnum,ProvidersEnumclient=ModelSonicClient(base_url='your_base_url',api_key='your_api_key')messages=[{"role":"user","content":"Write me a short poem"},]prompt_params=GenerationParams(messages=messages)claude2_request=ModelGenerationRequest(model_name=ModelsEnum.CLAUDE_INSTANT_12,provider_name=ProvidersEnum.ANTHROPIC.value,order=1,prompt_params=prompt_params,)response=client.generate(ordered_generation_requests=[claude2_request])print(response.choices[0].text)Remember to replace'your_base_url'and'your_api_key'with your actual base URL and API key when using the client.
Package: python-modhex
python_modhexWhen working with yubikeys, you get OTPs inmodhex, which according tohttps://developers.yubico.com/OTP/Modhex_Converter.htmlis similar to hex encoding but with a different encoding alphabet.The alphabet isALPHABET = "cbdefghijklnrtuv".This module merely does whathttps://developers.yubico.com/OTP/Modhex_Converter.htmloffers as well:Convert amodhexstring tohex.Convert ahexstring tomodhex.Installationpip install python_modhexThe installation also creates an executable, thatprovidesa simple interfaces:python_modhex --version
python_modhex --help

# From modhex.
python_modhex from-modhex cccccctcjhhrrrdeejrtrvdldhthenggvuedgfevjecu <list_of_modhex_strings>

# To modhex.
python_modhex to-modhex 000000d0866ccc2338cdcf2a26d63b55fe32543f830e <list_of_hex_strings>Use as module>>> from python_modhex.python_modhex import from_modhex, to_modhex
>>> modhex = "cccccccgklgcvnkcvnnegrnhgrjkhlkfhdkclfncvlgj"
>>> hex_ = "000000059a50fb90fbb35cb65c896a946290a4b0fa58
>>>
>>> from_modhex(modhex)
>>> 000000059a50fb90fbb35cb65c896a946290a4b0fa58
>>>
>>> to_modhex(hex_)
>>> cccccccgklgcvnkcvnnegrnhgrjkhlkfhdkclfncvlgj
Package: python-modularity-maximization
Python implementation of Newman’s spectral methods to maximize modularity.See:Leicht, E. A., & Newman, M. E. J. (2008). Community Structure in Directed Networks. Physical Review Letters, 100(11), 118703.https://doi.org/10.1103/PhysRevLett.100.118703Newman, M. E. J. (2006). Modularity and community structure in networks. Proceedings of the National Academy of Sciences of the United States of America, 103(23), 8577–82.https://doi.org/10.1073/pnas.0601602103All the datasets in./datacomes fromhttp://www-personal.umich.edu/~mejn/netdata/Specifically,big_10_football_directed.gmlis compiled by myself to test community detection for directed network. I combined data fromhttp://www.sports-reference.com/cfb/conferences/big-ten/2005-schedule.htmland the originalfootball.gmlto define the edge directions.
Package: python-module-installer
Package installerThis package helps you to install all modules you need in your directory.Installation$pipinstallpython-module-installerSample Usagefrominstaller.installimportModuleInstallerinstall=ModuleInstaller({})install.install_modules(path_to_folder="absolute path to folder")Instruction1. Create file "install.py" in needed directory2. Copy and paste code belowfromintaller.installimportModuleInstallerinstall=ModuleInstaller({})install.install_modules(path_to_folder="absolute path to folder")and press CTRL + S (Save file)3. Get needed path to folder.Click right mouse button and click "Copy path"4. Past path into line 4 in install.py (install.install_modules(path_to_folder="absolute path to folder")).4.1 Delete "\install.py" in path because it requires path to folder, not to fileNow save the file and run script! Script will install all requested frameworks.For ContributorsPrepare development environmentInstall docker on your development machineStart server for testing by following commands from the project's root folder or change path toconfdir in second command to correct:dockerpullbytemark/installer
dockerrun-d--nameinstaller-eAUTH_TYPE=Basic-eUSERNAME=alice-ePASSWORD=secret1234-vconf:/usr/local/apache2/conf-p8585:80bytemark/installerCode conventionPlease check your code according PEP8 Style guides.Run testsCheck that installer container is started on your local machineExecute following command in the project's root folder:python-munittestdiscover-stestsPrepare a Pull RequestPlease use this check list before creating PR:You code should be formatted according PEP8All tests should successfully passYour changes shouldn't change previous default behaviour, exclude defectsAll changes are covered by tests
Package: python-module-loader
Python Module LoaderThis package provides a way to automatically load specified modules with all of its submodules.
It is useful if we want to get all of the submodules without explicitly importing them.For example, if we want to get all command classes in the packagecommands, we can do the following:
::commands = (
    PythonModuleLoader()
    .load("app.commands", recursive=True)
    .find_objects(validators=[lambda obj: issubclass(obj, Command)])
)The above code will load all modules in the packageapp.commandsand find all subclasses ofCommandin it.
Package: python-module-starter
# pypi starter project[![Build Status](https://travis-ci.org/wuhaifengdhu/python-module-starter.svg?branch=master)](https://travis-ci.org/wuhaifengdhu/python-module-starter)[![codecov](https://codecov.io/gh/wuhaifengdhu/python-module-starter/branch/master/graph/badge.svg)](https://codecov.io/gh/wuhaifengdhu/python-module-starter)This is a template repository that you can use to quickly create a python application that can be built, tested, and released as an internal python module.## Setting up a new repository from this template**Create a directory and pull all the files in this template into it**```bashmkdir new_repo_namecd new_repo_namegit initgit pull https://github.com/wuhaifengdhu/python-module-starter.git```## Build*Linux*```bashvirtualenv env. env/bin/activatepip install -e .```*Windows*```bashvirtualenv envenv\Scripts\activatepip install -e .```## Tox Tests and Build the Wheels```pip install -r requirements-build.txt# run the python teststox -r```## upload to pypi* Register your account in ![pypi](https://pypi.org/)* Create file .pypirc in your home folder with 600.```[distutils]index-servers =pypipypitest[pypi]repository=https://upload.pypi.org/legacy/username=your_usernamepassword=your_password[pypitest]repository=https://test.pypi.org/legacy/username=your_usernamepassword=your_password```* Upload your repository```python setup.py bdist_wheel --universaltwine upload dist/*```