diff --git a/mmdet/core/anchor/anchor_generator.py b/mmdet/core/anchor/anchor_generator.py
index ec27c4c02c919af8103440966a69c723291ea427..cd227ad0665ce705a79a3a5328d2fbba2155b114 100644
--- a/mmdet/core/anchor/anchor_generator.py
+++ b/mmdet/core/anchor/anchor_generator.py
@@ -92,6 +92,7 @@ class AnchorGenerator(object):
         valid_y[:valid_h] = 1
         valid_xx, valid_yy = self._meshgrid(valid_x, valid_y)
         valid = valid_xx & valid_yy
-        valid = valid[:, None].expand(
-            valid.size(0), self.num_base_anchors).contiguous().view(-1)
+        valid = valid[:,
+                      None].expand(valid.size(0),
+                                   self.num_base_anchors).contiguous().view(-1)
         return valid
diff --git a/mmdet/core/anchor/anchor_target.py b/mmdet/core/anchor/anchor_target.py
index bba372ffae5d6ffb43bdb21bd76eb3e3e2725f5a..daf43c45e545127e33ee29aeb1c8fea55647513c 100644
--- a/mmdet/core/anchor/anchor_target.py
+++ b/mmdet/core/anchor/anchor_target.py
@@ -159,7 +159,9 @@ def anchor_target_single(flat_anchors,
             neg_inds)
 
 
-def anchor_inside_flags(flat_anchors, valid_flags, img_shape,
+def anchor_inside_flags(flat_anchors,
+                        valid_flags,
+                        img_shape,
                         allowed_border=0):
     img_h, img_w = img_shape[:2]
     if allowed_border >= 0:
diff --git a/mmdet/core/anchor/guided_anchor_target.py b/mmdet/core/anchor/guided_anchor_target.py
index 21abe5ec508722c13147c9b524fb86cd600a136e..bf43850b6d15689fae7d5a5d900cb9f1a7a61d37 100644
--- a/mmdet/core/anchor/guided_anchor_target.py
+++ b/mmdet/core/anchor/guided_anchor_target.py
@@ -94,12 +94,12 @@ def ga_loc_target(gt_bboxes_list,
             # calculate positive (center) regions
             ctr_x1, ctr_y1, ctr_x2, ctr_y2 = calc_region(
                 gt_, r1, featmap_sizes[lvl])
-            all_loc_targets[lvl][img_id, 0, ctr_y1:ctr_y2 + 1, ctr_x1:ctr_x2 +
-                                 1] = 1
-            all_loc_weights[lvl][img_id, 0, ignore_y1:ignore_y2 +
-                                 1, ignore_x1:ignore_x2 + 1] = 0
-            all_loc_weights[lvl][img_id, 0, ctr_y1:ctr_y2 + 1, ctr_x1:ctr_x2 +
-                                 1] = 1
+            all_loc_targets[lvl][img_id, 0, ctr_y1:ctr_y2 + 1,
+                                 ctr_x1:ctr_x2 + 1] = 1
+            all_loc_weights[lvl][img_id, 0, ignore_y1:ignore_y2 + 1,
+                                 ignore_x1:ignore_x2 + 1] = 0
+            all_loc_weights[lvl][img_id, 0, ctr_y1:ctr_y2 + 1,
+                                 ctr_x1:ctr_x2 + 1] = 1
             # calculate ignore map on nearby low level feature
             if lvl > 0:
                 d_lvl = lvl - 1
@@ -107,8 +107,8 @@ def ga_loc_target(gt_bboxes_list,
                 gt_ = gt_bboxes[gt_id, :4] / anchor_strides[d_lvl]
                 ignore_x1, ignore_y1, ignore_x2, ignore_y2 = calc_region(
                     gt_, r2, featmap_sizes[d_lvl])
-                all_ignore_map[d_lvl][img_id, 0, ignore_y1:ignore_y2 +
-                                      1, ignore_x1:ignore_x2 + 1] = 1
+                all_ignore_map[d_lvl][img_id, 0, ignore_y1:ignore_y2 + 1,
+                                      ignore_x1:ignore_x2 + 1] = 1
             # calculate ignore map on nearby high level feature
             if lvl < num_lvls - 1:
                 u_lvl = lvl + 1
@@ -116,8 +116,8 @@ def ga_loc_target(gt_bboxes_list,
                 gt_ = gt_bboxes[gt_id, :4] / anchor_strides[u_lvl]
                 ignore_x1, ignore_y1, ignore_x2, ignore_y2 = calc_region(
                     gt_, r2, featmap_sizes[u_lvl])
-                all_ignore_map[u_lvl][img_id, 0, ignore_y1:ignore_y2 +
-                                      1, ignore_x1:ignore_x2 + 1] = 1
+                all_ignore_map[u_lvl][img_id, 0, ignore_y1:ignore_y2 + 1,
+                                      ignore_x1:ignore_x2 + 1] = 1
     for lvl_id in range(num_lvls):
         # ignore negative regions w.r.t. ignore map
         all_loc_weights[lvl_id][(all_loc_weights[lvl_id] < 0)
diff --git a/mmdet/datasets/pipelines/transforms.py b/mmdet/datasets/pipelines/transforms.py
index e6d3b688d3d40873ceb68f88e5932272e10c8783..760b3b1d1b291435da6f679005701c897a2882b5 100644
--- a/mmdet/datasets/pipelines/transforms.py
+++ b/mmdet/datasets/pipelines/transforms.py
@@ -370,8 +370,8 @@ class RandomCrop(object):
             if 'gt_masks' in results:
                 valid_gt_masks = []
                 for i in np.where(valid_inds)[0]:
-                    gt_mask = results['gt_masks'][i][crop_y1:crop_y2, crop_x1:
-                                                     crop_x2]
+                    gt_mask = results['gt_masks'][i][crop_y1:crop_y2,
+                                                     crop_x1:crop_x2]
                     valid_gt_masks.append(gt_mask)
                 results['gt_masks'] = valid_gt_masks
 
diff --git a/mmdet/models/anchor_heads/anchor_head.py b/mmdet/models/anchor_heads/anchor_head.py
index f4899f9f7926ab5bc992b322872ff35a08d1bc69..83944c88008fdc5a68e1ceda39b50bf4a08b81f6 100644
--- a/mmdet/models/anchor_heads/anchor_head.py
+++ b/mmdet/models/anchor_heads/anchor_head.py
@@ -206,7 +206,11 @@ class AnchorHead(nn.Module):
         return dict(loss_cls=losses_cls, loss_bbox=losses_bbox)
 
     @force_fp32(apply_to=('cls_scores', 'bbox_preds'))
-    def get_bboxes(self, cls_scores, bbox_preds, img_metas, cfg,
+    def get_bboxes(self,
+                   cls_scores,
+                   bbox_preds,
+                   img_metas,
+                   cfg,
                    rescale=False):
         """
         Transform network output for a batch into labeled boxes.
diff --git a/mmdet/models/anchor_heads/guided_anchor_head.py b/mmdet/models/anchor_heads/guided_anchor_head.py
index 9e9282509b6bd04a7061594ff8e2acf7f3bcca69..271a0dc74f38f7b132870bc3ed9b2aeef8dfddd8 100644
--- a/mmdet/models/anchor_heads/guided_anchor_head.py
+++ b/mmdet/models/anchor_heads/guided_anchor_head.py
@@ -94,31 +94,32 @@ class GuidedAnchorHead(AnchorHead):
     """
 
     def __init__(
-            self,
-            num_classes,
-            in_channels,
-            feat_channels=256,
-            octave_base_scale=8,
-            scales_per_octave=3,
-            octave_ratios=[0.5, 1.0, 2.0],
-            anchor_strides=[4, 8, 16, 32, 64],
-            anchor_base_sizes=None,
-            anchoring_means=(.0, .0, .0, .0),
-            anchoring_stds=(1.0, 1.0, 1.0, 1.0),
-            target_means=(.0, .0, .0, .0),
-            target_stds=(1.0, 1.0, 1.0, 1.0),
-            deformable_groups=4,
-            loc_filter_thr=0.01,
-            loss_loc=dict(
-                type='FocalLoss',
-                use_sigmoid=True,
-                gamma=2.0,
-                alpha=0.25,
-                loss_weight=1.0),
-            loss_shape=dict(type='BoundedIoULoss', beta=0.2, loss_weight=1.0),
-            loss_cls=dict(
-                type='CrossEntropyLoss', use_sigmoid=True, loss_weight=1.0),
-            loss_bbox=dict(type='SmoothL1Loss', beta=1.0, loss_weight=1.0)):
+        self,
+        num_classes,
+        in_channels,
+        feat_channels=256,
+        octave_base_scale=8,
+        scales_per_octave=3,
+        octave_ratios=[0.5, 1.0, 2.0],
+        anchor_strides=[4, 8, 16, 32, 64],
+        anchor_base_sizes=None,
+        anchoring_means=(.0, .0, .0, .0),
+        anchoring_stds=(1.0, 1.0, 1.0, 1.0),
+        target_means=(.0, .0, .0, .0),
+        target_stds=(1.0, 1.0, 1.0, 1.0),
+        deformable_groups=4,
+        loc_filter_thr=0.01,
+        loss_loc=dict(
+            type='FocalLoss',
+            use_sigmoid=True,
+            gamma=2.0,
+            alpha=0.25,
+            loss_weight=1.0),
+        loss_shape=dict(type='BoundedIoULoss', beta=0.2, loss_weight=1.0),
+        loss_cls=dict(
+            type='CrossEntropyLoss', use_sigmoid=True, loss_weight=1.0),
+        loss_bbox=dict(type='SmoothL1Loss', beta=1.0,
+                       loss_weight=1.0)):  # yapf: disable
         super(AnchorHead, self).__init__()
         self.in_channels = in_channels
         self.num_classes = num_classes
@@ -209,7 +210,10 @@ class GuidedAnchorHead(AnchorHead):
     def forward(self, feats):
         return multi_apply(self.forward_single, feats)
 
-    def get_sampled_approxs(self, featmap_sizes, img_metas, cfg,
+    def get_sampled_approxs(self,
+                            featmap_sizes,
+                            img_metas,
+                            cfg,
                             device='cuda'):
         """Get sampled approxs and inside flags according to feature map sizes.
 
diff --git a/mmdet/models/detectors/mask_scoring_rcnn.py b/mmdet/models/detectors/mask_scoring_rcnn.py
index 9c16ab14adb5bb5dc32e0dbcf32db47dd28b79bc..f184c453ba2e03e0a9246fb0392ed621116f8b19 100644
--- a/mmdet/models/detectors/mask_scoring_rcnn.py
+++ b/mmdet/models/detectors/mask_scoring_rcnn.py
@@ -152,8 +152,8 @@ class MaskScoringRCNN(TwoStageDetector):
             # mask iou head forward and loss
             pos_mask_pred = mask_pred[range(mask_pred.size(0)), pos_labels]
             mask_iou_pred = self.mask_iou_head(mask_feats, pos_mask_pred)
-            pos_mask_iou_pred = mask_iou_pred[range(mask_iou_pred.size(0)
-                                                    ), pos_labels]
+            pos_mask_iou_pred = mask_iou_pred[range(mask_iou_pred.size(0)),
+                                              pos_labels]
             mask_iou_targets = self.mask_iou_head.get_target(
                 sampling_results, gt_masks, pos_mask_pred, mask_targets,
                 self.train_cfg.rcnn)
@@ -193,8 +193,8 @@ class MaskScoringRCNN(TwoStageDetector):
                                                        rescale)
             # get mask scores with mask iou head
             mask_iou_pred = self.mask_iou_head(
-                mask_feats,
-                mask_pred[range(det_labels.size(0)), det_labels + 1])
+                mask_feats, mask_pred[range(det_labels.size(0)),
+                                      det_labels + 1])
             mask_scores = self.mask_iou_head.get_mask_scores(
                 mask_iou_pred, det_bboxes, det_labels)
         return segm_result, mask_scores
diff --git a/mmdet/models/mask_heads/maskiou_head.py b/mmdet/models/mask_heads/maskiou_head.py
index 3c923680313215acac2ce19458c5510b60427e45..d509f177f0fc457d043aac59b89e5e7010a13b9e 100644
--- a/mmdet/models/mask_heads/maskiou_head.py
+++ b/mmdet/models/mask_heads/maskiou_head.py
@@ -181,8 +181,8 @@ class MaskIoUHead(nn.Module):
         mask_score = bbox_score * mask_iou
         """
         inds = range(det_labels.size(0))
-        mask_scores = mask_iou_pred[inds, det_labels +
-                                    1] * det_bboxes[inds, -1]
+        mask_scores = mask_iou_pred[inds, det_labels + 1] * det_bboxes[inds,
+                                                                       -1]
         mask_scores = mask_scores.cpu().numpy()
         det_labels = det_labels.cpu().numpy()
         return [
diff --git a/mmdet/models/plugins/generalized_attention.py b/mmdet/models/plugins/generalized_attention.py
index 9517776fe7e9a10b66fbc4db762541dacc96183e..86e5b1e9df5c0df7df79a8a45836f08c4aec1db4 100644
--- a/mmdet/models/plugins/generalized_attention.py
+++ b/mmdet/models/plugins/generalized_attention.py
@@ -120,17 +120,16 @@ class GeneralizedAttention(nn.Module):
                 (max_len, max_len, max_len_kv, max_len_kv), dtype=np.int)
             for iy in range(max_len):
                 for ix in range(max_len):
-                    local_constraint_map[iy, ix,
-                                         max((iy - self.spatial_range) //
-                                             self.kv_stride, 0):min(
-                                                 (iy + self.spatial_range +
-                                                  1) // self.kv_stride +
-                                                 1, max_len),
-                                         max((ix - self.spatial_range) //
-                                             self.kv_stride, 0):min(
-                                                 (ix + self.spatial_range +
-                                                  1) // self.kv_stride +
-                                                 1, max_len)] = 0
+                    local_constraint_map[
+                        iy, ix,
+                        max((iy - self.spatial_range) //
+                            self.kv_stride, 0):min((iy + self.spatial_range +
+                                                    1) // self.kv_stride +
+                                                   1, max_len),
+                        max((ix - self.spatial_range) //
+                            self.kv_stride, 0):min((ix + self.spatial_range +
+                                                    1) // self.kv_stride +
+                                                   1, max_len)] = 0
 
             self.local_constraint_map = nn.Parameter(
                 torch.from_numpy(local_constraint_map).byte(),
diff --git a/tests/test_forward.py b/tests/test_forward.py
index 0bec83c73ca0c8fc632b17736572d76d7b3b3864..dede4ce005b25ab149c669c507290243d787751a 100644
--- a/tests/test_forward.py
+++ b/tests/test_forward.py
@@ -168,8 +168,8 @@ def test_retina_ghm_forward():
                 batch_results.append(result)
 
 
-def _demo_mm_inputs(
-        input_shape=(1, 3, 300, 300), num_items=None, num_classes=10):
+def _demo_mm_inputs(input_shape=(1, 3, 300, 300),
+                    num_items=None, num_classes=10):  # yapf: disable
     """
     Create a superset of inputs needed to run test or train batches.