From fe7f7d62a510e0b2e6d31cd347587ef485e4f881 Mon Sep 17 00:00:00 2001 From: Kentaro Wada Date: Tue, 19 May 2020 12:47:57 +0100 Subject: [PATCH] Fix for flake8 --- examples/bbox_detection/labelme2voc.py | 2 +- labelme/__main__.py | 14 +++++++------- labelme/widgets/label_dialog.py | 5 +++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/examples/bbox_detection/labelme2voc.py b/examples/bbox_detection/labelme2voc.py index 9c2fc3f..0a3d5e4 100755 --- a/examples/bbox_detection/labelme2voc.py +++ b/examples/bbox_detection/labelme2voc.py @@ -128,7 +128,7 @@ def main(): ) if not args.noviz: - captions = [class_names[l] for l in labels] + captions = [class_names[label] for label in labels] viz = imgviz.instances2rgb( image=img, labels=labels, diff --git a/labelme/__main__.py b/labelme/__main__.py index 8e02473..27b51f2 100644 --- a/labelme/__main__.py +++ b/labelme/__main__.py @@ -78,9 +78,9 @@ def main(): parser.add_argument( '--labelflags', dest='label_flags', - help='yaml string of label specific flags OR file containing json ' - 'string of label specific flags (ex. {person-\d+: [male, tall], ' - 'dog-\d+: [black, brown, white], .*: [occluded]})', # NOQA + help=r'yaml string of label specific flags OR file containing json ' + r'string of label specific flags (ex. {person-\d+: [male, tall], ' + r'dog-\d+: [black, brown, white], .*: [occluded]})', # NOQA default=argparse.SUPPRESS, ) parser.add_argument( @@ -118,16 +118,16 @@ def main(): if hasattr(args, 'flags'): if os.path.isfile(args.flags): with codecs.open(args.flags, 'r', encoding='utf-8') as f: - args.flags = [l.strip() for l in f if l.strip()] + args.flags = [line.strip() for line in f if line.strip()] else: - args.flags = [l for l in args.flags.split(',') if l] + args.flags = [line for line in args.flags.split(',') if line] if hasattr(args, 'labels'): if os.path.isfile(args.labels): with codecs.open(args.labels, 'r', encoding='utf-8') as f: - args.labels = [l.strip() for l in f if l.strip()] + args.labels = [line.strip() for line in f if line.strip()] else: - args.labels = [l for l in args.labels.split(',') if l] + args.labels = [line for line in args.labels.split(',') if line] if hasattr(args, 'label_flags'): if os.path.isfile(args.label_flags): diff --git a/labelme/widgets/label_dialog.py b/labelme/widgets/label_dialog.py index ebbb15e..06a7816 100644 --- a/labelme/widgets/label_dialog.py +++ b/labelme/widgets/label_dialog.py @@ -5,12 +5,13 @@ from qtpy import QtCore from qtpy import QtGui from qtpy import QtWidgets -QT5 = QT_VERSION[0] == '5' # NOQA - from labelme.logger import logger import labelme.utils +QT5 = QT_VERSION[0] == '5' + + # TODO(unknown): # - Calculate optimal position so as not to go out of screen area. -- GitLab