This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sphinx-quickstart "docs" -p "project" -a "Jaan Tollander de Balsch" -v "0.1" -l "en" --makefile --batchfile --quiet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import numba | |
from numba import deferred_type, optional, f8 | |
node_type = deferred_type() | |
spec = ( | |
("value", optional(f8[:, :])), | |
("center", f8[:]), | |
("length", f8), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import sys | |
def format_time(timespan, precision=3): | |
"""Formats the timespan in a human readable form | |
Args: | |
timespan (float): | |
Time in seconds. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def public(f): | |
"""Use a decorator to avoid retyping function/class names. [#]_ | |
* Based on an idea by Duncan Booth: | |
http://groups.google.com/group/comp.lang.python/msg/11cbb03e09611b8a | |
* Improved via a suggestion by Dave Angel: | |
http://groups.google.com/group/comp.lang.python/msg/3d400fb22d8a42e1 | |
References: | |
.. [#] https://stackoverflow.com/questions/6206089/is-it-a-good-practice-to-add-names-to-all-using-a-decorator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import functools | |
def decorator(function): | |
"""A general decorator function""" | |
@functools.wraps(function) | |
def wrapper(*args, **kwargs): | |
# Write decorator function logic here | |
# Before function call |
NewerOlder