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

@@ -121,12 +121,14 @@
# ***************************************************************************/
import gtk
from zenmapGUI.higwidgets.higboxes import HIGVBox, HIGHBox, hig_box_space_holder
from zenmapGUI.higwidgets.higboxes import HIGVBox, HIGHBox,\
hig_box_space_holder
from zenmapGUI.higwidgets.higtables import HIGTable
from zenmapGUI.higwidgets.higlabels import HIGEntryLabel
import zenmapCore.I18N
class ScanRunDetailsPage(HIGVBox):
def __init__(self, scan):
HIGVBox.__init__(self)
@@ -146,7 +148,8 @@ class ScanRunDetailsPage(HIGVBox):
self.debug_label = HIGEntryLabel(_('Debug level:'))
self.info_debug_label = HIGEntryLabel(na)
self.command_expander = gtk.Expander("<b>"+_("Command Info")+"</b>")
self.command_expander = gtk.Expander(
"<b>" + _("Command Info") + "</b>")
self.command_expander.set_use_markup(True)
self.command_table = HIGTable()
@@ -158,17 +161,17 @@ class ScanRunDetailsPage(HIGVBox):
self.command_hbox._pack_noexpand_nofill(hig_box_space_holder())
self.command_hbox._pack_noexpand_nofill(self.command_table)
self.command_table.attach(self.command_label,0,1,0,1)
self.command_table.attach(self.info_command_label,1,2,0,1)
self.command_table.attach(self.command_label, 0, 1, 0, 1)
self.command_table.attach(self.info_command_label, 1, 2, 0, 1)
self.command_table.attach(self.nmap_version_label,0,1,1,2)
self.command_table.attach(self.info_nmap_version_label,1,2,1,2)
self.command_table.attach(self.nmap_version_label, 0, 1, 1, 2)
self.command_table.attach(self.info_nmap_version_label, 1, 2, 1, 2)
self.command_table.attach(self.verbose_label,0,1,2,3)
self.command_table.attach(self.info_verbose_label,1,2,2,3)
self.command_table.attach(self.verbose_label, 0, 1, 2, 3)
self.command_table.attach(self.info_verbose_label, 1, 2, 2, 3)
self.command_table.attach(self.debug_label,0,1,3,4)
self.command_table.attach(self.info_debug_label,1,2,3,4)
self.command_table.attach(self.debug_label, 0, 1, 3, 4)
self.command_table.attach(self.info_debug_label, 1, 2, 3, 4)
self.command_expander.add(self.command_hbox)
self._pack_noexpand_nofill(self.command_expander)
@@ -199,7 +202,8 @@ class ScanRunDetailsPage(HIGVBox):
self.closed_label = HIGEntryLabel(_('Closed ports:'))
self.info_closed_label = HIGEntryLabel(na)
self.general_expander = gtk.Expander("<b>"+_("General Info")+"</b>")
self.general_expander = gtk.Expander(
"<b>" + _("General Info") + "</b>")
self.general_expander.set_use_markup(True)
self.general_table = HIGTable()
@@ -211,29 +215,29 @@ class ScanRunDetailsPage(HIGVBox):
self.general_hbox._pack_noexpand_nofill(hig_box_space_holder())
self.general_hbox._pack_noexpand_nofill(self.general_table)
self.general_table.attach(self.start_label,0,1,0,1)
self.general_table.attach(self.info_start_label,1,2,0,1)
self.general_table.attach(self.start_label, 0, 1, 0, 1)
self.general_table.attach(self.info_start_label, 1, 2, 0, 1)
self.general_table.attach(self.finished_label,0,1,1,2)
self.general_table.attach(self.info_finished_label,1,2,1,2)
self.general_table.attach(self.finished_label, 0, 1, 1, 2)
self.general_table.attach(self.info_finished_label, 1, 2, 1, 2)
self.general_table.attach(self.host_up_label,0,1,2,3)
self.general_table.attach(self.info_hosts_up_label,1,2,2,3)
self.general_table.attach(self.host_up_label, 0, 1, 2, 3)
self.general_table.attach(self.info_hosts_up_label, 1, 2, 2, 3)
self.general_table.attach(self.host_down_label,0,1,3,4)
self.general_table.attach(self.info_hosts_down_label,1,2,3,4)
self.general_table.attach(self.host_down_label, 0, 1, 3, 4)
self.general_table.attach(self.info_hosts_down_label, 1, 2, 3, 4)
self.general_table.attach(self.host_scanned_label,0,1,4,5)
self.general_table.attach(self.info_hosts_scanned_label,1,2,4,5)
self.general_table.attach(self.host_scanned_label, 0, 1, 4, 5)
self.general_table.attach(self.info_hosts_scanned_label, 1, 2, 4, 5)
self.general_table.attach(self.open_label,0,1,5,6)
self.general_table.attach(self.info_open_label,1,2,5,6)
self.general_table.attach(self.open_label, 0, 1, 5, 6)
self.general_table.attach(self.info_open_label, 1, 2, 5, 6)
self.general_table.attach(self.filtered_label,0,1,6,7)
self.general_table.attach(self.info_filtered_label,1,2,6,7)
self.general_table.attach(self.filtered_label, 0, 1, 6, 7)
self.general_table.attach(self.info_filtered_label, 1, 2, 6, 7)
self.general_table.attach(self.closed_label,0,1,7,8)
self.general_table.attach(self.info_closed_label,1,2,7,8)
self.general_table.attach(self.closed_label, 0, 1, 7, 8)
self.general_table.attach(self.info_closed_label, 1, 2, 7, 8)
self.general_expander.add(self.general_hbox)
self._pack_noexpand_nofill(self.general_expander)
@@ -260,7 +264,8 @@ class ScanRunDetailsPage(HIGVBox):
self.info_closed_label.set_text(str(scan.get_closed_ports()))
for scaninfo in scan.get_scaninfo():
exp = gtk.Expander('<b>%s - %s</b>' % (_('Scan Info'), scaninfo['type'].capitalize()))
exp = gtk.Expander('<b>%s - %s</b>' % (
_('Scan Info'), scaninfo['type'].capitalize()))
exp.set_use_markup(True)
display = self.make_scaninfo_display(scaninfo)
@@ -277,17 +282,18 @@ class ScanRunDetailsPage(HIGVBox):
table.set_row_spacings(6)
table.set_col_spacings(6)
table.attach(HIGEntryLabel(_('Scan type:')),0,1,0,1)
table.attach(HIGEntryLabel(scaninfo['type']),1,2,0,1)
table.attach(HIGEntryLabel(_('Scan type:')), 0, 1, 0, 1)
table.attach(HIGEntryLabel(scaninfo['type']), 1, 2, 0, 1)
table.attach(HIGEntryLabel(_('Protocol:')),0,1,1,2)
table.attach(HIGEntryLabel(scaninfo['protocol']),1,2,1,2)
table.attach(HIGEntryLabel(_('Protocol:')), 0, 1, 1, 2)
table.attach(HIGEntryLabel(scaninfo['protocol']), 1, 2, 1, 2)
table.attach(HIGEntryLabel(_('# scanned ports:')),0,1,2,3)
table.attach(HIGEntryLabel(scaninfo['numservices']),1,2,2,3)
table.attach(HIGEntryLabel(_('# scanned ports:')), 0, 1, 2, 3)
table.attach(HIGEntryLabel(scaninfo['numservices']), 1, 2, 2, 3)
table.attach(HIGEntryLabel(_('Services:')),0,1,3,4)
table.attach(self.make_services_display(scaninfo['services']),1,2,3,4)
table.attach(HIGEntryLabel(_('Services:')), 0, 1, 3, 4)
table.attach(
self.make_services_display(scaninfo['services']), 1, 2, 3, 4)
hbox._pack_noexpand_nofill(hig_box_space_holder())
hbox._pack_noexpand_nofill(table)