Saravanan666/pypi-org huggingface dataset:
Package: experta
Experta is a Python library for building expert systems strongly inspired
byCLIPS.fromrandomimportchoicefromexpertaimport*classLight(Fact):"""Info about the traffic light."""passclassRobotCrossStreet(KnowledgeEngine):@Rule(Light(color='green'))defgreen_light(self):print("Walk")@Rule(Light(color='red'))defred_light(self):print("Don't walk")@Rule(AS.light<<Light(color=L('yellow')|L('blinking-yellow')))defcautious(self,light):print("Be cautious because light is",light["color"])>>>engine=RobotCrossStreet()>>>engine.reset()>>>engine.declare(Light(color=choice(['green','yellow','blinking-yellow','red'])))>>>engine.run()Becautiousbecauselightisblinking-yellowMigrating from PyknowExperta is a Pyknow fork. Just replace anypyknowreferences in your
code/examples toexpertaand everything should work the same.ExamplesYou can find some more examples onGitHub.TODOCHANGELOG1.9.4Resolved #10. Corner case in DepthStrategy in which the first
activation of the agenda didn’t get removed.1.9.3Resolved #11 that was introduced with #7, that caused the same
behavior under different conditions.1.9.2Resolved #7. In some situations last activation was removed right
after entering the agenda.1.9.1Resolved #3. Rules should not be called with already retracted facts.1.9.0Drop Python 3.4 support.Use setup.cfg to save all package metadata.1.8.0-1.8.2Rebranded to Experta.1.7.0Implemented the template system.Replaced warnings by watchers messages.Fixed freeze() with frozen objects.Fixed unfreeze() with unfrozen objects.Parametrized DefFacts via reset() kwargs.1.6.0Improved overall performance.1.5.0Added Python version 3.7 to tox.ini.Monkey and bananas example.Fixed bug, numeric index args gets repeated in a weird way introduced in1.4.0.Pass only the defined args in absence of kwargs.1.4.0Order integer facts keys after making a copy.as_dict method for Fact.freeze and unfreeze method documentation.unfreeze method in pyknow.utils.Zebra example from Clips.1.3.0pyknow.operatormodule.Nested matching.Added Talk ‘Sistemas Expertos en Python con PyKnow - PyConES 2017’ to docs
folder.1.2.0Freeze fact values as the default behavior to address Issue #9.Addedpyknow.utils.anyofto mitigate Issue #7.Raise RuntimeError if a fact value is modified after declare().Added MATCH and AS objects.1.1.1Removing the borg optimization for P field constraints.Use the hash of the check in the sorting of the nodes to always
generate the same alpha part of the network.1.1.0Allow any kind of callable in Predicate Field Constraints (P()).1.0.1DNF of OR clause inside AND or Rule was implemented wrong.1.0.0RETE matching algorithm.Better Rule decorator system.Facts are dictionaries.Documentation.<1.0.0Unestable API.Wrong matching algorithm.Bad performancePLEASE DON’T USE THIS.
Package: expert-informed-dl
Expert-attention guided deep learning for medical imagesGet StartedPip install the PYPI distro:pipinstallexpert-informed-dlHere's an example of how to use the trained model for inference (with subimages)Check out eidl/examples/subimage_example.py for a simple example of how to use the trained model for inference on subimages.fromeidl.utils.model_utilsimportget_subimage_modelsubimage_handler=get_subimage_model()subimage_handler.compute_perceptual_attention('9025_OD_2021_widefield_report',is_plot_results=True,discard_ratio=0.1)If you want to use the rollouts/gradcams in a user interface, you may consider precomputing them, as it can be slow to compute them on the fly.fromeidl.utils.model_utilsimportget_subimage_modelsubimage_handler=get_subimage_model(precompute='vit')# orsubimage_handler=get_subimage_model(precompute='resnet')# orsubimage_handler=get_subimage_model(precompute=['vit','resnet'])If you don't want to use subimages:Check out eidl/examples/example.py for a simple example of how to use the trained model for inference.When forwarding image through the network, use the argumentcollapse_attention_matrix=Trueto get the attention matrix
to get the attention matrix averaged across all heads and keys for each query token.y_pred,attention_matrix=model(image_data,collapse_attention_matrix=False)Train model locallyInstallrequirements.txtDownload Pytorch matching with a CUDA version matching your GPU fromhere.Runtrain.pyFor example, if you have 32 * 32 patches,
the attention matrix will be of size (32 * 32 + 1) 1025. Plus one for the classificaiton token.
If you setcollapse_attention_matrix=False, the attention matrix will be
uncollapsed. The resulting attention matrix will be of shape (n_batch, n_heads, n_queries, n_keys). For example, if you have 32 * 32 patches,
one image and one head, the attention matrix will be of shape (1, 1, 1025, 1025).TroubleshootIf get model functions raises the following error:RuntimeError:AttemptingtodeserializeobjectonaCUDAdevicebuttorch.cuda.is_available()isFalse.IfyouarerunningonaCPU-onlymachine,pleaseusetorch.loadwithmap_location=torch.device('cpu')tomapyourstoragestotheCPU.You will need to install the correct version of Pytorch matching with a CUDA version matching your GPU fromhere.
This is because all the models are trained on GPU.
Package: expert-intelligence-toolbox
Expert Intelligence ToolboxExpert Intelligence is a broadband research company. Our work involves geographic data across different granularities and classification systems.This toolbox contains functions to help us do our work.Mac users may need to install lxml, which will need to be downloaded separately first.Internal users: Use 'instructions.md' for information on maintaining this package.xcode-select --install
pip install lxml==4.9.2
Package: expetator
expetatorA tool for running HPC benchmarks using several type of leverages (DVFS) and low-level monitoring (hardware performance counters, RAPL) mostly on Grid5000.Documentation is available here:https://expetator.readthedocs.io/Source code is available here:https://gitlab.irit.fr/sepia-pub/expetatorTo install expetator:pip3 install expetator
Package: expfactory
The Experiment FactorySee ourdocumentationfor getting started. If you are new to containers, read ourbackgroundorpaperfirst. If you want a more guided entry, see thedetailed startThe Experiment Factory is software to create a reproducible container that you can easily customize to deploy a set of web-based experiments.CitationIf the Experiment Factory is useful to you, please citethe paperto support the software and open source development.Sochat, (2018). The Experiment Factory: Reproducible Experiment Containers. Journal of Open Source Software, 3(22), 521, https://doi.org/10.21105/joss.00521ContributingWe have many ways to contribute, and will briefly provide resources here to get you started.How to ContributeIf you are a developer interested in working on the Experiment Factory software you should read outcontributing guidelinesfor details. For contributing containers and experiments, see ouruser documentation. If you have any questions, please don't hesitate toask a question. You'll need to lint your code using black:$pipinstallblack
$blackexpfactory--excludetemplate.pyCode of ConductIt's important to treat one another with respect, and maintain a fun and respectful environment for the open source community. Toward this aim, we ask that you review ourcode of conductBackgroundIt's predecessor atExpfactory.orgwas never able to open up to the public, and this went against the original goal of the software. Further, the badly needed functionality to serve a local battery was poorly met withexpfactory-pythonas time progressed and dependencies changes.This version is agnostic to the underlying driver of the experiments, and provides reproducible, instantly deployable "container" experiments. What does that mean?You obtain (or build) one container, a battery of experiments.You (optionally) customize itcustom variables (e.g., a study identifier) and configurations go into the build recipeyou can choose to use your own database (default output is flat files)other options are available at runtimeThe container can be easily shared.You run the container, optionally specifying a subset and ordering, and collect your resultsIf you build onDocker Hubanyone else can then pull and use your exact container to collect their own results. It is exact down to the file hash. Note
that bases for expfactory were initially provided onDocker Huband have moved toQuay.io. Dockerfiles in the repository that use the expfactory-builder are
also updated. If you need a previous version, please see the tags on the original Docker Hub.Experiment LibraryThe experiments themselves are now maintained underexpfactory-experiments, official submissions to be found by expfactory can be added to thelibrary(under development) to be tested that they meet minimum requirements.
Package: exp-hurst
Hurst Exponent PackageDescriptionThe function hurst takes a np.array of numbers and returns the Hurst exponent of the time series. The Hurst exponent is a measure of randomness of a time series. It is used in the study of long-term memory of time series. The value of the Hurst exponent is between 0 and 1. A value of 0.5 indicates that the time series is random. A value greater than 0.5 indicates that the time series is trending. A value less than 0.5 indicates that the time series is mean reverting.InstallationpipinstallhurstRequirementsnumpymmqUsagefromcoef_hurstimporthursthurst(time_series)Examplefromexp_hurstimporthurstimportnumpyasnp# Create a time series of random numbersrs=np.random.normal(0,1,100000)# Evaluate the Hurst exponenth=hurst(rs)LicenseMITAuthor[Igor Matheus Jasenovski]Version0.0.1ReferencesHurst Exponent
Package: expipe
ExpipeTo facilitate data sharing, provenance and management of data and metadata we introduce Expipe, a semi-structured and lightweight data management platform designed for neuroscience research.
Expipe implements a conceptually simple and familiar project structure and includes functionalities for data and metadata handling, retrieval, and exploration, which in turn can simplify the steps from experiments to analysis.
Differently from existing solutions, the flexible and easy-to-use Expipe framework can provide an entry-level data management solution for both small and large experimental laboratories.InstallationExpipe can be installed using pip:pip install expipeSee thedocumentationfor more information on how to use expipe.
Package: expipe-plugin-cinpla
Expipe plugin CINPLAExpipe plugin for CINPLA laboratoryInstallationYou can install the package with pip:>>>pipinstallexpipe-plugin-cinplaor from sources:gitclonecdexpipe-plugin-cinpla
pipinstall-e.UsageThe starting point is a validexpipeproject. Refer to theexpipe docsto read more on how
to create one.The recommended usage is via Jupyter Notebook / Lab, using the interactive widgets to Register, Process,
Curate, and View your actions.To launch the interactive browser, you can run:fromexpipe_plugin_cinplaimportdisplay_browserproject_path="path-to-my-project"display_browser(project_path)Updating old projectsThe current version uses Neurodata Without Borders as backend instead of Exdir. If you have an existing
project created with the old version, you can convert it to a new project as follows:fromexpipe_plugin_cinplaimportconvert_old_projectold_project_path="path-to-old-project"new_project_path="path-to-new-project"probe_path="path-to-probe-path.json"# see probes/ folderconvert_old_project(old_project_path,new_project_path,probe_path)To check out other options, useconvert_old_project?
Package: expirecache
|Build Status|expirecache========Python utilities and middleware for neuron.jsexpirecache analyzes the dependencies from user defined facades accordingto the dependency tree, and outputs ``<script>`` tags and configurationsfor `neuron.js <https://github.com/kaelzhang/neuron>`__The dependency tree can be generated by`neuron-package-dependency <https://github.com/kaelzhang/neuron-package-dependency>`__Install-------.. code:: sh$ pip install expirecacheUsage-----.. code:: pyfrom expirecache import Neuronn = Neuron(dependency_tree=dependency_tree,  # must definedresolve=resolve,version=version,cache=cache,debug=False)``expirecache`` could be used either in template file or your pythoncontroller.`Here <./sample/sample-jinja.html>`__ is a sample Jinja2 template file.-  **dependency\_tree** ``dict`` the ``json.loads()``\ ed dependencytree-  **resolve** ``function(id)=`` (optional) implements your own customresolver. ``resolve`` accepts one parameter ``id`` which can beeither a ``str`` of module id or a ``list`` of module ids. If a``str`` is passed in, the method should returns the resolved absoluteurl of the module id. If ``id`` is a ``list``, an url of comboedscript files should be returned.-  **debug** ``function|bool=False`` tells expirecache whether shouldswitch on debug mode. When on debug mode, no javascript files ofdependencies will be preloaded, and the output will not becompressed.-  if ``debug`` is callable, expirecache will use the return value ofmethod ``debug``-  if ``debug`` is a boolean value, and ``debug`` is true, the debugmode will be on.-  **cache** ``dict=None`` if ``cache`` is defined, it should contains 3methods:-  ``cache.has(key)`` returns ``bool``-  ``cache.get(key)`` looks up and returns the cached value by key-  ``cache.set(key, value)`` sets the value by key-  **version** ``str`` only works if ``cache`` is defined. expirecache willuses ``version`` to generate the key to cache the output resultmodule id^^^^^^^^^.. code:: js<name>@<version><path>  # for example: 'jquery@2.0.0/jquery.js'n.facade(entry, data=None)^^^^^^^^^^^^^^^^^^^^^^^^^^-  **entry** ``str`` id of the entry moduleRegisters a facade entry with ``data``. expirecache willReturns ``''``\ (empty string), so you can use this method in pythontemplaten.combo(id...)^^^^^^^^^^^^^^Returns ``''``n.css(id)^^^^^^^^^Returns ``''``n.output()^^^^^^^^^^Returns ``str``n.output\_css()^^^^^^^^^^^^^^^Returns ``str``License-------MIT.. |Build Status| image:: https://travis-ci.org/kaelzhang/python-expirecache.svg?branch=master:target: https://travis-ci.org/kaelzhang/python-expirecache
Package: expiredict
# expiredict### 介绍python的一个小模块，支持时间过期及限制key个数的dict,涵盖所有常用的dict方法。[expiredict 更多介绍](http://xiaorui.cc  "xiaorui.cc")New Future1. support len2. support clearTo Do List1. logging.....### 安装1. 源码安装```git@github.com:rfyiamcool/expiredict.gitpython setup.py install```2. pip 安装```pip install expiredict```### 使用方法```import timefrom expiredict import ExpireDictd = ExpireDict(10)d['a'] = 'abc'print d.clear()print "clear data :%s"%d.keys()d['a'] = 'abc'print "dict length :%s"%len(d)print "d.keys() : %s"%d.keys()d.set_ttl('a',2)print d.ttl('a')print "return value : %s"%d['a']time.sleep(3)print d['a']```
Package: expire-lock
可以过期的python线程锁，基于python字典实现的锁可以过期实现方式类似于redis锁过期的实现机制。使用字典代替 redis服务。安装方式pip install expire_lock过期锁用法importtimefromthreadingimportThreadfromexpire_lockimportExpireLockConf,ExpireLockContextManagerlockx1_expire=ExpireLockConf(expire_seconds=4,lock_key='test_lock_name_expire',)deff(x):withExpireLockContextManager(lockx1_expire):print(x,time.time())time.sleep(5)foriinrange(100):Thread(target=f,args=[i]).start()''''400秒钟内就把100个函数的print(x)运行完成了， 过期锁的设置 expire=4 和原生锁.acquire(timeout=4) 作用完全不同。过期锁意思是一个锁获取后，最多能占用这个锁n秒。原生锁.acquire(timeout=4) 意思是最多只等待这个锁4秒钟，强行获得锁。'''和原生线程锁的 lock.acquire(timeout=xx) 完全不一样，原生锁importtimefromthreadingimportThread,Locktest_raw_lock=Lock()deftest_raw_lock_fun(x):try:test_raw_lock.acquire(timeout=4)print(x,time.time())time.sleep(5)test_raw_lock.release()exceptExceptionase:if'release unlocked lock'instr(e):returnprint(e)foriinrange(100):Thread(target=test_raw_lock_fun,args=[i]).start()''''4秒钟内就把100个函数的print(x)运行完成了， 原生锁.acquire(timeout=4) timeout 和 过期锁的4秒过期完全不一样。'''
Package: expiring-cache
expiring-cacheA simple Python dict with TTL support for auto-expiring caches with support for case-insensitive keys.Installationpipinstallexpiring-cacheFeaturesTTL support for auto-cachingCase-insensitive keys supportUsageExample 1:importtimefromcacheimportExpiringCachecache=ExpiringCache(2)# Keys will exist for 2 seconds.cache['ABC']='Example value'print(cache['ABC'])# Prints the 'Example Value'time.sleep(2)print(cache['ABC'])# Raises KeyErrorExample 2: (shows case-insensitive feature)importtimefromcacheimportExpiringCachecache=ExpiringCache(2,case_insensitive=True)cache['ABC']='Example value'print(cache['ABC'])print(cache['abc'])# Both print statements above print the exact same 'Example Value'time.sleep(2)print(cache['ABC'])print(cache['abc'])# Both the print statements above raise KeyError
Package: expiringdict
Expiring DictChangeLogexpiringdict is a Python caching library. The core of the library is ExpiringDict class which
is an ordered dictionary with auto-expiring values for caching purposes. Expiration happens on
any access, object is locked during cleanup from expired values. ExpiringDict can not store
more thanmax_lenelements - the oldest will be deleted.Note:Iteration over dict and also keys() do not remove expired values!InstallationIf you wish to install from PyPi:pipinstallexpiringdictIf you wish to download the source and install from GitHub:gitclonegit@github.com:mailgun/expiringdict.gitpythonsetup.pyinstallor to install with test dependencies (Nose,Mock,coverage) run from the directory above:pipinstall-eexpiringdict[test]To run tests with coverage:nosetests--with-coverage--cover-package=expiringdictUsageCreate a dictionary with capacity for 100 elements and elements expiring in 10 seconds:fromexpiringdictimportExpiringDictcache=ExpiringDict(max_len=100,max_age_seconds=10)put and get a value there:cache["key"]="value"cache.get("key")copy from dict or OrderedDict:fromexpiringdictimportExpiringDictmy_dict=dict()my_dict['test']=1cache=ExpiringDict(max_len=100,max_age_seconds=10,items=my_dict)assertcache['test']==1copy from another ExpiringDict, with or without new length and timeout:fromexpiringdictimportExpiringDictcache_hour=ExpiringDict(max_len=100,max_age_seconds=3600)cache_hour['test']=1cache_hour_copy=ExpiringDict(max_len=None,max_age_seconds=None,items=cache_hour)cache_minute_copy=ExpiringDict(max_len=None,max_age_seconds=60,items=cache_hour)assertcache_minute_copy['test']==1pickle :importdillfromexpiringdictimportExpiringDictcache=ExpiringDict(max_len=100,max_age_seconds=10)cache['test']=1pickled_cache=dill.dumps(cache)unpickled_cache=dill.loads(cache)assertunpickled_cache['test']==1
Package: expiring-dict
py-expiring-dictPython dict with TTL support for auto-expiring cachesInstallpipinstallexpiring-dictUsageClass Level TTLfromtimeimportsleepfromexpiring_dictimportExpiringDictcache=ExpiringDict(1)# Keys will exist for 1 secondcache["abc123"]="some value"assert"abc123"incachesleep(1)assert"abc123"notincacheKey Level TTLfromtimeimportsleepfromexpiring_dictimportExpiringDictcache=ExpiringDict()# No TTL set, keys set via [] will not expirecache["abc"]="persistent"cache.ttl("123","expired",1)# This will expire after 1 secondassert"abc"incacheassert"123"incachesleep(1)assert"abc"incacheassert"123"notincache
Package: expiringdict-with-default
Expiring Dictexpiringdict is a Python caching library. The core of the library is ExpiringDict class which
is an ordered dictionary with auto-expiring values for caching purposes. Expiration happens on
any access, object is locked during cleanup from expired values. ExpiringDict can not store
more thanmax_lenelements - the oldest will be deleted.Note:Iteration over dict and also keys() do not remove expired values!Features after forkoptioinal default value passed by dict after keys expiredInstallationIf you wish to install from PyPi:pipinstallexpiringdict-with-defaultIf you wish to download the source and install from GitHub:gitclonegit@github.com:weaming/expiringdict.gitpythonsetup.pyinstallTo run tests with coverage:nosetests--with-coverage--cover-package=expiringdictUsageCreate a dictionary with capacity for 100 elements and elements expiring in 10 seconds:fromexpiringdictimportExpiringDictcache=ExpiringDict(max_len=100,max_age_seconds=10,default={'name':'Alice'})put and get a value there:cache["key"]="value"cache.get("key")
Package: expiringdictx
ExpiringDictx简介 | Introduction这是一个带有过期时间的字典数据结构，适用于缓存和临时存储。This is a dictionary data structure with an expiration time, suitable for caching and temporary storage.安装 | Install使用 pip 安装 | Install with pippipinstallexpiringdictx使用 poetry 安装 | Install with poetrypoetryaddexpiringdictx使用 pdm 安装 | Install with pdmpdmaddexpiringdictx使用 | UsageExpiringDictfromdatetimeimporttimedeltafromexpiringdictximportExpiringDict# 创建一个 ExpiringDict 实例 | Create an ExpiringDict instancecache=ExpiringDict[str,str](capacity=100,default_age=60)# 添加一个元素，过期时间为默认值 | Add an item with the default expiration timecache["key0"]="value0"# 添加一个元素，过期时间为 30 秒 | Add an item with an expiration time of 30 secondscache["key1",30]="value1"# 添加一个元素，过期时间为 2 分钟 | Add an item with an expiration time of 2 minutescache["key2",timedelta(minutes=2)]="value2"# 或者使用 set 方法 | Or use the set methodcache.set("key3","value3",60)# 获取一个元素 | Get an itemvalue0=cache["key0"]value1=cache.get('key1')# 获取时附带过期时间 | Get with expiration timevalue2,deadtime2=cache.get_with_deadtime('key2')# 获取并删除一个元素 | pop an itemvalue3=cache.pop('key3')value4=cache.popitem(least_recently=True)# 获取元素ttl(剩余存活时间) | Get the ttl(time to live) of an itemttl=cache.ttl('key0')# 获取元素ddl(过期时间) | Get the ddl(deadline) of an itemddl=cache.ddl('key0')# 按照给定keys创建一个新的ExpiringDict | Create a new ExpiringDict with the given keysnew_cache=cache.fromkeys(['key0','key1','key2'],"default_value",60)# 按照给定可映射对象创建一个新的ExpiringDict | Create a new ExpiringDict with the given mappingnew_cache=cache.frommapping({'key0':'value0','key1':('value1',1),'key2':('value2',timedelta(hours=2))},60)# 从另一个ExpiringDict创建一个新的ExpiringDict | Create a new ExpiringDict from another ExpiringDictnew_cache=cache.fromexpiringdict(cache,60)测试 | Tests运行单元测试： | Run the unit tests:pytesttests/致谢 | Thankslru-dict: ExpiringDict 的内部存储实现expiringdict: 本项目的灵感来源，在此基础上添加类型注解和其他功能许可 | LicenseMIT
Package: expiring-lru-cache
expiring_lru_cacheexpiring_lru_cacheis a minimal drop-in replacement offunctools.lru_cache. It
allows the user to specify a time interval (in secs) after which the cache is
invalidated and reset.UsageHere an example cached function whose cache will invalidate after 10 seconds.fromexpiring_lru_cacheimportlru_cache@lru_cache(expires_after=10)defmy_plus_one_func(x:int)->int:returnx+1Here an example cached function whose cache will invalidate after 1 day. Note that the
convenience variablesMINUTES,HOURSandDAYSare available within theexpiring_lru_cachenamespace.fromexpiring_lru_cacheimportlru_cache,DAYS@lru_cache(expires_after=1*DAYS)defmy_plus_one_func(x:int)->int:returnx+1
Package: expiring_object
# Expiring_object![[PyPI](https://pypi.python.org/project/expiring_object)](https://img.shields.io/pypi/v/expiring_object.svg)![License](https://img.shields.io/pypi/l/expiring_object.svg)![Status](https://img.shields.io/pypi/status/expiring_object.svg)![Python versions](https://img.shields.io/pypi/pyversions/expiring_object.svg)![Downloads](https://img.shields.io/pypi/dw/expiring_object.svg)This module provides a simple way to build self-removal objects## Examples```pythonimport timefrom expiring_object import object_factory, Dispatcherclass Stub:passwith Dispatcher(expiring_time=10, maxlen=10) as dp:obj = object_factory(Stub(), dp)  # pass object that you want to self-remove and a dispatcher instance# do somethingtime.sleep(10)# the object was self-removedprint(obj) # raises ReferenceError```Also you can use this way:```pythonfrom weakref import proxydp = Dispatcher(10)dp.start()some_ref = Stub()weak_ref = proxy(some_ref)  # a weak reference to an objectdp.add(some_ref)# you must delete your link to this object# in another way only handler(if specified) will ba calleddel some_ref# do somethingtime.sleep(10)# the object was self-removeddp.stop()del weak_ref  # this proxy object already not needs```Also you can pass an object that has a callable attribute named `_handler`<br>It is calling (and then deleting item too) when the lifetime has expired:```pythonclass Stub:def _handler(self):print('deleting `stub`')dp.add(Stub())```> Note: You should remind that this object must not have another strong references### LicenseThis project provided by a MIT licenseAlso all issues are welcome> Note that it is an alpha branch