A broad range of python tools. Some uses: round datetimes, verify input data, execute functions by schedule, parse argv
Project description
fons
Python library for various purposes.
fons
- latin for "source"
Some useful functions and classes:
* aio.call_via_loop_afut - call a (async)function via (another) loop (possibly running in a different thread),
returns async future with pending result/exception thrown of the function
* argv.parse_argv - for parsing input sys.argv into dict values and list values, modifying them, and de-parsing
* func.(async_)limitcalls - a decorator for setting rate limit to (async) function/method
@limitcalls(1, 5, action='sleep')
def f(): pass -> f can only be called once per every 5 seconds, sleeps until that delay is reached
* io.update_settings - load dict from settings file, supporting multiple configs in the same or different files
* iter.flatten - "flatten" a nested list (iterator): list(flatten([2,{3:4},[5,6,(7,)],'89'])) -> [2,{3:4},5,6,7,'89']
(by default includes only "known" iterators; doesn't include: dicts, strings, namedtuples, custom defined classes)
* iter.fliter - "flatten" any iterable: list(fliter([2,{3:4},[5,6,(7,)],'89'])) -> [2,3,4,5,6,7,'8','9']
* iter.unique - keep each value of iterator only once: list(unique([2,3,2])) -> [2,3]
* sched.(Async)Ticker.loop - repeatedly execute a (async)function with a set interval (supports pandas offsets, e.g. '1B')
* time.dt_round - round datetime: dt_round(datetime.datetime(2016,3,1,2), 'D') -> datetime.datetime(2016,3,1)
* verify.verify_data - assert the correctness of input data (useful for avoiding accidental user config mistypes)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
fons-0.4.0.tar.gz
(137.7 kB
view details)
Built Distribution
fons-0.4.0-py3-none-any.whl
(136.2 kB
view details)
File details
Details for the file fons-0.4.0.tar.gz
.
File metadata
- Download URL: fons-0.4.0.tar.gz
- Upload date:
- Size: 137.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac098911af45d20ea29922cae99738865f0cb48db6d57886507d8fccf0f0ffb8 |
|
MD5 | 3fbfe63bb0fc169af7e4faaec04de284 |
|
BLAKE2b-256 | cbb7ae34d9f8eb59f0bf44f8678157ba3ba443f16e3f9dfcafe7bb69e56db63d |
File details
Details for the file fons-0.4.0-py3-none-any.whl
.
File metadata
- Download URL: fons-0.4.0-py3-none-any.whl
- Upload date:
- Size: 136.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4de6a2f56f584bd5e91bb8711181a6d299ad041c86f0f98a898987af2adeb555 |
|
MD5 | 00052c9a452b8d778b01286dbaa5b075 |
|
BLAKE2b-256 | 12e9184c2908e1924ba5c662ebcf0339d1cbe22d97a5ee19a663975ac70e535b |