Saravanan666/pypi-org huggingface dataset:
Package: utils
Sometimes you write a function over and over again; sometimes you look up at
the ceiling and ask “why, Guido, why isn’t this included in the standard
library?”Well, we perhaps can’t answer that question. But we can collect those functions
into a centralized place!Provided thingsUtils is broken up into broad swathes of functionality, to ease the task of
remembering where exactly something lives.enumPython doesn’t have a built-in way to define an enum, so this module provides (what I think) is a pretty clean way to go about them.fromutilsimportenumclassColors(enum.Enum):RED=0GREEN=1# Defining an Enum class allows you to specify a few# things about the way it's going to behave.classOptions:frozen=True# can't change attributesstrict=True# can only compare to itself; i.e., Colors.RED == Animals.COW# will raise an exception.# or use the enum factory (no Options, though)ColorsAlso=enum.enum("RED","GREEN")Once defined, use is straightforward:>>>Colors<class'blahblah.Colors'>>>>Colors.RED<EnumItem:RED[0]>>>>Colors.RED==0True>>>Colors.RED==Colors.REDTrue>>>Colors.RED=2Traceback(mostrecentcalllast):File"<stdin>",line1,in<module>File"utils/enum.py",line114,in__setattr__raiseTypeError("can't set attributes on a frozen enum")TypeError:can't set attributes on a frozen enummathCurrently only has the multiplicative analogue of the built-insum.dictsintersections, differences, winnowing, a few specialized dicts…listsflatten and unlisting. alsoflat_map!boolscurrently only provides anxorfunction.datesMostly cool for theTimePeriodclasses:>>>fromdatetimeimportdate# will also work with datetimes>>>time_period=TimePeriod(date(2013,5,10),date(2013,8,11))>>>time_period<TimePeriod:2013-05-1000:00:00-2013-08-1123:59:59>>>>date(2013,6,12)intime_periodTrue>>>other_time_period=TimePeriod(date(2013,6,1),date(2013,6,30))>>>other_time_periodintime_periodTrue>>>another_time_period=TimePeriod(date(2013,8,1),date(2013,8,30))>>>time_period.overlaps(another_time_period)True>>>TimePeriod.get_containing_period(time_period,another_time_period)<TimePeriod:2013-05-0800:00:00-2013-08-3023:59:59>and so on and so forth. There’s also aDiscontinousTimePeriodclass, which
stores a collection of TimePeriods.There’s also helper functions for common operations likedays_aheadanddays_ago, which pretty much do what they say on the tin.objectsprovidesget_attr, which is really just a convenient way to do deepgetattrchaining:>>>get_attr(complicated,'this.is.a.deep.string',default=None)"the deep string"# or None, if anything in the lookup chain didn't existThere’s also animmutableutility, which will wrap an object and preven all attribute changes,
recursively by default. Any attempt to set attributes on the wrapped object will raise anAttributeError:>>>imm=immutable(something)>>>imm<ImmutableSomething:<Something>>>>>imm.red<ImmutableSomethingElse:<SomethingElse:red>>>>>imm.red=SomethingElse('blue')# ...AttributeError:Thisobjecthasbeenmarkedasimmutable;youcannotsetitsattributes.>>>something.red=SomethingElse('blue')>>>imm.red<ImmutableSomethingElse:<SomethingElse:blue>>You can toggle the recursive immutability by specifying the ‘recursive’ flag.Installation (via pip)pip install utils
Package: utils2devops
Welcome to Utils2DevOps documentation!Infrastructure As CodeA package that contain python 3 functions and class that can be helpfull in the
all working day. Any help for develop, test, validate, documentation are
welcome!TAKE CARE THIS LIBRARY AND THE TOOLS will do what ever you ask to do, even for
destroy image, network, container, …One of my main principles is not to reinvent the wheel, and if someone has
already created a function, a class and sharing it, and if I like its implementation,
I will use this function / class and say a big thank you to this person in all respect of the Copyright and the Licence.
This library is in development and the folder structure will change certainlyWe will use- AWS CLI and API: https://aws.amazon.com/tools/
- GPC tools and API?: https://cloud.google.com/sdk/docs/
- Docker CLI and API: https://docs.docker.com/get-started/
    - Docker, Docker-compose and Docker Swarm
- Portainer: https://www.portainer.io/installation/
- Traefik: https://traefik.io/
- Terraform: https://www.terraform.io/downloads.html
- ...To develop or improve this library you can run it with the env DEBUG_OR_IMPROVEOnline documentation is here onReadthedocOnline source code available onGithub
Package: utils2p
OverviewThis module provides utility functions necessary for loading and processing
2-photon imaging data acquired with ThorLabs microscopes. It includes function
to read files generated by ThorImage and ThorSync.DocumentationThe full documentation is hosted ongithub pages.InstallationNote that you will need an installation ofnumpyto install this package.
You can install numpy with the following command:pipinstallnumpyThe package can be installed usingpipwith:pipinstallutils2pIf you need the latest version or you want to make changes to the code, you should install
utils2p from source by following the steps below.To do so first create a copy of the source code on your machine by cloning the repository:gitclonehttps://github.com/NeLy-EPFL/utils2p.gitThen install it using the following command:pipinstall-eutils2pDependenciespython >3.6pipnumpyh5pyscipy
Package: utils4ymc
utils4ymcMaking our programing more efficient.utils4ymc是一个Yummy Chen为自己提高效率，复用代码的库。示例Decos装饰器工具记录函数运行时间工具 logger@logger(log_path)deffunc(*args):pass检查参数的输入类型@type_assert(*types)deffunc(*args):pass忽略错误@omit_exception(hadle_func)deffunc(*args):pass出错重试@retry()deffunc(*args):passTools 计算工具One-hotdist
计算两个高阶向量的距离，支持L1、L2距离。a=np.random.randn(4,3)b=np.random.randn(2,3)dist=dist(a,b)# (4, 2)使用方式fromutils4ymcimport*安装$ pip install utils4ymc目录树.
├── LICENSE
├── README.md
├── setup.cfg
├── setup.py
└── utils4ymc
├── Decos
│   ├──init.py
│   ├── check_args.py
│   └── decorators.py
├── Tools
│   ├──init.py
│   ├── calculate.py
│   └── file.py
└──init.pyLicenseMIT
Package: utils-anviks
Utilities by anviksThis package contains some useful functions and decorators.Features indecorators.py:@stopwatchdecorator to measure execution time of a function@read_datadecorator to read data from file and pass it to a function@catchdecorator to catch exceptions, that can be raised by a function@memoizedecorator to cache function results@enforce_typesdecorator to check types of function arguments and return value (raises TypeError if types don't match)Features inb64coder.py:b64encodefunction to encode a string to base64b64decodefunction to decode a base64 string to a readable stringFeatures inmemory_profiler.py:display_tm_snapshotdisplays the top memory allocations from a tracemalloc snapshot.Installationpipinstall-ihttps://test.pypi.org/simple/utils-anviksUsagefromutils_anviksimport*
Package: utils-api-pipefy
utils-api-pipefyBiblioteca que possui um kit de ferramentas úteis para ações usualmente rotineiras de quem trabalha com Pipefy, desde consulta de cards a criação de Pipes, Tables e atualizações em geral.Utilizamos como apoio as collection requests e python-dotenv.Instalaçãopip install utils-api-pipefy.envHOST_PIPE=app or seu_host_pipefyPIPE= seu_numero_pipeNONPHASES= [numeros_fases_ignoradas]TOKEN= seu_tokenLOGENV = DEV or PROD [ PROD remove urlib3 logs ]LOGNAME = nome_arquivo_logsDISABLELOG = True or False [True desabilita a criação de pasta e arquivo de logs, temos essa opção para utilização em plataformas como Google Cloud Platform, neste caso o logging apenas imprime da tela, sem salvar o log.]Exemplo de usoimportosimportjsonimporttimeimportloggingfromutils_api_pipefyimportEnginefromutils_api_pipefyimportexceptionsif__name__=="__main__":try:eng=Engine()# ALGUMAS DAS UTILIDADES DO ENGINElogging.info(eng.columns)print(json.dumps(eng.phases_id,ensure_ascii=False,indent=2))print(json.dumps(eng.fields,ensure_ascii=False,indent=2))print(json.dumps(eng.phases,ensure_ascii=False,indent=2))a=time.time()data=eng.run_all_data_phases()print(f"\n\nTempo total:{time.time()-a}\n\n")print()exceptExceptionaserr:raiseexceptions(err)
Package: utils-core
utils-coreGeneral utilities on top of Python standard libraries.Examples for process-related utilities:fromutils.processimportrun,silent_runrun('ls -l')out=run(['ls','-l'],return_output=True)# Just runs without any output to stdout. Alias for: run(..., silent=True)silent_run('ls -l')Examples for filesystem-related utilities:importosfromutils.fsimportin_dir,in_temp_dirwithin_temp_dir()astmpdir:assertos.getcwd()==tmpdirwithin_dir('/tmp'):assertos.getcwd()=='/tmp'Links & Contact InfoPyPI Package:https://pypi.python.org/pypi/utils-coreGitHub Source:https://github.com/maxzheng/utils-coreReport Issues/Bugs:https://github.com/maxzheng/utils-core/issuesFollow:https://twitter.com/MaxZhengXConnect:https://www.linkedin.com/in/maxzhengContact: maxzheng.os @t gmail.com
Package: utils-cv-baiyigali
setup docker envdocker build -t utils_cv -f docker/Dockerfile .
docker run -it --rm --name utils_cv -v .\:/code utils_cv bashThis is a simple example package. You can useGithub-flavored Markdownto write your content.Change Logsv0.0.10add utils_datasetv0.0.11get_area return 0 if box invalid
Package: utilsd
Common utils for deep learningDocumentation:https://utilsd.readthedocs.io/en/stable/pip install utilsdWhat is utilsd?I'm collectingcommon utilsthat are used in at least 2 of the projects I have been working on. I expect most of the utils are in the corner of logging, experiment setup, config management, log analysis, and etc. As I almost always use PyTorch and most of the projects are featuring vision tasks, it will be built upon PyTorch.Why it is named utilsd?To join the D-universe that is powered by several ambitious system researchers.Is it a stable toolkit I can use?Not really. It is still a draft and being tested against multiple internal projects. I will try to write documentation for this project within a couple of months (or give up on it forever).
Package: utils-flask-sqlalchemy
Librairie "outil" pour SQLAlchemy et FlaskCette librairie fournit des décorateurs pour faciliter le développement avec Flask et SQLAlchemy.Paquet Python :https://pypi.org/project/utils-flask-sqlalchemy/.Elle est composée de trois outils principaux :Les serialisersLe décorateur de classe@serializablepermet la sérialisation JSON d'objets Python issus des classes SQLAlchemy. Il rajoute dynamiquement une méthodeas_dict()aux classes qu'il décore. Cette méthode transforme l'objet de la classe en dictionnaire en transformant les types Python non compatibles avec le format JSON. Pour cela, elle se base sur les types des colonnes décrits dans le modèle SQLAlchemy.Le décorateur@serializablepeut être utilisé tel quel, ou être appelé avec les arguments suivants :exclude(iterable, default=()). Spécifie les colonnes qui doivent être exclues lors de la sérialisation. Par défaut, toutes les colonnes sont sérialisées.La méthodeas_dict()contient les paramètre suivants :recursif(boolean, default = False) : contrôle si la serialisation doit sérialiser les modèles enfants (relationships) de manière recursivecolumns(iterable, default=()). Spécifie les colonnes qui doivent être présentes dans le dictionnaire en sortie. Si non spécifié, le comportement par défaut du décorateur est adopté.relationships(iterable, default=()). Spécifie les relationnships qui doivent être présentes dans le dictionnaire en sortie. Par défaut toutes les relationships sont prises sirecursif=True.Les réponsesLe fichier contient des décorateurs de route Flask :Le décorateur@json_resptransforme l'objet retourné par la fonction en JSON. Renvoie une 404 si la valeur retournée par la fonction est None ou un tableau videLe décorateur@json_resp_accept_empty_listtransforme l'objet retourné par la fonction en JSON. Renvoie  une 404 si la valeur retournée par la fonction est None et 200 si c'est un tableau videLe décorateur@csv_resptranforme l'objet retourné par la fonction en fichier CSV. La fonction doit retourner un tuple de ce format(file_name, data, columns, separator)Le mapping à la voléeLe fichiergenericcontient les classesGenericTableetGenericQuerypermettant de faire des requêtes sans définir de modèle au préalable.
Package: utilsforecast
utilsforecastInstallPyPIpipinstallutilsforecastCondacondainstall-cconda-forgeutilsforecastHow to useGenerate synthetic datafromutilsforecast.dataimportgenerate_seriesseries=generate_series(3,with_trend=True,static_as_categorical=False)seriesunique_iddsy002000-01-010.422133102000-01-021.501407202000-01-032.568495302000-01-043.529085402000-01-054.481929............48122000-06-11163.91462548222000-06-12166.01847948322000-06-13160.83917648422000-06-14162.67960348522000-06-15165.089288486 rows × 3 columnsPlottingfromutilsforecast.plottingimportplot_seriesfig=plot_series(series,plot_random=False,max_insample_length=50,engine='matplotlib')fig.savefig('imgs/index.png',bbox_inches='tight')Preprocessingfromutilsforecast.preprocessingimportfill_gapsserie=series[series['unique_id'].eq(0)].tail(10)# drop some pointswith_gaps=serie.sample(frac=0.5,random_state=0).sort_values('ds')with_gapsunique_iddsy21302000-08-0118.54314721402000-08-0219.94176421602000-08-0421.96873322002000-08-0819.09150922102000-08-0920.220739fill_gaps(with_gaps,freq='D')unique_iddsy002000-08-0118.543147102000-08-0219.941764202000-08-03NaN302000-08-0421.968733402000-08-05NaN502000-08-06NaN602000-08-07NaN702000-08-0819.091509802000-08-0920.220739Evaluatingfromfunctoolsimportpartialimportnumpyasnpfromutilsforecast.evaluationimportevaluatefromutilsforecast.lossesimportmape,masevalid=series.groupby('unique_id').tail(7).copy()train=series.drop(valid.index)rng=np.random.RandomState(0)valid['seas_naive']=train.groupby('unique_id')['y'].tail(7).valuesvalid['rand_model']=valid['y']*rng.rand(valid['y'].shape[0])daily_mase=partial(mase,seasonality=7)evaluate(valid,metrics=[mape,daily_mase],train_df=train)unique_idmetricseas_naiverand_model00mape0.0241390.44017311mape0.0542590.27812322mape0.0426420.48031630mase0.90714916.41801441mase0.9916356.40425452mase1.01359611.365040
Package: utils-formatter-br
utils_formatter_brInstallationUse the package managerpipto install utils_formatter_brpipinstallutils-formatter-brUsage#format to currency pt-brfromutils_formatter_brimportformattersasftnum=1000.5ft.currency_format(num)# Output: 'R$ 1.000,50'#format to date pt-brfromutils_formatter_brimportformattersasftfromdatetimeimportdatedate=date.fromisoformat('2021-07-19')ft.date_format(date)# Output: '19/07/2021'#format to porcent pt-brfromutils_formatter_brimportformattersasftnum=1/5ft.porcent_format(num)# Output: '20,00%'AuthorJuan de Oliveira FariasLicenseMIT
Package: utils-functions-plus
Utils PlusA set of auxiliary functions that are subdivided into:DecoratorThis module is responsible for grouping the decorator functions.
There are decorators to use lazy load, notifications, timeout, measure time and prevent exception.fromutils_plus.decoratorsimporttimeout@timeout(20)defprocess_test():# processParserThis module is responsible for grouping the parser functions.
There are functions to parser xml, json and images.fromutils_plus.parserimportconvert_list_to_dictlist_data=[{"name":"Fabio"},{"age":"26"},{"company":"SIDIA"}]result={}convert_list_to_dict(result,list_data)print(result)>>{"name":"Fabio","age":"26","company":"SIDIA"}UtilityThis module is responsible for grouping the utility functions.
There are functions to logging config, prints and threads.fromutils_plus.utilityimportwaitingtasks=[]tasks.append(threading.Thread(target=process_1))tasks.append(threading.Thread(target=process_2))tasks.append(threading.Thread(target=process_3))waiting(tasks)
Package: utils-jinja-sqlite
Utils for Jinja & sqliteMust setup an .env pointing to a database fileDB_FILE; otherwise, will default totest.db.Setup Jinja Environment to fetch via .sql fileAssumes a basic Jinja environment has been setup:fromjinja2importEnvironmentassertisinstance(env,Environment)SyncQuery the environment usingsqlite3,viz:fromutils_jinja_sqliteimportget_rows,get_row# baseparams=dict(a="'hello world'")sql_stmt=env.get_template("test.sql").render(params)# get allrows=get_rows(sql_stmt=sql_stmt)type(rows)# generator# get onerow=get_row(sql_stmt=sql_stmt)# gets only the first rowtype(row)# dictAsyncQuery the environment using aaiosqlite3,viz:fromutils_jinja_sqliteimportget_rows,get_rowimportasyncio# baseparams=dict(a="'hello world'")sql_stmt=env.get_template("test.sql").render(params)# get allrows=a_rows(sql_stmt=sql_stmt)type(rows)# co-routinerows_result=asyncio.run(rows)type(rows_result)# generator# get onerow=a_row(sql_stmt=sql_stmt)type(row)# co-routinerow_result=asyncio.run(row)type(row_result)# dictNote that this will not work:forfirst_stmt_rowinget_rows(sql_stmt=sql_stmt1):forsecond_stmt_rowinget_rows(sql_stmt=sql_stmt2):...# the first sql_stmt has not yet terminatedSQL string literal binder funcsInstead of quoting a string literal can use a helper functionfromutils_jinja_sqliteimportquote_sql_stringparams=dict(a=quote_sql_string(helloworld))
Package: utils-misc
misc_utilsMisc system and time utilities for Python projects.InstallationFor pippipinstallutils-miscFor sourceClone the repo, cd into it and runpip install .command.gitclonehttps://github.com/misads/misc_utils.gitcdmisc_utils
pipinstall.For condasource~/anaconda3/bin/activate
condaactivate<env>
pythonsetup.pyinstallA configure filemisc_utils.egg-infowill be generated in the repo directory. Copymisc_utilsandmisc_utils.egg-infoto yoursite-packagesfolder.Usageimportmisc_utilsasutilsutils.color_print('Yellow Text',3)DocumentationThe documentation webpage can be found herehttps://misc-utils.readthedocs.io/en/latest/index.html.
Package: utils-nm
utils_nmThis package contains utility objects like functions and classes.The following modules can be imported:db_functions: functions for database operationsdata_functions: functions specific for data transformation with pandasorm_models: sqlalchemy orm models for logging purposes of job executionsutil_classes: useful classesutil_functions: useful functionsutil_decorators: useful decorator functions, classes, factoriesTo use (with caution), simply do:>>> from src.utils_nm import util_functions as uf
>>> user_input = uf.input_prompt(name='arg', choices=('a', 'b'), default='a', enum=False)
Package: utils-pandas
Python Package: utils-pandasDescrição:Biblioteca Python com objetivo de criar funcionalidades adicionais para a Biblioteca pandas.LinksPandas:https://pypi.org/project/pandas/Instalação:pip install utils-pandasDoação:Ajude o Projeto a continuar, qualquer doação é bem vindaCHAVE PIX:d51024a6-4320-4cb6-9241-b0a4d165dfd2PIX Copia e Cola:LinkQRCODE PIX:Nome:Jonathas Henrique Miante -Banco:PicPay
Package: utilsparrel
Antonio San Románpdf_view(self,master,width=1200,height=600,pdf_location="",bar=True,load="after")Crea la interface grafica para moverse por las paginas del documento con dos botones gráficos Avanzar/Retroceder.FuncsVisorPDFgrid_by_column(cuadro, columns, spacex=6, spacey=6)Distribuye los botones de avanzar y retroceder por las paginas PDF; y la etiqueta que los datos del 	documento obtenidos con otra función de forma autónoma a la visualización del documento.metaDataPDF(archivo)Recoge los metadatos de documento PDF (titulo, autor y fecha de creación) y los devuelve en estructura directory de forma autónoma a la visualización.defEstado(archivo)Recoge en estructura clave-valor el estado de botón (avance/retroceso) y las imágenes que representen estos estados según tenga sólo una pagina o más.desglosaPDF(archivo)Crea una imagen jpg por pagina de documento PDF.outFondo(origen, destino)Quita fondo a imagen de botón (avance/retroceso)cargaPagPDF(archivo, índice)Incorpora a visualización de documento PDF la imagen jpg con la pagina indicada por segundo parámetro.
Package: utilspie
Documentation:utilspie.readthedocs.orgWhat is utilspie?Utilspieis a Python library that offers a sensible, human-friendly utilities which do not come along with Python installation. Utilspie is categorized into 5 modules:asyncutils: utilities for asynchronous call/threadsfileutils: utilities related to file operations/manipulationsiterutils: utilities for iterators. Inspired byitertoolspackagecollectionsutils: provides data objects not present incollectionspackageimportutils: utilities related to importing the modulesInstallationutilspieis available onpypi. To install, run:$pipinstallutilspieQuick StartFor using the utilspie, you have to import the package utilspie and call it’s function as:fromutilspieimportiterutils# OR, from utilspie.iterutils import get_chunksiterutils.get_chunks([1,2,3,4,5,6],2)<generatorobject<genexpr>at0x1018fab40># returns generator objectlist(iterutils.get_chunks([1,2,3,4,5,6],2))[[1,2],[3,4],[5,6]]API Guideutilspie.asyncutilsContains utility functions for asynchronous calls.ordered_async_call(function_list)utilspie.fileutilsContains utility functions for files related operations.copy_file(source, destination, unique, sort, case_sensitive, create_path)utilspie.iterutilsContains utility functions for iterables. It is inspired byitertoolspackage.get_chunks(iterable_obj, chunk_size)utilspie.collectionsutilsContains additional data objects not available as in-built in Python. This is inspired bycollectionsmodule.frozendict(dict_obj)swap_dict(dict_obj, multivalued)utilspie.importutilsContains utilites related to importing the modules.lazy_load_modules(*modules)reload_module(module)delete_module(modname)Didn’t find what you want?Are you looking for something which you think should be the part ofutilspiebut is not currently present? Feel free to mention it by
opening aissue. We will take a look at it, and will implement it if it’s a good fit.How to Contribute?Check for open issues or open a fresh issue to start a discussion around a feature idea or a bug.Forkthe repositoryon GitHub to start making your changes to themasterbranch (or branch off of it).Write a test which shows that the bug was fixed or that the feature works as expected.Send a pull request and bug the maintainer until it gets merged and published. Make sure to add yourself toAUTHORS.
Package: utils-pna
IntroductionTODO: Give a short introduction of your project. Let this section explain the objectives or the motivation behind this project.Getting StartedTODO: Guide users through getting your code up and running on their own system. In this section you can talk about:Installation processSoftware dependenciesLatest releasesAPI referencesBuild and TestTODO: Describe and show how to build your code and run the tests.ContributeTODO: Explain how other users and developers can contribute to make your code better.If you want to learn more about creating good readme files then refer the followingguidelines. You can also seek inspiration from the below readme files:ASP.NET CoreVisual Studio CodeChakra Core