Пример #1
0
def phy(ctx, pdb=None, ipython=None, prof=None, lprof=None):
    """By default, the `phy` command does nothing. Add subcommands with plugins
    using `attach_to_cli()` and the `click` library."""
    add_default_handler(level='DEBUG' if DEBUG else 'INFO')
Пример #2
0
from traceback import format_exception

import click

from phy import (add_default_handler, DEBUG, _Formatter, _logger_fmt,
                 __version_git__, discover_plugins)
from phy.utils import _fullname

logger = logging.getLogger(__name__)


#------------------------------------------------------------------------------
# Set up logging with the CLI tool
#------------------------------------------------------------------------------

add_default_handler(level='DEBUG' if DEBUG else 'INFO')


def exceptionHandler(exception_type, exception, traceback):  # pragma: no cover
    logger.error("An error has occurred (%s): %s",
                 exception_type.__name__, exception)
    logger.debug(''.join(format_exception(exception_type,
                                          exception,
                                          traceback)))

# Only show traceback in debug mode (--debug).
# if not DEBUG:
sys.excepthook = exceptionHandler


def _add_log_file(filename):
Пример #3
0
import logging
import numpy as np
import os

from pytest import yield_fixture

from phy import add_default_handler
from phy.utils.tempdir import TemporaryDirectory


#------------------------------------------------------------------------------
# Common fixtures
#------------------------------------------------------------------------------

logging.getLogger().setLevel(logging.DEBUG)
add_default_handler('DEBUG')

# Fix the random seed in the tests.
np.random.seed(2015)


@yield_fixture
def tempdir():
    with TemporaryDirectory() as tempdir:
        yield tempdir


@yield_fixture
def chdir_tempdir():
    curdir = os.getcwd()
    with TemporaryDirectory() as tempdir:
Пример #4
0
import logging
import numpy as np
import os

from pytest import yield_fixture

from phy import add_default_handler
from phy.utils.tempdir import TemporaryDirectory

#------------------------------------------------------------------------------
# Common fixtures
#------------------------------------------------------------------------------

logging.getLogger().setLevel(logging.DEBUG)
add_default_handler('DEBUG')

# Fix the random seed in the tests.
np.random.seed(2015)


@yield_fixture
def tempdir():
    with TemporaryDirectory() as tempdir:
        yield tempdir


@yield_fixture
def chdir_tempdir():
    curdir = os.getcwd()
    with TemporaryDirectory() as tempdir:
Пример #5
0
Файл: cli.py Проект: mspacek/phy
import click
from six import exec_

from phy import (add_default_handler, DEBUG, PDB, IPYTHON, _Formatter,
                 _logger_fmt, __version_git__, discover_plugins)
from phy.utils import _fullname
from phy.utils.testing import _enable_pdb, _enable_profiler, _profile

logger = logging.getLogger(__name__)

#------------------------------------------------------------------------------
# Set up logging with the CLI tool
#------------------------------------------------------------------------------

add_default_handler(level='DEBUG' if DEBUG else 'INFO')


def exceptionHandler(exception_type, exception, traceback):  # pragma: no cover
    logger.error("An error has occurred (%s): %s", exception_type.__name__,
                 exception)
    logger.debug(''.join(format_exception(exception_type, exception,
                                          traceback)))


# Only show traceback in debug mode (--debug).
# if not DEBUG:
sys.excepthook = exceptionHandler


def _add_log_file(filename):
Пример #6
0
import logging
import numpy as np
import os

from pytest import yield_fixture

from phy import add_default_handler
from phy.utils.tempdir import TemporaryDirectory


#------------------------------------------------------------------------------
# Common fixtures
#------------------------------------------------------------------------------

logging.getLogger().setLevel(10)
add_default_handler(5)

# Fix the random seed in the tests.
np.random.seed(2015)


@yield_fixture
def tempdir():
    with TemporaryDirectory() as tempdir:
        yield tempdir


@yield_fixture
def chdir_tempdir():
    curdir = os.getcwd()
    with TemporaryDirectory() as tempdir: