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

isort #2469

Merged
merged 1 commit into from
Oct 7, 2018
Merged

isort #2469

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 asv_bench/benchmarks/dataset_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import xarray as xr

from . import randn, randint, requires_dask
from . import randint, randn, requires_dask

try:
import dask
Expand Down
1 change: 1 addition & 0 deletions asv_bench/benchmarks/unstacking.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import absolute_import, division, print_function

import numpy as np

import xarray as xr

from . import requires_dask
Expand Down
4 changes: 2 additions & 2 deletions properties/test_encode_decode.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"""
from __future__ import absolute_import, division, print_function

from hypothesis import given, settings
import hypothesis.strategies as st
import hypothesis.extra.numpy as npst
import hypothesis.strategies as st
from hypothesis import given, settings

import xarray as xr

Expand Down
4 changes: 1 addition & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#!/usr/bin/env python
import sys

from setuptools import find_packages, setup

import versioneer

from setuptools import find_packages, setup

DISTNAME = 'xarray'
LICENSE = 'Apache'
Expand Down
10 changes: 6 additions & 4 deletions versioneer.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,17 +277,19 @@
"""

from __future__ import print_function
try:
import configparser
except ImportError:
import ConfigParser as configparser

import errno
import json
import os
import re
import subprocess
import sys

try:
import configparser
except ImportError:
import ConfigParser as configparser


class VersioneerConfig:
"""Container for Versioneer configuration parameters."""
Expand Down
3 changes: 1 addition & 2 deletions xarray/backends/netCDF4_.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
from .. import Variable, coding
from ..coding.variables import pop_to
from ..core import indexing
from ..core.pycompat import (
PY3, OrderedDict, basestring, iteritems, suppress)
from ..core.pycompat import PY3, OrderedDict, basestring, iteritems, suppress
from ..core.utils import FrozenOrderedDict, close_on_error, is_remote_uri
from .common import (
HDF5_LOCK, BackendArray, DataStorePickleMixin, WritableCFDataStore,
Expand Down
11 changes: 4 additions & 7 deletions xarray/backends/pseudonetcdf_.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import, division, print_function

import functools

import numpy as np

from .. import Variable
from ..core.pycompat import OrderedDict
from ..core.utils import (FrozenOrderedDict, Frozen)
from ..core import indexing

from .common import AbstractDataStore, DataStorePickleMixin, BackendArray
from ..core.pycompat import OrderedDict
from ..core.utils import Frozen, FrozenOrderedDict
from .common import AbstractDataStore, BackendArray, DataStorePickleMixin


class PncArrayWrapper(BackendArray):
Expand Down
2 changes: 1 addition & 1 deletion xarray/backends/rasterio_.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import warnings
from collections import OrderedDict
from distutils.version import LooseVersion
import warnings

import numpy as np

Expand Down
5 changes: 2 additions & 3 deletions xarray/coding/cftime_offsets.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,14 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

import re

from datetime import timedelta
from functools import partial

import numpy as np

from .cftimeindex import _parse_iso8601_with_reso, CFTimeIndex
from .times import format_cftime_datetime
from ..core.pycompat import basestring
from .cftimeindex import CFTimeIndex, _parse_iso8601_with_reso
from .times import format_cftime_datetime


def get_date_type(calendar):
Expand Down
1 change: 1 addition & 0 deletions xarray/coding/cftimeindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

from __future__ import absolute_import

import re
from datetime import timedelta

Expand Down
4 changes: 2 additions & 2 deletions xarray/coding/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
from ..core.pycompat import bytes_type, dask_array_type, unicode_type
from ..core.variable import Variable
from .variables import (
VariableCoder, lazy_elemwise_func, pop_to,
safe_setitem, unpack_for_decoding, unpack_for_encoding)
VariableCoder, lazy_elemwise_func, pop_to, safe_setitem,
unpack_for_decoding, unpack_for_encoding)


def create_vlen_dtype(element_type):
Expand Down
2 changes: 1 addition & 1 deletion xarray/coding/times.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import numpy as np
import pandas as pd

from ..core.common import contains_cftime_datetimes
from ..core import indexing
from ..core.common import contains_cftime_datetimes
from ..core.formatting import first_n_items, format_timestamp, last_item
from ..core.options import OPTIONS
from ..core.pycompat import PY3
Expand Down
4 changes: 2 additions & 2 deletions xarray/conventions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
import numpy as np
import pandas as pd

from .coding import times, strings, variables
from .coding import strings, times, variables
from .coding.variables import SerializationWarning
from .core import duck_array_ops, indexing
from .core.pycompat import (
OrderedDict, basestring, bytes_type, iteritems, dask_array_type,
OrderedDict, basestring, bytes_type, dask_array_type, iteritems,
unicode_type)
from .core.variable import IndexVariable, Variable, as_variable

Expand Down
2 changes: 1 addition & 1 deletion xarray/core/accessors.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import numpy as np
import pandas as pd

from .common import is_np_datetime_like, _contains_datetime_like_objects
from .common import _contains_datetime_like_objects, is_np_datetime_like
from .pycompat import dask_array_type


Expand Down
2 changes: 1 addition & 1 deletion xarray/core/combine.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
from .alignment import align
from .merge import merge
from .pycompat import OrderedDict, basestring, iteritems
from .variable import concat as concat_vars
from .variable import IndexVariable, Variable, as_variable
from .variable import concat as concat_vars


def concat(objs, dim=None, data_vars='all', coords='different',
Expand Down
5 changes: 2 additions & 3 deletions xarray/core/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@
import numpy as np
import pandas as pd

from . import duck_array_ops, dtypes, formatting, ops
from . import dtypes, duck_array_ops, formatting, ops
from .arithmetic import SupportsArithmetic
from .pycompat import OrderedDict, basestring, dask_array_type, suppress
from .utils import either_dict_or_kwargs, Frozen, SortedKeysDict, ReprObject

from .utils import Frozen, ReprObject, SortedKeysDict, either_dict_or_kwargs

# Used as a sentinel value to indicate a all dimensions
ALL_DIMS = ReprObject('<all-dims>')
Expand Down
8 changes: 4 additions & 4 deletions xarray/core/computation.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
Functions for applying functions that act on arrays to xarray's labeled data.
"""
from __future__ import absolute_import, division, print_function
from distutils.version import LooseVersion

import functools
import itertools
import operator
from collections import Counter
from distutils.version import LooseVersion

import numpy as np

from . import duck_array_ops
from . import utils
from . import duck_array_ops, utils
from .alignment import deep_align
from .merge import expand_and_merge_variables
from .pycompat import OrderedDict, dask_array_type, basestring
from .pycompat import OrderedDict, basestring, dask_array_type
from .utils import is_dict_like

_DEFAULT_FROZEN_SET = frozenset()
Expand Down
2 changes: 1 addition & 1 deletion xarray/core/dask_array_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

from distutils.version import LooseVersion

import dask.array as da
import numpy as np
from dask import __version__ as dask_version
import dask.array as da

try:
from dask.array import isin
Expand Down
4 changes: 2 additions & 2 deletions xarray/core/dask_array_ops.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from __future__ import absolute_import, division, print_function

from distutils.version import LooseVersion

import numpy as np

from . import nputils
from . import dtypes
from . import dtypes, nputils

try:
import dask
Expand Down
8 changes: 4 additions & 4 deletions xarray/core/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
alignment, computation, duck_array_ops, formatting, groupby, indexing, ops,
resample, rolling, utils)
from .. import conventions
from ..coding.cftimeindex import _parse_array_of_cftime_strings
from .alignment import align
from .common import (
ALL_DIMS, DataWithCoords, ImplementsDatasetReduce,
Expand All @@ -31,12 +32,11 @@
from .pycompat import (
OrderedDict, basestring, dask_array_type, integer_types, iteritems, range)
from .utils import (
Frozen, SortedKeysDict, either_dict_or_kwargs, decode_numpy_dict_values,
ensure_us_time_resolution, hashable, maybe_wrap_array, datetime_to_numeric)
Frozen, SortedKeysDict, datetime_to_numeric, decode_numpy_dict_values,
either_dict_or_kwargs, ensure_us_time_resolution, hashable,
maybe_wrap_array)
from .variable import IndexVariable, Variable, as_variable, broadcast_variables

from ..coding.cftimeindex import _parse_array_of_cftime_strings

# list of attributes of pd.DatetimeIndex that are ndarrays of time info
_DATETIMEINDEX_COMPONENTS = ['year', 'month', 'day', 'hour', 'minute',
'second', 'microsecond', 'nanosecond', 'date',
Expand Down
3 changes: 1 addition & 2 deletions xarray/core/formatting.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@

from .options import OPTIONS
from .pycompat import (
PY2, bytes_type, dask_array_type, unicode_type, zip_longest,
)
PY2, bytes_type, dask_array_type, unicode_type, zip_longest)

try:
from pandas.errors import OutOfBoundsDatetime
Expand Down
7 changes: 3 additions & 4 deletions xarray/core/missing.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
from __future__ import absolute_import, division, print_function

import warnings
from collections import Iterable
from functools import partial

import warnings

import numpy as np
import pandas as pd

from . import rolling
from .common import _contains_datetime_like_objects
from .computation import apply_ufunc
from .duck_array_ops import dask_array_type
from .pycompat import iteritems
from .utils import is_scalar, OrderedSet, datetime_to_numeric
from .utils import OrderedSet, datetime_to_numeric, is_scalar
from .variable import Variable, broadcast_variables
from .duck_array_ops import dask_array_type


class BaseInterpolator(object):
Expand Down
7 changes: 3 additions & 4 deletions xarray/core/nanops.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

import numpy as np

from . import dtypes
from . import dtypes, nputils
from .duck_array_ops import (
_dask_or_eager_func, count, fillna, isnull, where_method)
from .pycompat import dask_array_type
from . duck_array_ops import (count, isnull, fillna, where_method,
_dask_or_eager_func)
from . import nputils

try:
import dask.array as dask_array
Expand Down
1 change: 1 addition & 0 deletions xarray/core/npcompat.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import absolute_import, division, print_function

from distutils.version import LooseVersion

import numpy as np

try:
Expand Down
2 changes: 1 addition & 1 deletion xarray/core/resample.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import absolute_import, division, print_function

from . import ops
from .groupby import DataArrayGroupBy, DatasetGroupBy, DEFAULT_DIMS
from .groupby import DEFAULT_DIMS, DataArrayGroupBy, DatasetGroupBy
from .pycompat import OrderedDict, dask_array_type

RESAMPLE_DIM = '__resample_dim__'
Expand Down
1 change: 1 addition & 0 deletions xarray/plot/facetgrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import warnings

import numpy as np

from ..core.formatting import format_item
from ..core.pycompat import getargspec
from .utils import (
Expand Down
1 change: 0 additions & 1 deletion xarray/plot/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from ..core.options import OPTIONS
from ..core.pycompat import basestring
from ..core.utils import is_scalar
from ..core.options import OPTIONS

ROBUST_PERCENTILE = 2.0

Expand Down
12 changes: 5 additions & 7 deletions xarray/tests/test_cftime_offsets.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import pytest

from itertools import product

import numpy as np
import pytest

from xarray.coding.cftime_offsets import (
BaseCFTimeOffset, YearBegin, YearEnd, MonthBegin, MonthEnd,
Day, Hour, Minute, Second, _days_in_month,
to_offset, get_date_type, _MONTH_ABBREVIATIONS, to_cftime_datetime,
cftime_range)
from xarray import CFTimeIndex
from xarray.coding.cftime_offsets import (
_MONTH_ABBREVIATIONS, BaseCFTimeOffset, Day, Hour, Minute, MonthBegin,
MonthEnd, Second, YearBegin, YearEnd, _days_in_month, cftime_range,
get_date_type, to_cftime_datetime, to_offset)

cftime = pytest.importorskip('cftime')

Expand Down
11 changes: 5 additions & 6 deletions xarray/tests/test_cftimeindex.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
from __future__ import absolute_import

import pytest
from datetime import timedelta

import numpy as np
import pandas as pd
import xarray as xr
import pytest

from datetime import timedelta
import xarray as xr
from xarray.coding.cftimeindex import (
parse_iso8601, CFTimeIndex, assert_all_valid_date_type,
_parsed_string_to_bounds, _parse_iso8601_with_reso,
_parse_array_of_cftime_strings)
CFTimeIndex, _parse_array_of_cftime_strings, _parse_iso8601_with_reso,
_parsed_string_to_bounds, assert_all_valid_date_type, parse_iso8601)
from xarray.tests import assert_array_equal, assert_identical

from . import has_cftime, has_cftime_or_netCDF4, requires_cftime
Expand Down
Loading