Saravanan666/pypi-org huggingface dataset:
Package: capture-errors
Capture ErrorsA python package that captures the exceptions and notify them via different methods of notification.This package provides the complete context of the runtime errors which help developers debug the issues and saves time in bug fixing.InstallationUse the commandpipto install the package$pipinstallcapture-errorsEnvironment Setup$exportCAPTURE_EMAIL_HOST=smtp.gmail.com
$exportCAPTURE_EMAIL_PORT=465$exportCAPTURE_EMAIL_USER=username@gmail.com
$exportCAPTURE_EMAIL_PASSWORD=securePassxxxxUsagefromcaptureimportCapturefromcapture.adapters.emailimportEmailAdaptercapture=Capture()email_adapter_properties={'from_email':'<email-address>','recipients':'<email-address>',}capture.set_adapter(EmailAdapter,email_adapter_properties)try:# Code that can generate an error# For example: ZeroDivisionErrorx=10y=500000whileTrue:remainder=y%xx-=1exceptExceptionasex:capture.push(ex)Available AdaptersEmailAdapter
Package: capturegridbot
# Capture Grid BotSimple application to automate common use  cases with [CaptureGrid4](https://www.kuvacode.com/)## InstallationThe actual application can be installed or upgraded with the following command:sudo pip3 install -U capturegridbot –system## CaptureGrid4 SetupThe easiest way to CaptureGrid4 should be installed via snap. However, due to the strict limitations of the snap
sandboxing, it is expected that you have installed it with–devmode. Otherwise downloading of files might not
work correctly.Given this, it is best to reinstall the application to make sure that thesudo snap remove capturegrid4; sudo snap install capturegrid4 –devmode
Package: capturejob
CaptureJobThis library provides the ability to copy stdout and stderr files to cloud storage.UsageProgrammatically it is used like this:from capturejob import CaptureJob

CaptureJob()but mainly its intended to be used in a dockerfile command script followng execution of a command script.echo "Running batch"

cd /work && poetry run python src/etl_noop/batchrun.py

TASK_ID="...
JOB_DATE="..."
CAPTURE_CONNECTION_STRING="..." 
CAPTURE_CONTAINER_NAME="..."
poetry run python -m capturejob 

echo "Done"ConfigurationThe following environment variables need to be setTASK_ID:  A name of the job which is used in the storage folder name createdJOB_DATE:  The date of the job which is used in the storage folder name createdCAPTURE_CONNECTION_STRING: Azure connection stringCAPTURE_CONTAINER_NAME: Azure container name
Package: capturepy
capturepyCapturepy captures the standard output and the standard error of functions, methods and any blocks of code. It is useful when testing, debugging and working with libraries.Installpip install capturepyIt requires python 3.8 or higher.UsageSee the examples.py file for a complete list of examples.This module is based on the class Capture, which can be use as a decorator, or with the 'with' statement.Here are some examples:Capturing output of functionfromcapturepyimportCaptureprint('Capture stdout and stderr of function using the Capture decorator.')@Capturedefmy_func(x):print('first')print('second',end='',file=sys.stderr)returnx**2output,result=my_func(4)print('The captured output is:')print(output)print('The function returned:')print(result)Capturing only standard error of code using "with" statementfromcapturepyimportCaptureprint('Capture only stderr of code using the "with" statement.')withCapture(stdout=False)ascapture:print('first')print('second',end='',file=sys.stderr)stderr=capture.get()print('The captured stderr is:')print(stderr)
Package: capture-stdout-decorator
Captures stdoutpipinstallcapture-stdout-decoratorfromcapture_stdout_decoratorimportprint_capture@print_capturedefhahaha():print("babab")return4@print_capture(print_output=False,return_func_val=False)defhahaha2():print("babab")return4x=hahaha()print(f'{x=}')y=hahaha2()print(f'{y=}')# output:bababx=(4,'babab\n')y='babab\n'
Package: capture-the-flag
Capture The Flag (CTF)Capture The Flag (CTF) is a Python package for reinforcement learning. This package is not related toCTF Hackingcompetitions.Installationpip install capture-the-flagDependenciesnumpypygletUsageFor a random game.importrandomimporttimeimportctfgame=ctf.Ctf()game.new_game()fps=30whilenotgame.winner:forunitingame.need_to_move:started=time.time()game.render()legal_moves=game.legal_moves()game.move(unit=unit,direction=random.choice(legal_moves[unit]))finished=time.time()sleeptime=1.0/fps-(finished-started)ifsleeptime>0:time.sleep(sleeptime)print(game.board)print(game.score)print(game.winner)Documentation
Package: capturewrap
Method CaptureWraps callables to capture stdout, stderr, exceptions and the return.Why?This library was created to assist in the testing of Python code, where
return values and exceptions are important, in addition to what is
written to stdout and stderr. It allows for a callable to be ran without
the caller being concerned with how important outputs are captured.An example use is when writing common code to test both a Python
interface and a corresponding CLI (tested by invokingmain). A
common test procedure - which may involve a complex setup and tear down
- can be ran using the different interfaces and return results that
encapsulate the outputs, without concern over the form they take (e.g.
the Python interface may have returnedTrueon success but theCLImay have calledexit(0), with raises aSystemExitexception).Otheralternativesexist for capturing stdout and
stderr but none also handle exceptions.How?GeneralfromcapturewrapimportCaptureWrapBuilderbuilder=CaptureWrapBuilder(capture_stdout=True,capture_stderr=True,capture_exceptions=True)wrapped=builder.build(my_method)result=wrapped(*args,**kwargs)print(f"stdout:{result.stdout}")print(f"stderr:{result.stderr}")print(f"return_value:{result.return_value}")print(f"exception:{result.exception}")Note: if an exception is captured,return_valuewill beNone.Custom Exception CaptureIt may be desirable to capture only some exceptions and leave others to
get raised as normal. To do this withCaptureWrapBuilder, setcapture_exceptionsas a function that takes the exception as the
first argument and returns back a boolean value to indicate if the
exception should be captured. e.g.fromcapturewrapimportCaptureWrapBuilderbuilder=CaptureWrapBuilder(capture_exceptions=lambdae:isinstance(e,SystemExit)ande.code==0)wrapped=builder.build(exit)print(wrapped(0))# {"exception": ["SystemExit: 0\n"]}print(wrapped(1))# Raises exceptionRequirementsPython >= 3.6InstallationStable releases can be installed viaPyPI:$pipinstallcapturewrapBleeding edge versions can be installed directly from GitHub:$pipinstallgit+https://github.com/wtsi-hgi/python-capturewrap.git@$commitOrBranch#egg=capturewrapImplementationThis implementation captures stdout and stdin using`redirect_stdout<https://docs.python.org/3/library/contextlib.html#contextlib.redirect_stdout>`__
and`redirect_stderr<https://docs.python.org/3/library/contextlib.html#contextlib.redirect_stderr>`__,
which were added to the standard library in Python 3.5.Alternativesiocapture: older solution,
replacessys.stdoutandsys.stderrwith capturing methods.capturer: complex
solution that works at lower level to intercept subprocessstdoutandstderrusing a pseudo terminal.
Package: capturing-process
Finally, a subprocess type that streams out stdout/stderr easilyCapturing the stderr AND stdout from a process in python is not that easy.
This class makes this capturing much easier by delegating the line capturing
to seperate threads. This capture can be totally in memory or can optionally
be streamed to a output stream such as a file handle.This class will unconditionally launch a shell command and the input will always
be string, not an array like what is accepted by subprocess.Popen().Example:Super simple example:fromcapturing_processimportCapturingProcessout_stream=StringIO()p=CapturingProcess("echo hi",stdout=out_stream)p.wait()self.assertIn("hi",out_stream.getvalue())self.assertIn("hi",p.get_stdout())For splitting the output to stdout and a file you'd write a stream class like so:classMyStream:def__init__(self,filehandle)->None:self.fh=filehandledefwrite(self,data:str)->None:self.fh.write(data)sys.stdout.write(data)withopen('myfile','w')asfd:out_stream=MyStream(fd)proc=CapturingProcess("echo hi",stdout=out_stream)proc.wait()# Output will go to file and sys.stdoutTo silence an output stream (stdout/stderr) drop a StringIO object as an argument to
the CapturingProcess like so:proc=CapturingProcess("echo hi",stdout=StringIO())proc.wait()# stdout redirected to StringIO()If you want the entire stdout/stderr bytesproc.get_stdout()proc.get_stderr()Python version: 3.6+Because of the use of type annotations, this library is not compatible with python 2.7
However you are free to strip out these type annotations and this projectshouldwork
pretty well.Links:https://pypi.org/project/capturing-process/https://github.com/zackees/capturing_processVersions1.0.9: stdout/stderr threads are now forcefully killed within .1 second if they don't join.1.0.8: Fixes CapturingProcess.kill blocking if the stdout and stderr threads fail to join.
Package: capuchin
capuchin 0.0.6Tornado server with some built-in endpoints.Here’s a simple usage example:import capuchin.web

class TestHandler(tornado.web.RequestHandler):
        def get(self):
                self.write("hola")

def test_job():
        print("did some job")

if __name__ == "__main__":
        c = capuchin.web.Application([
                (r"/test", TestHandler),
        ])
        c.add_status_job("Test Job", 5, test_job)
        c.listen()The Application looks at the environment variablesHOST,PORT, andENDPOINTon initialization.
If These are not set the defaults areHOST: 0.0.0.0,PORT: 8080,ENDPOINT: /.get capuchinInstalltornadoandrequestssudo easy_install capuchinDownload the latest release fromPython Package Indexor clonethe repositoryMore documentation is on it’s way(check thesitefor updates)Provide any feedback and issues on thebug tracker, that should be coming soon.
Package: caput
Easy file metadata.Store metadata in a special YAML configuration header for text files, or a
sidecar “shadow” configuration file for binary files.Caput:n.Latin for “head” or “top”. Root of many English words, such as
“captain”, “capital”, and “decapitate”.InstallCaput is available from PyPI:pip install caputUsageSay that you’re building a static site generator. You can add a metadata header
to any textfile. The first three bytesmustbe---\n. Inindex.md:---
title: My Site
author: Me
featured_image: /images/my-header.jpg
---
# Welcome to my site!Read the metadata header:>>> import caput

>>> caput.read_config('./index.md', defaults={'markup': 'markdown'})
{'markup': 'markdown',
 'title': 'My Site',
 'author': 'Me',
 'featured_image': '/images/my-header.jpg'}Read the file contents:>>> caput.read_contents('./index.md')
'# Welcome to my site!\n'You can add metadata to binary files with a “shadow” header. For your featured
image, add a.ymlfile with the same base name, e.g. for./images/my-header.jpgyou would add./images/my-header.yml:title: My Site Header
credit: MeRead the metadata header:>>> caput.read_config('./images/my-header.jpg')
{'title': 'My Site Header', 'credit': 'Me')Read the file contents:>>> caput.read_contents('./images/my-header.jpg', encoding=None)
b'...binary data...'
Package: capybara
AboutAPIs usually require access tokens to limit frequencies of requests.If you want to request over limitations, you need to generate multiple
tokens and roop over them.Capybara is a simple wrapper for multiple tokens.Send Pull Requests onGitHubto add available
services!DependenciesInstalledpython-amazon-simple-product-api(pip installpython-amazon-simple-product-api)Installedrequests(pip install requests)Valid API tokens for each service you want to useInstallationpip install capybaraorpip install git+https@github.com:AkihikoITOH/capybara.gitAvailable ServicesAmazonWrapper ofAmazon Product Advertising
API.楽天Wrapper of楽天商品検索API.Usagevia cAPIbara server (Recommended)Start serverpython api.py <config_dir> <tokens_dir>orvirtualenv/bin/Python2.7 api.py <config_dir> <tokens_dir>Send requestsGet info about serviceshttp GEThttp://localhost:5000/info/<service>/Example:http GET http://localhost:5000/info/amazon/Get itemhttp GEThttp://localhost:5000/get/<service>/<item>/Example:http GET http://localhost:5000/get/amazon/B000WLKFCK/
# => {'category': 'Kitchen', 'raw': <amazon.api.AmazonProduct object at 0x104b1fcd0>, 'title': u'Panasonic \u98df\u5668\u6d17\u3044\u6a5f\u7528\u7f6e\u53f0 N-SP3'}

http GET http://localhost:5000/get/amazon/B000WLKFCK/title/
# => Panasonic 食器洗い機用置台 N-SP3

http GET http://localhost:5000/get/amazon/B000WLKFCK/category
# => KitchenAs a Python moduleimportcapybarac=capybara.Capybara(config_dir='/path/to/config/',tokens_dir='/path/to/tokens/')# Amazonresult=c.get(service='amazon',item='B005CSYH5Y')printresult['raw']printresult['title']printresult['category']# 楽天result=c.get(service='rakuten',item='urutoragion:10000866')printresult['raw']printresult['title']printresult['url']printresult['category_id']printresult['category']Setupanywhere/you/like
   ├── config
   │   ├── amazon_config.json
   │   └── rakuten_config.json
   └── tokens
       ├── amazon_tokens.tsv
       └── rakuten_tokens.tsvconfig directorySetaccess frequencyor other configurations inJSONformat for
each service.attributetypedescriptionexampleintervalintegerinterval time between requests per token (in milli second)1000slowfloatextension ratio of interval1.2path/to/config/sample_config.json{"interval":1000,"slow":1.2}Note: Attributes must be in lower cases and “double quoted”.NoteActual interval time per token will be[interval]*[slow]Thus actual access frequency(per hour) will be[# oftokens]*3600/[interval]*[slow]tokens directoryListaccess tokensand other required parameters inTSVformat
for each service.SeeProduct Advertising
APIto get new access tokens.AmazonparameterdescriptionACCESS_KEYaccess keySECRET_KEYsecret keyASSOC_TAGassociate tagLOCALElocalepath/to/tokens/amazon_tokens.tsvACCESS_KEY1 SECRET_KEY1 ASSOC_TAG1  LOCALE
ACCESS_KEY2 SECRET_KEY2 ASSOC_TAG2  LOCALE
ACCESS_KEY3 SECRET_KEY3 ASSOC_TAG3  LOCALE
ACCESS_KEY4 SECRET_KEY4 ASSOC_TAG4  LOCALE楽天See楽天商品検索APIto get new access tokens.parameterdescriptionapplicationIdapplication idlib/tokens/rakuten_tokens.tsvapplicationId1
applicationId2
applicationId3
applicationId4LicenseCopyright &copy 2015 ITOH AkihikoSee LICENSE for details.
Package: capybara-forms
Capybara formsDynamic Django forms and filters using JSON schema.If you have 2 models: Category and Entry.
And some entry features depends on it's category.
Using this library, you will obtain easy-to-configure
schema with form, filter and entry fields generators.
Also, it can work with model fields.Quick start1.Define your modelsfromdjango.dbimportmodelsfromcapybara_forms.modelsimportCapybaraFormsCategory,CapybaraFormsModelclassCategory(CapybaraFormsCategory):title=models.CharField(max_length=100)classAdvert(CapybaraFormsModel(Category)):# Global model fieldstitle=models.CharField(max_length=100)price=models.PositiveSmallIntegerField()# Rest fields will be stored in JSON 'data' field2.Write schema for category 'Cats'[{"name":"breed","type":"string","required":true,"display_name":"Breed","placeholder":"Enter breed of your cat"},{"name":"year","type":"number","required":true,"max_value":2020,"min_value":1980,"placeholder":"Enter birth year of your cat","display_name":"Birth year"},{"name":"weight","type":"number","placeholder":"Enter the weight of your cat","display_name":"Weight"},{"name":"height","type":"number","placeholder":"Height (only placeholder, without display name)"},{"type":"color","display_name":"Cat's color"},{"name":"name","type":"string","placeholder":"Enter cat nickname","display_name":"Name"},{"name":"vaccinated","type":"checkbox","display_name":"is vaccinated"}]3.Create form. It's a basic rendering objectfromdjangoimportformsfromcapybara_forms.formsimportCapybaraFormsModelFormfrom.modelsimportAdvertclassAdvertForm(CapybaraFormsModelForm):# This fields from model will be rendered using form.render_formfields_in_model=['title','price']# For custom placeholdertitle=forms.CharField(widget=forms.TextInput(attrs={'placeholder':'Enter title'}))classMeta:model=Advertfields=('title','price')4.Use this form in your viewfromdjango.shortcutsimportrender,get_object_or_404,redirectfrom.modelsimportCategoryfrom.formsimportAdvertFormdefadd(request,category_id):category=get_object_or_404(Category,pk=category_id)ifrequest.method=='POST':form=AdvertForm(category,request.POST.dict())ifform.is_valid():form.save()returnredirect('/{0}/'.format(category_id))else:form=AdvertForm(category)returnrender(request,'add.html',{'form':form,})5.Render form in your template.
Note, that library usesparsleyfor validation. All dependencies listed below<formmethod="POST"data-parsley-validate>{% csrf_token %}
    {{ form.render_form | safe }}<buttontype="submit">Submit</button></form>Result form:Result filter, with similar schema, plus some in-form configuration:DependenciesDjangojQuery(version 3.3.1 included)JSON editor(version 5.9.6 included)parsley(version 2.8.1 included)Documentation and full exampleSeereadthedocsfor
API, advanced usage cases, parameters definition
and more informationSeeexample projectfor all features, used in worked applicationSloganWith goal to simplify, with love to capybaras
Package: capybara-py
Capybara helps you test web applications by simulating how a real user would
interact with your app. It is agnostic about the driver running your tests and
comes with Werkzeug and Selenium support built in.DocumentationSeehttps://elliterate.github.io/capybara.py/.Need help?Ask on the mailing list (please do not open an issue on GitHub):http://groups.google.com/group/capybara-py/.CreditsPorted to Python byIan Lesperance, from theoriginal Ruby librarybyJonas Nicklas.
Package: capybre
CapybreThin python wrapper over (some of) the Calibre CLI. Can be used for ebook conversion, metadata-extraction, and metadata-lookup:Simple Usages# convert between formats; creates 'PrideAndPrejudice.mobi'

from capybre import convert

convert('PrideAndPrejudice.epub', as_ext='mobi')


# extract metadata 
from capybre import extract_metada

metadata = extract_metadata('PrideAndPrejudice.epub')

# prints "Pride and Prejudice"
print(metadata.title)


# extract cover from metadata; saves as cover.jpg
from capybre import extract_cover

extract_cover('PrideAndPrejudice.epub', output_file='cover.jpg')


# fetch metadata from internet sources
from capybre import fetch_metadata

metadata = fetch_metadata(title='Pride and Prejudice')

# prints Jane Austen
print(metadata.author)


# download cover from internet sources; saves as cover.jpg
from capybre import fetch_cover

fetch_cover(title='Pride and Prejudice')Getting StartedFirst, you need to download Calibre's command line tools.You can follow instructionson Calibre's siteto download, or download through package managers:# on Ubuntu
sudo apt-get install calibre

# on MacOS
brew install calibreOn MacOS, the command line tools may not be added to your path. To access them, add/Applications/calibre.app/Contents/MacOS/to your PATH variable, for instance in~/.bashrcaddingexport PATH=$PATH:/Applications/calibre.app/Contents/MacOS/Then, just install Capybre with pip!pip install capybreSee the full documentation athttps://capybre.readthedocs.io/
Package: capylang
CapylangCapylang is a pretty simple language.Regular Examplesfromcapylangimportcapymycapy=capy(id="MyCapy",printinst=True)# ID is for identification of Capylang Instances, and printinst prints the IDprint(mycapy.__doc__)# Returns helpa=4b=3print(str(mycapy.add(a,b)))# Prints 7 (also uses the add function)print(str(mycapy.minus(a,b)))# Prints 1 (also uses the subtract function)print(str(mycapy.multi(a,b)))# Prints 12 (also uses the multiply function)print(str(mycapy.div(a,b)))# Prints 2.3 (average, also uses the divide function)print(str(mycapy.hyp(a,b)))# It returns the hypotenuse of opp, and adjprint(str(mycapy.opp(a,b)))# Try this yourself for more info, check mycapy.__doc__print(str(mycapy.adj(a,b)))# Try this yourself for more info, check mycapy.__doc__Mean, Median, and Modeimportcpaylangarr=[1,2,3,4,5]# AIML means AI Machine Learning (AIML.)capylang.aiml.mean(arr)capylang.aiml.median(arr)capylang.aiml.mode(arr)Decorators (Make your own Capylang if you feel lazy or want to!)importcapylang@capylang.decorators.add# Equivalent to mycapy.adddefmyadd(a,b,c):returna,b,c# The decorator does it all for ya.print(myadd(1,2,3))# Basicallly everything above. Add, minus, multi, div, hyp, opp, and adj. Fibonacci is here.DateTime alternativeimportcapylangdate="1/16/1921"# MM/DD/YYYY (January 16th 1921)mydate=capylang.date.new(date)print(mydate)print(mydate.text())#Clearing on Terminalsimportcapylangcapylang.terminal.os_clear()# Clear with the os modulecapylang.terminal.replit_clear()# Clear with the replit moduleFibonacci Sequencefromcapylangimportcapy# The fibonacci sequence function returns numbers in the fibonacci sequence, it contains 2 args:# num_of_nums: the number of sequence numbers you'd like to generate (required)# index: to return a specific number in the sequence (optional)fibo=capy(printinst=True,id="Fibonacci Sequence")print(fibo.nacci(num_of_nums=10,index=6))Math string evaluation# Coming in decorators soon.fromcapylangimportcapyeval=capy(printinst=True,id="Evaluation")print(eval.calc("6/2*(1+2)"))# 9Old, used to be deprecated, but revived capy.log# Coming in decorators soon.fromcapylangimportcapyeval=capy(printinst=True,id="Evaluation")eval.log("The prophecy is true!!!")Did you know you could use "deprecated" syntax?fromcapylangimportcapycapy.log("You don't even need to initialize the module!")String occurrencesimportcapylangmystr="I am an Apple."mystr=capylang.string.init(mystr)print(mystr.freq()["Apple."])String occurrences to lowerimportcapylangmystr="I am an Apple."mystr=capylang.string.init(mystr)print(mystr.lowfreq()["apple."])Binary searching in an arrayimportcapylanghi=[1,3,5,7,9]print(capylang.capi.binary_search(hi,3))# Returns the index of 3 in hi. Otherwise, returns None.print(capylang.capi.binary_search(hi,-1))# Returns None because -1 is not in the array.Color setsimportcapylangprint(capylang.color.set["classic"])# ROYGBPprint(capylang.color.set["full"])# ROYGBIVprint(capylang.color.set["full_bip"])# ROYGBIP# Useful for color sorting.That's pretty much it for a basic tutorial of Capylang.
Package: capypdf
CapyPDFThis is a library for generating PDF files. It aims to be very low level.
It does not have its own document model, it merely exposes PDF primitives
directly.FeaturesFully color managed usingLittleCMS 2All fonts are embedded as subsetsNot implemented in CProvides a plain C API for easy integration into scripting languagesShips with actypesPython bindingMinimal dependenciesThings the library does not doReading PDF filesModifying PDF filesSupporting any other backend than PDFParsing any vector data files like SVGData conversions in general (apart from colorspaces)Supporting PDF versions earlier than 1.7API stability guaranteesUntil 1.0 there is no guarantee of any kind. Anything can be changed.
However we try not to change things without a good reason. Once 1.0
happens, we aim to provide the following:The plain C interface is both API and ABI stableThe internal C++ implementation "API" is not stable in any wayOnly C symbols are exported so in order to get to the C++ API you
have to change build settings. If you do that, there is no stability
guarantee.The Python API shall be stable as wellStatusThe basic functionality is there but it's not even close to feature
complete.