yetus-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aajis...@apache.org
Subject yetus git commit: YETUS-695. Fix pylint warnings.
Date Thu, 27 Sep 2018 00:26:12 GMT
Repository: yetus
Updated Branches:
  refs/heads/master f2610ec5a -> 0671694c0


YETUS-695. Fix pylint warnings.

Signed-off-by: Sean Busbey <busbey@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/yetus/repo
Commit: http://git-wip-us.apache.org/repos/asf/yetus/commit/0671694c
Tree: http://git-wip-us.apache.org/repos/asf/yetus/tree/0671694c
Diff: http://git-wip-us.apache.org/repos/asf/yetus/diff/0671694c

Branch: refs/heads/master
Commit: 0671694c0638bb8d3956afd7ab2e8efc8645e003
Parents: f2610ec
Author: Akira Ajisaka <aajisaka@apache.org>
Authored: Wed Sep 26 12:28:34 2018 +0900
Committer: Akira Ajisaka <aajisaka@apache.org>
Committed: Thu Sep 27 09:24:19 2018 +0900

----------------------------------------------------------------------
 release-doc-maker/releasedocmaker.py | 19 +++++++++----------
 release-doc-maker/utils.py           |  8 +++-----
 shelldocs/shelldocs.py               | 26 +++++++++-----------------
 3 files changed, 21 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/yetus/blob/0671694c/release-doc-maker/releasedocmaker.py
----------------------------------------------------------------------
diff --git a/release-doc-maker/releasedocmaker.py b/release-doc-maker/releasedocmaker.py
index 90658af..2b2ada4 100755
--- a/release-doc-maker/releasedocmaker.py
+++ b/release-doc-maker/releasedocmaker.py
@@ -204,11 +204,10 @@ class Jira(object):
         return to_unicode(ret)
 
     def get_components(self):
-        if len(self.fields['components']) > 0:
+        if self.fields['components']:
             return ", ".join([comp['name'] for comp in self.fields['components']
                              ])
-        else:
-            return ""
+        return ""
 
     def get_summary(self):
         return self.fields['summary']
@@ -426,7 +425,7 @@ class Linter(object):
     def _parse_options(self, options):
         """Parse options from optparse."""
 
-        if options.lint is None or len(options.lint) == 0:
+        if options.lint is None or not options.lint:
             return
         self.enabled = True
 
@@ -467,7 +466,7 @@ class Linter(object):
     def message(self):
         """Return summary lint message suitable for printing to stdout."""
         if not self.enabled:
-            return
+            return None
         return self._lint_message + \
                "\n=======================================" + \
                "\n%s: Error:%d, Warning:%d \n" % \
@@ -478,7 +477,7 @@ class Linter(object):
         if not self._filters["component"]:
             return False
 
-        if len(jira.fields['components']) > 0:
+        if jira.fields['components']:
             return False
         return True
 
@@ -507,7 +506,7 @@ class Linter(object):
         """Run lint check on a JIRA."""
         if not self.enabled:
             return
-        if len(jira.get_release_note()) == 0:
+        if not jira.get_release_note():
             if self._filters["incompatible"] and jira.get_incompatible_change():
                 self._warning_count += 1
                 self._lint_message += "\nWARNING: incompatible change %s lacks release notes."
% \
@@ -744,7 +743,7 @@ def main():
         vstr = str(version)
         linter = Linter(vstr, options)
         jlist = sorted(JiraIter(vstr, projects))
-        if len(jlist) == 0:
+        if not jlist:
             print "There is no issue which has the specified version: %s" % version
             continue
 
@@ -852,11 +851,11 @@ def main():
                    % (sanitize_text(jira.get_id()),
                       sanitize_text(jira.get_priority()), sanitize_text(jira.get_summary()))
 
-            if len(jira.get_release_note()) > 0 or \
+            if jira.get_release_note() or \
                jira.get_incompatible_change() or jira.get_important():
                 reloutputs.write_key_raw(jira.get_project(), "\n---\n\n")
                 reloutputs.write_key_raw(jira.get_project(), line)
-                if len(jira.get_release_note()) == 0:
+                if not jira.get_release_note():
                     line = '\n**WARNING: No release note provided for this change.**\n\n'
                 else:
                     line = '\n%s\n\n' % (

http://git-wip-us.apache.org/repos/asf/yetus/blob/0671694c/release-doc-maker/utils.py
----------------------------------------------------------------------
diff --git a/release-doc-maker/utils.py b/release-doc-maker/utils.py
index 5479980..db957d3 100644
--- a/release-doc-maker/utils.py
+++ b/release-doc-maker/utils.py
@@ -136,11 +136,9 @@ def processrelnote(input_string):
     fmt = relnote_pattern.match(input_string)
     if fmt is None:
         return sanitize_text(input_string)
-    else:
-        return {
-            'markdown': sanitize_markdown(input_string),
-        }.get(
-            fmt.group(1), sanitize_text(input_string))
+    return {
+        'markdown': sanitize_markdown(input_string),
+    }.get(fmt.group(1), sanitize_text(input_string))
 
 
 def to_unicode(obj):

http://git-wip-us.apache.org/repos/asf/yetus/blob/0671694c/shelldocs/shelldocs.py
----------------------------------------------------------------------
diff --git a/shelldocs/shelldocs.py b/shelldocs/shelldocs.py
index a3c31b7..a096cbe 100755
--- a/shelldocs/shelldocs.py
+++ b/shelldocs/shelldocs.py
@@ -115,8 +115,7 @@ class ShellFunction(object):
         '''get the name of the function'''
         if self.filename is None:
             return "undefined"
-        else:
-            return self.filename
+        return self.filename
 
     def setname(self, text):
         '''set the name of the function'''
@@ -127,8 +126,7 @@ class ShellFunction(object):
         '''get the name of the function'''
         if self.name is None:
             return "None"
-        else:
-            return self.name
+        return self.name
 
     def setlinenum(self, linenum):
         '''set the line number of the function'''
@@ -147,8 +145,7 @@ class ShellFunction(object):
         '''get the audience of the function'''
         if self.audience is None:
             return "None"
-        else:
-            return self.audience
+        return self.audience
 
     def setstability(self, text):
         '''set the stability of the function'''
@@ -159,8 +156,7 @@ class ShellFunction(object):
         '''get the stability of the function'''
         if self.stability is None:
             return "None"
-        else:
-            return self.stability
+        return self.stability
 
     def setreplace(self, text):
         '''set the replacement state'''
@@ -171,8 +167,7 @@ class ShellFunction(object):
         '''get the replacement state'''
         if self.replaceb == "Yes":
             return self.replaceb
-        else:
-            return "No"
+        return "No"
 
     def getinter(self):
         '''get the function state'''
@@ -188,8 +183,7 @@ class ShellFunction(object):
         '''get the complete return state'''
         if self.returnt is None:
             return "Nothing"
-        else:
-            return "\n\n".join(self.returnt)
+        return "\n\n".join(self.returnt)
 
     def adddesc(self, text):
         '''add to the description'''
@@ -201,8 +195,7 @@ class ShellFunction(object):
         '''get the description'''
         if self.desc is None:
             return "None"
-        else:
-            return " ".join(self.desc)
+        return " ".join(self.desc)
 
     def addparam(self, text):
         '''add a parameter'''
@@ -214,8 +207,7 @@ class ShellFunction(object):
         '''get all of the parameters'''
         if self.params is None:
             return ""
-        else:
-            return " ".join(self.params)
+        return " ".join(self.params)
 
     def getusage(self):
         '''get the usage string'''
@@ -411,7 +403,7 @@ def main():
     if options.lint:
         for funcs in allfuncs:
             message = funcs.lint()
-            if len(message) > 0:
+            if message:
                 print message
 
     if options.outfile is not None:


Mime
View raw message