Change evaluation functions and decorators
Project description
ChangeTools (Python)
Change evaluation functions and decorators.
Direct example:
>>> from pathlib import Path
>>> from functools import partial
>>> from changetools import ChangeEvaluator
>>> hello_path = Path('hello.txt')
>>> _ = hello_path.write_text('hello')
>>> change_evaluator = ChangeEvaluator(partial(hello_path.read_text))
>>> change_evaluator.changed
True
>>> change_evaluator.changed
False
>>> _ = hello_path.write_text('hi')
>>> change_evaluator.changed
True
>>> change_evaluator.changed
False
While example:
>>> hello_path = Path('hello.txt')
>>> change_evaluator.changed
KeyboardInterrupt
>>> _ = hello_path.write_text('hello')
>>> change_evaluator = ChangeEvaluator(partial(hello_path.read_text))
>>> while change_evaluator.changed:
... _ = hello_path.write_text('hi')
...
For example using cycle
:
>>> hello_path = Path('hello.txt')
>>> change_evaluator = ChangeEvaluator(partial(hello_path.read_text))
>>> _ = hello_path.write_text('hello')
>>> for i in change_evaluator.cycle(10):
... print(i)
... _ = hello_path.write_text('hi')
...
0
1
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
changetools-0.1.0.tar.gz
(4.3 kB
view details)
Built Distribution
File details
Details for the file changetools-0.1.0.tar.gz
.
File metadata
- Download URL: changetools-0.1.0.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.7.14
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1000a49e0e0006707bf6e9745c8f35e1c22d1fe009889a9ca9c2979012611d45 |
|
MD5 | 8a05dc8ef64290694f30af592d1609cd |
|
BLAKE2b-256 | d1610d30b5a34a6b2fb272b0aed9b6a2c5ef2ad3a7239d81b53e5d86630b9311 |
File details
Details for the file changetools-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: changetools-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.7.14
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b5ff68ac37a9f654a10b796d3d47865de0c9019ab95cdabb7ee87eebfff3819d |
|
MD5 | 42857f70f6cf9445de119ccb5a3f6aea |
|
BLAKE2b-256 | 0027283fde9a4b50ef669987cfc217beadf2d6c164c2bdbc69631b16f6d23357 |