Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Readme
.. image:: https://img.shields.io/pypi/v/timeout-timer.svg :alt: PyPI version :target: https://pypi.org/project/timeout-timer/
::
python setup.py install
Add a timeout function to a function or statement and raise a exception if time limit runs out, can work as
a context or decorator, support loop nesting and should use diff exception class, if use signal timer,
outside timer will fired after the inside signal timer finish the work(raise exception or normal finish).
Support signal timer and thread timer, signal timer can only work on main thread, if not on main thread use
thread timer, thread timer may cost longer time than time out seconds settled if the user's function is busy
in a system call (time.sleep(), socket.accept()...), exception will fired after system call done.
support nested loop ::
from timeout_timer import timeout, TimeoutInterrupt
class TimeoutInterruptNested(TimeoutInterrupt):
pass
def test_timeout_nested_loop_both_timeout(timer):
cnt = 0
try:
with timeout(5, timer=timer):
try:
with timeout(2, timer=timer, exception=TimeoutInterruptNested):
sleep(2)
except TimeoutInterruptNested:
cnt += 1
time.sleep(10)
except TimeoutInterrupt:
cnt += 1
assert cnt == 2
use as decorator ::
@timeout(2):
def f():
time.sleep(3)
time.sleep(2)
Code released under the MIT license <http://en.wikipedia.org/wiki/MIT_License>
_
FAQs
Timeout timer use signal or thread module, support nested loop
We found that timeout-timer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.