[Yum] code cleanup: one function in one source

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



		Hi!

=========================================
$ grep -A 14 "def formatRequire" *py 
clientStuff.py:def formatRequire (name, version, flags):
clientStuff.py-    string = name
clientStuff.py-        
clientStuff.py-    if flags:
clientStuff.py-        if flags & (rpm.RPMSENSE_LESS | rpm.RPMSENSE_GREATER | rpm.RPMSENSE_EQUAL):
clientStuff.py-            string = string + ' '
clientStuff.py-        if flags & rpm.RPMSENSE_LESS:
clientStuff.py-            string = string + '<'
clientStuff.py-        if flags & rpm.RPMSENSE_GREATER:
clientStuff.py-            string = string + '>'
clientStuff.py-        if flags & rpm.RPMSENSE_EQUAL:
clientStuff.py-            string = string + '='
clientStuff.py-            string = string + ' %s' % version
clientStuff.py-    return string
clientStuff.py-
--
depchecktree.py:def formatRequire (name, version, flags):
depchecktree.py-    string = name
depchecktree.py-        
depchecktree.py-    if flags:
depchecktree.py-        if flags & (rpm.RPMSENSE_LESS | rpm.RPMSENSE_GREATER | rpm.RPMSENSE_EQUAL):
depchecktree.py-            string = string + " "
depchecktree.py-        if flags & rpm.RPMSENSE_LESS:
depchecktree.py-            string = string + "<"
depchecktree.py-        if flags & rpm.RPMSENSE_GREATER:
depchecktree.py-            string = string + ">"
depchecktree.py-        if flags & rpm.RPMSENSE_EQUAL:
depchecktree.py-            string = string + "="
depchecktree.py-            string = string + " %s" % version
depchecktree.py-    return string
depchecktree.py-
--
serverStuff.py:def formatRequire (name, version, flags):
serverStuff.py-    import rpm
serverStuff.py-    string = name
serverStuff.py-        
serverStuff.py-    if flags:
serverStuff.py-      if flags & (rpm.RPMSENSE_LESS | rpm.RPMSENSE_GREATER | rpm.RPMSENSE_EQUAL):
serverStuff.py-         string = string + " "
serverStuff.py-      if flags & rpm.RPMSENSE_LESS:
serverStuff.py-         string = string + "<"
serverStuff.py-      if flags & rpm.RPMSENSE_GREATER:
serverStuff.py-         string = string + ">"
serverStuff.py-      if flags & rpm.RPMSENSE_EQUAL:
serverStuff.py-         string = string + "="
serverStuff.py-         string = string + " %s" % version
serverStuff.py-    return string
=========================================

 and, please, no import inside functions (look at 'import rpm' in this grep 
 output  and many-many-many  import string/os/sys/etc  in other sources)...
 
 PythonStyleGuide (http://www.python.org/peps/pep-0008.html): 
 
   Imports
    - Imports are always put at the top of the file, just after any
      module comments and docstrings, and before module globals and
      constants.
 
-- 
		Bor.


[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux