Blame 0009-pylint-fix-some-pylint-warnings.patch

b7f8439
From 99578c5d7ce9a6ed952da292a2ed8467dc5c85d5 Mon Sep 17 00:00:00 2001
b7f8439
From: Matej Habrnal <mhabrnal@redhat.com>
b7f8439
Date: Thu, 31 May 2018 15:05:15 +0200
b7f8439
Subject: [PATCH] pylint: fix some pylint warnings
b7f8439
b7f8439
Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
b7f8439
---
b7f8439
 pylintrc                             |  2 +-
b7f8439
 src/gnome_abrt/application.py        |  2 +-
b7f8439
 src/gnome_abrt/dbus_problems.py      |  4 +---
b7f8439
 src/gnome_abrt/directory_problems.py |  4 ++--
b7f8439
 src/gnome_abrt/problems.py           | 32 +++++++++-----------------------
b7f8439
 src/gnome_abrt/views.py              |  8 ++------
b7f8439
 6 files changed, 16 insertions(+), 36 deletions(-)
b7f8439
b7f8439
diff --git a/pylintrc b/pylintrc
b7f8439
index 934d7c0..0dc1c8e 100644
b7f8439
--- a/pylintrc
b7f8439
+++ b/pylintrc
b7f8439
@@ -155,7 +155,7 @@ ignore-imports=no
b7f8439
 [FORMAT]
b7f8439
 
b7f8439
 # Maximum number of characters on a single line.
b7f8439
-max-line-length=80
b7f8439
+max-line-length=120
b7f8439
 
b7f8439
 # Maximum number of lines in a module
b7f8439
 max-module-lines=1000
b7f8439
diff --git a/src/gnome_abrt/application.py b/src/gnome_abrt/application.py
b7f8439
index 3504b03..927262a 100644
b7f8439
--- a/src/gnome_abrt/application.py
b7f8439
+++ b/src/gnome_abrt/application.py
b7f8439
@@ -16,7 +16,7 @@
b7f8439
 ## Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335  USA
b7f8439
 
b7f8439
 import os
b7f8439
-import gnome_abrt.wrappers as wrappers
b7f8439
+from gnome_abrt import wrappers
b7f8439
 
b7f8439
 class Application(object):
b7f8439
 
b7f8439
diff --git a/src/gnome_abrt/dbus_problems.py b/src/gnome_abrt/dbus_problems.py
b7f8439
index 89f092e..d6574aa 100644
b7f8439
--- a/src/gnome_abrt/dbus_problems.py
b7f8439
+++ b/src/gnome_abrt/dbus_problems.py
b7f8439
@@ -22,9 +22,7 @@ import traceback
b7f8439
 import dbus
b7f8439
 from dbus.mainloop.glib import DBusGMainLoop
b7f8439
 
b7f8439
-import gnome_abrt.problems as problems
b7f8439
-import gnome_abrt.config as config
b7f8439
-import gnome_abrt.errors as errors
b7f8439
+from gnome_abrt import problems, config, errors
b7f8439
 from gnome_abrt.l10n import _
b7f8439
 
b7f8439
 BUS_NAME = 'org.freedesktop.problems'
b7f8439
diff --git a/src/gnome_abrt/directory_problems.py b/src/gnome_abrt/directory_problems.py
b7f8439
index 02a06ed..3ec7fe5 100644
b7f8439
--- a/src/gnome_abrt/directory_problems.py
b7f8439
+++ b/src/gnome_abrt/directory_problems.py
b7f8439
@@ -30,8 +30,8 @@ import pyinotify
b7f8439
 from pyinotify import WatchManager, Notifier, ProcessEvent
b7f8439
 
b7f8439
 # gnome-abrt
b7f8439
-import gnome_abrt.problems as problems
b7f8439
-import gnome_abrt.errors as errors
b7f8439
+from gnome_abrt import problems
b7f8439
+from gnome_abrt import errors
b7f8439
 from gnome_abrt.l10n import _
b7f8439
 
b7f8439
 class INOTIFYGlibSource(GLib.Source):
b7f8439
diff --git a/src/gnome_abrt/problems.py b/src/gnome_abrt/problems.py
b7f8439
index fbde9ac..05a3fa7 100644
b7f8439
--- a/src/gnome_abrt/problems.py
b7f8439
+++ b/src/gnome_abrt/problems.py
b7f8439
@@ -17,6 +17,7 @@
b7f8439
 
b7f8439
 import datetime
b7f8439
 import logging
b7f8439
+import re
b7f8439
 
b7f8439
 # gnome-abrt
b7f8439
 import gnome_abrt.url
b7f8439
@@ -279,6 +280,7 @@ class Problem(object):
b7f8439
 
b7f8439
     def get_submission(self):
b7f8439
         if not self.submission:
b7f8439
+            reg = re.compile(r'^(?P<pfx>.*):\s*(?P<typ>\S*)=(?P<data>.*)')
b7f8439
             self.submission = []
b7f8439
             if self['reported_to']:
b7f8439
                 # Most common type of line in reported_to file
b7f8439
@@ -287,30 +289,14 @@ class Problem(object):
b7f8439
                     if not line:
b7f8439
                         continue
b7f8439
 
b7f8439
-                    pfx_lst = []
b7f8439
-                    i = 0
b7f8439
-                    for i in range(0, len(line)):
b7f8439
-                        if line[i] == ':':
b7f8439
-                            break
b7f8439
-                        pfx_lst.append(line[i])
b7f8439
-
b7f8439
-                    pfx = ''.join(pfx_lst)
b7f8439
-                    i += 1
b7f8439
-
b7f8439
-                    for i in range(i, len(line)):
b7f8439
-                        if line[i] != ' ':
b7f8439
-                            break
b7f8439
-
b7f8439
-                    typ_lst = []
b7f8439
-                    for i in range(i, len(line)):
b7f8439
-                        if line[i] == '=':
b7f8439
-                            break
b7f8439
-                        typ_lst.append(line[i])
b7f8439
-
b7f8439
-                    typ = ''.join(typ_lst)
b7f8439
-                    i += 1
b7f8439
+                    parsed = reg.match(line)
b7f8439
+                    if parsed:
b7f8439
+                        pfx = parsed.group('pfx')
b7f8439
+                        typ = parsed.group('typ')
b7f8439
+                        data = parsed.group('data')
b7f8439
+                    else:
b7f8439
+                        continue
b7f8439
 
b7f8439
-                    data = line[i:]
b7f8439
                     sbm = next((s for s in self.submission
b7f8439
                                 if s.rtype == typ and s.name == pfx), None)
b7f8439
 
b7f8439
diff --git a/src/gnome_abrt/views.py b/src/gnome_abrt/views.py
b7f8439
index ec7b211..1b62515 100644
b7f8439
--- a/src/gnome_abrt/views.py
b7f8439
+++ b/src/gnome_abrt/views.py
b7f8439
@@ -40,12 +40,7 @@ from gi.repository import GLib
b7f8439
 
b7f8439
 import humanize
b7f8439
 
b7f8439
-import gnome_abrt.problems as problems
b7f8439
-import gnome_abrt.config as config
b7f8439
-import gnome_abrt.wrappers as wrappers
b7f8439
-import gnome_abrt.errors as errors
b7f8439
-import gnome_abrt.desktop as desktop
b7f8439
-from gnome_abrt import GNOME_ABRT_UI_DIR
b7f8439
+from gnome_abrt import GNOME_ABRT_UI_DIR, problems, config, wrappers, errors, desktop
b7f8439
 from gnome_abrt.tools import fancydate, smart_truncate, load_icon
b7f8439
 from gnome_abrt.tools import set_icon_from_pixbuf_with_scale
b7f8439
 from gnome_abrt.l10n import _, C_, GETTEXT_PROGNAME
b7f8439
@@ -1075,6 +1070,7 @@ _("This problem has been reported, but a Bugzilla ticket has not"
b7f8439
                     self._builder.lb_problems.select_row(problem_row)
b7f8439
                     self._builder.menu_problem_item.popup(None, None,
b7f8439
                             None, None, data.button, data.time)
b7f8439
+        return None
b7f8439
 
b7f8439
     def get_box_header_left_offset(self):
b7f8439
         # Returns the offset of box_header_left relative to the main paned
b7f8439
-- 
b7f8439
2.13.6
b7f8439