Skip to content

Commit dc8d791

Browse files
authored
Add files via upload
0 parents  commit dc8d791

File tree

8 files changed

+82
-0
lines changed

8 files changed

+82
-0
lines changed

LICENSE.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
MIT License
2+
Copyright (c) 2018 YOUR NAME
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
The above copyright notice and this permission notice shall be included in all
10+
copies or substantial portions of the Software.
11+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17+
SOFTWARE.

MANIFEST

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# file GENERATED by distutils, do NOT edit
2+
setup.cfg
3+
setup.py
4+
RepetitiveTimer\RepetitiveTimer.py
5+
RepetitiveTimer\__init__.py

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# RepetitiveTimer
2+
3+
4+
RepetitiveTimer module is wrapper for threading.Thread, makes it easy to initialize a repetitive timer.
5+
6+
- No additional modules needed
7+
8+
### Usage
9+
```python
10+
import threading, time
11+
12+
def poo():
13+
print("Timer ticked.")
14+
15+
stopper = threading.Event()
16+
timer = RepetitiveTimer(func=poo, interval=.5, stopper)
17+
timer.run() # To start timer
18+
time.sleep(10)
19+
stopper.set() # To stop timer
20+
```

RepetitiveTimer/RepetitiveTimer.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import threading
2+
class RepetitiveTimer(threading.Thread):
3+
def __init__(self, func, interval:float, event:threading.Event):
4+
threading.Thread.__init__(self)
5+
self.stopped = event
6+
self.function = func
7+
self.interval = interval
8+
9+
def run(self):
10+
while not self.stopped.wait(self.interval):
11+
self.function()

RepetitiveTimer/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from RepetitiveTimer import RepetitiveTimer

dist/RepetitiveTimer-0.1.tar.gz

1.23 KB
Binary file not shown.

setup.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[metadata]
2+
description-file = README.md

setup.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
from distutils.core import setup
2+
setup(
3+
name = 'RepetitiveTimer',
4+
packages = ['RepetitiveTimer'],
5+
version = '0.1',
6+
license='MIT',
7+
description = 'A wrapper around builtin threading module to automate repetitive timing.',
8+
author = 'Ömer Feyyaz Selçuk',
9+
author_email = '[email protected]',
10+
url = 'https://github.com/divisia/RepetitiveTimer',
11+
download_url = 'https://github.com/divisia/RepetitiveTimer/archive/v_01.tar.gz',
12+
keywords = ['timer', 'repetitive'],
13+
install_requires=[],
14+
classifiers=[
15+
'Development Status :: 5 - Production/Stable',
16+
'Intended Audience :: Developers',
17+
'Topic :: Software Development :: Build Tools',
18+
'License :: OSI Approved :: MIT License',
19+
'Programming Language :: Python :: 3',
20+
'Programming Language :: Python :: 3.4',
21+
'Programming Language :: Python :: 3.5',
22+
'Programming Language :: Python :: 3.6',
23+
'Programming Language :: Python :: 3.7',
24+
'Programming Language :: Python :: 3.8',
25+
],
26+
)

0 commit comments

Comments
 (0)