diff --git a/ci/docker/Dockerfile.build.ubuntu_cpu b/ci/docker/Dockerfile.build.ubuntu_cpu index f86c2f2e724b..86531a3cdd83 100755 --- a/ci/docker/Dockerfile.build.ubuntu_cpu +++ b/ci/docker/Dockerfile.build.ubuntu_cpu @@ -28,22 +28,20 @@ COPY install/ubuntu_core.sh /work/ RUN /work/ubuntu_core.sh COPY install/ubuntu_python.sh /work/ RUN /work/ubuntu_python.sh -COPY install/ubuntu_scala.sh /work/ -RUN /work/ubuntu_scala.sh -COPY install/ubuntu_r.sh /work/ -RUN /work/ubuntu_r.sh -COPY install/ubuntu_perl.sh /work/ -RUN /work/ubuntu_perl.sh -COPY install/ubuntu_lint.sh /work/ -RUN /work/ubuntu_lint.sh -COPY install/ubuntu_clang.sh /work/ -RUN /work/ubuntu_clang.sh -COPY install/ubuntu_mklml.sh /work/ -RUN /work/ubuntu_mklml.sh -COPY install/ubuntu_caffe.sh /work/ -RUN /work/ubuntu_caffe.sh -COPY install/ubuntu_docs.sh /work/ -RUN /work/ubuntu_docs.sh +#COPY install/ubuntu_scala.sh /work/ +#RUN /work/ubuntu_scala.sh +#COPY install/ubuntu_r.sh /work/ +#RUN /work/ubuntu_r.sh +#COPY install/ubuntu_perl.sh /work/ +#RUN /work/ubuntu_perl.sh +#COPY install/ubuntu_clang.sh /work/ +#RUN /work/ubuntu_clang.sh +#COPY install/ubuntu_mklml.sh /work/ +#RUN /work/ubuntu_mklml.sh +#COPY install/ubuntu_caffe.sh /work/ +#RUN /work/ubuntu_caffe.sh +#COPY install/ubuntu_docs.sh /work/ +#RUN /work/ubuntu_docs.sh COPY install/ubuntu_adduser.sh /work/ RUN /work/ubuntu_adduser.sh diff --git a/ci/docker/install/ubuntu_core.sh b/ci/docker/install/ubuntu_core.sh index e78f29ae0a93..dc9b091f2055 100755 --- a/ci/docker/install/ubuntu_core.sh +++ b/ci/docker/install/ubuntu_core.sh @@ -34,9 +34,7 @@ apt-get install -y \ unzip \ sudo \ software-properties-common \ - ninja-build \ - python-pip + ninja-build # Link Openblas to Cblas as this link does not exist on ubuntu16.04 ln -s /usr/lib/libopenblas.so /usr/lib/libcblas.so -pip install cpplint==1.3.0 pylint==1.8.2 \ No newline at end of file diff --git a/ci/docker/install/ubuntu_lint.sh b/ci/docker/install/ubuntu_lint.sh deleted file mode 100755 index f3a1d6ba2441..000000000000 --- a/ci/docker/install/ubuntu_lint.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -# build and install are separated so changes to build don't invalidate -# the whole docker cache for the image - -set -ex -apt-get update -apt-get install -y python-pip sudo \ No newline at end of file diff --git a/ci/docker/install/ubuntu_python.sh b/ci/docker/install/ubuntu_python.sh index b19448eecab8..b906b55f7509 100755 --- a/ci/docker/install/ubuntu_python.sh +++ b/ci/docker/install/ubuntu_python.sh @@ -29,5 +29,5 @@ wget -nv https://bootstrap.pypa.io/get-pip.py python3 get-pip.py python2 get-pip.py -pip2 install nose pylint numpy nose-timer requests h5py scipy -pip3 install nose pylint numpy nose-timer requests h5py scipy \ No newline at end of file +pip2 install nose cpplint==1.3.0 pylint==1.8.3 numpy nose-timer requests h5py scipy +pip3 install nose cpplint==1.3.0 pylint==1.8.3 numpy nose-timer requests h5py scipy diff --git a/python/mxnet/kvstore.py b/python/mxnet/kvstore.py index 221b94fda0fe..ac355eb97910 100644 --- a/python/mxnet/kvstore.py +++ b/python/mxnet/kvstore.py @@ -424,6 +424,7 @@ def set_gradient_compression(self, compression_params): Other keys in this dictionary are optional and specific to the type of gradient compression. """ + # pylint: disable=unsupported-membership-test if ('device' in self.type) or ('dist' in self.type): ckeys, cvals = _ctype_dict(compression_params) check_call(_LIB.MXKVStoreSetGradientCompression(self.handle, @@ -431,6 +432,7 @@ def set_gradient_compression(self, compression_params): ckeys, cvals)) else: raise Exception('Gradient compression is not supported for this type of kvstore') + # pylint: enable=unsupported-membership-test def set_optimizer(self, optimizer): """ Registers an optimizer with the kvstore. @@ -465,7 +467,7 @@ def set_optimizer(self, optimizer): is_worker = ctypes.c_int() check_call(_LIB.MXKVStoreIsWorkerNode(ctypes.byref(is_worker))) - # pylint: disable=invalid-name + # pylint: disable=invalid-name,unsupported-membership-test if 'dist' in self.type and is_worker.value: # send the optimizer to server try: @@ -476,7 +478,8 @@ def set_optimizer(self, optimizer): self._send_command_to_servers(0, optim_str) else: self._set_updater(opt.get_updater(optimizer)) - + # pylint: enable=unsupported-membership-test + @property def type(self): """ Returns the type of this kvstore. diff --git a/python/mxnet/model.py b/python/mxnet/model.py index 33dae1732599..c66b17cab34d 100644 --- a/python/mxnet/model.py +++ b/python/mxnet/model.py @@ -848,7 +848,7 @@ def fit(self, X, y=None, eval_data=None, eval_metric='acc', # init optmizer if isinstance(self.optimizer, str): batch_size = data.batch_size - if kvstore and 'dist' in kvstore.type and not '_async' in kvstore.type: + if kvstore and 'dist' in kvstore.type and '_async' not in kvstore.type: batch_size *= kvstore.num_workers optimizer = opt.create(self.optimizer, rescale_grad=(1.0/batch_size), diff --git a/python/mxnet/ndarray/ndarray.py b/python/mxnet/ndarray/ndarray.py index 536784586e38..a226b84a4689 100644 --- a/python/mxnet/ndarray/ndarray.py +++ b/python/mxnet/ndarray/ndarray.py @@ -1683,7 +1683,9 @@ def shape(self): pdata = ctypes.POINTER(mx_uint)() check_call(_LIB.MXNDArrayGetShape( self.handle, ctypes.byref(ndim), ctypes.byref(pdata))) + # pylint: disable=invalid-slice-index return tuple(pdata[:ndim.value]) + # pylint: enable=invalid-slice-index @property diff --git a/python/mxnet/symbol/register.py b/python/mxnet/symbol/register.py index 7b293f5fbea0..79ed6afa889a 100644 --- a/python/mxnet/symbol/register.py +++ b/python/mxnet/symbol/register.py @@ -126,12 +126,14 @@ def %s(*%s, **kwargs):"""%(func_name, arr_name)) else: keys.append(k) vals.append(v)"""%(func_name.lower())) + # pylint: disable=using-constant-test if key_var_num_args: code.append(""" if '%s' not in kwargs: keys.append('%s') vals.append(len(sym_args) + len(sym_kwargs))"""%( key_var_num_args, key_var_num_args)) + # pylint: enable=using-constant-test code.append(""" return _symbol_creator(%d, sym_args, sym_kwargs, keys, vals, name)"""%( diff --git a/python/mxnet/symbol/symbol.py b/python/mxnet/symbol/symbol.py index 59402e66c606..31463844aa3b 100644 --- a/python/mxnet/symbol/symbol.py +++ b/python/mxnet/symbol/symbol.py @@ -767,7 +767,9 @@ def __len__(self): """ output_count = mx_uint() check_call(_LIB.MXSymbolGetNumOutputs(self.handle, ctypes.byref(output_count))) + # pylint: disable=invalid-length-returned return output_count.value + # pylint: enable=invalid-length-returned def list_auxiliary_states(self): """Lists all the auxiliary states in the symbol. diff --git a/python/mxnet/torch.py b/python/mxnet/torch.py index fc815b146921..7fe126318f3b 100644 --- a/python/mxnet/torch.py +++ b/python/mxnet/torch.py @@ -142,6 +142,7 @@ def generic_torch_function(*args, **kwargs): for k in kwargs: kwargs[k] = str(kwargs[k]) + # pylint: disable=invalid-slice-index check_call(_LIB.MXFuncInvokeEx( \ handle, \ c_handle_array(ndargs[n_mutate_vars:]), \ @@ -150,10 +151,13 @@ def generic_torch_function(*args, **kwargs): ctypes.c_int(len(kwargs)), c_str_array(kwargs.keys()), c_str_array(kwargs.values()))) + if n_mutate_vars == 1: return ndargs[0] else: return ndargs[:n_mutate_vars] + # pylint: enable=invalid-slice-index + # End of function declaration ret_function = generic_torch_function ret_function.__name__ = func_name[4:]