Skip to content
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

Use LooseVersion for bottleneck checks #1235

Merged
merged 1 commit into from
Jan 30, 2017
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
4 changes: 2 additions & 2 deletions xarray/core/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import inspect
import operator
import warnings
from distutils.version import StrictVersion
from distutils.version import LooseVersion

import numpy as np
import pandas as pd
Expand Down Expand Up @@ -525,7 +525,7 @@ def inject_bottleneck_rolling_methods(cls):

# bottleneck rolling methods
if has_bottleneck:
if StrictVersion(bn.__version__) < StrictVersion('1.0'):
if LooseVersion(bn.__version__) < LooseVersion('1.0'):
return

for bn_name, method_name in BOTTLENECK_ROLLING_METHODS.items():
Expand Down
4 changes: 2 additions & 2 deletions xarray/core/rolling.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from __future__ import print_function
import numpy as np
import warnings
from distutils.version import StrictVersion
from distutils.version import LooseVersion

from .pycompat import OrderedDict, zip
from .common import ImplementsRollingArrayReduce, full_like
Expand Down Expand Up @@ -51,7 +51,7 @@ def __init__(self, obj, min_periods=None, center=False, **windows):
"""

if (has_bottleneck and
(StrictVersion(bn.__version__) < StrictVersion('1.0'))):
(LooseVersion(bn.__version__) < LooseVersion('1.0'))):
warnings.warn('xarray requires bottleneck version of 1.0 or '
'greater for rolling operations. Rolling '
'aggregation methods will use numpy instead'
Expand Down
4 changes: 2 additions & 2 deletions xarray/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from __future__ import print_function
import warnings
from contextlib import contextmanager
from distutils.version import StrictVersion
from distutils.version import LooseVersion

import numpy as np
from numpy.testing import assert_array_equal
Expand Down Expand Up @@ -70,7 +70,7 @@

try:
import bottleneck
if StrictVersion(bottleneck.__version__) < StrictVersion('1.0'):
if LooseVersion(bottleneck.__version__) < LooseVersion('1.0'):
raise ImportError('Fall back to numpy')
has_bottleneck = True
except ImportError:
Expand Down