Saravanan666/pypi-org huggingface dataset:
Package: barcode-image-composer
Barcode Image ComposerThe project is used to generate an image set with barcode, QR code and DataMatrix.Install Dependenciespipinstallpython-barcodepylibdmtxopencv-pythonpillowSupported Barcode TypesUPCAQR CodeDataMatrixCommand-line Usage$imgcompose[-tTIMES][-oOUTPUT]image-sourceSample CodeimportargparsefromimgcomposerimportImageManagerfromimgcomposer.upcaimportUPCACodefromimgcomposer.qrcodeimportQrcodefromimgcomposer.datamatriximportDataMatrixCodeimportsysimportnumpyasnpimportosimportcv2defprocess_file(imageManager,base,index,input,output):bg_image=cv2.imread(input)(height,width)=bg_image.shape[:2]wRatio=width/1039;hRatio=height/591upca_renderer=imageManager.Renderer(wRatio*10,hRatio*140,(10,10),UPCACode(base,0.5,cv2.ROTATE_90_CLOCKWISE))dm_renderer=imageManager.Renderer(wRatio*920,hRatio*40,(10,10),DataMatrixCode(str(index),1.5,-1))qr_renderer=imageManager.Renderer(wRatio*20,hRatio*390,(10,10),Qrcode('www.dynamsoft.com',0.4,-1))renderers=[upca_renderer,dm_renderer,qr_renderer]composed_image=imageManager.compose(bg_image,renderers)# cv2.imshow('composed_image', composed_image)outfile='{0}x{1}_{2}.png'.format(bg_image.shape[1],bg_image.shape[0],index)cv2.imwrite(os.path.join(output,outfile),bg_image)parser=argparse.ArgumentParser(description='Compose images with barcode, QR code, and DataMatrix code.')parser.add_argument('source',help='An image file or a folder containing image files')parser.add_argument('-t','--times',default=1,type=int,help='Specify the number of times to compose the image')parser.add_argument('-o','--output',default='',type=str,help='Image output folder')args=parser.parse_args()# print(args)try:input=args.sourceoutput=args.outputtimes=args.timesifnotos.path.exists(input):print('Source not found')exit(-1)ifoutput=='':output=os.getcwd()else:ifnotos.path.exists(output):os.mkdir(output)imageManager=ImageManager()base='10000000000'index=0foriinrange(times):ifos.path.isfile(input):print('Processing '+input)process_file(imageManager,base,index,input,output)base=str(int(base)+1)index+=1else:filelist=os.listdir(input)forfileinfilelist:print('Processing '+file)process_file(imageManager,base,index,os.path.join(input,file),output)base=str(int(base)+1)index+=1# cv2.waitKey(0)exceptExceptionaserr:print(err)sys.exit(1)How to Build the PackageSource distribution:pythonsetup.pysdistWheel:pipwheel.--verbose# Orpythonsetup.pybdist_wheel
Package: barcodenumber
Python module to validate product codes.Codescode39ean (ean12)ean8ean13gtin (ean13)gtin14gs1_datamatrixisbnisbn10isbn13upc (ean12)NutshellHere a simple example to validate product codes:>>> import barcodenumber
>>> barcodenumber.check_code('ean13','9788478290222')
True
>>> barcodenumber.barcodes()
['CODE39', 'EAN', 'EAN13', 'EAN8', 'GS1', 'GTIN', 'ISBN', 'ISBN10', 'ISBN13',
'ISSN', 'JAN', 'PZN', 'UPC', 'UPCA']
Package: barcode-splitter
A utility to split multiple sequence files using multiple sets of barcodes.Copyright 2017 Lance Parsons <lparsons@princeton.edu>, Robert Leach <rleach@princeton.edu>BSD 2-Clause License- SeeLICENSE.txtInstallationInstall Barcode Splitter:pip install barcode_splitterbarcode_splitterSplit multiple fastq files by matching barcodes in one or more of the sequence
files. Barcodes in the tab-delimitedbarcodes.txtfile are matched against
the beginning (or end) of the specified index read(s). By default, barcodes must
match exactly, but--mistmatchescan be set higher if desired. Compressed
input is read (from all files) if the first input file name ends in.gz.
Reading of compressed input can be forced with thegzipinoption.ExamplesSplit an Illumina paired-end run where the index read are in the second read
file (read 2), the forward read is the first read file (read 1), and the reverse
reads are in the third read file (read 3):barcode_splitter --bcfile barcodes.txt read1.fastq read2_index.fastq read3.fastq --idxread 2 --suffix .fastqUTF-8Sample names containing UTF-8 characters are allowed, however, outputting those
characters to STDOUT and piping to a file can be problematic. Ensure python
uses the proper encoding for STDOUT by settingPYTHONIOENCODING='utf-8'.:PYTHONIOENCODING='utf-8' barcode_splitter --bcfile barcodes_utf8.txt read1.fastq read2_index.fastq read3.fastq --idxread 2 --suffix .fastqCitationPlease use the followingBibTeXentry:@misc{leach_bcs_2019,
    address = {Princeton, {NJ}, {USA}},
    title = {Barcode Splitter, version 0.18.5 [Software]},
    url = {https://bitbucket.org/princeton_genomics/barcode_splitter},
    author = {Leach, Robert and
              Parsons, Lance},
    year = {2019}
}
Package: barcodes-uc
Barcodes python moduleThanks to Melisa for her precious help.⚠️ This python package is still in development. ⚠️For now only QR codes are available. Only alphanumeric and byte encodings are available.It looks like qr codes encoding a URL sometimes do not work unless you add a "/" at the end.OpenAPII used this package to learn how to use the fastapi package. The API that I created is available athttps://qrgeneratorapi-1-c9139268.deta.app.Use it to generate QR codes by sending GET requests to the API.For now the API can return the QR code data or the QR code image encoded in base64.Example usage:importrequestsfromPILimportImageimportbase64url='https://qrgeneratorapi-1-c9139268.deta.app/qrimg/test'#get jsonr=requests.get(url)jsonData=r.json()#Get the json answer from the APIsize=jsonData["img"]["size"]base64Data=jsonData["img"]["base64"]imgdecoded=Image.frombytes('L',(size,size),base64.b64decode(base64Data))#Decode the imageimgdecoded.show()#Show the imageInstallationpipinstallbarcodes-ucYou might want to install the package in a virtual environment. For that do:python3-mvenvvenvsourcevenv/bin/activate
pipinstallbarcodes-ucUsagefrombarcodes_uc.qrcodesimportqrgenerator,qrutils# Generate a QR codemessage="Hello world!"encoding=qrutils.QREncoding.byteversion,error_correction_level,qr=qrgenerator.get_min_version(message,encoding,qrutils.QRErrorCorrectionLevels.Q)generator=qrgenerator.QRGenerator(msg=message,encoding=encoding,version=version,error_correction=error_correction_level)qr=generator.generate()qr.show()# Show the QR code in the terminalqr.save("qr.png",imgSize=1000,colour=[qrgenerator.QRColour.red])# Save the QR code in a fileCLI toolsThe package comes with CLI tools:QR code generatorqrcode--helpusage:qrcode[-h][-e{byte,numeric,alphanumeric,kanji}][-VQR_VERSION][-E{L,M,Q,H}][--saveSAVE][--no-show]message

CreateQRcodes

positionalarguments:messageMessagetoencode

optionalarguments:-h,--helpshowthishelpmessageandexit-e{byte,numeric,alphanumeric,kanji},--encoding{byte,numeric,alphanumeric,kanji}Encodingofthemessage-VQR_VERSION,--qr-versionQR_VERSIONQRversion,1-40-E{L,M,Q,H},--qr-error-correction{L,M,Q,H}QRerrorcorrection--saveSAVESavetheQRcodetoa.pngfile,donotaddthefileformat--no-showDonotshowtheQRcodeMadebyPedroJuanRoyo,@UnstrayCatoThe program will show the QR code in the terminal and save it to a file if the--saveoption is used.
Ifno -e, -V or -E options are used, the program will try to guess the best options for the message.Future workAdd byte and numeric encoding to qr codes.Save qr code as image in different styles.Generate barcodes.
Package: bardata
Bar data utilities in PythonThis package includes utilities and a plugin model to fetch and manipulate bar data
for stocks and other financial series. This is work in progress.Bar data is represented as a datafrane with adatetimestamp index
andopen,high,low,close,volumecolumns all in lower case.
Data for stocks prices is always assumed adjusted.The main conventions are:data sources are referenced by an opaquesourceparameterflexible definition of frequencies with thefreqparametermaximum number of bars is indicated with themax_barsparameterdate range is optional withstart_dateandend_dateparametersTypical Usagefrombardataimportget_tickers,get_pricesSOURCE='sample'FREQ='daily'tickers=get_tickers(source=SOURCE)fortickerintickers:prices=get_prices(ticker,freq=FREQ,source=SOURCE)...
Package: bardclient
bardclientA simple reverse engineering of google's bard implements by python3Installation$pip3install--upgradebardclientAuthenticationGo tohttps://bard.google.com/F12 for consoleCopy the cookie valuePath: Application -> Cookies ->__Secure-1PSID, Copy the value of the cookie.UsageImplementationfromosimportenvironfrombardclientimportBardClientbard_token=environ.get('BARD_TOKNE')bot=BardClient(bard_token)res_message=bot.ask('Hi, how are you?')print(res_message["content"])
Package: bardToken
Author:KuoYuan Liauto login google account by selenium chrome driverinstallation NoteNeed selenium 4(or newer) and webdriver_manager to get the chromedriver automatically.
if the version dose not matcch , please uninstall the selenium and install again.bardapi is used in sample code
and should be installed to insure it work normalypip install bardapiSample codefrom selenium import webdriver
from selenium.webdriver.chrome.service import Service as ChromeService
from webdriver_manager.chrome import ChromeDriverManager
from bardapi import Bard
import seleniumGoogleLogin
import bardToken
email = 'your gmail'
password = 'your password'
#start chromedriver
driver = webdriver.Chrome(service=ChromeService(ChromeDriverManager().install()))
#google auth
if seleniumGoogleLogin.start(driver,email, password):
    #get bard token
    token = bardToken.get(driver)
    print(token)
    bard = Bard(token=token)
    ans = bard.get_answer("is there any bard api?")['content']
    print(ans)LicenseMIT
Package: bard-webapi
Bard-APIReverse-engineered asynchronous API for Google Bard providing a simple but elegant interface inspired by official Gemini API.Installationpipinstallbard-webapiAuthenticationGo tohttps://bard.google.com/and login with your Google accountPress F12 for web inspector, go toNetworktab and refresh the pageClick any request and copy cookie values of__Secure-1PSIDand__Secure-1PSIDTSUsageInitializationfrombard_webapiimportBardClient# Replace "COOKIE VALUE HERE" with your actual cookie values as stringsSecure_1PSID="COOKIE VALUE HERE"Secure_1PSIDTS="COOKIE VALUE HERE"client=BardClient(Secure_1PSID,Secure_1PSIDTS,proxy=None)awaitclient.init()Generate contents from text inputsresponse=awaitclient.generate_content("Hello World!")print(response.text)# Note: simply use print(response) to get the same output if you just want to see the response textRetrieve images in responseresponse=awaitclient.generate_content("Send me some pictures of cats")images=response.imagesforimageinimages:print(f"{image.title}({image.url}) -{image.alt}",sep="\n")Conversations across multiple turnschat=client.start_chat()# A chat stores the metadata to keep a conversation continuous. It will automatically get updated after each turnresponse1=awaitchat.send_message("Briefly introduce Europe")response2=awaitchat.send_message("What's the population there?")print(response1.text,response2.text,sep="\n----------------------------------\n")Check and switch to other answer candidateschat=client.start_chat()response=awaitchat.send_message("What's the best Japanese dish in your mind? Choose one only.")forcandidateinresponse.candidates:print(candidate,"\n----------------------------------\n")# Control the ongoing conversation flow by choosing candidate manuallynew_candidate=chat.choose_candidate(index=1)# Choose the second candidate herefollowup_response=awaitchat.send_message("Tell me more about it.")# Will generate contents based on the chosen candidateprint(new_candidate,followup_response,sep="\n----------------------------------\n")
Package: bare68k
bare68k allows you to writem68k system emulatorsin Python 2 or 3.  It
consists of aCPU emulationfor 68000/68020/68EC020 provided by theMusashiengine written in native C. Amemory mapwith RAM, ROM,
special function is added and you can start the CPU emulation of your system.
You can intercept the running code with a trap mechanism and use powerful
diagnose functions,written by Christian Vogelgsang <chris@vogelgsang.org>under the GNU Public License V2Featuresall emulation code written in C for fast speedruns on Python 2.7 and Python 3.5emulates CPU 68000, 68020, and 68EC020use a 24 or 32 bit memory mapdefine memory regions for RAM and ROM with page granularity (64k)special memory regions that call your code for each read/write operationintercept m68k code by placing ALINE-opcode based traps to call your codeevent-based CPU emulation frontend does always return to Python firstprovide Python handlers for all CPU emulation eventsRESET opcodeALINE trap opcodeinvalid memory access (e.g. write in ROM region)out of memory bounds (e.g. read above memory map)control interrupt acknowledgementwatch and break pointscustom timers based on CPU cyclesextensive diagnose functionsinstruction tracememory access for both CPU and Python APIregister dumpmemory labels to mark memory regions with arbitrary Python dataall bare68k components use Python loggingrich API to configure memory and CPU statestore/restore CPU contextInstallationuse pip:$ pip install bare68kor checkout github repository and install:$ python setup.py installuse dev setup:$ python setup.py develop --userDocumentationthe full documentation is hosted atReadTheDocs
Package: bareasgi
bareASGIA lightweight PythonASGIweb server framework
(read thedocs).OverviewThis is abareASGI web server framework. The goal is to provide
a minimal implementation, with other facilities (serving static files, CORS,
sessions, etc.) being implemented by optional packages.The framework is targeted at micro-services which require a light footprint
(in a container for example), or as a base for larger frameworks.Python 3.8+ is required.Optional PackagesbareASGI-corsfor cross origin resource sharing,bareASGI-staticfor serving static files,bareASGI-jinja2forJinja2template rendering,bareASGI-graphql-nextforGraphQLandgraphene,bareASGI-restfor REST support,bareASGI-prometheusforprometheusmetrics,bareASGI-sessionfor sessions.FunctionalityThe framework provides the basic functionality required for developing a web
application, including:Http,WebSockets,Routing,Lifecycle,MiddlewareSimple ServerHere is a simple server with a request handler that returns some text.importuvicornfrombareasgiimportApplication,HttpRequest,HttpResponse,text_writerasyncdefexample_handler(request:HttpRequest)->HttpResponse:returnHttpResponse(200,[(b'content-type',b'text/plain')],text_writer('This is not a test'))app=Application()app.http_router.add({'GET'},'/',example_handler)uvicorn.run(app,port=9009)
Package: bareasgi-cors
bareASGI-corsCORS support forbareASGI(read thedocs)UsageSimply create theCORSMiddlewareclass and put is as the first middleware.importjsonimportuvicornfrombareasgiimport(Application,text_reader,text_writer)frombareasgi_corsimportCORSMiddlewareasyncdefget_info(request):text=json.dumps(request.info)returnHttpResponse(200,[(b'content-type',b'application/json')],text_writer(text))asyncdefset_info(request):text=awaittext_reader(request.body)data=json.loads(text)request.info.update(data)returnHttpResponse(204)# Create the CORS middleware classcors_middleware=CORSMiddleware()# Use the CORS middleware as the first middleware.app=Application(info={'name':'Michael Caine'},middlewares=[cors_middleware])app.http_router.add({'GET'},'/info',get_info)app.http_router.add({'POST','OPTIONS'},'/info',set_info)uvicorn.run(app,port=9010)The POST methodIn the above example an OPTION method is included with the POST. This
is always required with a POST as a browser will try first with an OPTION.
Package: bareasgi-graphql-next
bareASGI-graphql-nextGraphql support forbareASGI(read thedocumentation)The controller provides a GraphQL GET and POST route, a WebSocket subscription server, and a Graphiql view.InstallationInstall from the pie shop.pipinstallbareasgi-graphql-nextIf you wish to install with the grapheme option:pipinstall'bareasgi-graphql-next[graphene]'UsageYou can register the graphql controller with theadd_graphql_nextfunction.frombareasgiimportApplicationfrombareasgi_graphql_nextimportadd_graphql_nextimportgraphql# Get the schema ...schema=graphql.GraphQLSchema(...)importuvicornapp=Application()add_graphql_next(app,schema)uvicorn.run(app,port=9009)DevelopmentTo develop with the graphene optional package:poetryinstall--extrasgraphene
Package: bareasgi-jinja2
bareASGI-jinja2Jinja2 support forbareASGI(read thedocumentation)UsageTry the following.fromtypingimportMapping,Anyimportjinja2importos.pathimportuvicornfrombareasgiimportApplicationfrombareasgi_jinja2importJinja2TemplateProvider,add_jinja2here=os.path.abspath(os.path.dirname(__file__))asyncdefhttp_request_handler(request:HttpRequest)->HttpResponse:"""Handle the request"""template='example1.html'variables={'name':'rob'}returnawaitJinja2TemplateProvider.apply(request,template,variables)app=Application()env=jinja2.Environment(loader=jinja2.FileSystemLoader(os.path.join(here,'templates')),autoescape=jinja2.select_autoescape(['html','xml']),enable_async=True)add_jinja2(app,env)app.http_router.add({'GET'},'/example1',http_request_handler)uvicorn.run(app,port=9010)
Package: bareasgi-prometheus
bareASGI-prometheusPrometheusmetrics for bareASGI (read thedocs).InstallationInstall from the pie store$pipinstallbareASGI-prometheusUsageThe middleware can either be configured manually or with a helper.Manual ConfigurationfrombareasgiimportApplicationfrombareasgi_prometheusimportPrometheusMiddleware,prometheus_view...prometheus_middleware=PrometheusMiddleware()app=Application(middlewares=[prometheus_middleware])app.http_router.add({'GET'},'/metrics',prometheus_view)Helper ConfigurationfrombareasgiimportApplicationfrombareasgi_prometheusimportadd_prometheus_middleware...app=Application()add_prometheus_middleware(app)
Package: bareasgi-session
bareASGI-sessionSession support for bareASGI (read thedocs).OverviewWhen a client (e.g. a browser tab) makes HTTP requests to a server, the server
does not know if the requests came from the same client. This makes it difficult
to maintain state information (e.g. the users identity).A solution which is transparent to the client involves the server sending a
cookie to the client. Once the cookie is sent the client will automatically add
the cookie to any subsequent request it makes to the server (assuming cookies
are enabled). By checking the cookie the server can know which client has sent
the request.UsageYou can add session middleware with theadd_session_middlewarehelper function.frombareasgiimportApplicationfrombareasgi_sessionimport(add_session_middleware,MemorySessionStorage)app=Application()add_session_middleware(app,MemorySessionStorage())The session can be retrieved with thesession_datahelper function. This returns
an (initially empty) dictionary.fromdatetimeimportdatetimefrombareutilsimporttext_writerfrombareasgi_sessionimportsession_dataasyncdefsession_handler(request:HttpRequest)->HttpResponse:session=session_data(request)now=session.get('now')message=f'The time was{now}'ifnowelse'First time'session['now']=datetime.now()headers:List[Header]=[(b'content-type',b'text/plain'),(b'content-length',str(len(message)).encode('ascii'))]returnHttpResponse(200,headers,text_writer(message))
Package: bareasgi-sspi
bareASGI-sspiASGImiddleware
for thebareASGIframework
providingSSPIauthentication
on Windows.The implementation uses thepyspnegopackage.There is also a generic ASGI server middleware implementation in the packagejetblack-asgi-sspi.InstallationInstall from the pie store.pip install bareasgi-sspiUsageThe following program uses theHypercornASGI server.importasyncioimportloggingfromtypingimportOptionalfrombareasgiimportApplication,HttpRequest,HttpResponsefrombareutilsimporttext_writerfromhypercornimportConfigfromhypercorn.asyncioimportservefrombareasgi_sspiimportadd_sspi_middleware,sspi_details# A callback to display the results of the SSPI middleware.asyncdefhttp_request_callback(request:HttpRequest)->HttpResponse:# Get the details from the request context request['sspi']. Note if# authentication failed this might be absent or empty.sspi=sspi_details(request)client_principal=(sspi['client_principal']ifsspiisnotNoneelse'unknown')returnHttpResponse(200,[(b'content-type',b'text/plain')],text_writer(f"Authenticated as '{client_principal}'"))asyncdefmain_async():# Make the ASGI application using the middleware.app=Application()app.http_router.add({'GET'},'/',http_request_callback)# Add the middleware. Change the protocol from Negotiate to NTLM,# and allow unauthenticated requests to pass through.add_sspi_middleware(app,protocol=b'NTLM',forbid_unauthenticated=False)# Start the ASGI server.config=Config()config.bind=['localhost:9023']awaitserve(app,config)if__name__=='__main__':logging.basicConfig(level=logging.DEBUG)asyncio.run(main_async())ArgumentsOptional arguments include:protocol(bytes): Eitherb"Negotiate"orb"NTLM"(for systems not part of a domain).service(str): The SPN service. Defaults to"HTTP".hostname(str, optional): The hostname. Defaults to he result ofsocket.gethostname().session_duration(timedelta, optional): The duration of a session. Defaults to 1 hour.forbid_unauthenticated(bool): If true, and authentication fails, send 403 (Forbidden). Otherwise handle the request unauthenticated.context_key(str, optional): The key used in the request context. Defaults tosspi.whitelist(Sequence[str], optional): Paths not to authenticate. Defaults to().ResultsIf the authentication is successful the SSPI details are added to thecontextdictionary of the HttpRequest object with the key"sspi"(if not overridden). There is a helper methodsspi_detailsfor this.The following properties are set:"client_principal"(str): The username of the client."negotiated_protocol"(str): The negotiated protocol."protocol"(str): The requested protocol."spn"(str): The SPN of the server.
Package: bareasgi-static
bareasgi-staticStatic file support forbareASGI(read thedocumentation)OverviewThis package provides support for serving static files to bareasgi.UsageThe following example serves a single file.importuvicornimportos.pathfrombareasgiimportApplicationfrombareasgi_staticimportfile_responsehere=os.path.abspath(os.path.dirname(__file__))asyncdefhttp_request_callback(request):returnawaitfile_response(request,200,os.path.join(here,'file_stream.html'))app=Application()app.http_router.add({'GET'},'/example1',http_request_callback)uvicorn.run(app,port=9010)The next example serves files below a given directory.importos.pathimportuvicornfrombareasgiimportApplicationfrombareasgi_staticimportadd_static_file_providerhere=os.path.abspath(os.path.dirname(__file__))app=Application()add_static_file_provider(app,os.path.join(here,simple_www),index_filename='index.html')uvicorn.run(app,port=9010)
Package: bareclient
bareClientAn asyncio HTTP Python client package supporting HTTP versions 1.0, 1.1
and 2 (read thedocs).This is the client companion to the ASGI server side web frameworkbareASGIand follows the same
"bare" approach. It provides only the essential functionality and makes little
attempt to provide any helpful features which might do unnecessary work.This package is suitable for:A foundation for async HTTP/2 clients,Async REST client API's,Containers requiring a small image size,Integration with ASGI web servers requiring async HTTP client access.FeaturesThe client has the following notable features:LightweightUses asyncioSupports HTTP versions 1.0, 1.1, 2Supports middlewareInstallationThe package can be installed with pip.pipinstallbareclientThis is a Python3.7 and later package.It has dependencies on:bareUtilsh11h2UsageThe basic usage is to create anHttpClient.importasynciofromtypingimportList,OptionalfrombareclientimportHttpClientasyncdefmain(url:str)->None:asyncwithHttpClient(url)asresponse:ifresponse.okandresponse.more_body:asyncforpartinresponse.body:print(part)asyncio.run(main('https://docs.python.org/3/library/cgi.html'))