Ver Fonte

Fix for flake8

Kentaro Wada há 5 anos atrás
pai
commit
fe7f7d62a5

+ 1 - 1
examples/bbox_detection/labelme2voc.py

@@ -128,7 +128,7 @@ def main():
             )
             )
 
 
         if not args.noviz:
         if not args.noviz:
-            captions = [class_names[l] for l in labels]
+            captions = [class_names[label] for label in labels]
             viz = imgviz.instances2rgb(
             viz = imgviz.instances2rgb(
                 image=img,
                 image=img,
                 labels=labels,
                 labels=labels,

+ 7 - 7
labelme/__main__.py

@@ -78,9 +78,9 @@ def main():
     parser.add_argument(
     parser.add_argument(
         '--labelflags',
         '--labelflags',
         dest='label_flags',
         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,
         default=argparse.SUPPRESS,
     )
     )
     parser.add_argument(
     parser.add_argument(
@@ -118,16 +118,16 @@ def main():
     if hasattr(args, 'flags'):
     if hasattr(args, 'flags'):
         if os.path.isfile(args.flags):
         if os.path.isfile(args.flags):
             with codecs.open(args.flags, 'r', encoding='utf-8') as f:
             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:
         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 hasattr(args, 'labels'):
         if os.path.isfile(args.labels):
         if os.path.isfile(args.labels):
             with codecs.open(args.labels, 'r', encoding='utf-8') as f:
             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:
         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 hasattr(args, 'label_flags'):
         if os.path.isfile(args.label_flags):
         if os.path.isfile(args.label_flags):

+ 3 - 2
labelme/widgets/label_dialog.py

@@ -5,12 +5,13 @@ from qtpy import QtCore
 from qtpy import QtGui
 from qtpy import QtGui
 from qtpy import QtWidgets
 from qtpy import QtWidgets
 
 
-QT5 = QT_VERSION[0] == '5'  # NOQA
-
 from labelme.logger import logger
 from labelme.logger import logger
 import labelme.utils
 import labelme.utils
 
 
 
 
+QT5 = QT_VERSION[0] == '5'
+
+
 # TODO(unknown):
 # TODO(unknown):
 # - Calculate optimal position so as not to go out of screen area.
 # - Calculate optimal position so as not to go out of screen area.