semvec/pypi-packages huggingface dataset:
libertymetric 0.1.4
Liberty Metric Utility
Keywords: liberty,metric,timing,EDA,physical design

## Liberty Metric Extraction

### installation
pip install libertymetric


### import package
from libertymetric.classLiberty import liberty as lutil


### load & convert CCS to JSON
lnode = lutil.read_lib('ccs.lib')
lutil.dump_json(lnode,out='ccs.json')
lnode.keys()


### load liberty from JSON
lnode = lutil.load_json('ccs.json')
lnode.keys()


### list cells in the liberary
[v for v in lnode['cell']]


### grab cell node by cell-name, e.g., 'ND2D1LVT'
cnode = lnode['cell']['ND2D1LVT']


### encapsulate all timing/power tables by timing-arc into a dataframe
lutT = lutil.get_cell_timing(cnode,todf=True)
lutP = lutil.get_cell_power(cnode,todf=True)
lutT.index # enumerate all lookup tables encapsulated by timing-arc
lutP.index # enumerate all lookup tables encapsulated by timing-arc


### lookup table interpolation, e.g., timing-arc ('A1,ZN,', 'combinational', 'cell_rise')
lut = lutT.loc[('A1,ZN,', 'combinational', 'cell_rise')]
y,x,v = map(np.array,lut.values) # unpack values as numpy array


### timing interpolation based on the specified transition & load
lutil.table_lookup(lut,trans=0.0207,load=0.0010072,dflag=True)


### LS regression & prediction
lutil.lut2lsCoeff(lut.to_dict(),trans=0.03,load=0.0017,dflag=True)


### visualization
lutT = lutT.T.to_dict() # convert dataframe to JSON
lutil.plot_lut(lutT,keys=('A1,ZN,', 'combinational', 'cell_rise'))
redis-cache-tools 1.1.1
redis-cache-tools is a pythonic interface for creating a cache over redis.
Requires Python: >=3.8,<4.0
Keywords: redis-cache-tools

# redis-cache-tools
It provides simple decorators that can be added to any function to cache its return values.

Requirements:
-------------
redis 4.0.0

Installation:
-------------

    pip install redis-cache-tools

Usage:
------

    from redis_cache import cache_it_json

    @cache_it_json(limit=1000, expire=60 * 60 * 24)
    def fib(n):
        if n == 0:
            return 0
        elif n == 1:
            return 1
        else:
            return fib(n-1) + fib(n-2)

`limit` is the maximum number of keys, `expire` is the expire time in seconds.  
It is always recommended to specify a expire time, since by default redis-server will only remove keys with an expire time set in a event of full memory. But if you wish your keys to never expire, set `expire` to `None`.  
**Note that function arguments and result must be pickleable, since cache_it uses the pickle module.**

It is also possible to use redis-cache-tools as a object-oriented cache:
        
    >> from redis_cache import SimpleCache
    >> c = SimpleCache(10)  # cache that has a maximum limit of 10 keys
    >> c.store("foo", "bar")
    >> c.get("foo")
    'bar'
    >> "foo" in c  # efficient membership test, time-complexity O(1)
    True
    >> len(c)  # efficient cardinality calculation, time-complexity O(1)
    1
    >> c.keys()  # returns all keys, time-complexity O(N) with N being the cache c cardinality
    set(['foo'])
    >> c.flush()  # flushes the cache, time-complexity O(N) with N being the cache c cardinality
    >> "foo" in c
    False
    >> len(c)
    0

Check out more examples in the test_rediscache.py file.

Advanced:
---------
Advanced users can customize the decorators even more by passing a SimpleCache object. For example:

    using env variables.

    export REDIS_HOST=localhost
    export REDIS_PORT=6379
    export REDIS_PORT=3
    
    my_cache = SimpleCache(limit=100, expire=60 * 60, hashkeys=True, host='localhost', port=6379, db=1, namespace='Fibonacci')
    @cache_it(cache=my_cache)
    def fib(n):
        # ...

`hashkeys` parameter makes the SimpleCache to store keys in md5 hash. It is `True` by default in decorators, but `False` by default in a new SimpleCache object.  
`host`, `port` and `db` are the same redis config params used in StrictRedis class of redis-py.
By default, the `namespace` is the name of the module from which the decorated function is called, but it can be overridden with the `namespace` parameter.