What is PyProbs?
PyProbs is a module that has useful functionality that returns True or False output based on the given probability.
Installation
You can install it from PyPI by running the following command:
pip install pyprobs
Or you can install it from source:
pip install .
Examples
Simple Usage:
>>> from pyprobs import Probability as pr
>>> # You can pass float (i.e. 0.5, 0.157), int (i.e. 1, 0) or str (i.e. '50%', '3/11')
>>> pr.prob(50/100)
False
>>> pr.prob(50/100, num=5)
[False, False, False, True, False]
Suggested and More Advanced Usage:
>>> from pyprobs import Probability as pr
>>> p = pr()
>>> p.iprob('3/7', 0.25, num=2)
[[True, True], [False, False]]
>>> p.history
{'3/7': [True, True], 0.25: [False, False]}
>>> p.count_values('all')
{True: 2, False: 2}
>>> p.set_constant(1/1000, mutable=True) # If you set the mutable parameter to False, you won't be able to change the constant again.
>>> # You can get the constant and mutable value:
>>> p.get()
{'constant': 0.001, 'mutable': True}
>>> # Also you can use it like "p.get(how='constant')" or "p.get(how='mutable')", this only returns the desired value.
>>> p._constant # You can more easily get the constant value.
0.001
Functions of The Probability Class
- prob
- iprob
- set_constant
- get
- clear
- count_values
Note: All of them require creating an instance except the prob function.
Requirements
- Python v3.6+
Documentation
Metadata
Release files for pyprobs 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pyprobs-1.0.2.tar.gz | 13.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyprobs-1.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.0 kB
Release files / pyprobs-1.0.2.tar.gz
| Download URL | pyprobs-1.0.2.tar.gz |
|---|---|
| Size | 13.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f852c3b5d89f43b86894d4fb883f3874efe26388846f75fb32105af752652a1d
|
|
BLAKE2b-256 checksum How to use checksums |
c2995ad63f7dec72145f9a3958957b71117d32af41cb7b7ce124f5bcb0b187af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.14
|
Release files / pyprobs-1.0.2-py3-none-any.whl
| Download URL | pyprobs-1.0.2-py3-none-any.whl |
|---|---|
| Size | 7.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
211c3475c4fe11d0312395e74c64ccb1d7a905e64fbc8b0b3dea23db6179d6ce
|
|
BLAKE2b-256 checksum How to use checksums |
2cdb4a7e71d6c13046f22a566abd928935ab676a956cd4f4fe14aa14829a71b7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.14
|
Security for pyprobs 1.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.