1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-24 00:19:01 +00:00

Apply PEP 8 style guidance to zenmap

Using the pep8 tool (https://pypi.python.org/pypi/pep8), fixed the
following style issues:

Count   Issue
11      E201 whitespace after '['
8       E203 whitespace before ','
41      E211 whitespace before '('
11      E221 multiple spaces before operator
61      E225 missing whitespace around operator
237     E231 missing whitespace after ':'
91      E251 no spaces around keyword / parameter equals
19      E261 at least two spaces before inline comment
41      E301 expected 1 blank line, found 0
200     E302 expected 2 blank lines, found 1
356     E303 too many blank lines (2)
563     E501 line too long (106 characters)
39      E701 multiple statements on one line (colon)
13      E702 multiple statements on one line (semicolon)
4       W291 trailing whitespace
2       W293 blank line contains whitespace
8       W391 blank line at end of file
21      W601 .has_key() is deprecated, use 'in'
2       W602 deprecated form of raising exception

The remaining issues are long lines due to very deep data structures. I
chose not to alter them, as it would involve backslash-continuation
where whitespace is not permitted:

./zenmapGUI/ScanInterface.py:323:80: E501 line too long (90 characters)
./zenmapGUI/ScanInterface.py:456:80: E501 line too long (84 characters)
./zenmapGUI/ScanInterface.py:464:80: E501 line too long (84 characters)
./zenmapGUI/ScanInterface.py:472:80: E501 line too long (122 characters)
./zenmapGUI/ScanInterface.py:479:80: E501 line too long (122 characters)
./zenmapGUI/ScanInterface.py:920:80: E501 line too long (94 characters)
./zenmapGUI/ScanInterface.py:923:80: E501 line too long (93 characters)
./zenmapGUI/MainWindow.py:575:80: E501 line too long (99 characters)
./zenmapGUI/MainWindow.py:906:80: E501 line too long (99 characters)
This commit is contained in:
dmiller
2014-01-08 19:50:22 +00:00
parent 9210a7f1fa
commit 5c662fffdc
100 changed files with 2287 additions and 1814 deletions

View File

@@ -126,10 +126,13 @@ higwidgets/higlabels.py
labels related classes
"""
__all__ = ['HIGSectionLabel', 'HIGHintSectionLabel', 'HIGEntryLabel', 'HIGDialogLabel']
__all__ = [
'HIGSectionLabel', 'HIGHintSectionLabel', 'HIGEntryLabel', 'HIGDialogLabel'
]
import gtk
class HIGSectionLabel(gtk.Label):
"""
Bold label, used to define sections
@@ -142,10 +145,11 @@ class HIGSectionLabel(gtk.Label):
self.set_alignment(0, 0.50)
self.set_line_wrap(True)
class HIGHintSectionLabel(gtk.HBox, object):
"""
Bold label used to define sections, with a little icon that shows up a hint when mouse is
over it.
Bold label used to define sections, with a little icon that shows up a hint
when mouse is over it.
"""
def __init__(self, text=None, hint=None):
gtk.HBox.__init__(self)
@@ -156,13 +160,15 @@ class HIGHintSectionLabel(gtk.HBox, object):
self.pack_start(self.label, False, False)
self.pack_start(self.hint, False, False, 5)
class Hint(gtk.EventBox, object):
def __init__(self, hint):
gtk.EventBox.__init__(self)
self.hint = hint
self.hint_image = gtk.Image()
self.hint_image.set_from_stock(gtk.STOCK_DIALOG_INFO, gtk.ICON_SIZE_SMALL_TOOLBAR)
self.hint_image.set_from_stock(
gtk.STOCK_DIALOG_INFO, gtk.ICON_SIZE_SMALL_TOOLBAR)
self.add(self.hint_image)
@@ -172,6 +178,7 @@ class Hint(gtk.EventBox, object):
hint_window = HintWindow(self.hint)
hint_window.show_all()
class HintWindow(gtk.Window):
def __init__(self, hint):
gtk.Window.__init__(self, gtk.WINDOW_POPUP)
@@ -208,6 +215,7 @@ class HIGEntryLabel(gtk.Label):
self.set_use_markup(True)
self.set_line_wrap(True)
class HIGDialogLabel(gtk.Label):
"""
Centered, line-wrappable label, usually used on dialogs.