def loglevel(request): level = max(40 - request.config.option.verbose * 10, 5) if sys.stdout.isatty(): # enable console logging utils.log_to_stderr(level) return level
import signal import atexit import itertools from collections import OrderedDict, deque from contextlib import contextmanager import tempfile import csv import os from switchio import utils import multiprocessing as mp import time try: import pandas as pd except ImportError as ie: utils.log_to_stderr().warn(str(ie)) pd = None else: from . import shmarray # use the entire screen width + wrapping when viewing frames in the console pd.set_option('display.expand_frame_repr', False) # app names should generally be shorter then this... min_size = 30 def moving_avg(x, n=100): '''Compute the windowed arithmetic mean of `x` with window length `n` ''' n = min(x.size, n) cs = pd.np.cumsum(x)
def log(loglevel): return utils.log_to_stderr(loglevel)