Saravanan666/pypi-org huggingface dataset:
Package: online-triplet-loss
online_triplet_lossPyTorch conversion of the excellent post on thesame topic in Tensorflow. Simply an implementation of a triple loss with online mining of candidate triplets used in semi-supervised learning.Installpip install online_triplet_lossThen import with:from online_triplet_loss.losses import *PS: Requires Pytorch version 1.1.0 or above to use.How to useIn these examples I use a really large margin, since the embedding space is so small. A more realistic margins seems to be between0.1 and 2.0from torch import nn
import torch

model = nn.Embedding(10, 10)#from online_triplet_loss.losses import *
labels = torch.randint(high=10, size=(5,)) # our five labels

embeddings = model(labels)
print('Labels:', labels)
print('Embeddings:', embeddings)
loss = batch_hard_triplet_loss(labels, embeddings, margin=100)
print('Loss:', loss)
loss.backward()Labels: tensor([6, 1, 3, 6, 6])
Embeddings: tensor([[-1.1335,  0.3364, -3.0174, -0.8732, -0.9301,  1.3619,  0.3746,  0.0457,
          0.0180, -0.4500],
        [ 1.0757, -0.8420, -0.7630, -0.0746,  1.1545,  0.4017,  0.5587,  1.7947,
          0.1992, -2.2288],
        [ 0.2646,  1.2383,  0.1949,  0.5743, -0.8460, -0.9929, -2.0350,  0.2095,
          0.2129, -0.4855],
        [-1.1335,  0.3364, -3.0174, -0.8732, -0.9301,  1.3619,  0.3746,  0.0457,
          0.0180, -0.4500],
        [-1.1335,  0.3364, -3.0174, -0.8732, -0.9301,  1.3619,  0.3746,  0.0457,
          0.0180, -0.4500]], grad_fn=<EmbeddingBackward>)
Loss: tensor(95.1271, grad_fn=<MeanBackward0>)#from online_triplet_loss.losses import *
embeddings = model(labels)
print('Labels:', labels)
print('Embeddings:', embeddings)
loss, fraction_pos = batch_all_triplet_loss(labels, embeddings, squared=False, margin=100)
print('Loss:', loss)
loss.backward()Labels: tensor([6, 1, 3, 6, 6])
Embeddings: tensor([[-1.1335,  0.3364, -3.0174, -0.8732, -0.9301,  1.3619,  0.3746,  0.0457,
          0.0180, -0.4500],
        [ 1.0757, -0.8420, -0.7630, -0.0746,  1.1545,  0.4017,  0.5587,  1.7947,
          0.1992, -2.2288],
        [ 0.2646,  1.2383,  0.1949,  0.5743, -0.8460, -0.9929, -2.0350,  0.2095,
          0.2129, -0.4855],
        [-1.1335,  0.3364, -3.0174, -0.8732, -0.9301,  1.3619,  0.3746,  0.0457,
          0.0180, -0.4500],
        [-1.1335,  0.3364, -3.0174, -0.8732, -0.9301,  1.3619,  0.3746,  0.0457,
          0.0180, -0.4500]], grad_fn=<EmbeddingBackward>)
tensor(94.9947, grad_fn=<DivBackward0>) tensor(1.)
Loss: tensor(94.9947, grad_fn=<DivBackward0>)ReferencesTriplet Loss and Online Triplet Mining in TensorflowFacenet paperadambielski's nice implementation(unfortunately context switches between CPU / GPU)
Package: onlinezip
OnlinezipOnlinezip is a Python library for reading zip file through network without downloading whole file locally.You can read one entry or whole zip file entry by entry.It may be useful when you want to read just few entries or file is really big and you don't want to download it at once.Prerequisitesserver with zip file must fulfill two conditions:respond to HTTP HEAD requestallows to read bytes in rangesMost modern servers supports this.InstallationUse the package managerpipto install onlinezip.pipinstallonlinezipUsageOnlineZip juz extending ZipFile. If you know how to use ZiFile class you also know how to use OnlineZip.To start just pass url to constructor.fromonlinezip.OnlineZipimportOnlineZipzip=OnlineZip('https://public-onlinezip.s3.eu-west-1.amazonaws.com/zip.zip')# returns names of all files in zipzip.namelist()# extract file a.txt to local directoryzip.extract('a.txt')# extract all fileszip.extractall()# open filewithzip.open('a.txt')asmyfile:print(myfile.read())Please remember that entries aren't stored neither cache so each time you calls method that read entry you are downloading it.ContributingPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.Please make sure to update tests as appropriate.LicenseGNU GENERAL PUBLIC LICENSE
Package: onlyfakes
Onlyfakes APIAn API wrapper for the onlyfakes website made in python.Is able to create prompts, submit them and fetch their results.License: MIT - See theLICENSEfile.InstallationInstall with pip:pip install onlyfakesInstall locally from github:pip install git+https://github.com/Egsagon/onlyfakes-api.gitUsageExample classic usage:importonlyfakesasof# Initialise the sessionclient=of.Client()# Create a new promptprompt=of.Prompt(positive='<insert positive prompt>',negative='<insert negative prompt>',engine=of.Engine.hentai_HD# Advanced settingswidth=512,height=640,cfg=7.5,seed=of.Seed(12345678))# Submit the prompt and wait for it to processimg=client.generate(prompt)# Download the image at a specific pathimg.download('result.png')Other example using shorthands:importonlyfakesasofof.Client().new(prompt='<fill>',negative_prompt='<fill>',engine=of.Engine.hentai_HD).generate().download('result.png')Thegeneratemethod contains a loop that breaks when it get a result. You can change its interaction intervals and
maximum by specifying them as arguments. You can also enable verbose to see the current process evolution.prompt.generate(interval=2*60,timeout=4*60,verbose=True)If want async or stuff that runs in parallel, you can use thesubmitfunction that will only send your prompt to the backend.
You will then be able to fetch the image using thecheckmethod. You can also build your async function.response=client.submit(prompt)# Do stuff for 2 min ...data=client.check()ifdata==False:...# The backend has not finished yet# Create the image object from data urlimage=of.Image(data['imageUrl'])TODOAsync stuffAccount handlingPresets
Package: onlyocr
Optical Character Recognition using PythonPlease install the following packages before using this package;PillowImagemagickPytesseractThis package is using Google's tesseract-OCR package for python to convert image data into usable text data.
After importing the package the program can be called by using the ocr() method. This method has no arguements and it returns a json object and also displays the text extracted in a text window.
Package: onlyoffice
onlyofficeProvides a python API for OnlyOffice APIInstallpip install onlyoffice --upgradeWork in progress to provide a python API for theOnlyOffice APIMinimal exampleimport onlyoffice
oo = onlyoffice.OnlyOffice('https://yourportal.onlyoffice.com', 'username', 'password')
# download file ID 123
oo.download(['123'], 'file.zip')Supported commandsReadonlyoffice/OnlyOffice.py
Package: onlyoffice.connector
Plone ONLYOFFICE integration pluginMoved toonlyoffice.plonePlease note:you have the previous plugin version installed (earlier plugin versions with the previous name onlyoffice.connector), please remove it before installing the new version.AuthorsAscensio System SIA:integration@onlyoffice.comChange Log2.2.0moved to onlyoffice.plone2.1.1Fixedissue with packaging2.1.0Addedsupport docxf and oform formatscreate blank docxf from creation menu"save as" in editor2.0.0AddedJWT supportFixedIssue when files inside unpublished folders couldn't be edited1.0.0AddedEdit option for DOCX, XLSX, PPTX.View template for documentsConfiguration pageTranslations for BR, CZ, DE, EN, ES, FR, IT, JP, NL, RU, ZH
Package: onlyonce
A simple Lock Dir system. Creating Dirs is atomic, which is useful for
locking things to only let one version of a process start.A directory is created, say called ‘lock’.
Inside this directory will be a PID file, which keeps the PID of the running process.
If the process dies, or is killed, then the whole directory will be deleted, allowing
the task to be run again later, and not leaving clutter around the place.Usage:Basic usage should be as simple astry:
    with onlyonce.SingleProcessLock('/tmp/lock') as lock:
        lock.run(['rsync', '-avz', '/here', 'there'])
except onlyonce.StillRunning as err:
    print str(err)if you want to do something special with running the task (redirecting output, etc)
then you can use lock.run with the same arguments as subprocess.Popen (they’ll all get
passed through). So:lock.run(['rsync','...'], stderr=...)Should work fine.If youdontwant to block and wait for the process to finish, then you’ll need to
go a bit more low level:try:
    with onlyonce.SingleProcessLock('/tmp/lock') as lock:
    process = Popen(['rsync', '-avz', '/here', 'there'], stderr=whatever ...)
    lock.write_pid(process.pid)
except ...Which doesn’t block.Notes:You can ‘kill’ the task, and onlyonce will clean up the lock dir for you.  If you ‘kill -9’ the
script, however, python freaks out and quits before the script can do anything. Sorry!This system is NOT designed to replace large daemonising clever init/systemd whatever stuff.
It was written simply to let us run rsync & other processess around the campus without
it being possible for multiple versions of the script to be running at once.Ideally, you should only be running ONE process with this at a time.Have fun. :-)
Package: only-pip3-autoremove
only-pip3-autoremoveRemove a package and its unused dependencies.This is a fork ofhttps://github.com/invl/pip-autoremoveto port it to Python 3.
To be clear, this is designed toonlywork with Python 3, andpip3by extension.QuickstartFirst installonly-pip3-autoremove$pip3installonly-pip3-autoremoveTo install using Git:$pip3installgit+https://github.com/JohnDevlopment/pip-autoremove.gitInstall a package which has dependencies, e.g.Flask$pip3installFlask
...
SuccessfullyinstalledFlaskJinja2MarkupSafeWerkzeugblinkerclickitsdangerousUninstall it and all its unused dependencies$pip3-autoremoveFlask-y
Flask2.3.2(/tmp/pip-autoremove/test/.env/lib/python3.10/site-packages)itsdangerous2.1.2(/tmp/pip-autoremove/test/.env/lib/python3.10/site-packages)blinker1.6.2(/tmp/pip-autoremove/test/.env/lib/python3.10/site-packages)Jinja23.1.2(/tmp/pip-autoremove/test/.env/lib/python3.10/site-packages)MarkupSafe2.1.3(/tmp/pip-autoremove/test/.env/lib/python3.10/site-packages)click8.1.6(/tmp/pip-autoremove/test/.env/lib/python3.10/site-packages)Werkzeug2.3.6(/tmp/pip-autoremove/test/.env/lib/python3.10/site-packages)...
Foundexistinginstallation:Flask2.3.2
UninstallingFlask-2.3.2:SuccessfullyuninstalledFlask-2.3.2
...Usageusage: pip3-autoremove [-h] [-L | -f] [-l] [ARG ...]

positional arguments:
  ARG           a Python package

options:
  -h, --help    show this help message and exit
  -L, --leaves  list leaves (packages that are not used by any others)
  -f, --freeze  list leaves (packages that are not used by any others) in requirements.txt format
  -l, --list    list unused dependencies, but don't uninstall themInstallation$pip3installonly-pip3-autoremove
$pip3installgit+https://github.com/JohnDevlopment/pip-autoremove.git
Package: only-pipe
Pipe.pyA non-intrusive Python pipeline.There are only pipeline. If you want more functional tools, you should look for another library.Installpip install only-pipeOr fetch from githubpip install git+https://github.com/abersheeran/only-pipeUsageUse pipeline to pass data as a positional parameter to the next function:frompipeimportFrange(10)|F(filter,lambdax:x%2)|F(sum)==25Or you need to pass multiple parameters through the pipeline:frompipeimportFFdefget_data():return1,2get_data()|FF(lambdax,y:x+y)==3Use alias like follow code, you can usemap/filter/reducemore conveniently:fromfunctoolsimportreducefrompipeimportFFilter=F(F,filter)Map=F(F,map)Reduce=F(F,reduce)range(100)|Filter(lambdax:x%2)|Map(lambdax:x*x)|Reduce(lambdax,y:x+y)Set GlobalMaybe you don't want to usefrom pipe import Fin every file of the entire project, you can use the following code to set it as a global function, just likemin/max/sum.importpipepipe.set_global(pipe.F,pipe.FF)Maybe you also want to exposefunctools.reduceto the world, just likemap/filter.importpipeimportfunctoolspipe.set_global(pipe.F,pipe.FF,functools.reduce)MoreNo more ~ This library has less than ten lines of valid code, but it is very effective.If you like it, please give a Star. 😀This repository is released under the MIT. Do what you want!
Package: only-pubsub
# Onlyfunction Pubsub### InstallationAdd dependency in yourrequirements.txtfileonly-pubsub## Kafkafrom only-pubsub import Kafkakafka = Kafka(‘access_key’, ‘secretkey’)kafka.publish(‘topic’, ‘key’, ‘message’)## RabbitMQfrom only-pubsub import RabbitMQrabbit = RabbitMQ(‘access_key’, ‘secretkey’)rabbit.publish(‘topic’, ‘message’)## License
MIT License
Package: only-relative-import
only-relative-importLinter to only allow relative imports! :sweat_smile:Installationpipinstallonly-relative-importUsageYou can either run the CLI or use it in the pre-commit.CLIonly-relative-import--package-name<package_name>Pre-commit-repo:rev:v0.1.0hooks:-id:only-relative-importargs:[--package-name,<package_name>]LicenseThis project is licensed under the terms of the MIT license.
Package: only-scraperpy
OnlyScraperPy 🚀Overview 📖OnlyScraperPy bridges the gap between Rust and Python, offering a high-performance web scraping tool built upon a compiled version of theOnly Scraper Rust library. This Python adaptation retains the core principles of minimalism and efficiency, making it a superior choice for developers who require the speed of Rust with the flexibility of Python for their scraping tasks. It's designed for those looking to leverage Rust's performance benefits within Python's versatile ecosystem.Why OnlyScraperPy? 🤔In a landscape flooded with web scraping solutions, OnlyScraperPy distinguishes itself by harnessing the raw speed and reliability of Rust, combined with the ease of use and widespread adoption of Python. It eliminates the complexity often associated with performing high-speed scraping tasks in Python, offering a streamlined, Rust-powered backend with a simple Python interface. This unique fusion ensures your scraping operations are both fast and straightforward, without the burden of external dependencies.Features 🌟Rust-Powered Performance⚡: Built on a compiled Rust library, offering unmatched speed and reliability for web scraping in Python.Zero External Dependencies📦: Inherits the simplicity of Only Scraper, requiring only the standard libraries of Rust and Python for operation.Pythonic Interface🐍: Provides a seamless and intuitive Python wrapper, making it easy to integrate into any Python project.Focused Functionality🔍: Maintains a singular focus on web scraping, without unnecessary features, for optimal efficiency.Getting Started 🚀Installation 🛠️To install OnlyScraperPy, use pip to fetch and install the package directly from PyPI:pipinstallonly-scraperpyUsage 📝OnlyScraperPy simplifies web scraping in Python by providing a straightforward interface. Here's a quick example to get you started:fromonly_scraperpyimportOnlyScraperdefmain():html=OnlyScraper().scrape("https://example.com")print(html)if__name__=="__main__":main()This snippet demonstrates how to fetch and print the HTML content of a specified URL, showcasing the efficiency and ease of use of OnlyScraperPy.Original Rust LibraryOnlyScraperPy is based on the powerful and efficientOnly Scraper Rust library, created to offer a minimalist and high-performance web scraping solution. For those interested in the Rust version or contributing to its development, please visit theGitHub repository.Contributing 🤝Contributions are highly appreciated to further refine and enhance OnlyScraperPy. Whether you have ideas for new features, bug fixes, or improvements, we encourage you to share your insights through GitHub issues or pull requests.License 📄OnlyScraperPy is released under the MIT License, embracing the same open-source spirit as its Rust counterpart. For more details, please refer to the LICENSE file in the repository.
Package: onlytld
onlyTLDJust only get TLD from domain. No other function. No non-standard library dependencies.Because it is simple, it is fast.One millionqueries only require2.4s.How to useIn Python3.5+:fromonlytldimportget_tld,get_sldassertget_tld("abersheeran.com")=="com"assertget_sld("upload.abersheeran.com")=="abersheeran.com"Support punycode-encoded domain names: if a punycode-encoded domain is passed in, a punycode-encoded domain will be returned, otherwise a utf8 string will be returned.Update TLD ListRefer tohttps://www.publicsuffix.org/list/, you can runonlytld.data.fetch_listregularly in the code or runpython -m onlytld.datain crontab.Use yourself TLD ListMaybe this is useless, but I still set this function.fromonlytldimportset_datapath,get_tldset_datapath(YOUR_FILE_PATH)assertget_tld("chinese.cn")=="cn"Why thisThere are many libraries in pypi that can get tld, such aspublicsuffix2,publicsuffixlist,dnspy, but they have too many functions. I just need a repository that can get tld, and it is best not to have dependencies other than the non-standard library.
Package: onms-kafka-events
onms_kafka_eventsThis library will allow you to generate event objects in Python to send to a Kafka topic for OpenNMS Horizon/Meridian to process.Documentation for this project is available athttps://opennms-forge.github.io/kafka-consumer-py/Documentation for configuring the Kafka Consumer feature on your Horizon/Meridian server can be found athttps://docs.opennms.com/horizon/latest/operation/deep-dive/events/sources/kafka.html.Installationpip install onms-kafka-eventsAssociating events to nodesWhen received, the eventd daemon will attempt to associate the event to a node in the following order:If thenodeIdfield is included, the event will be matched to the node with that database ID.If the event does not havenodeID, the parameters_foreignSourceand_foreignIdcan be included to associate the event based on the requisition name and ID.Any event that cannot match a node on either of these criteria will not be associated with a node.Examplefromonms_kafka_eventsimportKafkaConnection,Severitymy_producer=KafkaConnection(servers=["broker01:9092","broker02:9092"],topic="opennms-kafka-events")my_event=my_producer.create_event(uei="uei.opennms.org/custom/event",severity=Severity.WARNING,node_id=1234,custom="value")result=my_producer.send_event(my_event)
Package: onn
Online Neural Network (ONN)This is a Pytorch implementation of theOnline Deep Learning: Learning Deep Neural Networks on the Flypaper. This algorithm contains a new backpropagation approach called Hedge Backpropagation and it is useful for online learning. In this algorithm you model a overnetwork architeture and the algorithm will try to turn on or turn off some of the hidden layers automatically. This algorithm uses the first hidden layer to train/predict but if it is going bad it starts to use another layers automatically. For more informations read the paper in the 'References' section.Installingpip install onnHow to use#Importing Libraryimportnumpyasnpfromonn.OnlineNeuralNetworkimportONN#Starting a neural network with feature size of 2, hidden layers expansible until 5, number of neuron per hidden layer = 10 #and two classes.onn_network=ONN(features_size=2,max_num_hidden_layers=5,qtd_neuron_per_hidden_layer=10,n_classes=2)#Do a partial trainingonn_network.partial_fit(np.asarray([[0.1,0.2]]),np.asarray([0]))onn_network.partial_fit(np.asarray([[0.8,0.5]]),np.asarray([1]))#Predict classespredictions=onn_network.predict(np.asarray([[0.1,0.2],[0.8,0.5]]))Predictions--array([1,0])New featuresThe algortihm works with batch now. (It is not recommended because this is an online approach. It is useful for experimentation.)The algorithm can use CUDA if available. (If the network is very small, it is not recommended. The CPU will process more fast.)Non-linear Contextual Bandit Algorithm (ONN_THS)The ONN_THS acts like a non-linear contextual bandit (a reinforcement learning algorithm). This algorithm works with the non-linear exploitation factor (ONN) plus an exploration factor provided by Thompson Sampling algorithm. The ONN_THS works with 'select' and 'reward' actions. For more detailed examples, please look at the jupyter notebook file in this repository. This algorithm was created by me to solve a problem in the company I work.The great thing about this algorithm is that it can be used in an online manner and it has a non-linear exploitation. This algorithm can learn different kind of data in a reinforcement learning way.How to use#Importing Libraryimportnumpyasnpfromonn.OnlineNeuralNetworkimportONN_THS#Starting a neural network with feature size of 2, hidden layers expansible until 5, number of neuron per hidden layer = 10 #and two classes.onn_network=ONN_THS(features_size=2,max_num_hidden_layers=5,qtd_neuron_per_hidden_layer=10,n_classes=2)#Select an actionarm_selected,exploration_factor=onn_network.predict(np.asarray([[0.1,0.2]]))#Reward an actiononn_network.partial_fit(np.asarray([[0.1,0.2]]),np.asarray([arm_selected]),exploration_factor)ContributorsAlison de Andrade CarreraFábio Silva Vilas BoasDaniel AraújoReferencesOnline Deep Learning: Learning Deep Neural Networks on the FlyA Survey of Online Experiment Design with the Stochastic Multi-Armed Bandit
Package: onn4arg
ONN4ARG is an Ontology-aware Neural Network model for Antibiotic Resistance Gene (ARG) annotation predictions. It employs a novel ontology-aware layer to encourage annotation predictions satisfying the ontology rules (i.e., the ontology tree structure). It requires the Diamond and the HHblits alignment tools to run. Our source codes are available on GitHub, and our pre-built ARG database and our pre-trained model can be downloaded from Zenodo or release. ONN4ARG provides web service for fast ARG prediction.
Package: onncas
OzNetNerd Cloud App SecurityConvenience Python module for interacting with Trend Micro Cloud App Security (CAS)Installationpip3 install onncasEnvironment VariablesCAS_URL: Default isapi.tmcas.trendmicro.com(see options)CAS_KEY: CAS API keyExamplesExamplecode snippets.ContactBlog: oznetnerd.comEmail:will@oznetnerd.com
Package: onnc-bench
WARNING: This repository is no longer maintained ⚠️This repository has been moved to:https://github.com/skymizer/oasis-api-clienthttps://pypi.org/project/oasis-api-client/Make sure you have permission to view this repositoryONNC-benchONNC-bench is a Python wrapper of ONNCInstallationDeveloper installpython3 -m pip install -e .Using pippip install onnc-benchPython API ExampleHere is an example to show how to use ONNC python APIfrom onnc.bench import login, Project
# Setup your ONNC API key
api_key = "Your API KEY"
login(api_key)

# Instantiate a projct
project = Project('experiment-1')

# Add a model and its coresponding calibration samples
project.add_model('path/to/model', 'path/to/samples')

# Compile the model and optmize to `CMSIS-NN` backend
project.compile(target='CMSIS-NN-DEFAULT')


# Save the compiled model
deployment = project.save('./output')Please Checkhttps://docs-tinyonnc.skymizer.com/index.htmlfor the full documents.
Package: onnds
OzNetNerd Deep SecurityConvenience Python module for interacting with Trend Micro Deep SecurityInstallationpip3 install onndsEnvironment VariablesDS_ADDRESS: Hostname or IP address of the DSM. (Default:https://app.deepsecurity.trendmicro.com)DS_KEY: REST API key.Requiredfor methods which use the SDKDS_USERNAME:Requiredfor methods which use the legacy REST APIDS_PASSWORD:Requiredfor methods which use the legacy REST APIDS_TENANT:Requiredfor methods which use the legacy REST API in a multi-tenant environmentExamplesExamplecode snippets.ContactBlog: oznetnerd.comEmail:will@oznetnerd.com