Skip to content

Commit

Permalink
Fix sparse namespace pylint (#179)
Browse files Browse the repository at this point in the history
  • Loading branch information
reminisce authored and eric-haibin-lin committed Aug 21, 2017
1 parent a90bf26 commit 1d8dce7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion python/mxnet/ndarray/op.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import sys as _sys
import os as _os
import ctypes
import numpy as np
import numpy as np # pylint: disable=unused-import

from ..ndarray_doc import _build_doc

Expand Down
4 changes: 2 additions & 2 deletions python/mxnet/ndarray/sparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
from ..context import Context
from . import _internal
from .ndarray import _DTYPE_NP_TO_MX, _DTYPE_MX_TO_NP
from .ndarray import _STORAGE_TYPE_STR_TO_ID, NDArrayBase
from .ndarray import _STORAGE_TYPE_STR_TO_ID
from .ndarray import NDArray, _storage_type
from .ndarray import zeros as _zeros_ndarray
from .ndarray import array as _array
Expand All @@ -61,13 +61,13 @@
if int(_os.environ.get("MXNET_ENFORCE_CYTHON", False)) != 0:
raise ImportError("Cython Module cannot be loaded but MXNET_ENFORCE_CYTHON=1")
from .._ctypes.ndarray import _set_ndarray_class
# pylint: enable=unused-import


__all__ = ["_ndarray_cls", "csr_matrix", "row_sparse_array",
"BaseSparseNDArray", "CSRNDArray", "RowSparseNDArray"]


# pylint: enable=unused-import
_STORAGE_AUX_TYPES = {
'row_sparse': [np.int64],
'csr': [np.int64, np.int64]
Expand Down
18 changes: 10 additions & 8 deletions python/mxnet/symbol/op.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,34 @@
import sys as _sys
import os as _os
import ctypes
import numpy as _numpy
import numpy as _numpy # pylint: disable=unused-import

from mxnet.base import mx_uint, check_call, _LIB, py_str, OpHandle, c_str
from mxnet.symbol_doc import _build_doc

# Use different version of SymbolBase
# When possible, use cython to speedup part of computation.
# pylint: disable=unused-import
try:
if int(_os.environ.get("MXNET_ENABLE_CYTHON", True)) == 0:
from .._ctypes.symbol import SymbolBase, _set_symbol_class
from .._ctypes.symbol import _symbol_creator # pylint: disable=unused-import
from .._ctypes.symbol import _symbol_creator
elif _sys.version_info >= (3, 0):
from .._cy3.symbol import SymbolBase, _set_symbol_class
from .._cy3.symbol import _symbol_creator # pylint: disable=unused-import
from .._cy3.symbol import _symbol_creator
else:
from .._cy2.symbol import SymbolBase, _set_symbol_class
from .._cy2.symbol import _symbol_creator # pylint: disable=unused-import
from .._cy2.symbol import _symbol_creator
except ImportError:
if int(_os.environ.get("MXNET_ENFORCE_CYTHON", False)) != 0:
raise ImportError("Cython Module cannot be loaded but MXNET_ENFORCE_CYTHON=1")
from .._ctypes.symbol import SymbolBase, _set_symbol_class
from .._ctypes.symbol import _symbol_creator # pylint: disable=unused-import
from .._ctypes.symbol import _symbol_creator

from ..base import _Null # pylint: disable=unused-import
from ..name import NameManager # pylint: disable=unused-import
from ..attribute import AttrScope # pylint: disable=unused-import
from ..base import _Null
from ..name import NameManager
from ..attribute import AttrScope
# pylint: enable=unused-import


def _make_atomic_symbol_function(handle, name):
Expand Down

0 comments on commit 1d8dce7

Please sign in to comment.