Fix warnings from pylint/pyflakes.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Mon, 28 Mar 2016 00:46:21 +0300
changeset 406 f0ac87e10d9a
parent 405 6208d07b30f0
child 407 6d13997f63b6
Fix warnings from pylint/pyflakes.
py/gadict.py
py/gadict_c5.py
--- a/py/gadict.py	Mon Mar 28 00:37:40 2016 +0300
+++ b/py/gadict.py	Mon Mar 28 00:46:21 2016 +0300
@@ -1,8 +1,12 @@
+"""
+gadict dictionary format parser.
+"""
 
 import regex
 
 
 class Prelude:
+    """Dictionary metainfo structure."""
     name = None
     about = ""
     urls = []
@@ -12,7 +16,8 @@
 
 class ParseException(BaseException):
 
-    def __init__(self, msg, lineno = None, line = None):
+    def __init__(self, msg, lineno=None, line=None):
+        super().__init__()
         self.msg = msg
         self.lineno = lineno
         self.line = line
@@ -27,6 +32,7 @@
 
 
 class Parser:
+    """gadict dictionary format parser."""
 
     SEPARATOR_RE = regex.compile(r"^__$")
     HEADWORD_RE = regex.compile(r"^(\p{L}.*)$")
@@ -66,7 +72,7 @@
             while not self.eof:
                 self.parse_article()
         except ParseException as ex:
-            raise ParseException(ex.msg, self.lineno, self.line) from ex
+            raise ParseException(ex.msg, self.lineno, self.line)
         return self.dom
 
     def parse_continuation(self):
@@ -75,7 +81,7 @@
             self.readline()
             if self.eof:
                 return string
-            m = CONT_RE.match(self.line)
+            m = self.CONT_RE.match(self.line)
             if m is not None:
                 string += "\n" + m.group(1)
             elif len(self.line) == 1:
@@ -203,4 +209,3 @@
         if len(tr) > 0:
             senses.append((pos, tr, ex))
         self.tran = senses
-
--- a/py/gadict_c5.py	Mon Mar 28 00:37:40 2016 +0300
+++ b/py/gadict_c5.py	Mon Mar 28 00:46:21 2016 +0300
@@ -94,4 +94,3 @@
                 FOUT.write(tr)
                 break
         FOUT.write("\n")
-