Saravanan666/pypi-org huggingface dataset:
Package: kleides-dssoclient
Discourse Single-Sign-on (DSSO) provider clientto connect yourDjangoproject to aDiscourse Single-Sign-On provider server.See:https://meta.discourse.org/t/official-single-sign-on-for-discourse-sso/Example usage:Addkleides_dssoclienttoINSTALLED_APPS.Create a customDssoLoginBackend, for example:from kleides_dssoclient.backends import DssoLoginBackend

class MyProjectDssoLoginBackend(DssoLoginBackend):
    """
    DssoLoginBackend that rejects anyone without is_superuser, and that
    sets all mapped variables on the newly created User object.
    """
    def authenticate(self, dsso_mapping):
        """
        Check that user is a superuser and pass along to DssoLoginBackend.
        """
        if dsso_mapping.get('is_superuser') not in ('True', 'true', '1'):
            return None

        return super(MyProjectDssoLoginBackend, self).authenticate(
            dsso_mapping)

    def configure_user(self, user, dsso_mapping):
        """
        We expect username, email, is_superuser in the dsso_mapping.
        """
        user = (
            super(MyProjectDssoLoginBackend, self)
            .configure_user(user, dsso_mapping))

        user.email = dsso_mapping.get('email', '')
        is_superuser = (
            dsso_mapping.get('is_superuser') in ('True', 'true', '1'))
        user.is_staff = is_superuser
        user.is_superuser = is_superuser

        user.save()
        return userAdd this to theDjangosettings:AUTHENTICATION_BACKENDS = (  # the only backend needed
    'myproject.backends.MyProjectDssoLoginBackend',
)
MIDDLEWARE_CLASSES += (
    'kleides_dssoclient.middleware.DssoLoginMiddleware',
)
KLEIDES_DSSO_ENDPOINT = 'https://DSSOSERVER/sso/'
KLEIDES_DSSO_SHARED_KEY = 'oh-sso-very-very-secret'Changesv0.8 -2020-09-28Allow using the Dsso backend as a mixin.v0.7 -2019-07-16Allow bypassing the middleware by setting KLEIDES_DSSO_ENDPOINT to None.v0.6 -2019-03-06Addrequestarg toDssoLoginBackendfor Django 2.1.v0.5 -2019-03-06Add logging to help investigate problems.v0.3 -2018-12-18Add support for Django 1.10 style middleware.Check Django version for is_authenticated usage.v0.2 -2018-11-19Replacesso_mappingwithdsso_mappingin authenticate argument list.v0.1 -2018-11-16Initial release.
Package: klein
Klein is a micro-framework for developing production-ready web services with Python.
It is ‘micro’ in that it has an incredibly small API similar toBottleandFlask.
It is not ‘micro’ in that it depends on things outside the standard library.
This is primarily because it is built on widely used and well tested components likeWerkzeugandTwisted.AKlein bottleis an example of a non-orientable surface, and a glass Klein bottle looks like a twisted bottle or twisted flask.
This, of course, made it too good of a pun to pass up.Klein’s documentation can be found atRead The Docs.ExampleThis is a sample Klein application that returns ‘Hello, world!’, running on port8080.fromkleinimportrun,route@route('/')defhome(request):return'Hello, world!'run("localhost",8080)Contributekleinis hosted onGitHuband is an open source project that welcomes contributions of all kinds from the community, including:code patches,documentationimprovements,bug reports,reviews forcontributed patches.For more information about contributing, seethe contributor guidelines.
Package: kleinberg-grid-simulator
Kleinberg's Grid UltimateGreat Trilogies Come in Threes.Kleinberg's Grid Reloadedproposed
a newdynamic rejection samplingapproach to simulateKleinberg's small world modelon very large graphs.Kleinberg's Grid Unchainedintroduceddouble rejection sampling,
enabling computations on virtual grids the size of the universe (yes, that's big).Kleinberg's Grid Ultimateproposes an improved version of the
simulator that isn't afraid withuniverse to the square! And it is nicely packaged for everyone to use.Free software: MIT licenseDocumentation:https://balouf.github.io/kleinberg-grid-simulator/.FeaturesProvides a Python frontend with possibility to use Julia or Python backend.Julia backend improved with fixed-size big ints (int256,int512,int1024) to speed up computation.Provides tools to parallelize, estimate complexity bounds, estimatereasonableshortcut distributions.Provides notebooks to benchmark the performance and reproduce the results from previous papers.InstallationPip installation preferred.pipinstallkleinberg-grid-simulatorUsagefromkleinberg_grid_simulatorimportcompute_edtcompute_edt(n=1000,r=2,p=1,q=1)CreditsCéline Comte, co-author ofKleinberg's Grid Unchained.This package was created withCookiecutterand thePackage Helper 3project template.
Package: klein-mongo
Klein MongoModule to allow simple instantiation of MongoDB from configurationSee theconfig.example.ymlfor example configuration.PythonUses python 3.7 but should be compatible with later versions.Usageconnection=MongoConnection(config)DevelopmentWe usevirtualenvfor local development environments:pip install virtualenv.Once installed, run:virtualenv -p python3.7 venv
source venv/bin/activate
pip install -r requirements.txtThen configure your IDE to use the python interpreter located atvenv/bin/python.Testingpython-mpytestFor test coverage you can run:pytest--cov-reportterm:skip-covered--covsrc/test/LicenseThis project is licensed under the terms of the Apache 2 license, which can be found in the repository asLICENSE.txt
Package: klein-queue
Klein QueueModule to abstract queues. Currently implements RabbitMQ.DocumentationAPI docs can be found athttps://informatics.pages.mdcatapult.io/klein/py-queue/src.Generate API docs for a particular version withpdoc:pipinstallpdoc3
pdoc--http:8080srcEnvironment VariablesEnv VariableDescriptionRABBITMQ_USERNAMERABBITMQ_PASSWORDRABBITMQ_HOSTRABBITMQ_PORTRABBITMQ_VHOSTUse a VHOST instead of default of /RABBITMQ_SOCKET_TIMEOUTRABBITMQ_HEARTBEATRABBITMQ_BLOCKED_CONNECTION_TIMEOUTRABBITMQ_RETRY_DELAYRABBITMQ_PUBLISHERRABBITMQ_CONSUMERRABBITMQ_ERRORRABBITMQ_CREATE_QUEUE_ON_CONNECTConfig to determine whether to create queue at connectionPythonUtilises python 3.7Ubuntusudo apt install python3.7Virtualenvvirtualenv -p python3.7 venv
source venv/bin/activate
pip install -r requirements.txtTestingdocker-composeup
python-mpytestLicenseThis project is licensed under the terms of the Apache 2 license, which can be found in the repository asLICENSE.txt
Package: klein-util
Klein UtilModule to contain some basic utility componentsklein_util.dicttraverse_dict()- function for traversing nested dicts using a list of keysExample:get a field from a mongodocusing dot notation:from klein_util.dict import traverse_dict

property = 'ner.chemicalentities.found'
entities_found = traverse_dict(doc, property.split('.'))TestsTo run tests, run the following command in the project root directory:python -m pytestLicenseThis project is licensed under the terms of the Apache 2 license, which can be found in the repository asLICENSE.txt
Package: kleio
Kleio=====`|Build Status| <https://travis-ci.org/tetherless-world/kleio>`_`|License| <https://github.com/tetherless-world/kleio/blob/master/LICENSE>`_`|Latest Release| <http://badge.fury.io/py/kleio>`_`|Downloads| <https://pypi.python.org/pypi/kleio/>`_A python library for W3C Provenance Data Model supporting PROV-O.Kleio is free software released under the MIT license.Features---------  An implementation of the W3C PROV Data Model in Python-  Supports serialization and deserialization as PROV-O in RDF/XML,Turtle, TriG, N3, NTriples, and JSON-LD formats-  Supports provenance-of-provenance (PROV bundles) via named graphs-  Built using `RDFlib <https://github.com/RDFLib/rdflib>`_Getting Started---------------Kleio can be installed from PyPI using the pip installer:::$ pip install kleioFrom kleio use the prov module to generate PROV records and outputPROV-O.\`\`\`python from kleio import provprov.ns("test", "http://tw.rpi.edu/ns/test#")entity = prov.Entity("test:entity") entity.set\_label("example entity")activity = prov.Activity("test:activity") activity.set\_label("exampleactivity")entity.set\_was\_generated\_by(activity)print(prov.serialize(format="turtle")) \`\`\` output:::@prefix prov: <http://www.w3.org/ns/prov#> .@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .@prefix test: <http://tw.rpi.edu/ns/test#> .@prefix xml: <http://www.w3.org/XML/1998/namespace> .@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .<test:activity> a prov:Activity ;rdfs:label "example activity" ;prov:generated <test:entity> ;prov:influenced <test:entity> .<test:entity> a prov:Entity ;rdfs:label "example entity" ;prov:wasGeneratedBy <test:activity> ;prov:wasInfluencedBy <test:activity> .Kleio can also be used to load and update existing PROV-O records.::from kleio import prov# load the existing PROV-O graphprov.graph.load("load-example.ttl", format="turtle")# get a reference to the existing entity with id="test:entity"entity = prov.Entity("test:entity")# ... update entity ...Support-------More information is available on the project webpage:https://github.com/tetherless-world/kleioContinuous integration status details available from Travis CI:https://travis-ci.org/tetherless-world/kleioThe documentation can be built by doing:::$ python setup.py build_sphinxAnd is also available from ReadTheDocs:http://kleio.readthedocs.org/en/latest.. |BuildStatus| image:: https://travis-ci.org/tetherless-world/kleio.svg?branch=master.. |License| image:: http://img.shields.io/badge/license-MIT-brightgreen.svg.. |Latest Release| image:: https://badge.fury.io/py/kleio.svg.. |Downloads| image:: https://pypip.in/download/kleio/badge.svg
Package: kleis-keyphrase-extraction
Kleis: Python package for keyphrase extractionKleis is a python package to label keyphrases in scientific text. It is named after the ancient greek wordκλείς.InstallPip (Easy and quick)$ pip install kleis-keyphrase-extractionMake your own wheel$ git clone https://github.com/sdhdez/kleis-keyphrase-extraction.git
$ cd kleis-keyphrase-extraction/
$ python setup.py sdist bdist_wheel
$ pip install dist/kleis_keyphrase_extraction-0.1.X.devX-py3-none-any.whlReplace X with the corresponding values.Note: This method doesn't include pre-trained models, you should download the corpus so it can train.UsageExamplehereDatasetsThepackage already includes some pre-trained models but if you want to test by your own you should download the datasets.Download fromSemEval 2017 Task 10and decompress in "~/kleis_data/corpus/semeval2017-task10" or "./kleis_data/corpus/semeval2017-task10"$ ls ~/kleis_data/corpus/semeval2017-task10

brat_config  eval.py       __MACOSX            README_data.md  scienceie2017_test_unlabelled  train2   xml_utils.py
dev          eval_py27.py  README_data_dev.md  README.md       semeval_articles_test          util.py  zipsTestYou can test your installation withkeyphrase-extraction-example.py$ python keyphrase-extraction-example.pyAlso, seeherefor another example.RequirementsPython 3 (Tested: 3.6.5)nltk (with corpus) (Tested: 3.2.5)python-crfsuite (Tested: 0.9.5)OptionalNotebooksTo run the noteooks in this repository install JupyterLab.$ pip install jupyterlabThen run the following command.jupyter labFurther informationThis method uses a CRFs model (Conditional Random Fields) to label keyphrases in text, the model is trained with keyphrase candidates filtered with Part-of-Spech tag sequences. It is based on the method describedhere, but with a better performance. Please, feel free to send us comments or questions.In this version we usepython-crfsuite.
Package: klemmbrett
klemmbrettGetting startedBesides just installing klembrett via pip, you will need to make sure a couple system packages are installed.
We use keybinder for global shortcuts and gtk3 for clipboard handling and the popup menus, so make sure the
packages for your distro are installed, also make sure the typelib files for gobject introspection are installed
if your distribution ships them as seperate packages (as Debian/Ubuntu does).apt-get install libgirepository1.0-dev gir1.2-keybinder-3.0 gir1.2-gtk-3.0 gir1.2-glib-2.0
pip install klemmbrettIf you do not like to install pip packages into your system globally, either use a virtualenv orpip install --user.Adding your own stuffActionsActions trigger the execution of a commandline with the clipboard contents injected at a user specified position.
To configure a simple action, find theactionssection in the config file and add a newlabel = commandentry.
To inject the current clipboard contents, use%sanywhere in the commandline string.search = firefox "http://www.duckduckgo.com/?q=%s"SnippetsStatic SnippetsAlthough snippets also have the ability to product a side-effect by executing python code, it's main goal is to
produce content that is place in the clipboard for you to use. The simplest form is static content. This is done
the same way an action is configured, just add alabel = textpair to thesnippetsand the snippet should
be available to you when you hit the snippets shortcut.Dynamic SnippetsStatic snippets are boring, what makes the snippets really useful is the possibility to run a python callable
that uses the current clipboard contents to generate new clipboard contents. To tell Klemmbrett to do this,
just prefix the label withcallable.and make the text part the global path to a python callable in dotted
notation.callable.n2c = klemmbrett.callable.newline_to_commaThis will add a stock callable snippet to your snippets menu, that converts newline sequences to commas.
This can for example be used to vertically select a column of an sql query output in the mysql oder psql
commandline clients, and convert it to content suitable for reuse in an IN() condition.Advanced dynamic snippetsSometimes you want to configure more than just a simple dynamic snippet, perhaps you want to parameterize
your calls for different situations so you do not copy, paste & modify your code too often.To do that, instead of adding a new key to the snippets section, you add a new section namedsnippet <label>.
In that section you can now add an arbitrary number of keys that get passed to the callable in addition to
the reserved keys that are required to setup the snippet.[snippet random product]
callable = klemmbrett.callable.alchemy.statement
engine = postgres://user:pw@host/database
statement = select id from products limit 1Additionally, the statement plugin passes the current clipboard contents to the prepared statement as :0,
so you may do a lookup based on it and return what has been found.[snippet lookup product name]
callable = klemmbrett.callable.alchemy.statement
engine = postgres://user:pw@host/database
statement = select name from products where id = :0 limit 1
Package: kleptes
You know that time you wanted to get some world data but it was a dreadful
jungle of bad documentation, requests that make very little sense, ridiculously
complicated data formats (SDMX?), and in the end you just said fuck this
and decided to do something else?This is an attempt at making world data mining suck a bit less.Currently available data sets:World BankOECDWHOEurostatSource and (minimal) documentationhere.
Package: kleverklog
While developing a program, have you ever scrolled and scrolled
through your progam output looking for a trace buried in hundreds of
lines of log? If so, kleverklog is for you.Klever KLog uses Apache Kafka to store your program log and provides a
Kafka client to search, filter and navigate your logs.UsageTo use Klever KLog, you need a Kafka server. It is easy to setup. You can run
one locally, without root privileges. Just follow thequickstart
instructions in the Kafka documentation.Klever KLog supports Pythonloggingand Twistedtwisted.loggerlogging systems. Depending of which one you use, setup is slightly
different.If you use Pythonlogging:importloggingfromkleverklog.python_loggingimportKafkaHandlerlogger=logging.getLogger('your logger name')logger.setLevel(logging.DEBUG)# or any other level you likekh=KafkaHandler('localhost:9092')logger.addHandler(kh)If you are usingtwisted.logger:fromkleverklog.twisted_loggerimportKafkaLogServiceKafkaLogService.activate('localhost:9092')Your program will now send its log entries to Kafka. To view them,
start the log viewer in a terminal:kleverklogall.jsonRun your application. The logs should be displayed by Klever KLog,
colored by log level.In the Klever KLog viewer, you can give the following commands:mPATTERNSet the match pattern to PATTERN. New log lines containing PATTERN
will be highlighted.rNRedisplay the last NN log lines, highlighting the ones matching
the match pattern.RRedisplay the whole log, highlighting the lines matching
the match pattern.pPause the log display.PResume the log display.qQuit Klever KLog
Package: klib
klibis a Python library for importing, cleaning, analyzing and preprocessing data. Explanations on key functionalities can be found onMedium / TowardsDataScienceand in theexamplessection. Additionally, there are great introductions and overviews of the functionality onPythonBytesor onYouTube (Data Professor).InstallationUse the package managerpipto install klib.pipinstall-UklibAlternatively, to install this package with conda run:condainstall-cconda-forgeklibUsageimportklibimportpandasaspddf=pd.DataFrame(data)# klib.describe - functions for visualizing datasets-klib.cat_plot(df)# returns a visualization of the number and frequency of categorical features-klib.corr_mat(df)# returns a color-encoded correlation matrix-klib.corr_plot(df)# returns a color-encoded heatmap, ideal for correlations-klib.corr_interactive_plot(df,split="neg").show()# returns an interactive correlation plot using plotly-klib.dist_plot(df)# returns a distribution plot for every numeric feature-klib.missingval_plot(df)# returns a figure containing information about missing values# klib.clean - functions for cleaning datasets-klib.data_cleaning(df)# performs datacleaning (drop duplicates & empty rows/cols, adjust dtypes,...)-klib.clean_column_names(df)# cleans and standardizes column names, also called inside data_cleaning()-klib.convert_datatypes(df)# converts existing to more efficient dtypes, also called inside data_cleaning()-klib.drop_missing(df)# drops missing values, also called in data_cleaning()-klib.mv_col_handling(df)# drops features with high ratio of missing vals based on informational content-klib.pool_duplicate_subsets(df)# pools subset of cols based on duplicates with min. loss of informationExamplesFind all available examples as well as applications of the functions inklib.clean()with detailed descriptionshere.klib.missingval_plot(df)# default representation of missing values in a DataFrame, plenty of settings are availableklib.corr_plot(df,split='pos')# displaying only positive correlations, other settings include threshold, cmap...klib.corr_plot(df,split='neg')# displaying only negative correlationsklib.corr_plot(df,target='wine')# default representation of correlations with the feature columnklib.corr_interactive_plot(df,split="neg").show()# The interactive plot has the same parameters as the corr_plot, but with additional Plotly heatmap graph object kwargs.klib.corr_interactive_plot(df,split="neg",zmax=0)#Since corr_interactive_plot returns a Graph Object Figure, it supports the update_layout chain method.klib.corr_interactive_plot(wine,split="neg").update_layout(template="simple_white")klib.dist_plot(df)# default representation of a distribution plot, other settings include fill_range, histogram, ...klib.cat_plot(data,top=4,bottom=4)# representation of the 4 most & least common values in each categorical columnFurther examples, as well as applications of the functions inklib.clean()can be foundhere.ContributingPull requests and ideas, especially for further functions are welcome. For major changes or feedback, please open an issue first to discuss what you would like to change.LicenseMIT
Package: kliff
KIM-based Learning-Integrated Fitting Framework (KLIFF)Documentation at:https://kliff.readthedocs.ioKLIFF is an interatomic potential fitting package that can be used to fit
physics-motivated (PM) potentials, as well as machine learning potentials such
as the neural network (NN) models.InstallationUsing condacondaintall-cconda-forgekliffUsing pippipinstallkliffFrom sourcegit clone https://github.com/openkim/kliff
pip install ./kliffTo train a KIM model,kim-apiandkimpyare needed; to train a machine learning
model,PyTorchis needed. For more information on installing these packages, seeInstallation.A quick example to train a neural network potentialfromkliffimportnnfromkliff.calculatorsimportCalculatorTorchfromkliff.descriptorsimportSymmetryFunctionfromkliff.datasetimportDatasetfromkliff.modelsimportNeuralNetworkfromkliff.lossimportLossfromkliff.utilsimportdownload_dataset# Descriptor to featurize atomic configurationsdescriptor=SymmetryFunction(cut_name="cos",cut_dists={"Si-Si":5.0},hyperparams="set51",normalize=True)# Fully-connected neural network model with 2 hidden layers, each with 10 unitsN1=10N2=10model=NeuralNetwork(descriptor)model.add_layers(# first hidden layernn.Linear(descriptor.get_size(),N1),nn.Tanh(),# second hidden layernn.Linear(N1,N2),nn.Tanh(),# output layernn.Linear(N2,1),)# Training set (dataset will be downloaded from:# https://github.com/openkim/kliff/blob/master/examples/Si_training_set.tar.gz)dataset_path=download_dataset(dataset_name="Si_training_set")dataset_path=dataset_path.joinpath("varying_alat")train_set=Dataset(dataset_path)configs=train_set.get_configs()# Set up calculator to compute energy and forces for atomic configurations in the# training set using the neural network modelcalc=CalculatorTorch(model,gpu=False)calc.create(configs)# Define a loss function and train the model by minimizing the lossloss=Loss(calc)result=loss.minimize(method="Adam",num_epochs=10,batch_size=100,lr=0.001)# Write trained model as a KIM model to be used in other codes such as LAMMPS and ASEmodel.write_kim_model()Detailed explanation and more tutorial examples can be found in thedocumentation.Why you want to use KLIFF (or not use it)Interacting seamlessly withKIM, the fitted model can
be readily used in simulation codes such as LAMMPS and ASE via theKIM APICreating mixed PM and NN modelsHigh level API, fitting with a few lines of codesLow level API for creating complex NN modelsParallel executionPyTorchbackend for NN (include GPU training)Citing KLIFF@Article{wen2022kliff,
  title   = {{KLIFF}: A framework to develop physics-based and machine learning interatomic potentials},
  author  = {Mingjian Wen and Yaser Afshar and Ryan S. Elliott and Ellad B. Tadmor},
  journal = {Computer Physics Communications},
  volume  = {272},
  pages   = {108218},
  year    = {2022},
  doi     = {10.1016/j.cpc.2021.108218},
}
Package: k-lights-interface
Kelvin lights interfaceThis is a python package to interface with Kelvin lights using  usb (serial) or bluetooth (experimental). This package is available on PyPI and can be installed with pip.
To use it in your project, simply run:pip install k-lights-interfaceFeaturesControl Kelvin devices. Set brightness, CCT and Duv, RGB, HSI, read out temperatures, voltages, and more.Supports Usb (serial) communication using the pyserial packageExperimental support of BLE communication using the bleak package. Check bleak for hardware requirements.Interface overviewLightUsbBluetoothPlay and Play ProYesYesEpos 300NoYesEpos 600YesYesUsageLoggingSet your desired log level using the set_log_level functionfromk_lights_interface.k_loggingimportset_log_level,loggingset_log_level(logging.INFO)Serial usage:fromk_lights_interface.k_serial_managerimportKSerialManagerfromk_lights_interface.k_loggingimportset_log_level,loggingset_log_level(logging.INFO)dev_manager=KSerialManager()devices=dev_manager.connect_to_all()[print(dev)fordevindevices]BLE usage:importasynciofromk_lights_interface.k_ble_managerimportKBleManagerfromk_lights_interface.k_loggingimportset_log_level,loggingasyncdefmain():set_log_level(logging.INFO)ble_manager=KBleManager()devices=awaitble_manager.connect_to_all()iflen(devices)==0:print("No devices found")returnprint(devices)ret,device_stats=devices[0].get_device_stats()print(device_stats)if__name__=="__main__":asyncio.run(main())print("finished")