<commit_before>"""PyAMG: Algebraic Multigrid Solvers in Python"""
from __future__ import absolute_import

import numpy as np
import scipy as sp

from .version import git_revision as __git_revision__
from .version import version as __version__

from .multilevel import coarse_grid_solver, multilevel_solver
from .classical import ruge_stuben_solver
from .aggregation import smoothed_aggregation_solver, rootnode_solver
from .gallery import demo
from .blackbox import solve, solver, solver_configuration

import warnings

__all__ = [__git_revision__, __version__,
           coarse_grid_solver, multilevel_solver,
           ruge_stuben_solver, smoothed_aggregation_solver, rootnode_solver,
           demo, solve, solver, solver_configuration]

__all__ = [s for s in dir() if not s.startswith('_')]
__all__ += ['test', '__version__']

__doc__ += """

Utility tools
-------------

  test        --- Run pyamg unittests (requires pytest)
  __version__ --- pyamg version string

"""

# Warn on old numpy or scipy.  Two digits.
npreq = '1.6'
npmin = [int(j) for j in npreq.split('.')]
npver = [int(j) for j in np.__version__.split('.')[:2]]
if npver[0] < npmin[0] or (npver[0] >= npmin[0] and npver[1] < npmin[1]):
    warnings.warn("Numpy %s or above is recommended for this version of"
                  "PyAMG (detected version %s)" % (npmin, npver),
                  UserWarning)

spreq = '0.11'
spmin = [int(j) for j in spreq.split('.')]
spver = [int(j) for j in sp.__version__.split('.')[:2]]
if spver[0] < spmin[0] or (spver[0] >= spmin[0] and spver[1] < spmin[1]):
    warnings.warn("SciPy %s or above is recommended for this version of"
                  "PyAMG (detected version %s)" % (spmin, spver),
                  UserWarning)


def test(verbose=False):
    import sys
    import os
    import pytest<commit_msg>more robust numpy/scipy version checks<commit_after>"""PyAMG: Algebraic Multigrid Solvers in Python"""
from __future__ import absolute_import

import numpy as np
import re
import scipy as sp

from .version import git_revision as __git_revision__
from .version import version as __version__

from .multilevel import coarse_grid_solver, multilevel_solver
from .classical import ruge_stuben_solver
from .aggregation import smoothed_aggregation_solver, rootnode_solver
from .gallery import demo
from .blackbox import solve, solver, solver_configuration

import warnings

__all__ = [__git_revision__, __version__,
           coarse_grid_solver, multilevel_solver,
           ruge_stuben_solver, smoothed_aggregation_solver, rootnode_solver,
           demo, solve, solver, solver_configuration]

__all__ = [s for s in dir() if not s.startswith('_')]
__all__ += ['test', '__version__']

__doc__ += """

Utility tools
-------------

  test        --- Run pyamg unittests (requires pytest)
  __version__ --- pyamg version string

"""

# Warn on old numpy or scipy.  Two digits.
npreq = '1.6'
npmin = [int(j) for j in npreq.split('.')]
m = re.match('(\d+)\.(\d+).*', np.__version__)
npver = [int(m.group(1)), int(m.group(2))]
if npver[0] < npmin[0] or (npver[0] >= npmin[0] and npver[1] < npmin[1]):
    warnings.warn("Numpy %s or above is recommended for this version of"
                  "PyAMG (detected version %s)" % (npmin, npver),
                  UserWarning)

spreq = '0.11'
spmin = [int(j) for j in spreq.split('.')]
m = re.match('(\d+)\.(\d+).*', sp.__version__)
spver = [int(m.group(1)), int(m.group(2))]
if spver[0] < spmin[0] or (spver[0] >= spmin[0] and spver[1] < spmin[1]):
    warnings.warn("SciPy %s or above is recommended for this version of"
                  "PyAMG (detected version %s)" % (spmin, spver),
                  UserWarning)


def test(verbose=False):
    import sys
    import os
    import pytest
{'fraction_non_alphanumeric': 0.1271660890429219, 'fraction_numerical': 0.010663822980538524, 'mean_word_length': 3.498800959232614, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1409856', 'n_tokens_mistral': 1318, 'n_tokens_neox': 1277, 'n_words': 383}