Skip to main content

timeouter

Timeout helper tools library for Python

Install

pip3 install timeouter

Examples

Simple class usage

import timeouter, time

t = timeouter.Timer(1)
time.sleep(0.5)
t.has(0.1) # True
t.has(0.6) # False
t.get() # returns remaining time
t.get(laps=3) # returns remaining time, split into 3 equal laps
t.reset() # resets timeout counter

# raises TimeoutError if timer has expired, message is optional
t.check(message=message)

# get remaining time, raise TimeoutError if expired, message is optional
t.get(check=True, check_message=message)

Custom timeout exception

Exception for the single timer object

class MyException(Exception): pass

t.set_exception_class(MyException)

Default exception for all new timers

class MyException(Exception): pass

timeouter.set_default_exception_class(MyException)

Thread-local usage

import timeouter as to

# init for the current thread
to.init(1)
time.sleep(2)
# module methods check, get, has, reset, set_timeout and set_exception_class
# are proxied to thread-local object
to.check()

Metadata

Release files for timeouter 0.0.15

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for timeouter 0.0.15
File Size Uploaded
timeouter-0.0.15.tar.gz 2.3 kB Details

Release files / timeouter-0.0.15.tar.gz

Download URL timeouter-0.0.15.tar.gz
Size 2.3 kB
Tags Source
SHA-256 checksum
How to use checksums
b6f2976f00ab636604eb2b194e268abe32e845980ebf466ba501bf271f98efec
BLAKE2b-256 checksum
How to use checksums
f07dee8a52e2606f2c4fe869b8d72bcb61a2b3739a46b33b214488719cd4360f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

Release history Release notifications | RSS feed

This release

0.0.15 This release

1 release file

0.0.14

1 release file

0.0.12

1 release file

0.0.11

1 release file

0.0.10

1 release file

0.0.9

1 release file

0.0.8

1 release file

0.0.7

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page