1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-08 05:31:31 +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

@@ -134,6 +134,7 @@ from zenmapCore.Paths import Path
from zenmapCore.UmitLogging import log
import zenmapCore.I18N
def scan_entry_data_func(widget, cell_renderer, model, iter):
"""Set the properties of a cell renderer for a scan entry."""
cell_renderer.set_property("ellipsize", pango.ELLIPSIZE_END)
@@ -150,12 +151,15 @@ def scan_entry_data_func(widget, cell_renderer, model, iter):
cell_renderer.set_property("strikethrough", True)
cell_renderer.set_property("text", entry.get_command_string())
class Throbber(gtk.Image):
"""This is a little progress indicator that animates while a scan is
running."""
try:
still = gtk.gdk.pixbuf_new_from_file(os.path.join(Path.pixmaps_dir, "throbber.png"))
anim = gtk.gdk.PixbufAnimation(os.path.join(Path.pixmaps_dir, "throbber.gif"))
still = gtk.gdk.pixbuf_new_from_file(
os.path.join(Path.pixmaps_dir, "throbber.png"))
anim = gtk.gdk.PixbufAnimation(
os.path.join(Path.pixmaps_dir, "throbber.gif"))
except Exception, e:
log.debug("Error loading throbber images: %s." % str(e))
still = None
@@ -177,6 +181,7 @@ class Throbber(gtk.Image):
self.set_from_pixbuf(self.still)
self.animating = False
class ScanNmapOutputPage(HIGVBox):
"""This is the "Nmap Output" scan results tab. It holds a text view of Nmap
output. The constructor takes a ScansListStore, the contents of which are
@@ -223,8 +228,8 @@ class ScanNmapOutputPage(HIGVBox):
self._update()
def set_active_iter(self, i):
"""Set the active entry to an interator into the ScansListStore referred
to by this object."""
"""Set the active entry to an interator into the ScansListStore
referred to by this object."""
self.scans_list.set_active_iter(i)
def get_active_entry(self):
@@ -287,9 +292,11 @@ class ScanNmapOutputPage(HIGVBox):
if self._details_windows.get(entry) is None:
window = gtk.Window()
window.add(ScanRunDetailsPage(entry.parsed))
def close_details(details, event, entry):
details.destroy()
del self._details_windows[entry]
window.connect("delete-event", close_details, entry)
window.show_all()
self._details_windows[entry] = window