Saravanan666/pypi-org huggingface dataset:
Package: python-brihome
python-brihomeThis library aims to control the brihome smart light bulbs.
It internally uses the pytuya library and is able to control
many parameters on the led bulb.install viapip install python-brihomeActually the briihome is part of a family of ESP8266MOD low cost
WiFi smart devices from Shenzhen Xenon. These bulbs are sold under
different names. If your bulb was around 10-20€, and port6668is open
chances are good you can control it with this library.DocsFor an example seeexamples.FAQIn Order to use thebrihome.Bulb(...)constructor you need
to obtain thelocal device idand thedevice keythat
your bulb uses. You can find these by sniffing the brihome app's
traffic. Refer tothis documentto obtain valid device id and device key.ContributingPull request are welcome. Not every function the bulb supports are
implemented. Help on error handling and extended functionality
is welcome.
Package: python-brink
Python Brink API Wrapper========================Install the Python Package-------------------------::$ pip install python-brinkUsing the API--------------1. Login to the api to receive a jwt token that can be used in future requests without the need to reauthenticate.. code-block:: pythonfrom brink.client import BrinkAPIfrom brink.exceptions import BrinkAPIExceptionapi = BrinkAPI()try:# Login to the api via username and passwordaccess = api.login( 'username', 'password' )except BrinkApiException, e:# Login errorexit()jwt_token = access['jwt_token']# After logging in using the api.login() method, the token is already set so additional# requests can be handled correctlyflights = api.getFlights()2. If you already have a jwt token prepared, you can use it when creating the api instance and bypass logging in... code-block:: pythonfrom brink.client import BrinkAPItoken='eyJ0eXAiOiJKV1QiLCJhbGc...'api = BrinkAPI(token)# Get flightsflights = api.getFlights()# Get details for a specific flightsflight = api.getFlight(10)# Get data points for a specific flightparams = { 'page': 1, 'per_page': 50 }flight_data = api.getFlightData(10,params)
Package: python-broadcaster
Broadcaster==========The Broadcaster is a simple python application that lets you to post to different social networking sites like Facebook, Twitter, etc, make Blog posts and mail utilizing Gmail, Yahoo accounts based on the configured plugins.Design----------The application is organised in 3 levels, namely:1. UI2. Engine3. PluginThe UI layer will provide the basic interface for the user to work with the application. It will also provide the request and response to user as needed.The layer Engine forms the backbone of the broadcaster by interfacing UI and Plugin. It provides facility for consistent storage of data for plugins and it also makes the UI functionalities available.The Plugin layer is the one that connects to the network entity to provide the service. These plugins are load-n-play modules tightly coupled to the corresponding network entities. This can easily be loaded and removed based on user requirments.API-------The broadcaster allows developers to bind new plugins and user interfaces by implementing the abstract methods of base classes plugin and ui.* ###**UI-development**:The engine module provides the following api methods for UI.**broadcast(msg, chnl_list, mode, ui)**:Provides the basic method which enable broadcasting the message torequested channels using the plugins.msg --> user message to be broadcastedchnl_list --> list of channels to which broadcast is to be mademode --> debug mode(boolean)ui --> UI object which is able to handle requests and responses from enginereturns dict with channels as keys and result messages as values.**get_channels()**:Returns list of available channels/plugins by searching the plugin directory.**reset_channels(chnls)**:Provides the facility to reset configuration data of each channels/plugins passedand returns dict with channel name as key and response as value.In addition UI must support user prompt and message display by implementingthe abstract method **_prompt(msg)_** of base class ui.* ###**Plugin-development**:The Engine class of engine module provides the required api methods for plugins.**get_attrib(self, option)**:Returns requested attribute value from configuration file. If unavailable, emptystring is returned.**set_attrib(self, option, value)**:Stores option-value pair to the configuration file.**prompt_user(self, msg, type=None, debug=False)**:Prompts user with msg and return the input from user based on debug flag.User input type can be specified with type argument.In addition plugin must wrap the code within class named same as that of plugin file.This class should inherit the plugin class and implement the abstract methods of it.About--------------This project is carried-out as a part of "thelycaeum" - python mentoring course, coordinated by Noufal Ibrahim.Developers:1. Gorbin2. Niyas3. Vinayak
Package: python-brtools
BRtoolsBrazilian ValidatorsFeaturesCPF Validation with or without maskCNPJ Validation with or without maskModes of useCPF#!/usr/bin/pythonfrompython_brtoolsimportvalidators# With maskvalidators.is_valid_cpf('386.438.283-19')# True# Without maskvalidators.is_valid_cpf('38643828319')# TrueCNPJ#!/usr/bin/pythonfrompython_brtoolsimportvalidators# With maskvalidators.is_valid_cnpj('40.158.686/0001-70')# True# Without maskvalidators.is_valid_cnpj('40158686000170')# TrueAuthorJoão FilhoGithubCreditsThis package was created with Cookiecutter and thecs01/cookiecutter-pypackageproject template.Cookiecuttercs01/cookiecutter-pypackage
Package: pythonbs
pythonbsA python client for running tests in browserstackAboutThis package aims to provide a straighforward python client to interact with browserstackPre-requisitespythonbs requiresPython3to runselenium installed  if notpip3 install seleniumInstallationThis client is hosted at PyPi under the name pythonbs, to install it, simply runpip install pythonbsExamplesimport pythonbs as bs
from selenium import webdriver

def test_bs():
    try :
        desired_cap = {
                'browser': 'Chrome',
                'browser_version': '83.0',
                'os': 'Windows',
                'os_version': '10',
                'resolution': '1024x768',
                'name': 'Bstack-[Python] Sample Test'
                }
        username = ''
        accesskey = ''
        driver = bs.get_webdriver(username,username,desired_cap)
        driver.get("http://www.google.com")
        if not "Google" in driver.title:
            raise Exception("Unable to load google page!")
        elem = driver.find_element_by_name("q")
        elem.send_keys("BrowserStack")
        elem.submit()
        print(driver.title)
        driver.quit()
    except:
        driver.close()
        driver.quit()


if __name__ == "__main__":
    test_bs()Obtain your username and accesskey values from browserstack settings and Update the values of variable names username & accesskey
Run your file and you will see your script run in browserstack
Package: python-bsc
python-bscThis is a python package containing a basic implementation of the Balanced Scorecard as designed by Kaplan and Norton. It is currently geared for agriculture but can be altered to fit any organisational needImplementationThe current implementation is a mix ofsqlalchemyon the database side andflaskmixed with some bootstrap andwtfforms.
The database can be spun up with a few commands as explained in more detail lower down, and the UI generated viaflaskcan be used
to populate the tables within the database.Additions are relatively straight forward and so this package can be altered to suit a multitude of organisational needs
with some adjustments, even if the stack is the only thing used.Featuressqlalchemy back endExample implementation for an agrilcultural companyImplements the Balanced Scorecard with objectives and measuresCan be run in a dockerised environmentRequirementsLinux or Mac (windows not yet supported)DockerPostgresql client or just a psql docker containerTo run and use this code base you need database backend where the tables can be built.
I suggest running a postgresql docker container, but any standard sql contianer should work with some minor adjustments.
See the section on starting a docker container with postgresql.Getting startedCreate a virtual environmentpython3 virtualenv <name-your-env>
source <name-your-env>/bin/activateInstall the packagepip install python-bscRunning a postgresql docker containerdocker run -d --name my-bsc-db -e POSTGRES_HOST_AUTH_METHOD=trust -v my_dbdata:/var/lib/postgresql/bsc-data -p 5432:5432 postgres:12ContributingClone the repogit cloneIssuesI am super amped to improve this package and learn from the community. If you a suggestions or an improvement
let me know or send those requests, I will do my best.
Package: python-bsonjs
Info:Seegithubfor the latest source.Author:Shane Harvey <shane.harvey@mongodb.com>AboutA fast BSON to MongoDB Extended JSON converter for Python that useslibbson.Installationpython-bsonjs can be installed withpip:$ python -m pip install python-bsonjsExamples>>>importbsonjs>>>bson_bytes=bsonjs.loads('{"hello": "world"}')>>>bson_bytes'\x16\x00\x00\x00\x02hello\x00\x06\x00\x00\x00world\x00\x00'>>>bsonjs.dumps(bson_bytes)'{ "hello" : "world" }'Using bsonjs with pymongo to insert a RawBSONDocument.>>>importbsonjs>>>frompymongoimportMongoClient>>>frombson.raw_bsonimportRawBSONDocument>>>client=MongoClient("localhost",27017,document_class=RawBSONDocument)>>>db=client.test>>>bson_bytes=bsonjs.loads('{"_id": 1, "x": 2}')>>>bson_bytes'\x15\x00\x00\x00\x10_id\x00\x01\x00\x00\x00\x10x\x00\x02\x00\x00\x00\x00'>>>result=db.test.insert_one(RawBSONDocument(bson_bytes))>>>result.inserted_id# NOTE: inserted_id is None>>>result.acknowledgedTrue>>>raw_doc=db.test.find_one({'x':2})>>>raw_doc.raw==bson_bytesTrue>>>bsonjs.dumps(raw_doc.raw)'{ "_id" : 1, "x" : 2 }'Speedbsonjs is roughly 10-15x faster than PyMongo’s json_util at decoding BSON to
JSON and encoding JSON to BSON. Seebenchmark.py:$ python benchmark.py
Timing: bsonjs.dumps(b)
10000 loops, best of 3: 0.110911846161
Timing: json_util.dumps(bson.BSON(b).decode())
10000 loops, best of 3: 1.46571397781
bsonjs is 13.22x faster than json_util

Timing: bsonjs.loads(j)
10000 loops, best of 3: 0.0628039836884
Timing: bson.BSON().encode(json_util.loads(j))
10000 loops, best of 3: 0.683200120926
bsonjs is 11.72x faster than json_utilLimitationsTop Level ArraysBecauselibbsondoes not distinguish between top level arrays and top
level documents, neither doespython-bsonjs. This means that if you givedumpsordumpa top level array it will give you back a dictionary.
Below are two examples of this behavior>>>importbson>>>frombsonimportjson_util>>>importbsonjs>>>bson.decode(bsonjs.loads(json_util.dumps(["a","b","c"]))){'0':'a','1':'b','2':'c'}>>>bson.decode(bsonjs.loads(json_util.dumps([]))){}One potential solution to this problem is to wrap your list in a dictionary,
like so>>>list=["a","b","c"]>>>dict={"data":list}>>>wrapped=bson.decode(bsonjs.loads(json_util.dumps(dict))){'data':['a','b','c']}>>>wrapped["data"]['a','b','c']Installing From Sourcepython-bsonjs supports CPython 3.7+.CompilerYou must build python-bsonjs separately for each version of Python. On
Windows this means you must use the same C compiler your Python version was
built with.Windows build requires Microsoft Visual Studio 2015SourceYou can download the source using git:$ git clone https://github.com/mongodb-labs/python-bsonjs.gitInstallOnce you have the source properly downloaded, build and install the package:$ pip install -v .TestTo run the test suite:$ python -m pytest
Package: python-bufflog
Python BufflogPython logger for Buffer services.InstallationYou can usepipto installpython-bufflog:pipinstallpython-bufflogUsageimportbufflogbufflog=bufflog.get_logger(__name__)bufflog.debug('Hello debug',extra={"some":"stuff"})bufflog.info('Hello info')bufflog.error('Hello error')bufflog.critical('Hello critical')Log verbosity levelsIf you wish to see more logs, simply set theLOG_LEVELto the desired level. Here a list with some use case:LevelsUse caseExamplesDEBUGInformation used for interactive investigation, with no long-term value. Activate it withLOG_LEVEL=DEBUGPrinting function names, steps inside a function.INFOInteresting events. Track the general flow of the application.  Activate it withLOG_LEVEL=INFOUser logs in, SQL logs, worker process/delete a message...NOTICEUncommon events.This is the default verbosity level.Missing environment variables, page redirection, pod starting/restarting/terminating, retrying to query an API...WARNINGExceptional occurrences that are not errors. Undesirable things that are not necessarily wrong.Use of deprecated APIs,  poor use of an API, unauthorized access, pod restart because of memory limit ...ERRORRuntime errors. Highlight when the current flow of execution is stopped due to a failure.Exceptions messages, incorect credentials or permissions...CRITICALCritical conditions. Describe an unrecoverable application, system crash, or a catastrophic failure that requires immediate attention.Application component unavailable, unexpected exception. entire website down, database unavailable ...DevelopmentFor local development, create a new virtual environment and activate it. That can be done with Pythonvenvmodule.$python-mvenvvenv
$sourcevenv/bin/activateOnce the virtual environment is activated, installpython-buffloglocally:$pipinstall-e.
Package: python-build
Python-BuildBuildPython is a python library to download and build a specified version of python
into a specified directory.That’s it.The code is basically derived from pyenv but provides a bit of a nicer wrapper.It was built for use withhttp://hitchtest.com/so that you can test the same code with multiple versions of python.UseInstall:$ pip install python-buildUse in python:>>> import python_build
>>> python_build.python_build("2.7.3", "/home/user/projectdirectory/py273")Use outside of python:$ python-build 2.7.3 /home/user/projectdirectory/py273Help:$ python-build --help
Package: python-buildhub
python-buildhubA simple wrapper on the Buildhub service. Basically, a glorified
Elasticsearch over HTTP wrapper.WORD OF WARNINGThis is an experimental project, and the API is to be considered a prototype.It's production-grade in terms of functionality (because it's so simple), but
not only might things change but also consider it very minimal in features
which means it can get better if you help out.Install and UsageRequires Python 3.pipinstallpython-buildhubfrombuildhubimportget_distinct_versions,get_distinct_buildidsprint(get_distinct_versions(# product="Firefox",# channel="beta",# startswith="64",))print(get_distinct_buildids(# product="Firefox",# channel="beta",# startswith="2018",))If you want to use a different URL for the backend there are two ways to override it:$exportBUILDHUB_SEARCH_URL=http://localhost:8888/api/search
$python-c'import buildhub; print(buildhub.SEARCH_URL)'http://localhost:8888/api/searchorfrombuildhubimportget_distinct_versionsprint(get_distinct_versions(_search_url='http://localhost:8000/api/v1'))Considering that this project is just a wrapper for making a Elasticsearch search
query in JSON over HTTP POST, if you want to know what query gets sent you can use:frombuildhubimportget_distinct_versionsget_distinct_versions(_verbose=True)...and it will print the JSON used onstdout.ContributingClone repo, create an environment and run:pipinstall-e".[dev]"To get automaticflake8andblackchecking done in a git pre-commit
hook run:therapistinstallLicenseDelivery Console is licensed under the MPLv2. See theLICENSEfile for details.
Package: python-bulletml
BulletML is the Bullet Markup Language. BulletML can describe the
barrage of bullets in shooting games. (For example Progear, Psyvariar,
Gigawing2, G DARIUS, XEVIOUS, …) This module parses and executes
BulletML scripts in Python. All data structures in it are
renderer-agnostic.In addition to the standard BulletML XML format, this module supports
an equivalent YAML format.Finally, two simple collision routines are provided, bulletml.overlaps
for stationary circles and bulletml.collides for moving circles.A sample renderer for Pygame is included.More information is available at the BulletML homepage,http://www.asahi-net.or.jp/~cs8k-cyu/bulletml/index_e.html, or the
python-bullet homepage,http://code.google.com/p/python-bulletml/.
Package: python-bunnycdn-storage
python-bunnycdn-storageThis package provides Bunny.net file storage for Django.
An improved and working version. Thanks to Will Meyers'django-bunny-storage.Package Installationpython-bunnycdn-storagerequires Python >= 3.7 and Django >= 3.0pipinstallpython-bunnycdn-storagePackage ConfigurationDetails to configure Bunny.net Storage.To use:Addbunnycdn_storageto yourINSTALLED_APPSinsettings.pyfileINSTALLED_APPS=[...'bunnycdn_storage',...]AddBUNNY_USERNAMEandBUNNY_PASSWORDto your settings.BUNNY_USERNAME='your_bunny_username'BUNNY_PASSWORD='your_bunny_password'# This is optionalBUNNY_REGION='de'The above settings must match the storage zone and password of your Bunny.net account. To find Storage zoneUsernameandPassword, open the FTP & API Access under Storage in your Bunny.net dashboard.Note: You must includeBUNNY_REGIONif you choose another region other than the default Falkenstein region,DE.Change the MEDIA_URL insettings.pyfile.MEDIA_URL='https://your_zone.b-cdn.net/'# This is your Pull Zone linked hostnameTheMEDIA_URLcorresponds to the linked Pull Zone you setup in the Bunny.net dashboard.Change the default file storage insettings.pyfile.DEFAULT_FILE_STORAGE='bunnycdn_storage.storage.BunnyCDNStorage'Displaying Media in TemplateThis setup uses media url context processor to serve media. Refer to the documentation inDjangofor more details.Adddjango.template.context_processors.mediain thecontext_processorsoption of TEMPLATES insettings.pyfile....'django.template.context_processors.media',...To load media properly without getting 404, use:<imgsrc="{{ MEDIA_URL }}{{ your_model.file }}"/>That's it.
Package: python-buycoins-sdk
Python-buycoinA python SDK for BuyCoinsUpdateNew features to be added to SDK includesType hintingNGNT manager and transactionsExtensive testsInstallationspipinstallpython-buycoins-sdkRequirementsPython 3.0+DocumentationYou can view the official documentation for the BuyCoins APi can be foundhereon the BuyCoins developer portal.ConfigurationCreate a .env file and set up authentication as follows:BUYCOIN_PUBLIC_KEY="<BUYCOIN_PUBLIC_KEY>"
BUYCOIN_SECRET_KEY="<BUYCOIN_SECRET_KEY>"To get public and private key, follow the process set athereUsageMost of the library's functionality lies in the managers.py file which contains all the managers required to perform wallet transactions, peer to peer transactions and NGNT transactions.The Manager classes handle every direct interaction with the BuyCoins API.Wallet TransactionsThis involves direct purchase, sale, transfer orders of cryptocurrencies and creation of cryptocurrencies addresses
A sample use-casefromBuyCoin.objects.walletimportWalletfromBuyCoin.managerimportCustomerWalletManager# Start a  purchase transaction and then assign to manager for initializationpurchase_order=Wallet(operation="buy",cryptocurrency="bitcoin",coin_amount=0.01)wallet_manager=CustomerWalletManager()wallet_manager.initialize_transaction(purchase_order)# To get prices for all cryptocurrenciesprint(wallet_manager.get_prices())# To get prices for a specific cryptocurrency for a side ('buy', 'sell')print(wallet_manager.get_prices(cryptocurrency="bitcoin",side="buy"))P2P TransactionsP2P Trading lets you trade cryptocurrencies with other users. If you are not familiar with p2p trading on the Buycoins platform, read about ithereA sample use-casefromBuyCoin.objects.p2pimportP2PfromBuyCoin.managerimportP2PManager# To place limit orderslimit_order=P2P(operation="plo",side="buy",coin_amount=0.01,cryptocurrency="bitcoin",price_type="dynamic",dynamic_exchange_rate=3000)manager=P2PManager()manager.initialize_transaction(limit_order)# to post market ordersmarket_order=P2P(operation="pmo",side="sell",coin_amount=0.01,cryptocurrency="bitcoin")manager.initialize_transaction(market_order)# Get market ordersprint(manager.get_market_order())Custom QueriesIf by chance, you need to perform queries outside the already provided ones, it can be done by creating an instance of the concerned transaction manager:fromBuyCoin.managerimportCustomerWalletManagerquery="""query {<query>}"""CustomerWalletManager._perform_request(query=query,variables={})# Variables are arguments to be passed into the query, if none, specify empty bracket
Package: python-bvk
python-bvkWater conspmution scraper for BVK (Brnenské vodárny a kanalizace, bvk.cz)Note that you need to have the "smart" water-gauge installed. If you don't know
what that is you probably don't have one. If you don't have one you have to ask
them (BVK) to install it for you and you may have to wait a potentially long
time - they are rolling them out gradually.Installpip install python-bvkUsageTo create the client object you need to provide your BVK username/password
(the one you use on the customer portalhttps://zis.bvk.cz/).from bvk import Bvk
from dateutil import parser

# Create client
bvk = Bvk('username', 'password')UsegetwaterConsumption()method to get the water consumption data. It accepts
adate_fromand optionally adate_to, both of which have to be adatetime.dateobject. Ifdate_tois not specified the method returns data to today.Examples:# Get water consumption data from the specified date to now
date_from = parser.parse('2020-08-01').date()
deferred_data = bvk.getWaterConsumption(date_from);

# Get water consumption data for a date interval
date_from = parser.parse('2020-08-01').date()
date_to = parser.parse('2020-08-11').date()
deferred_data = bvk.getWaterConsumption(date_from, date_to);

# Get water consumption data for a specific date (just 1 day)
date = parser.parse('2020-08-01').date()
deferred_data = bvk.getWaterConsumption(date, date);You may callgetWaterConsumptionmultiple times with different parameters. It
returns atwisted.internet.defer.Deferredobject that can be used to retrieve the price data in the future using a
callback you need to provide.def process_consumption(consumption)
  print(consumption)

deferred_data.addCallback(process_consumption)If you have multipleDeferreds from multiple calls togetWaterConsumptionyou can useBvk.join()to get aDeferredthat will be resolved after all
crawlers are finished.The last callback should stop the reactor so it's shut down cleanly. Reactor
should be stopped after all crawlers are done so thejoin()method comes in
handy. Note that the reactor cannot be restarted so make sure this is the last
thing you do:from twisted.internet import reactor

d = bvk.join()
d.addBoth(lambda _: reactor.stop())The last thing you need to do is run the reactor. The script will block until
the crawling is finished and all configured callbacks executed.reactor.run(installSignalHandlers=False)Keep in mind the library is usingScrapyinternally which means it is
scraping the BVK customer portal to get the data. If BVK comes to think you are
abusing the website they may block your IP address and/or account.LicenseSeeLICENSE.
Package: python-by-contract-corpus
We present here a corpus of Python programs annotated withcontracts.The corpus includes:Solutions to the exercises of theAdvent of Code 2020, andSolutions to the exercises used during the lecture“Introduction to Programming”at ETH Zurich (Switzerland) in Fall 2019.Please see the full documentation at:https://python-by-contract-corpus.readthedocs.io/en/latest/