timer-for-python 0.7.1__tar.gz → 0.7.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {timer-for-python-0.7.1/src/timer_for_python.egg-info → timer-for-python-0.7.3}/PKG-INFO +14 -8
- {timer-for-python-0.7.1 → timer-for-python-0.7.3}/README.md +2 -2
- {timer-for-python-0.7.1 → timer-for-python-0.7.3}/pyproject.toml +1 -1
- {timer-for-python-0.7.1 → timer-for-python-0.7.3}/setup.cfg +11 -10
- {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer/model/timer.py +65 -1
- {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer/version.py +1 -1
- {timer-for-python-0.7.1 → timer-for-python-0.7.3/src/timer_for_python.egg-info}/PKG-INFO +14 -8
- {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer_for_python.egg-info/SOURCES.txt +0 -10
- timer-for-python-0.7.3/src/timer_for_python.egg-info/requires.txt +10 -0
- timer-for-python-0.7.1/src/timer/.pytest_cache/.gitignore +0 -2
- timer-for-python-0.7.1/src/timer/.pytest_cache/CACHEDIR.TAG +0 -4
- timer-for-python-0.7.1/src/timer/.pytest_cache/README.md +0 -8
- timer-for-python-0.7.1/src/timer/.pytest_cache/v/cache/nodeids +0 -1
- timer-for-python-0.7.1/src/timer/.pytest_cache/v/cache/stepwise +0 -1
- timer-for-python-0.7.1/src/timer/model/.pytest_cache/.gitignore +0 -2
- timer-for-python-0.7.1/src/timer/model/.pytest_cache/CACHEDIR.TAG +0 -4
- timer-for-python-0.7.1/src/timer/model/.pytest_cache/README.md +0 -8
- timer-for-python-0.7.1/src/timer/model/.pytest_cache/v/cache/nodeids +0 -1
- timer-for-python-0.7.1/src/timer/model/.pytest_cache/v/cache/stepwise +0 -1
- timer-for-python-0.7.1/src/timer_for_python.egg-info/requires.txt +0 -10
- {timer-for-python-0.7.1 → timer-for-python-0.7.3}/LICENSE.md +0 -0
- {timer-for-python-0.7.1 → timer-for-python-0.7.3}/MANIFEST.in +0 -0
- {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer/__init__.py +0 -0
- {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer/constant/__init__.py +0 -0
- {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer/constant/decimals.py +0 -0
- {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer/constant/various.py +0 -0
- {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer/controller/__init__.py +0 -0
- {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer/decorator/benchmark.py +0 -0
- {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer/error/__init__.py +0 -0
- {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer/helper/__init__.py +0 -0
- {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer/helper/decimals.py +0 -0
- {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer/helper/output.py +0 -0
- {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer/helper/thread/__init__.py +0 -0
- {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer/helper/thread/list.py +0 -0
- {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer/helper/time_fractions.py +0 -0
- {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer/model/__init__.py +0 -0
- {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer/model/elapsed_time_fractions.py +0 -0
- {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer/model/thread_item.py +0 -0
- {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer/model/time_fractions.py +0 -0
- {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer/model/timer_base.py +0 -0
- {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer/py.typed +0 -0
- {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer_for_python.egg-info/dependency_links.txt +0 -0
- {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer_for_python.egg-info/not-zip-safe +0 -0
- {timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer_for_python.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: timer-for-python
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.3
|
|
4
4
|
Summary: Timer for Python
|
|
5
5
|
Home-page: https://jakob-bagterp.github.io/timer-for-python/
|
|
6
6
|
Download-URL: https://pypi.org/project/timer-for-python/
|
|
@@ -15,19 +15,27 @@ Project-URL: API Reference, https://jakob-bagterp.github.io/timer-for-python/ref
|
|
|
15
15
|
Project-URL: Source Code, https://github.com/jakob-bagterp/timer-for-python
|
|
16
16
|
Project-URL: Release Notes, https://github.com/jakob-bagterp/timer-for-python/releases
|
|
17
17
|
Keywords: python,timer
|
|
18
|
-
Platform: UNKNOWN
|
|
19
18
|
Classifier: Programming Language :: Python :: 3
|
|
20
19
|
Classifier: Programming Language :: Python :: 3.10
|
|
21
20
|
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
22
|
Classifier: License :: OSI Approved :: MIT License
|
|
23
23
|
Classifier: Operating System :: OS Independent
|
|
24
24
|
Requires-Python: >=3.10
|
|
25
25
|
Description-Content-Type: text/markdown
|
|
26
|
-
Provides-Extra: testing
|
|
27
26
|
License-File: LICENSE.md
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
Requires-Dist: colorist==1.7.1
|
|
28
|
+
Provides-Extra: testing
|
|
29
|
+
Requires-Dist: coverage==7.4.4; extra == "testing"
|
|
30
|
+
Requires-Dist: flake8==7.0.0; extra == "testing"
|
|
31
|
+
Requires-Dist: mypy==1.9.0; extra == "testing"
|
|
32
|
+
Requires-Dist: numpy==1.26.4; extra == "testing"
|
|
33
|
+
Requires-Dist: pytest==8.1.1; extra == "testing"
|
|
34
|
+
Requires-Dist: pytest-cov==5.0.0; extra == "testing"
|
|
35
|
+
Requires-Dist: tox==4.14.2; extra == "testing"
|
|
36
|
+
|
|
37
|
+
[](https://github.com/jakob-bagterp/timer-for-python/releases/latest)
|
|
38
|
+
[](https://www.python.org)
|
|
31
39
|
[](https://github.com/jakob-bagterp/timer-for-python/blob/master/LICENSE.md)
|
|
32
40
|
[](https://codecov.io/gh/jakob-bagterp/timer-for-python)
|
|
33
41
|
[](https://github.com/jakob-bagterp/timer-for-python/actions/workflows/codeql.yml)
|
|
@@ -148,5 +156,3 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
|
148
156
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
149
157
|
|
|
150
158
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
151
|
-
|
|
152
|
-
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
[](https://github.com/jakob-bagterp/timer-for-python/releases/latest)
|
|
2
|
+
[](https://www.python.org)
|
|
3
3
|
[](https://github.com/jakob-bagterp/timer-for-python/blob/master/LICENSE.md)
|
|
4
4
|
[](https://codecov.io/gh/jakob-bagterp/timer-for-python)
|
|
5
5
|
[](https://github.com/jakob-bagterp/timer-for-python/actions/workflows/codeql.yml)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[metadata]
|
|
2
2
|
name = timer-for-python
|
|
3
|
-
version =
|
|
3
|
+
version = 0.7.3
|
|
4
4
|
author = Jakob Bagterp
|
|
5
5
|
author_email = jakob_bagterp@hotmail.com
|
|
6
6
|
maintainer = Jakob Bagterp
|
|
@@ -23,6 +23,7 @@ classifiers =
|
|
|
23
23
|
Programming Language :: Python :: 3
|
|
24
24
|
Programming Language :: Python :: 3.10
|
|
25
25
|
Programming Language :: Python :: 3.11
|
|
26
|
+
Programming Language :: Python :: 3.12
|
|
26
27
|
License :: OSI Approved :: MIT License
|
|
27
28
|
Operating System :: OS Independent
|
|
28
29
|
license = MIT License
|
|
@@ -34,21 +35,21 @@ package_dir =
|
|
|
34
35
|
packages = find:
|
|
35
36
|
python_requires = >=3.10
|
|
36
37
|
setup_requires =
|
|
37
|
-
colorist==1.
|
|
38
|
+
colorist==1.7.1
|
|
38
39
|
install_requires =
|
|
39
|
-
colorist==1.
|
|
40
|
+
colorist==1.7.1
|
|
40
41
|
zip_safe = no
|
|
41
42
|
include_package_data = True
|
|
42
43
|
|
|
43
44
|
[options.extras_require]
|
|
44
45
|
testing =
|
|
45
|
-
coverage==7.
|
|
46
|
-
flake8==
|
|
47
|
-
mypy==1.
|
|
48
|
-
numpy==1.
|
|
49
|
-
pytest==
|
|
50
|
-
pytest-cov==
|
|
51
|
-
tox==4.
|
|
46
|
+
coverage==7.4.4
|
|
47
|
+
flake8==7.0.0
|
|
48
|
+
mypy==1.9.0
|
|
49
|
+
numpy==1.26.4
|
|
50
|
+
pytest==8.1.1
|
|
51
|
+
pytest-cov==5.0.0
|
|
52
|
+
tox==4.14.2
|
|
52
53
|
|
|
53
54
|
[options.packages.find]
|
|
54
55
|
where = src
|
|
@@ -21,7 +21,71 @@ class Timer(TimerBase):
|
|
|
21
21
|
cls._instance = super().__new__(cls)
|
|
22
22
|
return cls._instance
|
|
23
23
|
|
|
24
|
-
def __init__(self, thread: str | None = None, decimals: int =
|
|
24
|
+
def __init__(self, thread: str | None = None, decimals: int = 2) -> None:
|
|
25
|
+
"""Main class to create a Timer instance. If not using the class with a `with` statement as [context manager](../user-guide/context-manager.md), remember that a `timer.start()` should always be followed by `timer.stop()` later in the code.
|
|
26
|
+
|
|
27
|
+
Args:
|
|
28
|
+
thread (str | None, optional): Option to start new thread.
|
|
29
|
+
decimals (int | None, optional): Option to define decimals for output. Minimum `0` (for no decimals) and maximum `9`. If `None`, default is `2` decimals. May be overruled in certain cases due to [humanised output](../user-guide/humanised-output.md).
|
|
30
|
+
|
|
31
|
+
Example:
|
|
32
|
+
Basic usage:
|
|
33
|
+
|
|
34
|
+
```python linenums="1" hl_lines="3"
|
|
35
|
+
from timer import Timer
|
|
36
|
+
|
|
37
|
+
timer = Timer()
|
|
38
|
+
timer.start()
|
|
39
|
+
|
|
40
|
+
# Insert your code here
|
|
41
|
+
|
|
42
|
+
timer.stop()
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Or with a `with` statement as [context manager](../user-guide/context-manager.md):
|
|
46
|
+
|
|
47
|
+
```python linenums="1" hl_lines="3"
|
|
48
|
+
from timer import Timer
|
|
49
|
+
|
|
50
|
+
with Timer():
|
|
51
|
+
# Insert your code here
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
In both cases, the terminal output example is the same:
|
|
55
|
+
|
|
56
|
+
```text title=""
|
|
57
|
+
Elapsed time: 12.34 seconds
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
With custom thread name and decimals:
|
|
61
|
+
|
|
62
|
+
```python linenums="1" hl_lines="3"
|
|
63
|
+
from timer import Timer
|
|
64
|
+
|
|
65
|
+
timer = Timer(thread="my_thread", decimals=5)
|
|
66
|
+
timer.start()
|
|
67
|
+
|
|
68
|
+
# Insert your code here
|
|
69
|
+
|
|
70
|
+
timer.stop(thread="my_thread")
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Or with a `with` statement as [context manager](../user-guide/context-manager.md):
|
|
74
|
+
|
|
75
|
+
```python linenums="1" hl_lines="3"
|
|
76
|
+
from timer import Timer
|
|
77
|
+
|
|
78
|
+
with Timer(thread="my_thread", decimals=5):
|
|
79
|
+
# Insert your code here
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
As before, the terminal will output the same result in both cases:
|
|
83
|
+
|
|
84
|
+
```text title=""
|
|
85
|
+
Elapsed time: 0.12345 seconds for thread MY_THREAD
|
|
86
|
+
```
|
|
87
|
+
"""
|
|
88
|
+
|
|
25
89
|
if not self._lock_init: # Ensure that initialisation of the lists only runs the first time.
|
|
26
90
|
self.threads: list[ThreadItem] = []
|
|
27
91
|
self.context_manager_threads: list[str] = []
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
__version_info__ = (0, 7,
|
|
1
|
+
__version_info__ = (0, 7, 3)
|
|
2
2
|
__version__ = ".".join(map(str, __version_info__))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: timer-for-python
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.3
|
|
4
4
|
Summary: Timer for Python
|
|
5
5
|
Home-page: https://jakob-bagterp.github.io/timer-for-python/
|
|
6
6
|
Download-URL: https://pypi.org/project/timer-for-python/
|
|
@@ -15,19 +15,27 @@ Project-URL: API Reference, https://jakob-bagterp.github.io/timer-for-python/ref
|
|
|
15
15
|
Project-URL: Source Code, https://github.com/jakob-bagterp/timer-for-python
|
|
16
16
|
Project-URL: Release Notes, https://github.com/jakob-bagterp/timer-for-python/releases
|
|
17
17
|
Keywords: python,timer
|
|
18
|
-
Platform: UNKNOWN
|
|
19
18
|
Classifier: Programming Language :: Python :: 3
|
|
20
19
|
Classifier: Programming Language :: Python :: 3.10
|
|
21
20
|
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
22
|
Classifier: License :: OSI Approved :: MIT License
|
|
23
23
|
Classifier: Operating System :: OS Independent
|
|
24
24
|
Requires-Python: >=3.10
|
|
25
25
|
Description-Content-Type: text/markdown
|
|
26
|
-
Provides-Extra: testing
|
|
27
26
|
License-File: LICENSE.md
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
Requires-Dist: colorist==1.7.1
|
|
28
|
+
Provides-Extra: testing
|
|
29
|
+
Requires-Dist: coverage==7.4.4; extra == "testing"
|
|
30
|
+
Requires-Dist: flake8==7.0.0; extra == "testing"
|
|
31
|
+
Requires-Dist: mypy==1.9.0; extra == "testing"
|
|
32
|
+
Requires-Dist: numpy==1.26.4; extra == "testing"
|
|
33
|
+
Requires-Dist: pytest==8.1.1; extra == "testing"
|
|
34
|
+
Requires-Dist: pytest-cov==5.0.0; extra == "testing"
|
|
35
|
+
Requires-Dist: tox==4.14.2; extra == "testing"
|
|
36
|
+
|
|
37
|
+
[](https://github.com/jakob-bagterp/timer-for-python/releases/latest)
|
|
38
|
+
[](https://www.python.org)
|
|
31
39
|
[](https://github.com/jakob-bagterp/timer-for-python/blob/master/LICENSE.md)
|
|
32
40
|
[](https://codecov.io/gh/jakob-bagterp/timer-for-python)
|
|
33
41
|
[](https://github.com/jakob-bagterp/timer-for-python/actions/workflows/codeql.yml)
|
|
@@ -148,5 +156,3 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
|
148
156
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
149
157
|
|
|
150
158
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
151
|
-
|
|
152
|
-
|
|
@@ -6,11 +6,6 @@ setup.cfg
|
|
|
6
6
|
src/timer/__init__.py
|
|
7
7
|
src/timer/py.typed
|
|
8
8
|
src/timer/version.py
|
|
9
|
-
src/timer/.pytest_cache/.gitignore
|
|
10
|
-
src/timer/.pytest_cache/CACHEDIR.TAG
|
|
11
|
-
src/timer/.pytest_cache/README.md
|
|
12
|
-
src/timer/.pytest_cache/v/cache/nodeids
|
|
13
|
-
src/timer/.pytest_cache/v/cache/stepwise
|
|
14
9
|
src/timer/constant/__init__.py
|
|
15
10
|
src/timer/constant/decimals.py
|
|
16
11
|
src/timer/constant/various.py
|
|
@@ -29,11 +24,6 @@ src/timer/model/thread_item.py
|
|
|
29
24
|
src/timer/model/time_fractions.py
|
|
30
25
|
src/timer/model/timer.py
|
|
31
26
|
src/timer/model/timer_base.py
|
|
32
|
-
src/timer/model/.pytest_cache/.gitignore
|
|
33
|
-
src/timer/model/.pytest_cache/CACHEDIR.TAG
|
|
34
|
-
src/timer/model/.pytest_cache/README.md
|
|
35
|
-
src/timer/model/.pytest_cache/v/cache/nodeids
|
|
36
|
-
src/timer/model/.pytest_cache/v/cache/stepwise
|
|
37
27
|
src/timer_for_python.egg-info/PKG-INFO
|
|
38
28
|
src/timer_for_python.egg-info/SOURCES.txt
|
|
39
29
|
src/timer_for_python.egg-info/dependency_links.txt
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# pytest cache directory #
|
|
2
|
-
|
|
3
|
-
This directory contains data from the pytest's cache plugin,
|
|
4
|
-
which provides the `--lf` and `--ff` options, as well as the `cache` fixture.
|
|
5
|
-
|
|
6
|
-
**Do not** commit this to version control.
|
|
7
|
-
|
|
8
|
-
See [the docs](https://docs.pytest.org/en/stable/how-to/cache.html) for more information.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
[]
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
[]
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# pytest cache directory #
|
|
2
|
-
|
|
3
|
-
This directory contains data from the pytest's cache plugin,
|
|
4
|
-
which provides the `--lf` and `--ff` options, as well as the `cache` fixture.
|
|
5
|
-
|
|
6
|
-
**Do not** commit this to version control.
|
|
7
|
-
|
|
8
|
-
See [the docs](https://docs.pytest.org/en/stable/how-to/cache.html) for more information.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
[]
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
[]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer_for_python.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer_for_python.egg-info/not-zip-safe
RENAMED
|
File without changes
|
{timer-for-python-0.7.1 → timer-for-python-0.7.3}/src/timer_for_python.egg-info/top_level.txt
RENAMED
|
File without changes
|