
Security News
ESLint Adds Official Support for Linting HTML
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
Simple python timer to use for single lines of code, or entire functions/classes
code_timer.Timer
as a class, context manager, decorator
code_timer.timer
decoratorcode_timer.timeit
decorator to measure the time to run the same function multiple times
code_timer.Timer
As a class:
t = Timer(name="class")
t.start()
# Do something
t.stop()
As a context manager:
Useful when trying to time a recursive function
with Timer(name="context manager") as t:
# Do something
print(f"Elapsed time: {t.elapsed_time}")
As a decorator:
@Timer(name="decorator")
def stuff():
# Do something
code_timer.timer
Without braces
@timer
def your_func():
# Do something
With braces
@timer(name="my_timer")
def your_func():
# Do something
code_timer.timeit
@timeit
def your_func():
# Do something
2020-03-12 21:56:46: code_timer.INFO - Best 3 of 10000 for your_func: 0.2200 ms; 0.2220 ms; 0.2232 ms
@timeit(num_repeats=50)
def your_func():
# Do something
2020-03-12 21:56:46: code_timer.INFO - Best 3 of 50 for your_func: 0.2200 ms; 0.2220 ms; 0.2232 ms
FAQs
Custom timer for your Python coding pleasure
We found that code-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
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
Security News
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.