Saravanan666/pypi-org huggingface dataset:
Package: witch-ver
witch-verHave you ever asked yourself which version you're at? witch-ver can help.witch-ver automatically calculates the version of a git repo and adds the information when building.If you just want to integrate witch-ver into your project, head tousageEnvironmentList of dependencies for package to run.Requiredgitpython modules, installed viapip install witch-vercoloramasetuptoolsOptionalTest extensions, installed viapip install witch-ver[test]AutoDictcoveragetime-machinetomliInstallation / Build / Deployment# To install latest stable version on PyPi, execute:python-mpipinstallwitch-ver# To install from source, execute:gitclonehttps://github.com/WattsUp/witch-vercdwitch-ver
python-mpipinstall.# For development, install as a link to repository such that code changes are used. And include testing packagesgitclonehttps://github.com/WattsUp/witch-vercdwitch-ver
python-mpipinstall-e".[dev]"UsageTo use witch-ver in your project, add two lines to the project configuration. Also should have some git tags.# setup.pysetuptools.setup(...use_witch_ver=True,...)# pyproject.toml[build-system]requires=[..."witch-ver",...]Running TestsMake sure to install package withtesting extensionUnit tests>python-mtestCoverage report>python-mcoveragerun&&python-mcoveragereportDevelopmentCode development of this project adheres toGoogle Python GuideLinters>ruff.
>codespell.Formatters>isort.
>black.Toolsformatters.shwill run every formatterlinters.shwill run every linterVersioningVersioning of this projects adheres toSemantic Versioningand is implemented using git tags.
Package: wit-core
wit-corewit-core is a message processor forwit.ai.Handle your intents by defining actions and responses.Getting StartedPrerequisitesPython 3.6+Install wheel package.pipinstallwheelInstalationpipinstallwit-coreDocumentationDomainThedomain.yamldefines how the chatbot should operate according to the definition of the intents.In the domain you specify the intents, actions and responses.greet:response:text:"Hello, there!"temperature_set:action:action_temperatureresponse:text:"The temperature was changed to{action_return}"order_pizza:action:action_pizzaresponse:template:template_pizzaActionsActions are ways for you to write your own codes. For example, manipulating entities, make an API call, or to query a database.defcustom_action(resource):temperature=resource.get_entity("wit$temperature")returntemperature.valueTheresourceparameter allows accessing the properties of the wit.ai response.Resource properties:get_latest_messageReturns the message sent by the user.get_intentReturns the properties of the intent.get_entity("entity_name")Returns the properties of the specified entity.get_trait("trait_name")Returns to the properties of the specified trait.ResponsesIt is possible to define two types of responses: plain text and templates.TextYou can directly in the domain specify in theresponsea text response quickly.TemplatesTemplates serve to give you the possibility to add some logic to the answer. Templates receive the return value of an action.defcustom_template(action_return):# Template logic...return"Some response"Command Line Interfacewit-core initCreates the directory structure.wit-core shellLoads the domain and allows interaction with the chatbot.wit-core http-serverCreates a http server that can be used for custom integrations. They provide a URL where you can post messages.wit-core websocket-serverCreate a websocket server for real-time interaction with the chatbot. They provide an endpoint where you can send messages.How to useCreates the folder structure needed for the project.wit-coreinitCreate a .env at the root of the application with your secret wit.ai key.# Wit.aiACCESS_TOKEN=YOUR-SECRET-KEYInteract with the chatbot.wit-coreshellContributingFork it (https://github.com/yourname/yourproject/fork)Create your feature branch (git checkout -b feature/fooBar)Commit your changes (git commit -am 'Add some fooBar')Push to the branch (git push origin feature/fooBar)Create a new Pull RequestDevelopmentClone the repository:gitclonehttps://github.com/LucasOliveiraS/wit-coreInstall the dependencies:poetryinstallRun tests:maketests
Package: witenc
Witness Encryption based on BLS signaturesImplements a signature based witness encryption scheme based on the BLS signatures.Uses the following implementations fromChia-Network/bls-signaturesBLS12 curve and optimal ate pairingBLS signaturesOther useful helper methodsInstallationRequires Python3.8or laterpipinstallwitencImport the libraryfromwitencimportbls,utils,encrypt,decryptGenerate Keys# Example seed, used to generate private key. Always use# a secure RNG with sufficient entropy to generate a seed (at least 32 bytes).seed:bytes=bytes([0,50,6,244,24,199,1,25,52,88,192,19,18,12,89,6,220,18,102,58,209,82,12,62,89,110,182,9,44,20,254,22])# Generate secret key and public keysk,pk=bls.key_gen(seed)Export and Import Secret keys# Export and import secret keysk=utils.export_sk(sk)# only when storing, default type is 'hex'sk=utils.import_sk(sk)# only when loading, default type is 'hex'Export and Import Public Keys# Export and import public keypk=utils.export_pk(pk)# only when storing, default type is 'hex'pk=utils.import_pk(pk)# only when loading, default type is 'hex'Theexport_*andimport_*funtions accept atypeparameter that specifies the output encoding (hex,bytes).
The default ishexand the only implemented now.Sign a message# Tag to be signed, it's signature is required for decrypting the messagetag:str='tag'# Message to be encryptedmessage:str='Hello, world!'# Sign the tagsignature=bls.sign(sk,tag)Export and Import Signatures# Export and import signaturesignature=utils.export_sig(signature)# only when storing, default type is 'hex'signature=utils.import_sig(signature)# only when loading, default type is 'hex'Verify Signature# Verify the signatureok:bool=bls.verify(pk,tag,signature)assertokprint("Signature verified")Encrypt and Decrypt Message with a tag# Encrypt the messageciphertext:str=encrypt(pk,tag,message)print("Ciphertext:\n"+ciphertext)# Decrypt the messagedecrypted_message:str=decrypt(signature,ciphertext)assertmessage==decrypted_messageprint("Decrypted message\n"+decrypted_message)Full example can be found inexample.py.Witenc licenseWitenc uses code fromChia-Network/bls-signaturesand licensed under theApache 2.0 license
Package: witertools
witertools.witertools provides:functions that take a function that returns and iterator, and return a function that returns list.wrappers around built in functions that return iterators (filter, map, and zip)wrappers around the functions in itertools except count, cycle, and repeatwrappers around the functions in more_itertoolsThe motivation as that itertools and more-itertools in particular have functions that return iterators, but very frequently
the desired result is a list. Over and over in code you will see repeated code of calling list on the result of a function
that produces an interator.  You will even see it in most examples in themore-itertools api.Wrappers Around Functions that Return IteratorsIn witertools:
iterator_to_list_function will take a function that returns an iterable, and return a function that returns a list.>>> from witertools import *
>>> f=iterator_to_list_function(filter)
>>> w.filter(lambda s: True, [3,4,5])     
[3, 4, 5]iterator_name_to_list_function will take a module object and a function name, and return a function that returns a list.>> g=iterator_name_to_list_function(__builtins__,"filter") 
>>> g(lambda s : True , [1,2]) 
[1, 2]Wrappers Around Built in FunctionsTo use a wrapper around a built in function, just use a function from the same name from the
witertools package.>>> import witertools as w 
>>> w.filter(lambda s: True, [3,4,5])
[3, 4, 5]which replaces[3, 4, 5]Wrappers Around itertoolsUse a function from the witertools.itertools namespace, with the same name as the function in the itertools namespace.>>> i.chain([1,3],[4,5])
[1, 3, 4, 5]Wrappers Around more-itertoolsUse a function from the witertools.more_itertools namespace, with the same name as the function in the more-itertools namespace.  You will need to install more-itertools to use these functions, as more-itertools as not a prequisite of witertools.>>> from witertools.more_itertools import chunked
>>> chunked([1, 2, 3, 4, 5, 6], 3)
[[1, 2, 3], [4, 5, 6]]There are a few functions in more_itertools that do not return iterables.  For example, nth_or_last.
These functions are still wrapped in witertools.more_itertools but will result in a traceback.>>> from witertools.more_itertools import  nth_or_last
>>> nth_or_last([0, 1, 2, 3], 2)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Program Files (x86)\Python39-32\lib\site-packages\witertools\iterator_to_list.py", line 7, in as_list
    return list(iterator_function(*args,**kwargs))
TypeError: 'int' object is not iterable
Package: with-as-a-function
Use context managers with a function instead of a statement.Provides a minimal and portable interface for using context
managers with all the advantages of functions over syntax.Allows using context managers on Python implementations that
are too old or too incomplete to have thewithstatement.VersioningThis library’s version numbers follow theSemVer 2.0.0
specification.Installationpip install with-as-a-functionUsageImportwith_,iwith, or both:fromwith_importwith_,iwithwith_wraps a function in a context manager.
For example,data=with_(open('my_file.txt'),lambdamy_file:my_file.read())is similar to:withopen('my_file.txt')asmy_file:data=my_file.read()iwithwraps a generator or other iterable in a context manager.
For example,lines=iwith(open('my_file.txt'),lambdamy_file:my_file)is similar to:def_lines():withopen('my_file.txt')asmy_file:yield frommy_filelines=_lines()And of course becausewith_andiwithare functions, you
can combine them withfunctools.partialand other functional
programming libraries and techniques for many more uses.PortabilityPortable to all releases of Python 3, and releases
of Python 2 starting with 2.2.Even those without thewithstatement and
without theyield fromexpression.For popular Python reimplementations with quicks or bugs that
make the normal implementation of this module not work, other
implementations are included in the source distribution.
Package: with_aws_config
Set AWSenvironment variablesfrom the configuration files maintained byaws configure, then run a command.Installationpip install with_aws_configpip showwith-aws-config-fEnsurewith-aws-configis on yourPATHUsagewith-aws-config[-h][--verbose][--profilePROFILE] COMMAND [ARGUMENT...]Positional argumentsCOMMANDthe command to run, e.g.ec2-describe-instances,aws, oransibleARGUMENTthe command’s arguments, e.g.iamget-userIf any arguments are options, specify--before the command to endwith-aws-config’s optional argument parsing.Optional arguments-h,--helpshow this help message and exit--verbose,-voutput debugging information to stderr--profilePROFILE,-pPROFILEset the profile, ignoring anyenvironment variablesBehaviourwith-aws-config:Loads profile information stored byaws configureRuns thecommand and argumentswithadjusted environment variables, andExits with itsexit statusif possible.You have three ways to specify the profile:Default todefaultGive the--profileor-poptional argumentsSet theAWS_PROFILEorAWS_DEFAULT_PROFILEinput environment variablesExamplesRun a command:with-aws-config -- aws iam get-user
with-aws-config -- ec2-list-instances
with-aws-config -- ansible-playbook setup-vpc.yamlSpecify a profile as an option:with-aws-config --profile=default -- ec2-describe-instancesSpecify a profile via the environment:env AWS_DEFAULT_PROFILE=default with-aws-config -- ec2-describe-instancesNote we’ve used--in each to force the end of theoptional arguments.Environment VariablesInputAWS_PROFILEis used to specify profile if--profileis not givenAWS_DEFAULT_PROFILEis used ifAWS_PROFILEis not setHOMEis required to locate$HOME/.awsOutputCOMMANDwill be run with the environment supplied towith-aws-config,
with the following exceptions:The following environment variables will be removed:AWS_CONFIG_FILEAWS_DEFAULT_PROFILEAWS_PROFILEAWS_SESSION_TOKENThe following environment variables will be set based on the AWS profile:AWS_ACCESS_KEYAWS_ACCESS_KEY_IDAWS_DEFAULT_REGIONAWS_SECRET_ACCESS_KEYAWS_SECRET_KEYEC2_URLAWS_DEFAULT_REGIONandEC2_URLwill default to point tous-west-2if not configured duringaws configure.Why this many?aws,boto, andansibleneedAWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY, andAWS_DEFAULT_REGIONec2-*needAWS_ACCESS_KEY,AWS_SECRET_KEY, andEC2_URLExit Statuswith-aws-configexits with either:The exit status ofCOMMANDor, if it can’t be run:One of the following status codes indicating why:124:no configuration files found125:no configuration section found for the requested profile127:command not found130:interrupted by user with ^C
Package: withcd
withcdChange working directory utility compatible with "with" statementChanges the working directory while inside the "with" statement, then it changes the working directory back to where it was originally.Installpython -m pip install withcdUsagefromwithcdimportcdfromosimportgetcwdprint(getcwd())#<path>with(cd('foo')):print(getcwd())#<path>/fooprint(getcwd())#<path>
Package: with-contextvars
This module providesSet, a context manager which sets one or morecontextvarsvariables upon activation and resets them to their previous values at exit.Usage:import contextvars, with_contextvars
A = contextvars.ContextVar("A")
B = contextvars.ContextVar("B")
A.set("Hello,")
B.set("world!")
print(A.get(), B.get())
# prints: Hello, world!
with with_contextvars.Set((A, "other"), (B, "value")):
    print(A.get(), B.get())
    # prints: other value
print(A.get(), B.get())
# prints: Hello, world!Even the entirety of variable assignments of acontextvars.Contextobject
(as obtained fromcontextvars.copy_context()) can be activated by initializingSetwith its items:with with_contextvars.Set(*context.items()):
    ...However, usingcontextvars.Context.run()is more efficient and should be preferred
where possible.More information can be found in the documentation ofSet.
Package: with-each-user
Thewith_each_usercommand is basically nothing but a shortcut/replacement
for constructs like:root:~# ls /home | xargs -i su - {} -c "whoami"That is, its goal is to execute the same command for all users in the system
in a row. The line above can be rewritten with:root:~# with_each_user whoamiAdditionally, you can filter out unneeded users by their logins, shells and
uid, run commands simultaneously, interactively, and store script outputs
in log files in a separate directory.See usage for details.UsageThis is thewith_each_user--helpoutput:usage: with_each_user [-h] [-m MASK] [-s SHELL] [-u MIN_UID] [-U MAX_UID]
                      [-c CONCURRENCY] [-d CURRENT_DIRECTORY] [-i]
                      [-L LOG_DIRECTORY]
                      command [command ...]

Execute a command for a number users in the server

positional arguments:
  command               Shell command to execute

optional arguments:
  -h, --help            show this help message and exit
  -m MASK, --mask MASK  Filter users by their logins. Globbing is here
                        allowed, you can type, for example, "user*"
  -s SHELL, --shell SHELL
                        Filter users by their shells. For example, you can
                        exclude the majority of system users by issuing
                        "/bin/bash" here
  -u MIN_UID, --min-uid MIN_UID
                        Filter users by their minimal uid.
  -U MAX_UID, --max-uid MAX_UID
                        Filter users by their max uid (to filter out "nobody",
                        for example
  -c CONCURRENCY, --concurrency CONCURRENCY
                        Number of processes to run simultaneously
  -d CURRENT_DIRECTORY, --current-directory CURRENT_DIRECTORY
                        Script working directory (relative to user's home)
  -p, --preserve-environment
                        Preserve root environment. Arguments match the same of
                        "su" command
  -f, --format          Format command line with variables custom for every
                        user. Supported variables: {user}, {uid}, {gid},
                        {home}, {shell}, {gecos}.
  -r, --root            Run command with root privileges (do not "su" to
                        selected user). Option "--format" is helpful there
  -i, --interactive     Interactive execution. Set this flag to run processes
                        interactively
  -L LOG_DIRECTORY, --log-directory LOG_DIRECTORY
                        Directory to store log for all executions. Omit this
                        argument if you want just to print everything to
                        stdout/stderr
Package: withenv
We use environment variables all the time, but they can be painful to
maintain because a shell is sticky. It is too easy to set an
environment variable in your shell, only to have that variable stick
around when you change projects.withenvaims to help this problem by providing a simple way to
prefix commands targeting YAML files that will be added to the
environment prior to the command running.See thedocsfor more info.Free software: BSD licenseDocumentation:https://withenv.readthedocs.org
Package: witheppy
witheppyPython packages built using eppyFree software: MIT licenseDocumentation:https://witheppy.readthedocs.io.Featuresincludes additional functionality that can be used witheppyWhat is witheppyWitheppy is a python package that gathers all the useful functions written with eppy. Many people have used eppy and some have written functions that may be useful to practitioners at large. This becomes an organized place to upload this code.More will be written on where to upload the code and how to document it. The functions will fall under multiple categories, such as idfhelpers, geometry, HVAC, JSON reader.The JSON reader may be the most critical functionality. E+ is transitioning towards using a JSON file format instead of the IDD/IDF text format. At one point all E+ files will be in the JSON format. Right now eppy cannot read the JSON format. The intent is to have JSON reader in witheppy for eppy.Witheppy to eppyAny code put into witheppy proves to be useful, it will be transitioned into eppy. To ensure that witheppy is working as intended, the maintainers of eppy will not write code directly into eppy. All code intended for eppy will be first written in witheppy and then if it proves to be useful, it will be transitioned into eppy.CreditsThis package was created withCookiecutterand theaudreyr/cookiecutter-pypackageproject template.HistoryReleasesrelease 0.1.8Date:Sun Dec 12 11:20:53 2021 -0800fixed issue #53Problem:Need guidance on how to do a releaseSolution:Steps for release are documented on CONTRIBUTIONS.rstDate:Sat Dec 11 19:35:58 2021 -0800fixed issue #11Problem:CONTRIBUTIONS.rst page needs to use the C4 contractSolutions:CONTRIBUTIONS.rst page updated to list the steps in the C4 Contractrelease 0.1.6Date:Mon Dec 6 14:37:38 2021 -0800fixed issue #42Problem:Need a function to add or remove exhaust fans from a zoneSolution:putexhaust(), removeexhaust(), hasexhaust(), findexhaust() in eppyhelpers.hvacrelease 0.1.52021-12-04fixed issue #39Problem:Need a function to merge 2 or more zonesSolution:wrote eppyhelpers.mergezones(idf, mergeznames)release 0.1.42021-01-25fixed issue #32Problem:runandget get uses idf.run() which does not allow runs simultaneouslySolution:use idfRUNs() which allows multiple runs simultaneously2021-01-22fixed issue #30Problem:remove ephtml - this functionality is present in eppySolution:removed ephtml- now using eppy.results.fasthtml2021-01-01fixed issue #27Problem:experimental.runadget() was written in eppy. It should be in witheppySolution:moved runadget() to witheppy2019-05-23removed the optional arg weather from eplaunchfix for issue #24release 0.1.02018-10-15First release on PyPI.
Package: with_fixture
with_fixtureis an experiment in using context-managers naturally
with Pythonunittestfixtures.Test fixtures and context-managers have very similar structures. In
both cases, they define bits of code to be run before and after other
bits ofa prioriunknown code. They are the bread in little code
sandwiches.Yet, as far as I know, there is no natural way to use them
together. That is, there is no way to use context-managers in - or
perhapsas- test fixtures with the standardunittestmodule. This
is doubly egregious because context-managers are a central element in
modern Python design, and we should be encouraging their use widely.with_fixture, then, is an experiment in making them work together. I
want to start to explore the options we have for using
context-managers in test fixtures, with the long-term goal of getting
something into the standard library.Experiment 1:with_fixture.TestCase.withFixture()with_fixturecurrently implements a single, simple approach to
combining context-managers and fixtures. It’s a kind ofminimum
viable product. The idea is to subclassunittest.TestCaseand
override thesetUp()andtearDown()methods to drive a new
generator method,withFixture().withFixture()must callyieldonce. Everything before theyieldis the equivalent ofsetUp()inunittest.TestCase, and everything
after theyieldis equivalent totearDown(). By placing theyieldin awith-block, it becomes very natural to use
context-managers in test fixtures.Example: Temporary fileHere we use thetempfile.TemporaryFilecontext-manager inwithFixture():class TestBindingToMembers(TestCase):
    TEST_DATA = b'1234567890'

    def withFixture(self):
        # This creates a tempfile and binds it to self.f
        with tempfile.TemporaryFile() as self.f:
            # This yield sends control to the test
            yield

            # The test has now been executed. Check for the data we
            # expect in the file.
            self.f.seek(0)
            assert(self.f.read() == self.TEST_DATA)

    def test_nothing(self):
        self.f.write(self.TEST_DATA)This is clearly a bit contrived (it’s taken from the somewhat awkward
test suite forwith_fixtureitself), but you can see what’s going
on.Future workThe current implementation is small and simple, and there’s plenty of
room for further experimentation. Areas to investigate include:Allowing users to usesetUp()andtearDown()along withwithFixture(). Currently we make that difficult. There are a
number of interesting problems that arise when you start to think
about this.Integrating an implementation directly intounittest.Consider alternative names. I thingwithFixtureis pretty good
and communicates the design intent, but others may find it
confusing.Consider equivalent support forsetUp/tearDownClass().Do some deeper thinking on exceptions. Ithinkthe currently
implementation is pretty sound WRT exceptions (i.e. that setup and
teardown will get executed correctly in the face of exceptions) but
I’m not testing it and haven’t given it great throught yet.Completely different designs. I can imagine completely different
ways to approach this, and I’m sure others can too.