Skip to content

Commit d5ae1c8

Browse files
agramfortlarsoner
authored andcommitted
[MRG] moving logging.py _logging.py (#5871)
* moving logging.py _logging.py * FIX: More general warn
1 parent d214798 commit d5ae1c8

File tree

10 files changed

+12
-14
lines changed

10 files changed

+12
-14
lines changed

mne/utils/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
from .docs import (copy_function_doc_to_method_doc, copy_doc, linkcode_resolve,
1919
open_docs, deprecated)
2020
from .fetching import _fetch_file, _url_to_local_path
21-
from .logging import (verbose, logger, set_log_level, set_log_file,
22-
use_log_level, catch_logging, warn, filter_out_warnings,
23-
ETSContext)
21+
from ._logging import (verbose, logger, set_log_level, set_log_file,
22+
use_log_level, catch_logging, warn, filter_out_warnings,
23+
ETSContext)
2424
from .misc import (run_subprocess, _pl, _clean_names, _Counter, pformat,
2525
_explain_exception, _get_argvalues, sizeof_fmt)
2626
from .progressbar import ProgressBar

mne/utils/logging.py renamed to mne/utils/_logging.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,12 +246,10 @@ def warn(message, category=RuntimeWarning, module='mne'):
246246
fname = frame.f_code.co_filename
247247
lineno = frame.f_lineno
248248
# in verbose dec
249-
if fname == '<string>' and last_fname == 'logging.py':
249+
if fname == '<string>' and last_fname == op.basename(__file__):
250250
last_fname = fname
251251
frame = frame.f_back
252252
continue
253-
if fname == '<string>':
254-
raise RuntimeError
255253
# treat tests as scripts
256254
# and don't capture unittest/case.py (assert_raises)
257255
if not (fname.startswith(root_dir) or

mne/utils/check.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
import numpy as np
1313

14-
from .logging import warn
14+
from ._logging import warn
1515

1616

1717
def _ensure_int(x, name='unknown', must_be='an int'):

mne/utils/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import numpy as np
2121

2222
from .check import _validate_type
23-
from .logging import warn, logger
23+
from ._logging import warn, logger
2424

2525

2626
_temp_home_dir = None

mne/utils/fetching.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from .progressbar import ProgressBar
1414
from .numerics import hashfunc
1515
from .misc import sizeof_fmt
16-
from .logging import warn, logger, verbose
16+
from ._logging import warn, logger, verbose
1717

1818

1919
def _get_http(url, temp_file_name, initial_size, file_size, timeout,

mne/utils/misc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import numpy as np
1919

2020
from ..fixes import _get_args
21-
from .logging import logger, verbose, warn
21+
from ._logging import logger, verbose, warn
2222

2323

2424
def _pl(x, non_pl=''):

mne/utils/mixin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import numpy as np
1414

1515
from .check import _check_pandas_installed, _check_preload, _validate_type
16-
from .logging import warn, verbose
16+
from ._logging import warn, verbose
1717
from .numerics import object_size, object_hash
1818

1919

mne/utils/numerics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import numpy as np
1515
from scipy import linalg, sparse
1616

17-
from .logging import logger, warn
17+
from ._logging import logger, warn
1818
from .check import check_random_state, _ensure_int, _validate_type
1919
from .docs import deprecated
2020

mne/utils/progressbar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
import numpy as np
1717

18-
from .logging import logger
18+
from ._logging import logger
1919
from .misc import sizeof_fmt
2020

2121

mne/utils/testing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
import numpy as np
2222

23-
from .logging import warn
23+
from ._logging import warn
2424

2525

2626
def _memory_usage(*args, **kwargs):

0 commit comments

Comments
 (0)