Skip to content

MRG, MAINT: Tweak CIs #7943

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Jun 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ upload-pipy:
flake:
@if command -v flake8 > /dev/null; then \
echo "Running flake8"; \
flake8 --count mne examples tutorials setup.py; \
flake8 --count; \
else \
echo "flake8 not found, please install it!"; \
exit 1; \
Expand Down
59 changes: 29 additions & 30 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@
]

linkcheck_ignore = [
'https://doi.org/10.1088/0031-9155/57/7/1937', # 403 Client Error: Forbidden for url: http://iopscience.iop.org/article/10.1088/0031-9155/57/7/1937/meta
'https://doi.org/10.1088/0031-9155/51/7/008', # 403 Client Error: Forbidden for url: https://iopscience.iop.org/article/10.1088/0031-9155/51/7/008
'https://sccn.ucsd.edu/wiki/.*', # HTTPSConnectionPool(host='sccn.ucsd.edu', port=443): Max retries exceeded with url: /wiki/Firfilt_FAQ (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:847)'),))
'https://docs.python.org/dev/howto/logging.html', # ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
'https://docs.python.org/3/library/.*', # ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
'https://hal.archives-ouvertes.fr/hal-01848442/', # Sometimes: 503 Server Error: Service Unavailable for url: https://hal.archives-ouvertes.fr/hal-01848442/
'https://doi.org/10.1088/0031-9155/57/7/1937', # noqa 403 Client Error: Forbidden for url: http://iopscience.iop.org/article/10.1088/0031-9155/57/7/1937/meta
'https://doi.org/10.1088/0031-9155/51/7/008', # noqa 403 Client Error: Forbidden for url: https://iopscience.iop.org/article/10.1088/0031-9155/51/7/008
'https://sccn.ucsd.edu/wiki/.*', # noqa HTTPSConnectionPool(host='sccn.ucsd.edu', port=443): Max retries exceeded with url: /wiki/Firfilt_FAQ (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:847)'),))
'https://docs.python.org/dev/howto/logging.html', # noqa ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
'https://docs.python.org/3/library/.*', # noqa ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
'https://hal.archives-ouvertes.fr/hal-01848442/', # noqa Sometimes: 503 Server Error: Service Unavailable for url: https://hal.archives-ouvertes.fr/hal-01848442/
]
linkcheck_anchors = False # saves a bit of time

Expand All @@ -95,7 +95,7 @@
source_suffix = '.rst'

# The encoding of source files.
#source_encoding = 'utf-8-sig'
# source_encoding = 'utf-8-sig'

# The master toctree document.
master_doc = 'index'
Expand All @@ -120,13 +120,13 @@

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
# language = None

# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
# today_fmt = '%B %d, %Y'

# List of documents that shouldn't be included in the build.
unused_docs = []
Expand All @@ -140,15 +140,15 @@
default_role = "py:obj"

# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# add_function_parentheses = True

# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# add_module_names = True

# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# show_authors = False

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'default'
Expand All @@ -157,7 +157,7 @@
modindex_common_prefix = ['mne.']

# If true, keep warnings as "system message" paragraphs in the built documents.
#keep_warnings = False
# keep_warnings = False


# -- Options for HTML output ----------------------------------------------
Expand Down Expand Up @@ -189,10 +189,10 @@

# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
#html_title = None
# html_title = None

# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
# html_short_title = None

# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
Expand Down Expand Up @@ -220,27 +220,27 @@

# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'
# html_last_updated_fmt = '%b %d, %Y'

# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# html_use_smartypants = True

# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# html_sidebars = {}

# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# html_additional_pages = {}

# If false, no module index is generated.
#html_domain_indices = True
# html_domain_indices = True

# If false, no index is generated.
#html_use_index = True
# html_use_index = True

# If true, the index is split into individual pages for each letter.
#html_split_index = False
# html_split_index = False

# If true, links to the reST sources are added to the pages.
html_show_sourcelink = False
Expand All @@ -250,12 +250,12 @@
html_show_sphinx = False

# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True
# html_show_copyright = True

# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
# html_use_opensearch = ''

# variables to pass to HTML templating engine
build_dev_html = bool(int(os.environ.get('BUILD_DEV_HTML', False)))
Expand All @@ -264,7 +264,7 @@
'use_media_buttons': True, 'build_dev_html': build_dev_html}

# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None
# html_file_suffix = None

# Output file base name for HTML help builder.
htmlhelp_basename = 'mne-doc'
Expand All @@ -282,8 +282,8 @@
# (source start file, target name, title, author, documentclass
# [howto/manual]).
latex_documents = [
# ('index', 'MNE.tex', u'MNE Manual',
# u'MNE Contributors', 'manual'),
# ('index', 'MNE.tex', u'MNE Manual',
# u'MNE Contributors', 'manual'),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -463,7 +463,7 @@ def reset_warnings(gallery_conf, fname):
'scipy.* is deprecated and will be removed in', # dipy
r'Converting `np\.character` to a dtype is deprecated', # vtk
r'sphinx\.util\.smartypants is deprecated',
'is a deprecated alias for the builtin', # NumPy
'is a deprecated alias for the builtin', # NumPy
):
warnings.filterwarnings( # deal with other modules having bad imports
'ignore', message=".*%s.*" % key, category=DeprecationWarning)
Expand Down Expand Up @@ -622,7 +622,6 @@ def reset_warnings(gallery_conf, fname):
'n_elp', 'n_pts', 'n_tris', 'n_nodes', 'n_nonzero', 'n_events_out',
'n_segments', 'n_orient_inv', 'n_orient_fwd', 'n_orient', 'n_dipoles_lcmv',
'n_dipoles_fwd',

# Undocumented (on purpose)
'RawKIT', 'RawEximia', 'RawEGI', 'RawEEGLAB', 'RawEDF', 'RawCTF', 'RawBTi',
'RawBrainVision', 'RawCurry', 'RawNIRX', 'RawGDF',
Expand Down
2 changes: 1 addition & 1 deletion doc/conftest.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from mne.conftest import *
from mne.conftest import * # noqa
4 changes: 2 additions & 2 deletions doc/sphinxext/flow_diagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ def generate_flow_diagram(app):
del node
g.get_node('legend').attr.update(shape='plaintext', margin=0, rank='sink')
# put legend in same rank/level as inverse
l = g.add_subgraph(['legend', 'inv'], name='legendy')
l.graph_attr['rank'] = 'same'
leg = g.add_subgraph(['legend', 'inv'], name='legendy')
leg.graph_attr['rank'] = 'same'

g.layout('dot')
g.draw(out_fname, format='svg')
Expand Down
4 changes: 1 addition & 3 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ channels:
dependencies:
- python>=3.5
- pip
- mkl
- numpy
- scipy
- matplotlib
Expand Down Expand Up @@ -33,8 +32,7 @@ dependencies:
- mne
- https://github.com/numpy/numpydoc/archive/master.zip
- imageio-ffmpeg>=0.4.1
- vtk<8.2; platform_system == "Darwin"
- vtk; platform_system != "Darwin"
- vtk>=9.0.1
- pyvista>=0.24
- pyvistaqt
- https://github.com/enthought/mayavi/archive/master.zip
Expand Down
3 changes: 2 additions & 1 deletion mne/beamformer/_compute_beamformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from scipy import linalg

from ..cov import Covariance, make_ad_hoc_cov
from ..fixes import dict_
from ..forward.forward import is_fixed_orient, _restrict_forward_to_src_sel
from ..io.proj import make_projector, Projection
from ..minimum_norm.inverse import _get_vertno, _prepare_forward
Expand Down Expand Up @@ -406,7 +407,7 @@ def _compute_power(Cm, W, n_orient):
return source_power


class Beamformer(dict):
class Beamformer(dict_):
"""A computed beamformer.

Notes
Expand Down
4 changes: 2 additions & 2 deletions mne/bem.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from .utils import (verbose, logger, run_subprocess, get_subjects_dir, warn,
_pl, _validate_type, _TempDir, _check_freesurfer_home,
_check_fname, has_nibabel)
from .fixes import einsum
from .fixes import einsum, dict_


# ############################################################################
Expand All @@ -47,7 +47,7 @@
#


class ConductorModel(dict):
class ConductorModel(dict_):
"""BEM or sphere model."""

def __repr__(self): # noqa: D105
Expand Down
8 changes: 1 addition & 7 deletions mne/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,14 +297,8 @@ def _check_skip_backend(name):
def renderer_notebook():
"""Verify that pytest_notebook is installed."""
from mne.viz.backends.renderer import _use_test_3d_backend
try:
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
from pytest_notebook import execution
except ImportError:
pytest.skip("Test skipped, requires pytest-notebook")
with _use_test_3d_backend('notebook'):
yield execution
yield


@pytest.fixture(scope='function', params=[testing._pytest_param()])
Expand Down
4 changes: 2 additions & 2 deletions mne/cov.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
from . import viz

from .fixes import (BaseEstimator, EmpiricalCovariance, _logdet,
empirical_covariance, log_likelihood)
empirical_covariance, log_likelihood, dict_)


def _check_covs_algebra(cov1, cov2):
Expand All @@ -63,7 +63,7 @@ def _get_tslice(epochs, tmin, tmax):
return tslice


class Covariance(dict):
class Covariance(dict_):
"""Noise covariance matrix.

.. warning:: This class should not be instantiated directly, but
Expand Down
58 changes: 58 additions & 0 deletions mne/fixes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1091,3 +1091,61 @@ def mean(array, axis):
@contextmanager
def nullcontext(enter_result=None):
yield enter_result


###############################################################################
# Work around autosummary making bad :class: links
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this sucks. It was working with an older version? if so can we rather pin the version rather than crippling our code?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this cripple our code? It just replaces a few docstrings. Subclassing like isinstance(x, dict) are still fine. Overhead should be minimal.

The problem is that numpydoc improved the signature extraction, and we hit a bug now with autosummary trying to add effectively:

:class:`v, remove specified key and return the corresponding value.`

to correspond to the D.pop() -> v, remove specified key and return the corresponding value. docstring.

This seemed like the cleanest solution, but I'm open to other ideas.


class dict_(dict):

def clear(self):
"""D.clear() -> None

Remove all items from D.
"""
return super().clear()

def copy(self):
"""D.copy() -> dict

a shallow copy of D."""
return super().copy()

def items(self):
"""D.items() -> object

A set-like object providing a view on D's items.
"""
return super().items()

def keys(self):
"""D.keys() -> object

A set-like object providing a view on D's keys.
"""
return super().keys()

def pop(self, k, *args, **kwargs):
"""D.pop(k[,d]) -> object

Remove specified key and return the corresponding value.
If key is not found, d is returned if given, otherwise KeyError is raised.
"""
return super().pop(k, *args, **kwargs)

def update(self, *E, **F):
"""D.update([E, ]**F) -> None

Update D from dict/iterable E and F.
If E is present and has a .keys() method, then does: for k in E: D[k] = E[k]
If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v
In either case, this is followed by: for k in F: D[k] = F[k]
"""
return super().update(*E, **F)

def values(self):
"""D.values() -> object

An object providing a view on D's values.
"""
return super().values()
4 changes: 2 additions & 2 deletions mne/forward/forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@
_validate_type, _check_compensation_grade, _check_option,
_check_stc_units, _stamp_to_dt)
from ..label import Label
from ..fixes import einsum
from ..fixes import einsum, dict_


class Forward(dict):
class Forward(dict_):
"""Forward class to represent info from forward solution.

Attributes
Expand Down
3 changes: 2 additions & 1 deletion mne/io/meas_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import numpy as np
from scipy import linalg

from ..fixes import dict_
from .pick import channel_type, pick_channels, pick_info
from .constants import FIFF
from .open import fiff_open
Expand Down Expand Up @@ -192,7 +193,7 @@ def _format_trans(obj, key):


# XXX Eventually this should be de-duplicated with the MNE-MATLAB stuff...
class Info(dict, MontageMixin):
class Info(dict_, MontageMixin):
"""Measurement information.

This data structure behaves like a dictionary. It contains all metadata
Expand Down
3 changes: 2 additions & 1 deletion mne/io/proj.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@
from .write import (write_int, write_float, write_string, write_name_list,
write_float_matrix, end_block, start_block)
from ..defaults import _BORDER_DEFAULT, _EXTRAPOLATE_DEFAULT
from ..fixes import dict_
from ..utils import logger, verbose, warn, fill_doc


class Projection(dict):
class Projection(dict_):
"""Projection vector.

A basic class to proj a meaningful print for projection vectors.
Expand Down
Loading