Skip to content

Commit cdbb6c4

Browse files
committed
BLD: upgrade pylint for python 3
1 parent dab1812 commit cdbb6c4

File tree

7 files changed

+22
-16
lines changed

7 files changed

+22
-16
lines changed

tensorflow_addons/custom_ops/image/cc/kernels/euclidean_distance_transform_op.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ class EuclideanDistanceTransformGenerator {
3838
int64 height_, width_;
3939

4040
public:
41-
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
42-
EuclideanDistanceTransformGenerator(typename TTypes<T, 4>::ConstTensor input)
41+
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE EuclideanDistanceTransformGenerator(
42+
typename TTypes<T, 4>::ConstTensor input)
4343
: input_(input) {
4444
height_ = input_.dimensions()[1];
4545
width_ = input_.dimensions()[2];

tensorflow_addons/image/utils.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,11 @@ def to_4D_image(image):
3535
Returns:
3636
4D tensor with the same type.
3737
"""
38-
# yapf:disable
3938
with tf.control_dependencies([
40-
tf.debugging.assert_rank_in(
41-
image, [2, 3, 4], message='`image` must be 2/3/4D tensor')
39+
tf.debugging.assert_rank_in( # pylint: disable=bad-continuation
40+
image, [2, 3, 4],
41+
message='`image` must be 2/3/4D tensor')
4242
]):
43-
# yapf: enable
4443
ndims = image.get_shape().ndims
4544
if ndims is None:
4645
return _dynamic_to_4D_image(image)
@@ -81,12 +80,12 @@ def from_4D_image(image, ndims):
8180
Returns:
8281
`ndims`-D tensor with the same type.
8382
"""
84-
# yapf:disable
8583
with tf.control_dependencies([
86-
tf.debugging.assert_rank(
87-
image, 4, message='`image` must be 4D tensor')
84+
tf.debugging.assert_rank( # pylint: disable=bad-continuation
85+
image,
86+
4,
87+
message='`image` must be 4D tensor')
8888
]):
89-
# yapf:enable
9089
if isinstance(ndims, tf.Tensor):
9190
return _dynamic_from_4D_image(image, ndims)
9291
elif ndims == 2:

tensorflow_addons/optimizers/weight_decay_optimizers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ def extend_with_decoupled_weight_decay(base_optimizer):
226226
227227
optimizer = tfa.optimizers.AdamW(learning_rate=lr, weight_decay=wd)
228228
```
229-
229+
230230
Note: you might want to register your own custom optimizer using
231231
`tf.keras.utils.get_custom_objects()`.
232232

tensorflow_addons/seq2seq/beam_search_decoder.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,8 +514,13 @@ def _maybe_sort_array_beams(self, t, parent_ids, sequence_length):
514514
self._beam_width):
515515
return t
516516
t = t.stack()
517+
# yapf:disable
517518
with tf.control_dependencies(
518-
[_check_batch_beam(t, self._batch_size, self._beam_width)]):
519+
[_check_batch_beam( # pylint: disable=bad-continuation
520+
t,
521+
self._batch_size,
522+
self._beam_width)]):
523+
# yapf:enable
519524
return gather_tree_from_array(t, parent_ids, sequence_length)
520525

521526
def step(self, time, inputs, state, training=None, name=None):
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# TODO: Upgrade pylint to 2.0 when python >= 3.4
2-
pylint == 1.6.4
1+
pylint == 1.9 ; python_version <= '2.7'
2+
pylint == 2.3.1 ; python_version > '2.7'
33
docformatter == 1.1
44
yapf == 0.26.0

tools/ci_build/install/install_ci_dependency.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ if [[ ! -d "tensorflow_addons" ]]; then
3636
exit 1
3737
fi
3838

39-
# Install python
39+
# Install python dependencies:
4040
CI_REQUIREMENT="$SCRIPT_DIR/ci_requirements.txt"
4141
pip install ${QUIET_FLAG} -r ${CI_REQUIREMENT}
4242

43-
# Check clang-format
43+
# Check clang-format:
4444
CLANG_FORMAT=${CLANG_FORMAT:-clang-format-3.8}
4545
which ${CLANG_FORMAT} > /dev/null
4646
if [[ $? != "0" ]]; then

tools/ci_build/pylintrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ disable=design,
7070
# TODO: remove not-callable when pylint can understand tf export paradigm
7171
not-callable,
7272
similarities,
73+
# TODO: enable it when pylint 1.6 (py2) support is dropping:
74+
unsupported-assignment-operation,
7375
useless-object-inheritance
7476

7577
# Enable the message, report, category or checker with the given id(s). You can

0 commit comments

Comments
 (0)