mirror of
https://github.com/nmap/nmap.git
synced 2025-12-09 14:11: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:
@@ -128,7 +128,7 @@ from zenmapCore.Paths import Path
|
||||
|
||||
|
||||
FORMAT_RGBA = 4
|
||||
FORMAT_RGB = 3
|
||||
FORMAT_RGB = 3
|
||||
|
||||
|
||||
def get_pixels_for_cairo_image_surface(pixbuf):
|
||||
@@ -144,16 +144,16 @@ def get_pixels_for_cairo_image_surface(pixbuf):
|
||||
j = 0
|
||||
while i < len(pixbuf.get_pixels()):
|
||||
|
||||
b, g, r = pixbuf.get_pixels()[i:i+FORMAT_RGB]
|
||||
b, g, r = pixbuf.get_pixels()[i:i + FORMAT_RGB]
|
||||
|
||||
if format == FORMAT_RGBA:
|
||||
a = pixbuf.get_pixels()[i + FORMAT_RGBA - 1]
|
||||
elif format == FORMAT_RGB:
|
||||
a = '\xff'
|
||||
else:
|
||||
raise TypeError, 'unknown image format'
|
||||
raise TypeError('unknown image format')
|
||||
|
||||
data[j:j+FORMAT_RGBA] = array.ArrayType('c', [r, g, b, a])
|
||||
data[j:j + FORMAT_RGBA] = array.ArrayType('c', [r, g, b, a])
|
||||
|
||||
i += format
|
||||
j += FORMAT_RGBA
|
||||
@@ -170,13 +170,11 @@ class Image:
|
||||
self.__path = path
|
||||
self.__cache = dict()
|
||||
|
||||
|
||||
def set_path(self, path):
|
||||
"""
|
||||
"""
|
||||
self.__path = path
|
||||
|
||||
|
||||
def get_pixbuf(self, icon, image_type='png'):
|
||||
"""
|
||||
"""
|
||||
@@ -186,11 +184,11 @@ class Image:
|
||||
if icon + image_type not in self.__cache.keys():
|
||||
|
||||
file = self.get_icon(icon, image_type)
|
||||
self.__cache[icon + image_type] = gtk.gdk.pixbuf_new_from_file(file)
|
||||
self.__cache[icon + image_type] = \
|
||||
gtk.gdk.pixbuf_new_from_file(file)
|
||||
|
||||
return self.__cache[icon + image_type]
|
||||
|
||||
|
||||
def get_icon(self, icon, image_type='png'):
|
||||
"""
|
||||
"""
|
||||
@@ -200,7 +198,6 @@ class Image:
|
||||
return os.path.join(self.__path, icon + "." + image_type)
|
||||
|
||||
|
||||
|
||||
class Pixmaps(Image):
|
||||
"""
|
||||
"""
|
||||
@@ -210,7 +207,6 @@ class Pixmaps(Image):
|
||||
Image.__init__(self, os.path.join(Path.pixmaps_dir, "radialnet"))
|
||||
|
||||
|
||||
|
||||
class Icons(Image):
|
||||
"""
|
||||
"""
|
||||
@@ -220,7 +216,6 @@ class Icons(Image):
|
||||
Image.__init__(self, os.path.join(Path.pixmaps_dir, "radialnet"))
|
||||
|
||||
|
||||
|
||||
class Application(Image):
|
||||
"""
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user