Saravanan666/pypi-org huggingface dataset:
Package: python-openid-pebble
This is a set of Python packages to support use of
the OpenID decentralized identity system in your application.  Want to enable
single sign-on for your web site?  Use the openid.consumer package.  Want to
run your own OpenID server? Check out openid.server.  Includes example code
and support for a variety of storage back-ends. This is Pebble’s fork that
we’re maintaining until we can deprecate this library.
Package: python-openobserve
python-openobserveA python connector to submit information to OpenObserve (https://github.com/openobserve/openobserve)The idea is to have a similar python connector to the "Elasticsearch" package, which allows a 1:1 replacement of the "Elasticsearch" package with the "OpenObserve" package.OpenObserve is way more lightweight than Elasticsearch, and it is open source, like everything should be.installpip install python-openobserveusageseeexample.ipynbfor a full examplefrompython_openobserve.openobserveimportOpenObserveOO=OpenObserve(user="root@example.com",password="Complexpass#123")fromdatetimeimportdatetimefromrandomimportrandomfrompprintimportpprintdocument={"@timestamp":datetime.utcnow(),"component":"testagent","action":"buy","amount":random()*100,"portfolio":{"USD":random()*100.0,"BTC":0.1+random()*0.1}}pprint(document)# insert documentOO.index("dd",document)#search# example sql parsing helpersql='SELECT * FROM "dd"'results=OO.search(sql)print(f"got{len(results)}results")pprint(results)
Package: python-opensesame
OpenSesameOpenSesame is a tool to create experiments for psychology, neuroscience, and experimental economics.Copyright, 2010-2022, Sebastiaan Mathôt and contributors.http://osdoc.cogsci.nl/AboutOpenSesame is a graphical experiment builder. OpenSesame provides an easy to use, point-and-click interface for creating psychological/ neuroscientific experiments.FeaturesA user-friendly interface — a modern, professional, and easy-to-use graphical interfaceOnline experiments — run your experiment in a browser with OSWebPython — add the power of Python to your experimentJavaScript — add the power of JavaScript to your experimentUse your devices — use your eye tracker, button box, EEG equipment, and more.Free — released under the GPL3Crossplatform — Windows, Mac OS, and LinuxRelated repositoriesIn addition to this repository, OpenSesame relies on a number repositories that are all hosted by theCogsci.nlorganization on GitHub. The most important of these are:rapunzelis a set of extensions that turns OpenSesame into a code editoroswebimplements OSWeb, the online OpenSesame runtimeopensesame-extension-oswebembeds OSWeb into the OpenSesame user interfacepyqode.coreimplements generic code-editor widgetspyqode.pythonimplements Python-specific code-editor widgetsdatamatriximplements a tabular data structure that is used by theloopitemqdatamatriximplements a Qt widget for editing datamatrix objectspseudorandomimplements pseudorandomization/ randomization constraintsBranchesEach major version of OpenSesame lives in its own branch. The default branch is currentlyloewenfeld.gibson- 2.8heisenberg- 2.9ising- 3.0james- 3.1kuhn- 3.2loewenfeld- 3.3CitationsMathôt, S., Schreij, D., & Theeuwes, J. (2012). OpenSesame: An open-source, graphical experiment builder for the social sciences.Behavior Research Methods,44(2), 314-324.doi:10.3758/s13428-011-0168-7Mathôt, S., & March, J. (2022). Conducting linguistic experiments online with OpenSesame and OSWeb.Language Learning.doi:10.1111/lang.12509LicenseOpenSesame is distributed under the terms of the GNU General Public License 3. The full license should be included in the fileCOPYING, or can be obtained from:http://www.gnu.org/licenses/gpl.txtOpenSesame contains works of others. For the full license information, please refer todebian/copyright.DocumentationInstallation instructions and documentation are available on the documentation website ...http://osdoc.cogsci.nl/... which is itself also hosted on GitHub:https://github.com/smathot/osdoc
Package: python_opensky
Python: OpenSkyAsynchronous Python client for the OpenSky API.AboutThis package allows you to request data about aircraft around the world.Installationpipinstallpython-openskyUsageimportasynciofrompython_openskyimportOpenSky,StatesResponseasyncdefmain()->None:"""Show example of fetching all flight states."""asyncwithOpenSky()asopensky:states:StatesResponse=awaitopensky.get_states()print(states)if__name__=="__main__":asyncio.run(main())Changelog & ReleasesThis repository keeps a change log usingGitHub's releasesfunctionality. The format of the log is based onKeep a Changelog.Releases are based onSemantic Versioning, and use the format
ofMAJOR.MINOR.PATCH. In a nutshell, the version will be incremented
based on the following:MAJOR: Incompatible or major changes.MINOR: Backwards-compatible new features and enhancements.PATCH: Backwards-compatible bugfixes and package updates.ContributingThis is an active open-source project. We are always open to people who want to
use the code or contribute to it.We've set up a separate document for ourcontribution guidelines.Thank you for being involved! :heart_eyes:Setting up development environmentThis Python project is fully managed using thePoetrydependency manager. But also relies on the use of NodeJS for certain checks during development.You need at least:Python 3.10+PoetryNodeJS 12+ (including NPM)To install all packages, including all development requirements:npminstall
poetryinstallAs this repository uses thepre-commitframework, all changes
are linted and tested with each commit. You can run all checks and tests
manually, using the following command:poetryrunpre-commitrun--all-filesTo run just the Python tests:poetryrunpytestAuthors & contributorsThe original setup of this repository is heavily inspired byFranck Nijhof.The content is byJoost LekkerkerkerFor a full list of all authors and contributors,
checkthe contributor's page.LicenseMIT LicenseCopyright (c) 2023 Joost LekkerkerkerPermission 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: python-openv
python-openvInstallation:pipinstallpython-openvUsage:fromopenvimportload_openvload_openv(project="my_project_name")OverviewThis is a simple utility for loading project environment variables from 1password. It works more or less the same aspython-dotenv. It uses the1password-clientpython package to access fields.PurposeIn theory, it's more secure, as someone with access to your computer can't go through your.envfiles, and you also don't risk accidentally including the.envfile in version control.RequirementsIn order to use this, you will need to install the1Password CLIand turn on the desktop app integration.You need to have a 1password vault named.env.The title of each item in that vault must be unique within the vault.Example WorkflowSuppose you're developing a FastAPI app calleddad_joke_generatorthat uses the OpenAI API to generate dad jokes. Assuming that you've added the API key to environment variables on whatever service we're deploying on (either directly, or through a service like Doppler or AWS Secrets Manager) - the question is how you reference the API key in your local development environment.If we're using poetry for the app, we might addpython-openvto the dev dependencies with:poetryaddpython-openv--groupdevAfter creating a.envvault in 1password, you might add an item calleddad_joke_generator, and add the following password field:OPENAI_API_KEY.Then, your FastAPI app might look as follows (I didn't test this app so it might not work, it's just meant to illustrate usage).importosimportuvicornfromopenaiimportOpenAIfromfastapiimportFastAPItry:fromopenvimportload_openvload_openv("dad_joke_generator")except:pass# The name of the field in the .env 1password vault.OPENAI_API_KEY=os.getenv("OPENAI_API_KEY")client=OpenAI(api_key=OPENAI_API_KEY)app=FastAPI()@app.get("/joke")asyncdefjoke():chat_completion=client.chat.completions.create(messages=[{"role":"user","content":"Tell me a dad joke.",}],model="gpt-3.5-turbo",)returnchat_completionif__name__=="__main__":uvicorn.run(app,host=HOST,port=PORT)Note that you probably don't want to implement a production app like this, this is just to demonstrate idea. Of course, you can also use this to dynamically determine the host, port, whether the app reloads, uses debug mode, etc.Also, in this case, when you deploy the app you would run:poetryinstall--withoutdevIn whatever build script/configuration file you're using. This waypython-openvwon't be installed in your production environment, so the import will fail and the value you set in your production environment for that environment variable will be used instead.
Package: python-open-weather
Python-Open-WeatherInstallationpip install python-open-weatherUsing gitgit clone https://github.com/pmk456/python-open-weather
cd py_open_weather
python setup.py installUsageGet Weather Of a Cityfrom weather import Weather
weather = Weather(temperature_unit=None) # Celsius (or) Kelvin (or) Fahrenheit
current_weather = weather.fetch_weather(city='CityName', only_temp=False) # if only_temp is set To True It Will Only return The current temperature in given unit
print(current_weather) # Returns Dictionary with City name, Temperature, Humidity, Pressure, Description
[+] OUTPUT IF TEMPERATURE_UNIT IS NONE
{'City: ': 'Kadiri', 'Temperature In Kelvin: ': '304°K', 'Temperature In Celsius: ': '31°C', 'Temperature In Fahrenheit: ': '88°F', 'Pressure: ': 1008, 'Humidity: ': 42, 'Description: ': 'overcast clouds'}
[+] OUTPUT IF TEMPERATURE UNIT IS SET CELSIUS OR KELVIN OR FAHRENHEIT
{'City: ': 'Kadiri', 'Temperature: ': '{TEMPERATURE IN C OR K OR F}', 'Pressure: ': 1008, 'Humidity: ': 42, 'Description: ': 'overcast clouds'}
[+] OUTPUT IF ONLY_TEMP IS SET TO TRUE
31°CGet A Table With Temperatures of given city list# Note: This uses prettytable Module So please Install it Using [ pip install prettytable ]
from weather import Weather, celsius
weather = Weather(temperature_unit=celsius)
city = ['Kadiri', 'Hindupur', 'Anantapur', 'Bangalore', 'Kolkata', 'Mumbai']
table = weather.fetch_multiple_city_weather(city)
print(table)
[+] OUTPUT
+-----------------------------------------------------------------+
|                           Weather Data                        |
+-----------+-------------+----------+----------+-----------------+
|    City   | Temperature | Pressure | Humidity |   Description   |
+-----------+-------------+----------+----------+-----------------+
|   Kadiri  |     31°C    |   1008   |    42    | overcast clouds |
|  Hindupur |     29°C    |   1009   |    50    | overcast clouds |
| Anantapur |     32°C    |   1008   |    46    | overcast clouds |
| Bangalore |     26°C    |   941    |    64    |    few clouds   |
|  Kolkata  |     30°C    |   1004   |    89    |       haze      |
|   Mumbai  |     29°C    |   1008   |    84    |       haze      |
+-----------+-------------+----------+----------+-----------------+
Package: python-openzwave-mqtt
python-openzwave-mqttPython library for the OpenZWave MQTT implementation.Consumes MQTT output fromhttps://github.com/OpenZWave/qt-openzwaveFor Home Assistant integration, see the custom componenthomeassistant-zwave_mqtt.InstallPython 3.7+ is required. We support the two latest Python 3 versions released at any one time.pipinstallpython-openzwave-mqttStructureEach object maps to one or two parts in the topic. A topic can contain the following parts:<Prefix>: the prefix of each topic. This is ignored in the processing. Usuallyopenzwave/.<CollectionType>/<CollectionID>: The collection type and the ID of the item in the collection. Example:value/3<CollectionID>: Some objects will have a direct collection that is not typed in the topic. Example is the OZW instance in<Prefix>/1<ObjectType>: If there is only a single instance of a type under a parent. For examplenode/2/statistics.ExampleA message is sent to topicopenzwave/1/node/2/statistics. This maps to:TypeIDPrefix-OZWInstance1OZWNode2OZWNodeStatistics-Message orderingWe work with signals to signal listeners when things change. However, when we connect to MQTT we will receive a lot of retained messages at once. To prevent signals being sent out of order, we will hold all messages for children until the parent has received its information.This has been disabled forOZWManagerandOZWInstance.If we receive messages on the following topics:openzwave/1/node/2/statisticsopenzwave/1/node/2We will process the messages in the reverse order:openzwave/1/node/2openzwave/1/node/2/statisticsModelling RulesThis library should not aim to do fancy things. We should, as much as possible, represent the data from MQTT as-is. We don't want to change names besides making them Pythonic (CamelCase -> snake_case).Automatic added helpersModels will have automatic helpers added based on their child models. For example, theNodemodel has the following child collections:defcreate_collections(self):"""Create collections that Node supports."""return{# A collection of children"instance":ItemCollection(OZWNodeInstance),# A single child"statistics":OZWNodeStatistics,}This means thatNodehas the following automatic functions created:get_instance(item_id)to get an instance by ID.instances()to get an iterator over all available instances.get_statistics()get the direct child.Gathering DataThis library is instantiated using messages received from MQTT. To make development easier, we have created two helper scripts. One that will dump all MQTT messages and one that will read messages from a text file and instantiate anOZWManagerwith all the data. This can be used to develop, test or reproduce bugs.python3-mscript.dump_mqtt>dump.csv
python3-mscript.instance_from_filedump.csvDevelopmentInstall all requirements:pipinstall-rrequirements_dev.txtWe useblackto format the code:black./Usetoxto run tests and linting:tox
Package: python-opnsense
python-opnsenseA Python library for the Opnsense APIGetting StartedSupported Controllers and ServicesFirewall AliasesFirewall Filter RulesUnbound Domain OverridesUnbound Host OverridesUnbound Host AliasesValid Environment VariablesOPN_API_KEYOPN_API_SECRETOPN_API_SCHEMEOPN_API_HOSTOPN_API_PORTOPN_API_CA_PATHOPN_API_CA_CONTENTExample Scriptimportjsonfromopnsense_apiimportOpnsensefromopnsense_api.utilimportAliasType# Create an instance of the Opnsense classopnsense=Opnsense(api_key="my_opnsense_api_key",api_secret="my_opnsense_api_secret",host="192.168.1.1",ca_path="/path/to/opnsense/ca/cert_bundle.pem")# Get the alias controlleralias=opnsense.firewall.alias_controller# The values for the example aliasexample_alias_name="foo_bar"example_alias_description="This is the description for foo_bar"example_alias_type=AliasType.PORT# List all the aliasesprint("LIST ALIASES")list_output=alias.list_aliases()print(json.dumps(list_output))# Add a new alias to the Opnsense device# This will return an object that represents the new alias.print("ADD ALIAS")add_output=alias.add_alias(name=example_alias_name,description=example_alias_description,alias_type=example_alias_type)print(json.dumps(add_output))# Get an alias by UUIDprint("GET ALIAS")get_output=alias.get_alias(add_output['uuid'])print(json.dumps(get_output))# Get the UUID of an alias for the given alias name# This outputs a string that contains the alias UUIDprint("GET ALIAS UUID")lookup_output_uuid=alias.get_alias_uuid(get_output["name"])print(lookup_output_uuid)# An updated description for the example aliasupdated_example_alias_description="This is the description for foo_bar"# Update an aliasprint("UPDATE ALIAS")update_output=alias.set_alias(uuid=lookup_output_uuid,name=example_alias_name,description=updated_example_alias_description,alias_type=example_alias_type)print(json.dumps(update_output))# Toggle an aliases enabled state.print("TOGGLE ALIAS")toggle_output=alias.toggle_alias(lookup_output_uuid)print(json.dumps(toggle_output))# Delete an unwanted alias.print("DELETE ALIAS")delete_output=alias.delete_alias(lookup_output_uuid)print(json.dumps(delete_output))Unbound DNS Examplefromopnsense_apiimportOpnsense# Create an instance of the Opnsense classopnsense=Opnsense(api_key="my_opnsense_api_key",api_secret="my_opnsense_api_secret",host="192.168.1.1",ca_path="/path/to/opnsense/ca/cert_bundle.pem")overridden_domain="reverb.io"nonexistent_domain="fake-domain"# Returns None because there is no configured override.result=opnsense.unbound_dns.domain_controller.get(nonexistent_domain)print(f"Get Result:{result}")# Retuns a list of configured domain overridesresult=opnsense.unbound_dns.domain_controller.list()print(f"List Result:{result}")found_domain=Falsefordomain_overrideinresult:ifdomain_override['domain']==overridden_domain:# Deletes the override for a specific domainresult=opnsense.unbound_dns.domain_controller.delete(domain_override['uuid'])print(f"Delete Result:{result}")found_domain=Trueifnotfound_domain:# Adds an override for a specific domainresult=opnsense.unbound_dns.domain_controller.add(overridden_domain,"0.0.0.0","foobarbaz",True)print(f"Add Result:{result}")
Package: python-optiEncoder
DescriptionThis is an easy to use library to encode categorical data in a feature into optimized set of
features with each categorical value mapping to a unique bitstring.>>>importoptiEncoder
>>>enc=optiEncoder.Encoder(["France","Canada","England"])>>>print("Mappings : ",enc.getMappings()){'France':[0,0],'Canada':[0,1],'England':[1,0]}>>>print("Encoded List : ",enc.getEncodedList())[[0,0],[0,1],[1,0]]Usage in Data Preprocessing>>>importoptiEncoder
>>>importpandas
>>>d=pd.read_csv('data.csv').dropna()PerformanceMeasureBRATS20180DiceCoefficient901JaccardCoefficient802AreaunderROC904HausdorffDistance105Sensitivity906Specificity907F-Measure908Precision809VolSimilarityDistance9010Fallout712TP190013FP20014TN250015FN600>>>enc=optiEncoder.Encoder(list('Performance Measure'))>>>enc.getEncodedList()[[1,0,0,1],[1,1,0,0],[1,0,0,0],[0,1,1,1],[0,1,0,0],[1,0,0,0],[0,1,1,0],[1,0,1,0],[0,0,1,1],[1,0,1,1],[1,1,0,0],[0,0,0,1],[0,0,1,0],[1,1,0,0],[1,0,1,0],[0,1,0,1],[0,0,0,0],[1,0,0,0],[1,1,0,0]]>>>d=d.iloc[:,1:]>>>dBRATS20180901802904105906907908809901071219001320014250015600>>>encodedList=enc.getEncodedList()>>>foriinrange(0,len(encodedList[0])):
...d[str(i)]=pd.DataFrame(encodedList).iloc[:,i]...
>>>dBRATS20180123090100118011002901000410010059010006900110790101088000119901011107110012190000101320011001425001010156000101LicenseMITAuthorSahil Ahuja
Package: python-optimus
python-optimusThis is based fully onpjebs/optimus-gofor Go which is based onjenssegers/optimusfor PHP which is based on Knuth's Integer Hashing (Multiplicative Hashing) from his bookThe Art Of Computer Programming, Vol. 3, 2nd Edition, Section 6.4, Page 516.With this library, you can transform your internal id's to obfuscated integers based on Knuth's integer hash. It is similar to Hashids, but will generate integers instead of random strings. It is also super fast.This library supports both 32 and 64 bits integers, although in Python you don't have that differentiation between int32 and int64, even bigint or bignum is the same sincePEP 237. The reason you need a bitlength is that the algorithm itself works on a fixed bitlength. By default this library uses 64 bits.Python SupportSo far it's only tested on Python 3.8 and Python 3.9Installationpip install python-optimusUsageBasic usage:fromoptimus_idsimportOptimusmy_optimus=Optimus(prime=<yourprimenumber>)my_int_id=<someidyouhave>my_int_id_hashed=my_optimus.encode(my_int_id)assertmy_int_id==my_optimus.decode(my_int_id_hashed)The caveat with the usage above is that every time you create yourOptimusinstance it will have a random component, even with using the same prime, so a proper usage should be like this:fromoptimus_idsimportOptimusmy_optimus=Optimus(prime=<yourprimenumber>,random=<somerandomnumber>)my_int_id=<someidyouhave>my_int_id_hashed=my_optimus.encode(my_int_id)assertmy_int_id==my_optimus.decode(my_int_id_hashed)To generate a suitable random number you could do this:fromoptimus_idsimportrand_n,MAX_64_INT# use 32 instead of 64 if you want tomy_random_number=rand_n(MAX_64_INT-1)You can also generate anOptimusintance and then keep itsprime,inverseandrandomproperties stored, so you can always configure a new instance with the same components, or even pickle it:fromoptimus_idsimportgenerate,Optimusmy_optimus=generate()# store the following variables or pickle the my_optimus variableprime=my_optimus.primeinverse=my_optimus.inverserandom=my_optimus.randombitlength=my_optimus.bitlength# create a new instance with the same parameters or unpickle an instancemy_other_optimus=Optimus(prime=prime,inverse=inverse,random=random,bitlength=bitlength,)assertmy_optimus.encode(42)==my_other_optimus.encode(42)assertmy_optimus.decode(my_other_optimus.encode(42))==my_other_optimus.decode(my_optimus.encode(42))NOTEfor the generate function to work, it needs data, the data is large, and not available with the package, the data should be downloaded fromhereand the path to it is passed to thegeneratefunction. By default it expects the data to be in a folder calledoptimus-primesin the current working directory.├── your-app.py
├── ...
└── optimus-primes
    ├── p1.txt
    ├── p2.txt
    ├── ...
    └── p50.txtCheck thetestsfolder for test cases and other usage examples.LicenseThis work is licensed underMIT License.
Package: python-optional
Python OptionalReturnsNoneif a dict key does not existInstallpipinstallpython_optionalUsagefrompython_optionalimportoptionaldata={'a':'b'}result=optional(data).get('a')# 'b'result=optional(data).a# 'b'result=optional(data).get('z')# Noneresult=optional(data).z# None
Package: python-options
python-optionsMake python class with option base on property. Using build option for client like kafka, command option like ffmpeg.Support: python 3.6+Feature:Build options (config) easily.Clone option (changing not effect with other config which initial from single class)(Optional) Filter value on set.(Optional) Auto fill default value if delete old value.Example:from typing import Any, Type
from pyopt import Options, UnsetOption, option


def filter_type(_type: Type):
    def _filter_wrapper(instance: Any):
        if not isinstance(instance, _type):
            raise TypeError(f"Instance must be `{_type.__name__}`")
        return instance
    return _filter_wrapper


class Config(Options):
    server = option("url", filter_type(str), doc="URL of server host.")

if __name__ == '__main__':
    conf = Config()
    try:
        conf.server = 1  # raise TypeError
    except TypeError as e:
        print(f"ERROR: {e}")

    try:
        print(conf.server)
    except UnsetOption as e:
        print(f"Unset: {e}")

    conf.server = "127.0.0.1:9090"
    print(conf.__repr__())
    print(conf.build())


>>> config = Config()

>>> config.server = 1
TypeError: Instance must be `str`

>>> conf.server
The option `url` of Config hasn't been set.

>>> config.server = "127.0.0.1:9090"
>>> print(conf)
Config:
    - server         | "url" = "127.0.0.1:9090"                    | Doc: URL of server host.

>>> print(conf.build())
{'url': '127.0.0.1:9090'}InfoAuthor = "Tin Dang"Copyright = "Copyright (C) 2020 DPS"Version = "1.0"Doc = "Options base on property which help build dict name=value with value filter."