Fix pylint: do not use bare 'except' (#5025)
* Fix E722, do not use bare 'except' * Remove used codes * Add FileNotFoundError in LoadImagesAndLabels * Remove AssertionError * Ignore LoadImagesAndLabels * Ignore downloads.py * Ignore torch_utils.py * Ignore train.py * Ignore datasets.py * Enable utils/download.py * Fixing exception in thop * Remove unused code * Fixing exception in LoadImagesAndLabels * Fixing exception in exif_size * Fixing exception in parse_model * Ignore exceptions in requests * Revert the exception as suggested * Revert the exception as suggested
This commit is contained in:
1 parent
b0ade48457
commit
1922ddeac0
4 files changed
+7
-7
No files matched your search
+5
-4
@@ -152,7 +152,7 @@ def is_colab():
|
||||
try:
|
||||
import google.colab
|
||||
return True
|
||||
except Exception as e:
|
||||
except ImportError:
|
||||
return False
|
||||
|
||||
|
||||
@@ -160,6 +160,7 @@ def is_pip():
|
||||
# Is file in a pip package?
|
||||
return 'site-packages' in Path(__file__).resolve().parts
|
||||
|
||||
|
||||
def is_ascii(s=''):
|
||||
# Is string composed of all ASCII (no UTF) characters? (note str().isascii() introduced in python 3.7)
|
||||
s = str(s) # convert list, tuple, None, etc. to str
|
||||
@@ -741,11 +742,11 @@ def print_mutation(results, hyp, save_dir, bucket):
|
||||
data = pd.read_csv(evolve_csv)
|
||||
data = data.rename(columns=lambda x: x.strip()) # strip keys
|
||||
i = np.argmax(fitness(data.values[:, :7])) #
|
||||
f.write(f'# YOLOv5 Hyperparameter Evolution Results\n' +
|
||||
f.write('# YOLOv5 Hyperparameter Evolution Results\n' +
|
||||
f'# Best generation: {i}\n' +
|
||||
f'# Last generation: {len(data)}\n' +
|
||||
f'# ' + ', '.join(f'{x.strip():>20s}' for x in keys[:7]) + '\n' +
|
||||
f'# ' + ', '.join(f'{x:>20.5g}' for x in data.values[i, :7]) + '\n\n')
|
||||
'# ' + ', '.join(f'{x.strip():>20s}' for x in keys[:7]) + '\n' +
|
||||
'# ' + ', '.join(f'{x:>20.5g}' for x in data.values[i, :7]) + '\n\n')
|
||||
yaml.safe_dump(hyp, f, sort_keys=False)
|
||||
|
||||
if bucket:
|
||||
|
||||
Reference in new issue
Block a user