Saravanan666/pypi-org huggingface dataset:
Package: resource-backed-dask-array
resource-backed-dask-arrayResourceBackedDaskArrayis an experimental Dask array subclass
that opens/closes a resource when computing (but only once per compute call).installationpipinstallresource-backed-dask-arraymotivation for this packageConsider the following class that simulates a file reader capable of returning a
dask array (usingdask.array.map_blocks)
The file handle must be in anopenstate in order to read a chunk, otherwise
it segfaults (or otherwise errors)importdask.arrayasdaimportnumpyasnpclassFileReader:def__init__(self):self._closed=Falsedefclose(self):"""close the imaginary file"""self._closed=True@propertydefclosed(self):returnself._closeddef__enter__(self):ifself.closed:self._closed=False# openreturnselfdef__exit__(self,*_):self.close()defto_dask(self)->da.Array:"""Method that returns a dask array for this file."""returnda.map_blocks(self._dask_block,chunks=((1,)*4,4,4),dtype=float,)def_dask_block(self):"""simulate getting a single chunk of the file."""ifself.closed:raiseRuntimeError("Segfault!")returnnp.random.rand(1,4,4)As long as the file stays open, everything works fine:>>>fr=FileReader()>>>dsk_ary=fr.to_dask()>>>dsk_ary.compute().shape(4,4,4)However, if one closes the file, the dask array returned
fromto_daskwill now fail:>>>fr.close()>>>dsk_ary.compute()# RuntimeError: Segfault!A "quick-and-dirty" solution here might be to force the_dask_blockmethod to
temporarily reopen the file if it finds the file in the closed state, but if the
file-open process takes any amount of time, this could incur significant
overhead as it opens-and-closes foreverychunk in the array.usageResourceBackedDaskArray.from_arrayThis library attempts to provide a solution to the above problem with aResourceBackedDaskArrayobject.  This manages the opening/closing of
an underlying resource whenever.compute()is called – and does so only once for all chunks in a single compute task graph.>>>fromresource_backed_dask_arrayimportresource_backed_dask_array>>>safe_dsk_ary=resource_backed_dask_array(dsk_ary,fr)>>>safe_dsk_ary.compute().shape(4,4,4)>>>fr.closed# leave it as we found itTrueThe second argument passed tofrom_arraymust be aresuable context managerthat additionally provides aclosedattribute (likeio.IOBase).  In other words,
it must implement the following protocol:it must have an__enter__methodthat opens the underlying resourceit must have an__exit__methodthat closes the resource and optionally handles exceptionsit must have aclosedattribute that reports whether or not the resource is closed.In the example above, theFileReaderclass itself implemented this protocol, and so was suitable as the second argument toResourceBackedDaskArray.from_arrayabove.Important CaveatsThis was created for single-process (and maybe just single-threaded?)
use cases where dask's out-of-core lazy loading is still very desireable.  Usage
withdask.distributedis untested and may very well fail.  Using stateful objects (such as the reusable context manager used here) in multi-threaded/processed tasks is error prone.
Package: resource_container
Master: [![Build Status](https://travis-ci.org/unfoldingWord-dev/python-resource-container.svg?branch=master)](https://travis-ci.org/unfoldingWord-dev/python-resource-container)# python-resource-containerA utility for managing Door43 Resource Containers. This follows the specification at http://resource-container.readthedocs.io/en/v0.2/.## What is an RC?A Resource Container (RC) is a modular/portable package of translation data.## Installation```pip install resource_container```## Requirementspython 2.7+## UsageTo get started you must first load an RC. Then you can read/write as needed.```pythonfrom resource_container import factoryrc = factory.load('/path/to/resource/container/dir')# some attributes have dedicated propertiesprint(rc.type)# other attributes are accessible from the manifestprint(rc.manifest['dublin_core']['rights'])# readchapter = rc.read_chunk('01', 'title')# writerc.write_chunk('front', 'title', 'Some book title')```### Multiple ProjectsIt is possible for an RC to contain multiple projects.In such cases methods like writing and reading chunks willthrow an error telling you to specify the project.```python# assume rc contains the projects: gen, exo.# this throws an errorrc.read_chunk('01', 'title')# you can check how many projects are in an rcrc.project_count# this works as expectedchapter01title = rc.read_chunk('gen', '01', 'title')```### Strict ModeBy default the tool will operate in strict mode when loading an RC.This will perform some checks to ensure the RC is valid.If you need to look at an RC regardless of it's validityyou can disable strict mode by passing in `False`.```pythonrc = factory.load('/invalid/rc/dir', False)# do stuff with the invalid rc```### Creating an RCThis tool also allows you to create a brand new RC.> NOTE: currently you must specify the complete manifest manually.> This might change a little in the future.```pythonmanifest = {...}rc = factory.create('/my/rc/dir/', manifest)# do stuff with your new rc```
Package: resourcedownloader
Resource downloader based on resource.yml-----------------------------------------Usage example: core.py [-f resource.yml] [-o output_directory]By default resource.yml in a local directory is searched for and files are downloaded to the command's directory.These options can be overridden as displayed in the usage example.Reads resource.yml in the following format:Required fields:---- name: <Name of resource>source: <Filename, directory name, or repository name>Optional fields added in second example:---- name: <Filename, directory name, or repository name>- name: <Second filename, directory name, or repository name>protocol: <Defaults based on filename, file extension, and falls back to cURL>command: <Overrides download procedure. Runs this command directly instead.>command_args: <Flags for protocol specific command. Note: command setting overrides this.>Protocols supported:- bzr- composer- curl- file- git- npm- svnThis version requires Python 3 or later; Python 2 is untested.
Package: resourceful
resourcefulHuman friendly HTTP client for RESTful APIsUsage>>>importresourceful>>>solaire=resourceful.API(url='https://api.le-systeme-solaire.net/rest')>>>bodies=solaire.resource('bodies')>>>bodies.url'https://api.le-systeme-solaire.net/rest/bodies'>>>solaire.bodies.url'https://api.le-systeme-solaire.net/rest/bodies'>>># Perform get on https://api.le-systeme-solaire.net/rest/bodies to get all /bodies>>>rsp=bodies.get()>>>rsp.status_code200>>>rsp.json(){"bodies":[{"id":"lune","name":"La Lune","englishName":"Moon","isPlanet":false,"moons":null,"semimajorAxis":384400,"perihelion":363300,"aphelion":405500,"eccentricity":0.0549,"inclination":5.145,"mass":{"massValue":7.346,"massExponent":22},"vol":{"volValue":2.1968,"volExponent":10},"density":3.344,"gravity":1.62,"escape":2380,...>>># Get resource by ID>>>rsp=bodies.get('lune')>>>rsp.status_code200>>>rsp.json(){'id':'lune','name':'La Lune','englishName':'Moon','isPlanet':False,'moons':None,'semimajorAxis':384400,'perihelion':363300,'aphelion':405500,'eccentricity':0.0549,'inclination':5.145,'mass':{'massValue':7.346,'massExponent':22},'vol':{'volValue':2.1968,'volExponent':10},'density':3.344,'gravity':1.62,'escape':2380.0,'meanRadius':1737.0,'equaRadius':1738.1,'polarRadius':1736.0,'flattening':0.0012,'dimension':'','sideralOrbit':27.3217,'sideralRotation':655.728,'aroundPlanet':{'planet':'terre','rel':'https://api.le-systeme-solaire.net/rest/bodies/terre'},'discoveredBy':'','discoveryDate':'','alternativeName':'','axialTilt':6.68,'avgTemp':0,'mainAnomaly':0,'argPeriapsis':0,'longAscNode':0,'bodyType':'Moon'}>>># Perform get on https://api.le-systeme-solaire.net/rest/bodies with query parameters>>>rsp=bodies.get(params={'data':'id,name,isPlanet','filter[]':'isPlanet,eq,true'})>>>rsp.status_code200>>>rsp.json(){'bodies':[{'id':'uranus','name':'Uranus','isPlanet':True},{'id':'neptune','name':'Neptune','isPlanet':True},{'id':'jupiter','name':'Jupiter','isPlanet':True},{'id':'mars','name':'Mars','isPlanet':True},{'id':'mercure','name':'Mercure','isPlanet':True},{'id':'saturne','name':'Saturne','isPlanet':True},{'id':'terre','name':'La Terre','isPlanet':True},{'id':'venus','name':'Vénus','isPlanet':True}]}
Package: resourcegeo
ResourcegeoDescriptionThis package contains data analysis tools to aid resource geologists in common tasks. More information about using resourcegeo in thedocumentation.If you want to try some of the example notebooks without any installation, visitrun online. It may take some minutes for mybinder to build  the virtual image.Code guidelinesPEP 8 naming conventions:Class names should be CamelCase (MyClass)Variable names should be snake_case and all lowercase (first_name)Function names should be snake_case and all lowercase (quick_sort())Constants should be snake_case and all uppercase (PI = 3.14)Modules should have short, snake_case names and all lowercase (numpy)Be consistent if using single quotes or double quotesPEP 8 line formatting:Indent using 4 spaces (spaces are preferred over tabs)Lines should not be longer than 79 charactersAvoid multiple statements on the same lineTop-level function and class definitions are surrounded with two blank linesMethod definitions inside a class are surrounded by a single blank lineImports should be on separate linesPEP 8 whitespace:Avoid extra spaces within brackets or bracesAvoid trailing whitespace anywhereAlways surround binary operators with a single space on either sideIf operators with different priorities are used, consider adding whitespace around the operators with the lowest priorityAvoid spaces around the = sign when used to indicate a keyword argumentPEP 8 comments:Comments should not contradict the codeComments should be complete sentencesComments should have a space after the # sign with the first word capitalizedMulti-line comments used in functions (docstrings) should have a short single-line description followed by more textContactRefer toorespace.netLicenseThis project is licensed unther the MT License - see the License.md for details
Package: resourcemanager
resourcemanager:A resource file manager for Python programsSTATUS: IN DEVELOPMENTIt provides:Centralized control of loading and updating resourcesAbility to use custom functions for reading and writing filesOriginal use case:Python program with various text file resources that need to be loaded/updatedEach resource belongs to a package that has a function for loading it from specified file or dataI wanted to centralize management of these resourcesInstallation:pip install resourcemanager(Tested for Python >=3.6.5 on Linux (Ubuntu) and Windows 7/10)
Package: resource-manager
This repository contains an interpreter for config files written in a
subset of Python’s grammar. It aims to combine Python’s beautiful
syntax, lazy initialization and a much simpler import machinery.Features overviewLazy scopesThe scopes inside config files are lazy, this means that any declared value will be calculated
only when requested. This allows the user to define various memory-consuming values in a single
config.Because the scopes are lazy, the following code is ambiguous:# which value to use?x=1x=2To avoid ambiguity, each name can be used only once in a config. As a consequence some
syntactic structures (e.g.forloops) are not supported.StatementsOnly three Python statements are supported: value definitions, function definitions and imports.Value definitionsValues are declared using the=operator followed by any valid Python expression.Here are some examples:file_path="/some/path"num_folds=5kernel_sizes=[3,3,5]some_value=apply_to_input(lambdax:x**2)odd_squares=[i**2foriinrange(10)ifi%2==1]Function definitionsYou can define functions inside configs, however their local scope is also lazy, thus the same
constraints hold.A function body consists of several value or function definitions or assertions followed by a return statement:defnormalize(x,y,z):length=sqrt(x**2+y**2+z**2)assertlength>0returnx/length,y/length,z/lengthdefadder(f):defwrapper(x):returnf(x)+1returnwrapper@adderdeff(x):returnxdefcheck_call(seq):assertseq,seqreturnf(seq[0])Even though the scopes are lazy, all the assertions are always evaluated (just before the return statement).ImportsYou can import from other libraries inside config files just like in regular Python:fromnumpyimportprodasproductfromnumpyimportsum,randomimportpandasaspdimporttqdmimportmath.radiansYou can also import from config files, located relative to the main config (in this
case from./some_config.config,./folder/dataset.configand../upper/another.config):from.some_configimport*from..upper.anotherimport*from.folder.datasetimportDataSetasDNote, that you can use starred imports (e.g.from a import *) only when importing from another config.
Package: resource-monitor-scanner
resource-monitor-scannerRequiremetnspip install -r requirements.txtRunningrunning the script will log the stats to a csv, if time is not passed it will take 300s (5 min) as default recording duration, if called with negative duration it will be
recording data until forced to stop (Ctrl+C)python main.py <time>at any time of the execution it can be stopped and there will still be a valid csv to useGPU and OS SupportThe system theoretically supports both AMD and NVIDIA GPUs, and also multiple GPUs but it has only been tested in a single NVIDIA GPU, in an ArchLinux system.ContributionsAll contributions are wellcome, even testing in different hardware configurations.
Package: resource-namer
academic-avocado-namerName things with better names than GUIDs, use in combination with
GUIDs or datetimes.module mainpython -m resource_namerlocal developmentpip install -e .run tests:pip install -e .
pytestExample API usage>>> from resource_namer import generate_name
>>> generate_name()
'handy-human'

# Use a different join character:

>>> generate_name(joiner=".")
'corny.camel'

# seed with a random number

>>> generate_name(seed=42)
'delightful-donkey'

# use plants instead of animals

>>> generate_name(prefer_plants=True)
'irritating-inkberry'https://pypi.org/project/resource-namer
Package: resourcerer
Resourcerer - an automation tool for OneDriveFeaturesResourcerer is a Python project that gives you an easy way of getting resources from OneDrive and other sources.Use casesWhat we use Resourcerer for is sharing unit test and integration test resources accros projects that need it. Resources like these don't belong in artifact repositories or in GitLab/GitHub, so it makes most sense to store them on a network drive or in the cloud. Our first choice was OneDrive, since our team was already using it extensively to share all kinds of information.How to use this for resource sharingWrite aresources.yamlfile and place it at the root of your project. For example the way we use it to get PCAPs:test_resources:-"analog.pcap"source_folder:'Software/resources'target_folder:'./tests/res'source_folderis the path within the source driver, e.g. OneDrive with your test resource files you want to point to.target_folderis the path to a target directory where resources should be downloaded. It's relative with respect to the root of the project folder (for predictable behavior with CI tools).test_resourcesis a list of filenames (with file extensions) that should be fetched for this particular repository. It's important to explicitly specify which files are required, because the application always checks whether a resource exists before downloading it. We don't want to re-download hundreds of megabytes of files if we already have them stored.For OneDrive: in your environment (or in your CI pipeline), specify the following environment variables:MSGRAPH_API_KEY-> Secret for the Azure the application of choice (seeportal.azure.com), you can also set it as a credentialMSGraphApiKey, e.g. using Python'skeyringpackage.MSGRAPH_CLIENT_ID-> Client ID for the application of choiceMSGRAPH_TENANT_ID-> Azure Tenant IDMSGRAPH_SITE_ID-> Site ID for your OneDrive or SharePointRun theget_resourcesscript in your CI pipeline or anytime you want to download test resources. This Python package installs an executable script that should be available from within an environment in which it was installed.So for example in.gitlab-ci.yml:variables:# connection to OneDrive:MSGRAPH_CLIENT_ID:"<client-id>"MSGRAPH_TENANT_ID:"<tenant-id>"MSGRAPH_SITE_ID:"<site-id>"before_script:-pip install resourcerer-get_resourcesTheget_resourcesscript will notify you whenever a file was encountered that was already there and it will also give you info on what files were specifically downloaded for easy debugging.Importable functionsYou may of course decide to use this within your own Python app somewhere. In such case, we export two main functions that can be used:download_file-> takes in a target path (with filename) and a URL, downloads from a publicly accessible location.download_from_onedrive-> takes in a source path to a given file from OneDrive and a target path (without filename) to where the file should be downloaded. This function does not rename the downloaded resource.There is also a protected function_download_from_onedrivewhich can be used with custom OAuth2 token and customsite_idif you need this.
Package: resources
Resource centered REST API clientsIdeas on how to useNot all features stated in the following examples are implemented.
This section serves only as motivation for future functionalities.importresourcesclassPersonResource(resources.Resource):classMeta:base_endpoint='http://api.com/v1/persons/'classPageResource(resources.Resource):classMeta:endpoints={'delete':'http://api.com/v1/pages/{}/''filter':'http://api.com/v1/pages/''get':'http://api.com/v1/pages/{}/''patch':'http://api.com/v1/pages/{}/''post':'http://api.com/v1/pages/''put':'http://api.com/v1/pages/'}owner=resources.RelatedField(PersonResource,source_field='owner_url',# default is owner_idauto_follow=True,# default is False)comments=resources.MultipleRelatedField(CommentResource,source_field='comments_url',)# GET / singleperson=Person.objects.get(pk=1)print(person.name)# GET / listperson_reqset=Person.objects.filter(age=18)forpersoninperson_reqset:# lazy requestprint(person.name)# POSTperson=Person.objects.create(name='John Doe',age=18)# PATCHperson.age=20person.save()# PUTperson=Person.objects.update_or_create(name='John Doe',age=30)
Package: resource-schema-guard-rail
CloudFormation - Resource Schema Guard RailNotesThis is not a stable version (Beta), it's still under developmentOverviewAWS CloudFormation Resource Schema Guard Rail is an open-source tool, which usesCloudFormation Guardpolicy-as-code evaluation engine to assess resource schema compliance. It validates json resource schemas against the AWS CloudFormation modeling best practices.ContributeSeeCONTRIBUTINGfor more information.Rule DevelopmentReadGuard Rail: Rule Developmentfor more information on how to write resource schema rules.How to use it?Schema guard rail package has a built-in library of rules, that CloudFormation believe are the best practices that resource modelers should follow. It supports two types of evaluation - Basic Linting & Breaking Change;Basic Linter (Stateless)Linter works only with current version of resource schema and runs CloudFormation authored rules, which will highlight problematic schema constructs. A provider developers can run multiple independent schemas at once as well as attach custom rules.In order to start using Basic Linting you need to run following command:$guard-rail--schemafile://path-to-schema-1--schemafile://path-to-schema-2--rulefile://path-to-custom-ruleset1--rulefile://path-to-custom-ruleset2List of Linting RulesBreaking Change (Stateful)Along with basic linting, guard rail supports capability of breaking change evaluation. Provider developer must provider two json objects - previous & current versions of the same resource schema. CloudFormation authored rules will be run and evaluation current version of the schema whether it is compliant or not.In order to start using Basic Linting you need to run following command:$guard-rail--schemafile://path-to-schema-1--schemafile://path-to-schema-2--rule...--statefulList of Breaking Change Rules*Additionally, you can specifyformatargument, which will produce a nicely formatted output.How to install it locally?Use following commandsClone github repo$gitclonegit@github.com:aws-cloudformation/resource-schema-guard-rail.gitCreate Virtual Environment & Activatepython3 -m venv env
source env/bin/activateInstall Package Locally from the rootpip install -e . -r requirements.txt
pre-commit installRun CI Locally# run all hooks on all files, mirrors what the CI runs
pre-commit run --all-filesLicenseThis project is licensed under the Apache-2.0 License.CommunityJoin us on Discord! Connect & interact with CloudFormation developers &
experts, find channels to discuss and get help for our CLI, cfn-lint, CloudFormation registry, StackSets,
Guard and more:
Package: resourceSet_for_execo
# Project_RICM4_2017Project realised by Timothée Lemaire and Nicolas Homberg for a student ingenering project at Polytech grenoble.## How to instal the package :The package is on Pypi so it should normaly work simply using pip :`pip install resourceSet_for_execo `## subject of the project :Enhance fonctionnalities of the library Execo.
- [ ] Add notion a of session ( allow to handle state of an experiment)
- [ ] Create a Rest API, with an tilisation of the framowork REST
- [x] Integrate a ResourceSet handler like the one in ExpoThe module resourceSet is fully fonctionnable and are compatible with normaly every function from expo.For now we have to convert the resourceSet into host using function named host.See the doc for more information about function :
* <a href=”https://github.com/TimotheeLemaire/resourceSet-for-execo/blob/gh-pages/dev/docs/_build/html/source/resourceSet.html”>Doc</a>
or look for the doc on the Dairy pageSee our Student instructions and dairy at :
* <a href=”http://air.imag.fr/index.php/ExperimentControl”>Dairy</a>See execo :
* <a href=”http://execo.gforge.inria.fr/doc/latest-stable/”>Execo</a>
Package: resources-example
This project shows how to package data files within a Python distribution, and has some example code for reading the data files. To build this distribution, create a venv with setuptools, wheel, and pep517 installed, then execute the latter as a module:python-mpep517.build.The distributions (an sdist .tar.gz and a bdist .whl) will be written to ./dist/ subdirectory. To test it out, install the distribution and run the console scriptresources-example.Here’s a compatibility summary of the five approaches demonstrated:ModuleDescriptionIn stdlib?Works on Py2?Works on Py3?Works in zipfile?example1.pyos.path.joinyesyesyesnoexample2.pypkgutilyesyesyesyesexample3.pypkg_resourcesnoyesyesyesexample4.pyimportlib.resourcesyesnoyes (3.7+)yesexample5.pyimportlib_resourcesnoyesyesyesIf you are interested in creating an executable zip from source, you can use stdlibzipapputility (Python 3.5+):python3-mzipapp--compress/path/to/resources-example--main="myapp:main"--output=myapp.zipAnd now you can run the zip directly with the interpreter (any Python version):pythonmyapp.zip
Package: resout
resoutThis description is under construction.概要Output path management tool for results (images, etc.) of numerical experiments, etc.
数値実験等の結果(画像等)の出力パス管理ツール基本的な使い方importresout# 保存ファイル名の生成(自動で連番になる) [resout]filename=resout.gen_save_path(".txt",label="exp_result")withopen(filename,"w",encoding="utf-8")asf:f.write("hoge")上記のように、gen_save_path()関数を使用することで連番のファイル名を取得できる連番の説明importresoutprint(resout.gen_save_path(".txt","exp_result"))# -> <path>\output_img\20210605T144210\exp_result_0.txtprint(resout.gen_save_path(".txt","exp_result"))# -> <path>\output_img\20210605T144210\exp_result_1.txtprint(resout.gen_save_path(".txt","exp_result"))# -> <path>\output_img\20210605T144210\exp_result_2.txt画像を保存するimportresoutimportnumpyasnpimg=np.zeros((200,200,3),dtype=np.uint8)# 画像の保存 [resout]resout.save_img(img,ratio=1.0,ext=".png",label="resout_img")保存パスの変更importresout# 保存パスの設定 [resout]resout.set_save_dir("./results/")# 保存ファイル名の生成(自動で連番になる) [resout]filename=resout.gen_save_path(".txt",label="exp_result")withopen(filename,"w",encoding="utf-8")asf:f.write("hoge")