Skip to content

Commit 6697f41

Browse files
committed
fix pylint error
1 parent 0f18f8e commit 6697f41

File tree

13 files changed

+16
-17
lines changed

13 files changed

+16
-17
lines changed

basicsr/archs/arch_util.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def __init__(self, scale, num_feat):
110110
m.append(nn.Conv2d(num_feat, 9 * num_feat, 3, 1, 1))
111111
m.append(nn.PixelShuffle(3))
112112
else:
113-
raise ValueError(f'scale {scale} is not supported. ' 'Supported scales: 2^n and 3.')
113+
raise ValueError(f'scale {scale} is not supported. Supported scales: 2^n and 3.')
114114
super(Upsample, self).__init__(*m)
115115

116116

basicsr/archs/swinir_arch.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ def __init__(self, scale, num_feat):
662662
m.append(nn.Conv2d(num_feat, 9 * num_feat, 3, 1, 1))
663663
m.append(nn.PixelShuffle(3))
664664
else:
665-
raise ValueError(f'scale {scale} is not supported. ' 'Supported scales: 2^n and 3.')
665+
raise ValueError(f'scale {scale} is not supported. Supported scales: 2^n and 3.')
666666
super(Upsample, self).__init__(*m)
667667

668668

basicsr/data/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def build_dataset(dataset_opt):
3333
dataset_opt = deepcopy(dataset_opt)
3434
dataset = DATASET_REGISTRY.get(dataset_opt['type'])(dataset_opt)
3535
logger = get_root_logger()
36-
logger.info(f'Dataset [{dataset.__class__.__name__}] - {dataset_opt["name"]} ' 'is built.')
36+
logger.info(f'Dataset [{dataset.__class__.__name__}] - {dataset_opt["name"]} is built.')
3737
return dataset
3838

3939

@@ -77,7 +77,7 @@ def build_dataloader(dataset, dataset_opt, num_gpu=1, dist=False, sampler=None,
7777
elif phase in ['val', 'test']: # validation
7878
dataloader_args = dict(dataset=dataset, batch_size=1, shuffle=False, num_workers=0)
7979
else:
80-
raise ValueError(f'Wrong dataset phase: {phase}. ' "Supported ones are 'train', 'val' and 'test'.")
80+
raise ValueError(f"Wrong dataset phase: {phase}. Supported ones are 'train', 'val' and 'test'.")
8181

8282
dataloader_args['pin_memory'] = dataset_opt.get('pin_memory', False)
8383
dataloader_args['persistent_workers'] = dataset_opt.get('persistent_workers', False)

basicsr/data/ffhq_dataset.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def __init__(self, opt):
3737
if self.io_backend_opt['type'] == 'lmdb':
3838
self.io_backend_opt['db_paths'] = self.gt_folder
3939
if not self.gt_folder.endswith('.lmdb'):
40-
raise ValueError("'dataroot_gt' should end with '.lmdb', " f'but received {self.gt_folder}')
40+
raise ValueError("'dataroot_gt' should end with '.lmdb', but received {self.gt_folder}")
4141
with open(osp.join(self.gt_folder, 'meta_info.txt')) as fin:
4242
self.paths = [line.split('.')[0] for line in fin]
4343
else:

basicsr/metrics/fid.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def calculate_fid(mu1, sigma1, mu2, sigma2, eps=1e-6):
7474

7575
# Product might be almost singular
7676
if not np.isfinite(cov_sqrt).all():
77-
print('Product of cov matrices is singular. Adding {eps} to diagonal ' 'of cov estimates')
77+
print('Product of cov matrices is singular. Adding {eps} to diagonal of cov estimates')
7878
offset = np.eye(sigma1.shape[0]) * eps
7979
cov_sqrt = linalg.sqrtm((sigma1 + offset) @ (sigma2 + offset))
8080

basicsr/metrics/metric_util.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def reorder_image(img, input_order='HWC'):
2121
"""
2222

2323
if input_order not in ['HWC', 'CHW']:
24-
raise ValueError(f'Wrong input_order {input_order}. Supported input_orders are ' "'HWC' and 'CHW'")
24+
raise ValueError(f"Wrong input_order {input_order}. Supported input_orders are 'HWC' and 'CHW'")
2525
if len(img.shape) == 2:
2626
img = img[..., None]
2727
if input_order == 'CHW':

basicsr/metrics/psnr_ssim.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def calculate_psnr(img, img2, crop_border, input_order='HWC', test_y_channel=Fal
2626

2727
assert img.shape == img2.shape, (f'Image shapes are different: {img.shape}, {img2.shape}.')
2828
if input_order not in ['HWC', 'CHW']:
29-
raise ValueError(f'Wrong input_order {input_order}. Supported input_orders are ' '"HWC" and "CHW"')
29+
raise ValueError(f'Wrong input_order {input_order}. Supported input_orders are "HWC" and "CHW"')
3030
img = reorder_image(img, input_order=input_order)
3131
img2 = reorder_image(img2, input_order=input_order)
3232
img = img.astype(np.float64)
@@ -108,7 +108,7 @@ def calculate_ssim(img, img2, crop_border, input_order='HWC', test_y_channel=Fal
108108

109109
assert img.shape == img2.shape, (f'Image shapes are different: {img.shape}, {img2.shape}.')
110110
if input_order not in ['HWC', 'CHW']:
111-
raise ValueError(f'Wrong input_order {input_order}. Supported input_orders are ' '"HWC" and "CHW"')
111+
raise ValueError(f'Wrong input_order {input_order}. Supported input_orders are "HWC" and "CHW"')
112112
img = reorder_image(img, input_order=input_order)
113113
img2 = reorder_image(img2, input_order=input_order)
114114
img = img.astype(np.float64)

basicsr/ops/dcn/deform_conv.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def forward(ctx,
4444
deformable_groups=1,
4545
im2col_step=64):
4646
if input is not None and input.dim() != 4:
47-
raise ValueError(f'Expected 4D tensor as input, got {input.dim()}' 'D tensor instead.')
47+
raise ValueError(f'Expected 4D tensor as input, got {input.dim()}D tensor instead.')
4848
ctx.stride = _pair(stride)
4949
ctx.padding = _pair(padding)
5050
ctx.dilation = _pair(dilation)

basicsr/train.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def train_pipeline(root_path):
124124
model = build_model(opt)
125125
if resume_state: # resume training
126126
model.resume_training(resume_state) # handle optimizers and schedulers
127-
logger.info(f"Resuming training from epoch: {resume_state['epoch']}, " f"iter: {resume_state['iter']}.")
127+
logger.info(f"Resuming training from epoch: {resume_state['epoch']}, iter: {resume_state['iter']}.")
128128
start_epoch = resume_state['epoch']
129129
current_iter = resume_state['iter']
130130
else:
@@ -144,7 +144,7 @@ def train_pipeline(root_path):
144144
if opt['datasets']['train'].get('pin_memory') is not True:
145145
raise ValueError('Please set pin_memory=True for CUDAPrefetcher.')
146146
else:
147-
raise ValueError(f'Wrong prefetch_mode {prefetch_mode}.' "Supported ones are: None, 'cuda', 'cpu'.")
147+
raise ValueError(f"Wrong prefetch_mode {prefetch_mode}. Supported ones are: None, 'cuda', 'cpu'.")
148148

149149
# training
150150
logger.info(f'Start training from epoch: {start_epoch}, iter: {current_iter}')

basicsr/utils/face_util.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
try:
1010
import dlib
1111
except ImportError:
12-
print('Please install dlib before testing face restoration.' 'Reference: https://github.com/davisking/dlib')
12+
print('Please install dlib before testing face restoration. Reference: https://github.com/davisking/dlib')
1313

1414

1515
class FaceRestorationHelper(object):

basicsr/utils/file_client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def get(self, filepath, client_key):
119119
client_key (str): Used for distinguishing different lmdb envs.
120120
"""
121121
filepath = str(filepath)
122-
assert client_key in self._client, (f'client_key {client_key} is not ' 'in lmdb clients.')
122+
assert client_key in self._client, (f'client_key {client_key} is not in lmdb clients.')
123123
client = self._client[client_key]
124124
with client.begin(write=False) as txn:
125125
value_buf = txn.get(filepath.encode('ascii'))

basicsr/utils/flow_util.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def flowread(flow_path, quantize=False, concat_axis=0, *args, **kwargs):
3333
raise IOError(f'Invalid flow file: {flow_path}')
3434
else:
3535
if header != 'PIEH':
36-
raise IOError(f'Invalid flow file: {flow_path}, ' 'header does not contain PIEH')
36+
raise IOError(f'Invalid flow file: {flow_path}, header does not contain PIEH')
3737

3838
w = np.fromfile(f, np.int32, 1).squeeze()
3939
h = np.fromfile(f, np.int32, 1).squeeze()

scripts/data_preparation/create_lmdb.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,7 @@ def prepare_keys_vimeo90k(folder_path, train_list_path, mode):
157157
parser.add_argument(
158158
'--dataset',
159159
type=str,
160-
help=("Options: 'DIV2K', 'REDS', 'Vimeo90K' "
161-
'You may need to modify the corresponding configurations in codes.'))
160+
help=("Options: 'DIV2K', 'REDS', 'Vimeo90K' You may need to modify the corresponding configurations in codes."))
162161
args = parser.parse_args()
163162
dataset = args.dataset.lower()
164163
if dataset == 'div2k':

0 commit comments

Comments
 (0)