NotificationFrequency
要素数が確定されたシーケンスの途中で処理を挟むタイミングの判定を補助します。
使い方
n回毎あるいはn%毎など、頻度を指定してインスタンスnfを生成します。nf.lengthに管理するシーケンスの要素数を与えます。enumerate付きのfor文などで(通知を行うか否か(bool),進捗率(int))を取得できます。
from otsunotificationfrequency import NotificationFrequency
# 2212個の要素を持つリストで実行する例
data = [x * 2 for x in range(2212)]
length = len(data)
# 25%毎に表示を行う
nf25per = NotificationFrequency('25%')
nf25per.set_length(length)
# 20個毎に表示を行う
# nf20 = NotificationFrequency(20)
# nf20.length = length
for i, d in enumerate(data):
i += 1
sa, per = nf25per.check_and_get_percentage(i)
# sa, per = nf20(i)
if sa:
print(f'{d}: {per}% ({i}/{length})')
25%毎に表示する例
1104: 25% (553/2212)
2210: 50% (1106/2212)
3316: 75% (1659/2212)
4422: 100% (2212/2212)
20個毎に表示する例
38: 0% (20/2212)
78: 1% (40/2212)
118: 2% (60/2212)
158: 3% (80/2212)
198: 4% (100/2212)
238: 5% (120/2212)
278: 6% (140/2212)
318: 7% (160/2212)
358: 8% (180/2212)
398: 9% (200/2212)
438: 9% (220/2212)
...
4158: 94% (2080/2212)
4198: 94% (2100/2212)
4238: 95% (2120/2212)
4278: 96% (2140/2212)
4318: 97% (2160/2212)
4358: 98% (2180/2212)
4398: 99% (2200/2212)
4422: 100% (2212/2212)
otsunotificationfrequency.validatorモジュール
otsuvalidatorライブラリがインストールされていない場合インポートできず、ImportErrorが発生します。
otsucfgmngなどでバリデータやコンバータが必要な場合に利用してください。
NotificationFrequencyを使用するだけの場合、このモジュールは何の機能も持ちません。
Metadata
Release files for otsunotificationfrequency 1.0.5.312
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 | |
|---|---|---|---|---|
| otsunotificationfrequency-1.0.5.312.tar.gz | 5.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| otsunotificationfrequency-1.0.5.312-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.7 kB
Release files / otsunotificationfrequency-1.0.5.312.tar.gz
| Download URL | otsunotificationfrequency-1.0.5.312.tar.gz |
|---|---|
| Size | 5.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6e5b6a18a62e9d14220b95c50b6bc90874379723d752b3c5706dc05eb7ba7f58
|
|
BLAKE2b-256 checksum How to use checksums |
caf2ada38aae8a6fcc70985fe25d84f0e80eb92d8cfeee5ad772cd1dcc159732
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Release files / otsunotificationfrequency-1.0.5.312-py3-none-any.whl
| Download URL | otsunotificationfrequency-1.0.5.312-py3-none-any.whl |
|---|---|
| Size | 7.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
56d047e75e7e6eb2948b87cb63d891308413dbdf5081401eb2f8f2446f8f3155
|
|
BLAKE2b-256 checksum How to use checksums |
b62db06ed24701bb8100d505b6f55c4da27d6411599d45dc861fdbc6a9432563
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Security for otsunotificationfrequency 1.0.5.312
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.