Saravanan666/pypi-org huggingface dataset:
Package: xfhir
XFHIR Python SDKimportxfhirxfhir.init(client_id='xxx',client_secret='xxxx')xfhir.create({})xfhir.get(id='',resource_type='Patient')xfhir.filter(resource_type='Patient',q='')xfhir.search(q='')Connect to the XFHIR ServicefromxfhirimportXFHIRx=XFHIR(client_id='xxx',client_secret='xxxx')Create a Policy for a FHIR Resourcepatient_redact_policy=x.policy.create(effect='Redact',actions=['account-id:client-id:method:resource:path','account-id:*:Read:Patient:$',])Create the FHIR Resource on XFHIR along with its resource policiesx.create({'fhir_resource':{},'policies':[patient_redact_policy]})Full examplefromxfhirimportXFHIRx=XFHIR(client_id='xxx',client_secret='xxxx')patient_redact_policy=x.policy.create(effect='Redact',actions=['account-id:client-id:method:resource:path','account-id:*:Read:Patient:$',])x.create({'fhir_resource':{},'policies':[patient_redact_policy]})patient=x.get('Patient','identifier')The output of the patient object should be{"id":"*** REDACTED **","name":"*** REDACTED **"}To redact only a few fields in the patient object you can create a policy that only redacts your custom fieldspatient_redact_policy=x.policy.create(effect='Redact',actions=['account-id:*:Read:Patient:$.id','account-id:*:Read:Patient:$.name','account-id:*:Read:Patient:$.contact'])
Package: xfilios
XfiliosExcel and Docx FileIO handlers in the client side for Streamlit (in future Dash will also be considered) Framework. The library provides easy to use classes to encode or decode Docx and Excel at the client side. The following core features are available in the library:Convert an uploaded Docx-file into base64 encoded string to send over HTTP post request (a wrapper over python-docx package)Convert Data received from an HTTP get/post request into Downloadable Excel file (a wrapper over pandas and openpyxl)Combine multiple data source into multi-sheet Downloadable Excel file at the frontend (a wrapper using pandas ReadExcel function with openpyxl)This package is actually a wrapper over pandas and python-docx package. It is possible to extend other fileIO types like csv, text etc in further release.DocxHandlerWhen a Docx file is uploaded into streamlit, it consider the content as a file like object. The packagexfiliosprovide a class calledDocxHandlerwhich has a class method can receive a file like object and will return aDocxHandlerobject. After create a handler object it easy to convert the content into base64 encoded string to send it over a Rest API as follows:importstreamlitasstfromxfilios.docximportDocxHandlerdefdocx_handler_demo():st.title('Demo of xfilios DocxHandler')content=st.file_uploader("Upload Docx File",type="docx")ifcontent:handler=DocxHandler.from_file_like(content)# Now you can send the encoded string over Http post requestdocument_base_64=handler.to_base64_str()# requests.post(body={"data": document_base_64})st.text("Here is the base64 encoded document{}...".format(document_base_64[:10]))# Or if you received a base64 encoded binary document you can create a downloadable linkdownload_link=handler.create_download_link(filename="demo.docx")download_text=f"Please Download the document back{download_link}"st.markdown(download_text,unsafe_allow_html=True)TableHandler and ExcelHandler
The TableHandler and ExcelHandler can work together to achieve the same functionality likeDocxHandler. After you upload a Excel file you can use TableHandler to collect the content of the file. If you have multiple table you can load all the tables and wrap them withTableHandlerand create a list ofTableHandlerand hand it over toExcelHandler.ExcelHandlerwill finally create a downloadable Excel file where each table will an Excel sheet.importstreamlitasstfromxfilios.tableimportTableHandlerfromxfilios.excelimportExcelHandlerdefexcel_handler_demo():st.title('Demo of xfilios ExcelHandler')content=st.file_uploader("Upload Docx File",type="xlsx")ifcontent:# Each table handler will consist one tabletable_handler=TableHandler.from_file_like(content)# You can put multiple table handler into a list [table_handler1, table_handler2 ...]excel_handlers=ExcelHandler([table_handler])download_link=excel_handlers.create_download_link(filename="demo.xlsx")download_text=f"Please Download the File back{download_link}"st.markdown(download_text,unsafe_allow_html=True)st.markdown("Here is the content of the file")st.table(table_handler.get_data_as_dataframe())
Package: xfinity-gateway
Query an Xfinity GatewayThis library allows an Xfinity Gateway to be queried for connected devices. It uses therequestslibrary to scrape the web interface of the gateway.Usagefromxfinity_gatewayimportXfinityGateway# Connect to gatewaygateway=XfinityGateway('10.0.0.1')# Get list of all connected devices' MAC addressesgateway.scan_devices()# Get specific device's namegateway.get_device_name('mac address of device here')ThoughtsI have only tested on my own Xfinity-provided gateway:Model:TG1682GHardware Revision:9.0If your gateway's web interface looks like the following, this library will likely work:Please open a Github issue if you encounter any problems. Thanks!
Package: xfit
InstallationThis package requiresxraylibandcompwizard. On Windows, xraylib can be installed through the Anaconda interface.conda install -c conda-forge xraylib=4.0.0pip instal compwizardFor further information on how to install xraylib on other operational systems, check xraylibwiki.This module can be installed with:pip install xfitUsageThis module provides the "Spectrum" class. It is possible to initialize this class with a numpy nd.array or loading an *.mca or *.spt file, by giving the path.
For the continuum estimation algorithm, refer to theContinuum.pyfile.Test.py file provides a common *.mca file to use with the example.py script provided.Example 1import xfit
import numpy as np
import matplotlib.pyplot as plt
path = r"./test.mca"
pool_file = r"./pool.txt"
Spec = xfit.Spectrum(file_path=path)
Spec.calibrate() #if no arguments are passed, it gets the parameters from the mca or spt header
Spec.estimate_continuum(30, 11, 11, 3) #iterations, filter window, sav-gol window, sav-gol order
Spec.fit_fano_and_noise()
Spec.create_pool(pool_file)
Spec.fit()

#Plot ------
fig, ax = plt.subplots()
ax.plot(Spec.energyaxis, Spec.data, color="black", label="Data")
ax.plot(Spec.energyaxis, Spec.continuum, color="green", label="Continuum")
for element in Spec.areas.keys():
     ax.plot(Spec.energyaxis, 
            Spec.plots[element],
            label=element+" fit result", 
            color=ElementColors[element],
            linestyle="--")
ax.legend(loc=1, fancybox=1)
ax.set_yscale("log")
plt.show()0.11400000005960464 80.00951851146041 (Fano and Noise values found, respectively)Example 2import xfit
import numpy as np
ydata = np.arange(1024)
fit_pool = {}
fit_pool["elements"] = {}
fit_pool["elements"]["Cu"] = ["KA1","KA2","KB1","KB3"]
fit_pool["bg"] = 1 #Forces the use of continuum estimation for the fit
Spec = xfit.Spectrum(array=ydata)
Spec.calibrate(x=channels, y=energies)
Spec.estimate_continuum(30, 11, 11, 3)
Spec.fit_fano_and_noise()
Spec.pool = fit_pool
Spec.fit()
#or simply: Spec.fit(pool=fit_pool)

#Plot ------
fig, ax = plt.subplots()
ax.plot(Spec.energyaxis, Spec.data, color="black", label="Data")
ax.plot(Spec.energyaxis, Spec.continuum, color="green", label="Continuum")
for element in Spec.areas.keys():
     ax.plot(Spec.energyaxis, 
            Spec.plots[element],
            label=element+" fit result", 
            color=ElementColors[element],
            linestyle="--")
ax.legend(loc=1, fancybox=1)
ax.set_yscale("log")
plt.show()
Package: xFlask
xFlask combines the extensions of Flask and it is designed to make getting started quick and easy to build Restful web service, with the ability to scale up to complex applications. It begin as a simple wrapper around Flask and its extensions to provide a simple platform to ease API development.1. FunctionalitiesFollow concepts of Model, Data Access Object (DAO), Service and ControllerEase to decouple component dependencies by using Flask-InjectorProvide a simple way to validate Value Object (VO) by using MarshmallowAdapt with Flask-Migration to easily maintain the database schemaProvide simple logging API helping to debug the application flowAdapt with Flask-Testing for testing the application components2. UsagesModelfromxflask.sqlalchemyimportColumn,Integer,Stringfromxflask.sqlalchemy.modelimportAuditModelclassUser(AuditModel):id=Column(Integer,primary_key=True)username=Column(String(50),unique=True,nullable=False)password=Column(String(50),unique=False,nullable=False)DAOfromxflask.daoimportDaofrommain.model.userimportUserclassUserDao(Dao):def__init__(self):super(UserDao,self).__init__(User)defget_by_username(self,username):returnself.query().filter_by(username=username).first()Servicefrominjectorimportinjectfromxflask.serviceimportCrudServicefrommain.dao.userimportUserDaoclassUserService(CrudService):@injectdef__init__(self,dao:UserDao):super(UserService,self).__init__(dao)defget_user(self,user_id):returnself.user_dao.get_user(user_id)Controllerfrominjectorimportinjectfromxflask.classyimportroute,JsonBodyfromxflask.controllerimportControllerfromxflask.web.responseimportResponsefrommain.controller.vo.userimportUserVofrommain.model.userimportUserfrommain.service.userimportUserServiceclassUserController(Controller):route_base='/api/user/'@injectdef__init__(self,user_service:UserService):self.user_service=user_service@route('<user_id>')defget(self,user_id):user=self.user_service.get(user_id)ifuserisNone:returnResponse.not_found()returnResponse.success(user)@route('',methods=['PUT'])defupdate(self,user:JsonBody(UserVo)):self.user_service.update(User(**user))returnResponse.success()Value Object (VO)fromxflask.marshmallowimportInt,Strfromxflask.marshmallowimportvalidatefromxflask.web.voimportVoclassUserVo(Vo):id:Int(required=True)username:Str(validate=validate.Length(min=2,max=50),required=True)password:Str(validate=validate.Length(min=2,max=50),required=True)
Package: xflat
Flatten documentsHTMLxflat turns this html<html><head><title>Example title</title><metacharset='utf-8'></head><body><h1class="main">Example heading</h1><pid="example-body"class="class-1 class-2">Example body, with a class and id<br>line break and some text</p><div><ol><li>List item 1</li><li>List item 2</li></ol></div></body><!--[if lt IE 7]><style type="text/css">body{behavior:url("/w/static/1.26wmf9/skins/Vector/csshover.min.htc")}</style><![endif]--></html>intohtml
html/head
html/head/title Example title
html/head/meta          charset="utf-8"
html/body
html/body/h1    Example heading     class="main"
html/body/p Example body, with a class and id       class="class-1 class-2" id="example-body"
html/body/p/br      line break and some text
html/body/div
html/body/div/ol
html/body/div/ol/li List item 1
html/body/div/ol/li List item 2
html/!comment   [if lt IE 7]><style type="text/css">body{behavior:url("/w/static/1.26wmf9/skins/Vector/csshover.min.htc")}</style><![endif]FormatAll tags on new lines, TAB seperated valuesPath and name - /html/body/h1Text content - Example headingFooter content (text after the closing of this tag, same level as
parent)Attrbutes e.g. id class etc
Package: xflow-net
XFlow Homepage|Documentation|Paper CollectionXFlowis a library built upon Python to easily write and train method for a wide range of applications related to graph flow problems. XFlow is organized task-wise, which provide datasets benchmarks, baselines and auxiliary implementation.Installationpip install xflow-netExampleimportsysimportoscurrent_script_directory=os.path.dirname(os.path.abspath(__file__))xflow_path=os.path.join(current_script_directory,'..','..','xflow')sys.path.insert(1,xflow_path)fromxflow.dataset.nximportBA,connSWfromxflow.dataset.pygimportCorafromxflow.diffusion.SIimportSIfromxflow.diffusion.ICimportICfromxflow.diffusion.LTimportLTfromxflow.seedimportrandomasseed_random,degreeasseed_degree,eigenasseed_eigenfromxflow.utilimportrun# graphs to testfn=lambda:connSW(n=1000,beta=0.1)fn.__name__='connSW'gs=[Cora,fn,BA]# diffusion models to testdf=[SI,IC,LT]# seed configurations to testse=[seed_random,seed_degree,seed_eigen]# run# configurations of IM experimentsfromxflow.method.imimportpiasim_pi,degreeasim_degree,sigmaasim_sigma,celfppasim_celfpp,greedyasim_greedyme=[im_pi]rt=run(graph=gs,diffusion=df,seeds=se,method=me,eval='im',epoch=10,budget=10,output=['animation','csv','fig'])[Result]Create your own modelsBenchmark TaskInfluence Maximizationsimulation:greedy,CELF, andCELF++,proxy:pi,sigma, degree, andeigen-centralitysketch:RISBlocking Maximizationgreedypisigmaeigen-centralitydegreeSource LocalizationNETSLEUTH(Legacy and Fast versions)Jordan CentralityLISN.Experimental ConfigurationsGraphs: Compatiable with graph objects/class byNetworkxandPytorch GeometricDiffusion Models: SupportNDLibContactFeel free toemail usif you wish your work to be listed in this repo.
If you notice anything unexpected, please open anissueand let us know.
If you have any questions or are missing a specific feature, feel freeto discuss them with us.
We are motivated to constantly make XFlow even better.
Package: xflrpy
Python API for XFLR5This is the python package for running scripts and interfacing withxflrpy.Note: This repository is in intial development phase.
There might be:Some instabilityBreaking changes without updating major versions until the first release.Any contributions/constructive criticism is welcome. Use github issues to roast me.How to UseSeeexamplesDependenciesThis package depends onmsgpackand would automatically installmsgpack-rpc-python(this may need administrator/sudo prompt):pip install msgpack-rpc-python
Package: xflsvg
This library is part of the Pony Preservation Project. It is designed to
support the development of 2D animation AI. It has three main functions:Support to creation for SVG spritemaps for XFL files. Since there’s no
publicly-known way to render Adobe’s Edge format, this library assumes
that Adobe Animate is required to render shape objects. The XflSvgRecorder
class simplifies the process by exporting (1) a simplified XFL file
containing a single symbol, whose frames contain all of the shapes in the
parent XFL files, and (2) a JSON object mapping parent XFL shapes to their
location in the simplified XFL file.Convert XFL files and exported SVG shapes (xflsvg files) into a tabular
data format. The tabular data will eventually contain ALL data necessary
to fully recreate the original animation, and the data will be
hierarchically structured to match the original XFL file. This is done
using the XflSvgRecorder class’s to_json() and to_xfl() methods.Render tabular animation data. The tabular data may be exported from
existing xflsvg files, or they may be programmatically generated. This
is done using the XflSvgRenderer class.This project is currently in an early stage. The xflsvg format will change
over time as we identify exactly what XFL data is necessary to recreate
animations, as will the rendering code.If you’re using pip to install xflsvg, you’ll need to install cairocffi
and cairosvg to use XflSvgRenderer. If you’re using conda to install xflsvg,
both will be automatically installed. Note that pip doesn’t seem to install
cairocffi properly.
Package: xfmr
Transformer/xfmr creates a unified interface for transforming data structures
between common forms used in core Python data anlytics libraries like pandas,
scikit-learn, NumPy, SciPy, and Vaex.xfmr provides:Single API and data object that can easily output and keep track of multiple
data structure formats so that data can be easily passed between different
analytics librariesMethods for transforming data using any one of a number of diffeent libraries
on the same data objectAll xfmr wheels distributed on PyPI are BSD 3-clause licensed.
Package: xfms-calculations
Make sure you have upgraded version of pipWindowspy -m pip install --upgrade pipLinux/MAC OSpython3 -m pip install --upgrade pipCreate a project with the following structurepackaging_tutorial/
├── LICENSE
├── pyproject.toml
├── README.md
├── setup.cfg
├── src/
│   └── example_package/
│       ├── __init__.py
│       └── example.py
└── tests/
touch LICENSE
touch pyproject.toml
touch setup.cfg
mkdir src/mypackage
touch src/mypackage/__init__.py
touch src/mypackage/main.py
mkdir testspyproject.tomlThis file tells tools like pip and build how to create your project[build-system]
requires = [
    "setuptools>=42",
    "wheel"
]
build-backend = "setuptools.build_meta"build-system.requires gives a list of packages that are needed to build your package. Listing something here will only make it available during the build, not after it is installed.build-system.build-backend is the name of Python object that will be used to perform the build. If you were to use a different build system, such as flit or poetry, those would go here, and the configuration details would be completely different than the setuptools configuration described below.Setup.cfg setupUsing setup.cfg is a best practice, but you could have a dynamic setup file using setup.py[metadata]
name = example-pkg-YOUR-USERNAME-HERE
version = 0.0.1
author = Example Author
author_email = author@example.com
description = A small example package
long_description = file: README.md
long_description_content_type = text/markdown
url = https://github.com/pypa/sampleproject
project_urls =
    Bug Tracker = https://github.com/pypa/sampleproject/issues
classifiers =
    Programming Language :: Python :: 3
    License :: OSI Approved :: MIT License
    Operating System :: OS Independent

[options]
package_dir =
    = src
packages = find:
python_requires = >=3.6

[options.packages.find]
where = srcRunning the buildMake sure your build tool is up to dateWindowspy -m pip install --upgrade buildLinux/MAC OSpython3 -m pip install --upgrade buildCreate the buildpy -m buildReferenceshttps://packaging.python.org/tutorials/packaging-projects/
Package: xfork
Write a classic sequential program. Then convert it into a parallel one.Why?It runs faster.What if not?Don’t use it.How?Before:forimageinimages:create_thumbnail(image)After:fromforkimportforkforimageinimages:fork(create_thumbnail,image)What about return values?As usual:result=fork(my_func,*args,**kwargs)It’s a proxy object that behaves almost exactly like the real return value ofmy_funcexcept that
it’s lazy.How lazy?Very lazy. You can even add, multiply, etc. such proxy results without blocking which come in
quite handy, especially in loops. Usefork.await,str,print, etc. to force evaluation
and get the real and non-lazy value back.sizes=0forimageinimages:sizes+=fork(create_thumbnail,image)# lazy evaluationprint(sizes)# forces evaluationThreads or Processes?You don’t need to bother. fork will take care of that for you.You can assist fork by decorating your functions; not decorating defaults tofork.cpu_bound:@io_bounddefcall_remote_webservice():# implementation@cpu_bounddefheavy_computation(n):# implementationException handlingOriginal (sequential) tracebacks are preserved. That should make debugging easier.
However, don’t try to catch exceptions. You better want to exit and see them.
When you force evaluation potential exceptions will be raised.Advanced Feature: Force Specific Type of ExecutionIf you really need more control over the type of execution, usefork.processorfork.thread.
They work just likefork.forkbut enforce the corresponding type of background execution.importpkg_resourcesforworker_functioninpkg_resources.iter_entry_points(group='worker'):process(worker_function)Advanced Feature: Multiple Execution At OnceYou can shorten your programs by usingfork.map. It works likefork.forkbut submits
a function multiple times for each item given by an iterable.results=fork.map(create_thumbnail,images)fork.map_processandfork.map_threadwork accordingly and force a specific type of
execution. Use those if really necessary.
Otherwise, just usefork.map. fork take care for you in this case again.In order to wait for the completion of a set of result proxies, usefork.await_all. If you want to
unblock by the first unblocking result proxy, callfork.await_any.There are also blocking variants available:fork.block_map,fork.block_map_processandfork.block_map_thread; in case you need some syntactic sugar:fork.await_all(fork.map(create_thumbnail,images))# equalsfork.block_map(create_thumbnail,images)ConclusionGoodeasy to give it a try / easy way from sequential to parallel and backresults evaluate lazilysequential tracebacks are preservedit’s thread-safe / cascading forks possiblecompatible with Python 2 and 3Badweird calling syntax (no syntax support)type(result) == ResultProxynot working with lambdas due to PickleErrorneeds fix:not working with coroutines (asyncio) yet (working on it)cannot fix efficiently:exception handling (force evaluation when entering and leaving try blocks)ideas are welcome :-)
Package: xformula
XFormulaHighly customizable language front-end, aimed to be a base
for custom DSL evaluators.Developer note:I've created this library to use in many of my projects and
decided to publish the source code, because it may help somebody to write a DSL
compiler or evaluator can get benefit from Python ecosystem, within a reasonable
time.I couldn't write documentation because of my tight schedule in these days.
But I see the code as self-explanatory, feel free to read it if you're interested.In the meantime, please note thatthis project is still in development.Features:Built on top ofLark Parser ToolkitLALR(1), Earley and CYK parsing algorithms are supported by Lark;
XFormula uses LALR(1) by defaultAutomatic EBNF grammar generator via declarative Python functions
(The final grammar generated using the default features can be found inout/Grammar.larkfile)Modular featurization system to manipulate grammar and parser context dynamically.A ready-to-use compact dialect that supports some general purpose data types
and basic symbols
(Seexformula.syntax.astpackage)Seexformula.syntax.core.featurespackage andxformula.syntax.core.operations.default_operator_precedencesmodule for more
information about the default behaviours.LicenseMIT