Saravanan666/pypi-org huggingface dataset:
Package: karnickel
“it’s no ordinary rabbit…”What is it?Karnickel is a small library that allows you to use macros (similar to those
found in Lisp) in Python code.  In a nutshell, macros allow you to insert code
(the macrodefinition) at a different point in the code (the macrocall).
It is different from calling functions in that the code is insertedbeforeit
is even compiled.(“Karnickel” is German for “rabbit”, and there’s a vicious killer
rabbit in “Monty Python and the Holy Grail” that is best left alone…)UsingUse Python 2.6+.  You can put macros in any module.  Macro definitions are
Python functions, like this:from karnickel import macro

@macro
def macroname(arg1, arg2):
     ... macro contents ...Optional arguments are not supported.If the contents are a single expression (noreturn), the macro is anexpression macro.  Otherwise, it is ablock macro.  If it contains a
statement consisting of only__body__, it is a block macrowith body.For using the macros, you must install the import hook:import karnickel
karnickel.install_hook()Then, you can import modules that use macros like this:from module.__macros__ import macro1, macro2That is, append.__macros__to the name of the module that contains the
macros.  Onlyfrom-imports are supported.Usage depends on the macro type:Expression macros can be used everywhere as expressions.  Arguments are put
into the places of macro arguments.Block macros without body can only be used as an expression statement –
i.e.:macroname(arg1, arg2)Block macros with body must be used with awithstatement:with macroname(arg1, arg2):
    bodyArguments are put into the places of macro arguments, and the body is put into
the place of__body__in the macro definition.Proper docs may follow as soon as I can find a decent documentation tool.Why?Why not?  Seriously, this is a demonstration of what you can do with the Python
AST, especially the standardastmodule, and import hooks.  Besides, it’s
been fun.InstallingUsesetup.py:sudo python setup.py installAuthorGeorg Brandl <georg@python.org>
Package: karoo-gp
Karoo GPKaroo GP is an evolutionary algorithm, a genetic programming application suite
written in Python which supports both symbolic regression and classification
data analysis. It has been used in radio astronomy, gravitational wave detector
characterisation and synthetic supernovae detection, and a variety of other use
cases in a diversity of fields.You need only prepare your dataset according to the User Guide. No programming
required. Karoo is multicore and GPU enabled by means of the powerful library
TensorFlow. Karoo has three text cases built-in: Iris dataset, Kepler's law of
planetary motion, and a maths problem you can modify to various degrees of
challenge.Karoo is launched from the command line with an intuitive user interface or
with arguments for full automation from bash or another Python script. The
output of each run is automatically archived and includes the configuraiton, a
summary, and the full suite of GP trees saved as .csv files for your review and
edit such that you can hand-build the starting block for your next run.Be certain to read the User Guide for a starter's guide to Genetic Programming
and examples of all you can do with this unique body of code.For an interesting read on scalar vs vector and CPU vs GPU performance with
Karoo GP:https://arxiv.org/abs/1708.03157or to learn how Karoo applied to
supernova detection at LIGO:https://arxiv.org/abs/2002.04591Learn more atkstaats.github.io/karoo_gp/...
Package: karoosync
Overviewkaroosync gets today's workout fromintervals.icufor usage on a Hammerhead Karoo bike computer.Getting StartedInstall this usingpip install karoosyncGet yourintervals.icuAPI key on youraccountpage.Runkaroosync, the first time it will create akaroosync.cfgconfig file in your current directory.Openkaroosync.cfgand modify it as required:The start & end dates that you want to get the activities for, can be the same date if you only want one day.Your intervals.icu athlete id & API key.Add your Hammerhead dashboard username & password.Run the app withkaroosync.You'll see the workout show up in the dashboard under workouts and on your Karoo.CaveatIf you run the app multiple times for the same date, you will see duplicates in the Hammerhead dashboard that might have to be removed manually. Bandwidth permitting I'll try to improve that workflow in a future version.DisclaimerThis website is in no way affiliated with either Hammerhead orhttps://intervals.icu. It was developed for personal use and is not supported. I welcome pull requests if you want to contribute.
Package: karp
KeepAliveRequestProtocolA mix-in protocol between http and websocket. It combines the route-based navigation of http with the
streamed aspects of websockets.This is still an early stage of development, things can change heavily in the future.RequirementsPython3.6+InstallationPip:pip install karpFrom Source:gitclone--depth=1https://github.com/tooxo/karpcdkarp/
pipinstall.Protocol DefinitionRequestnamecontentlengthHeader TextKARP_HEAD9Route (case insensitive)route name ([A-z_])n/aType (Request=0; Response=1)01Response Wanted (0 or 1)11Request IDRequest Identifier (16* [0-9])16Content_LengthC_LEN5Content_Lengthcontent length in num of bytesn/aDataKARP_DATA9Datarequest data encoded in base64Content_LengthEnd of RequestKARP_END7Length = 9 + len(route_name) + 1 + 1 + 16 + 5 + len(content_length) + 9 + content_length +MetaAllowed chars:[A-Za-z0-9+/=]ResponsenamecontentlengthHeader TextKARP_HEAD9Type (Request=0; Response=1)11Request Successful (1/0)*¹11Request IDRequest Identifier (16* [0-9])16Content_LengthC_LEN5Content_Lengthcontent length in num of bytesn/aDataKARP_DATA9Datarequest data encoded in base64Content_LengthEnd of RequestKARP_END7*¹ = If the request was not successful, the data will be an error message.MetaAllowed chars: [A-Za-z0-9+/=]Every Response/Request sent to the socket ends with\nas a command-separator.TODO:Add Getting Started to READMEUnit-Tests
Package: karp-backend
Karp backendThis in the version 6 of Karp backend,for the legacy version (v5).SetupThis project usespoetryandMariaDB.Runmake installormake install-devfor a develop-installInstall MariaDB and create a databaseSetup environment variables (can be placed in a.envfile in the root and then?poetry runsets those):export DB_DATABASE=<name of database>
export DB_USER=<database user>
export DB_PASSWORD=<user's password>
export DB_HOST=localhost
export AUTH_JWT_PUBKEY_PATH=/path/to/pubkeyActivate the virtual environment by running:poetry shellRunkarp-cli db upto initialize databaseRunmake serveormake serve-w-reloadto start development serverorpoetry shelland thenuvicorn asgi:appTo setup Elasticsearch, download Elasticsearch 6.x and start itInstall elasticsearch python libs for the right versionIf you use Elasticsearch 6.x, runsource <VENV_NAME>/bin/activateandpip install -e .[elasticsearch6]Add environment variablesexport ES_ENABLED=true
export ELASTICSEARCH_HOST=localhost:9200
export SEARCH_CONTEXT=es6_search_serviceCreate test resourcespoetry shelland then:karp-cli entry-repo create karp/tests/data/config/places.jsonkarp-cli resource create karp/tests/data/config/places.jsonkarp-cli entries add places tests/data/places.jsonlDo the same formunicipalitieskarp-cli resource publish placeskarp-cli resource publish municipalitiesPre-processing data before publishing** TODO: review this **
Can be used to have less downtime, because sometimes the preprocessing may
be faster on another machine than the machine that talks to Elasticsearch.
Docreateandimporton both machines, with the same data. Use
machine 1 to preprocess and use result on machine 2.Create resource and import data as usual.Runkarp-cli preprocess --resource_id places --version 2 --filename places_preprocessedplaces_preprocessedwill contain a pickled dataset containing everything that is neededRunkarp-cli publish_preprocessed --resource_id places --version 2 --data places_preprocessedAlternatively runkarp-cli reindex_preprocessed --resource_id places --data places_preprocessed, if the resource was already published.TechnologiesPythonPoetry >= 3.10FastAPISQLAlchemyTyperElasticsearchElasticsearch DSLDatabasesMariaDBElasticsearchDevelopmentVersion handlingVersion can be bumped withbump2version.Usage:Increase patch numbera.b.X => a.b.(X+1):make bumpversionorbumpversion patchIncrease minor numbera.X.c => a.(X+1).0:make bumpversion-minororbumpversion minorIncrease major numberX.b.c => (X+1).0.0:make bumpversion-majororbumpversion majorTo custom versiona.b.c => X.Y.Z:bumpversion --new-version X.Y.Zbumpversionis configured in.bumpversion.cfg.The version is changed in the following files:setup.pysrc/karp/__init__.py.bumpversion.cfgdoc/karp_api_spec.yaml
Package: karp-backend-5
karp-backend-5This package is the legacy version of Karp, [go here for the current version(https://github.com/spraakbanken/karp-backend)]masterKarp is the lexical platform of Språkbanken.
Now migrated to Python 3.6+.Karp in DockerFor easy testing, useDockerto run Karp-b.Follow the steps givenhereRundocker-compose up -dTest it by runningcurl localhost:8081/app/testIf you want to use Karp without Docker, keep on reading.PrerequisitesElasticSearch6SQL, preferrablyMariaDBa WSGI server
for examplemod_wsgiwithApache, Waitress, Gunicorn, uWSGI. . .an authentication server. Read more about thisherePython >= 3.6withpipInstallationKarp uses virtuals envs for python. To get running:runmake installor:Create the virtual environment usingpython3 -m venv venv.Activate the virtual environment withsource venv/bin/activate.pip install -r requirements.txtConfigurationSet the environment variblesKARP5_INSTANCE_PATHandKARP5_ELASTICSEARCH_URL:usingexport VAR=valueor creating a file.envin the root of your cloned path withVAR=valueKARP5_INSTANCE_PATH- the path where your configs are. If you have cloned this repo you can use/path/to/karp-backend/.KARP5_ELASTICSEARCH_URL- the url to elasticsearch. Typicallylocalhost:9200Copyconfig.json.exampletoconfig.jsonand make your changes.
You will also need to make configurations for your lexicons.
Read morehere.TestsTODO: DO MORE TESTS!
Run the tests by typing:make testTest thatkarp-backendis working by starting itmake runorpython run.pyKnown bugsCounts from thestatisticscall may not be accurate when performing
subaggregations (multiple buckets) on big indices unless the query
restricts the search space. Usingbreadth_firstmode does not (always) help.Possible workarounds:usecomposite aggregationinstead, but this does not work with filtering.set a bigger shard_size (27 000 works for saldo), but this might break your ES cluster.have smaller indices (one lexicon per index) but this does not help for big lexicons or statistics over many lexicons.don't allow deeper subaggregations than 2. Chaning thesizewon't help.ElasticsearchIf saving stops working because ofDatabase Exception: Error during update. Message: TransportError(403, u'cluster_block_exception', u'blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];')., you need to unlock the relevant ES index.This is how you do it:Repeat for every combination ofhostandportthat is relevant for you. But you only need to do it once per cluster.Check if any index is locked:curl <host>:<port>/_all/_settings/index.blocks*If all is open, Elasticsearch answers with{}else it answers with{<index>: { "settings": { "index": { "blocks": {"read_only_allow_delete": "true"} } } }, ... }To unlock all locked indices on ahostandport:curl -X PUT <host>:<port>/_all/_settings -H 'Content-Type: application' -d '{"index.blocks.read_only_allow_delete": null}'
Package: karpyncho-reload-urls
Karpyncho Reload-UrlsGoalThis package main goal is to extend unittest to have a context manager that can change a setting
and then reload the django urls routing.Without this package if a url.py file that defines the urlpatterns to be using by the django
routing module have a conditional url like:ifsetting.DEBUG:urlpatterns+=[url("home",my_home_view,name="home")]this routing will be loaded only once in the pytest suit, and depending on the django_settings_module file
configuration, the routing will be loaded with (or without) the optional url.
If in a test method, self.settings(DEBUG=True) is used the routing will not be reloadedWith this package you can inherit from karpyncho.reload_urls.ReloadUrlsContextManager and then use the method
self.reload_url(url_module, settings) within a context. When the context is freed, first the setting is removed,
and then the urls are reloaded againFor example:fromdjango.urlsimportreverse,NoReverseMatchfromkarpyncho.reload_urlsimportTestCaseReloadableURLclassTestExample(TestCaseReloadableURL):deftest_example(self):withself.reload_urls(None,ADD_HELLO_URL=True):self.client.get(reverse("home"))withself.assertRaises(NoReverseMatch):reverse("home")reload_url methodthis method is added to the class django.tests.TestCase, the paramters are:urls_module: a string with the specific app url module to be reloaded (ie: "my_app.urls"). If None,
the url module definen in settings.ROOT_URLCONF is reloaded**settings: the keywords parameters, each key is the setting to be overriden, just as the
with self.settings(**settings) worksInstallpipinstallkarpyncho_reload_urlshttps://pypi.org/project/karpyncho-reload-urls/Future improvementsFix potential bugs
Package: karpyncho-stdout-context
Karpyncho Stdout-ContextGoalThis package main goal is to extend unittest to be able to make assertions on what was printed in the console (StdOut)Installpipinstallkarpyncho_stdout_contexthttps://pypi.org/project/stdout-stderr-capturing/TestCaseStdoutMixinOnce the package is installed TestCaseStdoutMixin can be used along unittest.TestCase or django.test.TestCase as multiple inheritance mixin.fromunittestimportTestCasefromkarpyncho.stdout_contextimportTestCaseStdoutMixinclassTestMyClass(TestCase,TestCaseStdoutMixin):deftest_assert_stdout_contains(self):withself.assertStdoutContains("xxxx"):print("test1")print("xxxx")print("test3")When the context ends, the assertion will be checkedAvailable assertionsassertStdout(expected_output)will assert that the context will finish writing exactly expected_output in consoleassertStdoutPrints(line1, line2, ...)is the same as assertStdout but passing each lineassertStdoutContains(*expected_output)will assert that each string in the expected_output tuple is a substring of the console outputassertStdoutRegex(regex)will assert that the console output matches with the provided regexFuture improvementsStderr Managementcontext capturing of stdout/stderr returning the text, not forcing an assertion creating the contextcapturing decorators
Package: karrio
karrio is a multi-carrier shipping SDK.The key features are:Unified API: A standardized set of models representing the common shipping data (Address,Parcel,Shipment...)Intuitive API: A library that abstracts and unifies the typical shipping API services (Rating,Shipping,Tracking...)Multi-carrier: Integrate karrio once and connect to multiple shipping carrier APIsCustom carrier: A framework to integrate a shipping carrier services within hours instead of monthsRequirementsPython 3.7+Installation# install karrio corepipinstallkarrio# eg: install the karrio canadapost extentionpipinstallkarrio.canadapostAdditional carrier extensionskarrio.aramexkarrio.australiapostkarrio.canadapostkarrio.canparkarrio.dhl-expresskarrio.dhl-universalkarrio.dicomkarrio.fedexkarrio.purolatorkarrio.royalmailkarrio.sendlekarrio.sf-expresskarrio.tntkarrio.upskarrio.uspskarrio.usps-internationalkarrio.yanwenkarrio.yunexpressUsageRates FetchingFetch shipping ratesimportkarriofromkarrio.core.modelsimportAddress,Parcel,RateRequestfromkarrio.mappers.canadapost.settingsimportSettings# Initialize a carrier gatewaycanadapost=karrio.gateway["canadapost"].create(Settings(username="6e93d53968881714",password="0bfa9fcb9853d1f51ee57a",customer_number="2004381",contract_id="42708517",test=True))# Fetching shipment rates# Provide the shipper's addressshipper=Address(postal_code="V6M2V9",city="Vancouver",country_code="CA",state_code="BC",address_line1="5840 Oak St")# Provide the recipient's addressrecipient=Address(postal_code="E1C4Z8",city="Moncton",country_code="CA",state_code="NB",residential=False,address_line1="125 Church St")# Specify your package dimensions and weightparcel=Parcel(height=3.0,length=6.0,width=3.0,weight=0.5,weight_unit='KG',dimension_unit='CM')# Prepare a rate requestrate_request=RateRequest(shipper=shipper,recipient=recipient,parcels=[parcel],services=["canadapost_xpresspost"],)# Send a rate request using a carrier gatewayresponse=karrio.Rating.fetch(rate_request).from_(canadapost)# Parse the returned responserates,messages=response.parse()print(rates)# [#     RateDetails(#         carrier_name="canadapost",#         carrier_id="canadapost",#         currency="CAD",#         transit_days=2,#         service="canadapost_xpresspost",#         discount=1.38,#         base_charge=12.26,#         total_charge=13.64,#         duties_and_taxes=0.0,#         extra_charges=[#             ChargeDetails(name="Automation discount", amount=-0.37, currency="CAD"),#             ChargeDetails(name="Fuel surcharge", amount=1.75, currency="CAD"),#         ],#         meta=None,#         id=None,#     )# ]ResourcesDocumentationCommunity DiscussionsIssue TrackerBlogJoin us on Discord
Package: karrio.amazon-mws
karrio.amazon_mwsThis package is a amazon_mws extension of thekarriomulti carrier shipping SDK.RequirementsPython 3.7+Installationpipinstallkarrio.amazon_mwsUsageimportkarriofromkarrio.mappers.amazon_mws.settingsimportSettings# Initialize a carrier gatewayamazon_mws=karrio.gateway["amazon_mws"].create(Settings(...))Check thekarrio Mutli-carrier SDK docsfor Shipping API requests
Package: karrio.amazon-shipping
karrio.amazon_shippingThis package is a Amazon Shipping extension of thekarriomulti carrier shipping SDK.RequirementsPython 3.7+Installationpipinstallkarrio.amazon_shippingUsageimportkarriofromkarrio.mappers.amazon_shipping.settingsimportSettings# Initialize a carrier gatewayamazon_shipping=karrio.gateway["amazon_shipping"].create(Settings(...))Check theKarrio Mutli-carrier SDK docsfor Shipping API requests
Package: karrio.aramex
karrio.aramexThis package is a Aramex extension of thekarriomulti carrier shipping SDK.RequirementsPython 3.7+Installationpipinstallkarrio.aramexUsageimportkarriofromkarrio.mappers.aramex.settingsimportSettings# Initialize a carrier gatewaycanadapost=karrio.gateway["aramex"].create(Settings(...))Check theKarrio Mutli-carrier SDK docsfor Shipping API requests
Package: karrio.asendia-us
karrio.asendia_usThis package is a Asendia US extension of thekarriomulti carrier shipping SDK.RequirementsPython 3.7+Installationpipinstallkarrio.asendia_usUsageimportkarriofromkarrio.mappers.asendia_us.settingsimportSettings# Initialize a carrier gatewayasendia_us=karrio.gateway["asendia_us"].create(Settings(...))Check theKarrio Mutli-carrier SDK docsfor Shipping API requests
Package: karrio.australiapost
karrio.carrier_nameThis package is a Australia Post extension of thekarriomulti carrier shipping SDK.RequirementsPython 3.7+Installationpipinstallkarrio.australiapostUsageimportkarriofromkarrio.mappers.australiapost.settingsimportSettings# Initialize a carrier gatewaycanadapost=karrio.gateway["australiapost"].create(Settings(...))Check theKarrio Mutli-carrier SDK docsfor Shipping API requests
Package: karrio.boxknight
karrio.boxknightThis package is a BoxKnight extension of thekarriomulti carrier shipping SDK.RequirementsPython 3.7+Installationpipinstallkarrio.boxknightUsageimportkarriofromkarrio.mappers.boxknight.settingsimportSettings# Initialize a carrier gatewayboxknight=karrio.gateway["boxknight"].create(Settings(...))Check theKarrio Mutli-carrier SDK docsfor Shipping API requests
Package: karrio.bpost
karrio.bpostThis package is a Belgian Post extension of thekarriomulti carrier shipping SDK.RequirementsPython 3.7+Installationpipinstallkarrio.bpostUsageimportkarriofromkarrio.mappers.bpost.settingsimportSettings# Initialize a carrier gatewaybpost=karrio.gateway["bpost"].create(Settings(...))Check theKarrio Mutli-carrier SDK docsfor Shipping API requests
Package: karrio.canadapost
karrio.canadapostThis package is a Canada Post extension of thekarriomulti carrier shipping SDK.RequirementsPython 3.7+Installationpipinstallkarrio.canadapostUsageimportkarriofromkarrio.mappers.canadapost.settingsimportSettings# Initialize a carrier gatewaycanadapost=karrio.gateway["canadapost"].create(Settings(...))Check theKarrio Mutli-carrier SDK docsfor Shipping API requests
Package: karrio.canpar
karrio.canparThis package is a Canpar extension of thekarriomulti carrier shipping SDK.RequirementsPython 3.7+Installationpipinstallkarrio.canparUsageimportkarriofromkarrio.mappers.canpar.settingsimportSettings# Initialize a carrier gatewaycanadapost=karrio.gateway["canpar"].create(Settings(...))Check theKarrio Mutli-carrier SDK docsfor Shipping API requests
Package: karrio.chronopost
karrio.chronopostThis package is a Chronopost extension of thekarriomulti carrier shipping SDK.RequirementsPython 3.7+Installationpipinstallkarrio.chronopostUsageimportkarriofromkarrio.mappers.chronopost.settingsimportSettings# Initialize a carrier gatewaychronopost=karrio.gateway["chronopost"].create(Settings(...))Check theKarrio Mutli-carrier SDK docsfor Shipping API requests
Package: karrio.colissimo
karrio.colissimoThis package is a Colissimo extension of thekarriomulti carrier shipping SDK.RequirementsPython 3.7+Installationpipinstallkarrio.colissimoUsageimportkarriofromkarrio.mappers.colissimo.settingsimportSettings# Initialize a carrier gatewaycolissimo=karrio.gateway["colissimo"].create(Settings(...))Check theKarrio Mutli-carrier SDK docsfor Shipping API requests
Package: karrio.dhl-express
karrio.dhl_expressThis package is a DHL Express extension of thekarriomulti carrier shipping SDK.RequirementsPython 3.7+Installationpipinstallkarrio.dhl_expressUsageimportkarriofromkarrio.mappers.dhl_express.settingsimportSettings# Initialize a carrier gatewaycanadapost=karrio.gateway["dhl_express"].create(Settings(...))Check theKarrio Mutli-carrier SDK docsfor Shipping API requests
Package: karrio.dhl-poland
karrio.dhl_polandThis package is a DHL Parcel Poland extension of thekarriomulti carrier shipping SDK.RequirementsPython 3.7+Installationpipinstallkarrio.dhl_polandUsageimportkarriofromkarrio.mappers.dhl_poland.settingsimportSettings# Initialize a carrier gatewaycanadapost=karrio.gateway["dhl_poland"].create(Settings(...))Check theKarrio Mutli-carrier SDK docsfor Shipping API requests
Package: karrio.dhl-universal
karrio.dhl_universalThis package is a DHL Universal Tracking extension of thekarriomulti carrier shipping SDK.RequirementsPython 3.7+Installationpipinstallkarrio.dhl_universalUsageimportkarriofromkarrio.mappers.dhl_universal.settingsimportSettings# Initialize a carrier gatewaycanadapost=karrio.gateway["dhl_universal"].create(Settings(...))Check theKarrio Mutli-carrier SDK docsfor Shipping API requests
Package: karrio.dicom
karrio.dicomThis package is a Dicom extension of thekarriomulti carrier shipping SDK.RequirementsPython 3.7+Installationpipinstallkarrio.dicomUsageimportkarriofromkarrio.mappers.dicom.settingsimportSettings# Initialize a carrier gatewaycanadapost=karrio.gateway["dicom"].create(Settings(...))Check theKarrio Mutli-carrier SDK docsfor Shipping API requests
Package: karrio.dpd
karrio.dpdThis package is a DPD extension of thekarriomulti carrier shipping SDK.RequirementsPython 3.7+Installationpipinstallkarrio.dpdUsageimportkarriofromkarrio.mappers.dpd.settingsimportSettings# Initialize a carrier gatewaydpd=karrio.gateway["dpd"].create(Settings(...))Check theKarrio Mutli-carrier SDK docsfor Shipping API requests
Package: karrio.dpdhl
karrio.dpdhlThis package is a Deutsche Post DHL extension of thekarriomulti carrier shipping SDK.RequirementsPython 3.7+Installationpipinstallkarrio.dpdhlUsageimportkarriofromkarrio.mappers.dpdhl.settingsimportSettings# Initialize a carrier gatewaydpdhl=karrio.gateway["dpdhl"].create(Settings(...))Check theKarrio Mutli-carrier SDK docsfor Shipping API requests