1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00

Fix Python syntax for dict literals

This commit is contained in:
dmiller
2025-05-29 18:06:32 +00:00
parent b35a88ac60
commit 340947fa29
6 changed files with 21 additions and 19 deletions

View File

@@ -640,8 +640,8 @@ in epoch format!")
return scan_name return scan_name
if self.profile_name and self.get_targets(): if self.profile_name and self.get_targets():
return _("%(profile_name)s on %(targets)s") % { return _("%(profile_name)s on %(targets)s") % {
profile_name = self.profile_name, 'profile_name': self.profile_name,
targets = join_quoted(self.get_targets()) 'targets': join_quoted(self.get_targets())
} }
return self.get_nmap_command() return self.get_nmap_command()

View File

@@ -130,7 +130,7 @@ class About(HIGDialog):
def __init__(self): def __init__(self):
HIGDialog.__init__(self) HIGDialog.__init__(self)
self.set_title(_("About %(nmap)s and %(zenmap)s") % { self.set_title(_("About %(nmap)s and %(zenmap)s") % {
nmap = NMAP_DISPLAY_NAME, zenmap = APP_DISPLAY_NAME }) 'nmap': NMAP_DISPLAY_NAME, 'zenmap': APP_DISPLAY_NAME })
self.vbox.set_border_width(12) self.vbox.set_border_width(12)
self.vbox.set_spacing(12) self.vbox.set_spacing(12)
@@ -155,14 +155,14 @@ class About(HIGDialog):
entry = _program_entry(APP_DISPLAY_NAME, APP_WEB_SITE, _( entry = _program_entry(APP_DISPLAY_NAME, APP_WEB_SITE, _(
"%(zenmap)s is a multi-platform graphical %(nmap)s frontend and results viewer. " "%(zenmap)s is a multi-platform graphical %(nmap)s frontend and results viewer. "
"It was originally derived from %(umit)s.") % { "It was originally derived from %(umit)s.") % {
zenmap = APP_DISPLAY_NAME, 'zenmap': APP_DISPLAY_NAME,
nmap = NMAP_DISPLAY_NAME, 'nmap': NMAP_DISPLAY_NAME,
umit = UMIT_DISPLAY_NAME}) 'umit': UMIT_DISPLAY_NAME})
self.vbox.pack_start(entry, True, True, 0) self.vbox.pack_start(entry, True, True, 0)
entry = _program_entry(UMIT_DISPLAY_NAME, UMIT_WEB_SITE, _( entry = _program_entry(UMIT_DISPLAY_NAME, UMIT_WEB_SITE, _(
"%(umit)s is a %(nmap)s GUI created as part of the Nmap/Google Summer " "%(umit)s is a %(nmap)s GUI created as part of the Nmap/Google Summer "
"of Code program.") % {umit = UMIT_DISPLAY_NAME, nmap = NMAP_DISPLAY_NAME}) "of Code program.") % {'umit': UMIT_DISPLAY_NAME, 'nmap': NMAP_DISPLAY_NAME})
button = Gtk.Button.new_with_label(_("%s credits") % UMIT_DISPLAY_NAME) button = Gtk.Button.new_with_label(_("%s credits") % UMIT_DISPLAY_NAME)
button.connect("clicked", self._show_umit_credits) button.connect("clicked", self._show_umit_credits)
entry.hbox.pack_start(button, False, True, 0) entry.hbox.pack_start(button, False, True, 0)

View File

@@ -227,9 +227,9 @@ The specific error was
%(zenmap)s needs to create this directory to store information such as the list of \ %(zenmap)s needs to create this directory to store information such as the list of \
scan profiles. Check for access to the directory and try again.""") % { scan profiles. Check for access to the directory and try again.""") % {
dirname = repr(Path.user_config_dir), 'dirname': repr(Path.user_config_dir),
configdir = repr(Path.config_dir), 'configdir': repr(Path.config_dir),
error = repr(str(e)), zenmap = APP_DISPLAY_NAME 'error': repr(str(e)), zenmap = APP_DISPLAY_NAME
} }
) )
error_dialog.run() error_dialog.run()
@@ -253,7 +253,8 @@ The specific error was
%(zenmap)s can continue without this file but any information in it will be ignored \ %(zenmap)s can continue without this file but any information in it will be ignored \
until it is repaired.""") % { until it is repaired.""") % {
filename = Path.user_config_file, error = str(e), zenmap = APP_DISPLAY_NAME} 'filename': Path.user_config_file,
'error': str(e), 'zenmap': APP_DISPLAY_NAME}
) )
error_dialog.run() error_dialog.run()
error_dialog.destroy() error_dialog.destroy()
@@ -266,7 +267,8 @@ To avoid further errors parsing the configuration file %(filename)s, \
you can copy the default configuration from %(dirname)s. you can copy the default configuration from %(dirname)s.
Do this now? \ Do this now? \
""") % {filename = Path.user_config_file, dirname = global_config_path}, """) % {
'filename': Path.user_config_file, 'dirname': global_config_path},
) )
repair_dialog.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL) repair_dialog.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL)
repair_dialog.set_default_response(Gtk.ResponseType.CANCEL) repair_dialog.set_default_response(Gtk.ResponseType.CANCEL)
@@ -323,7 +325,7 @@ class NonRootWarning (HIGAlertDialog):
warning_text = _('''You are trying to run %(zenmap)s with a non-root user! warning_text = _('''You are trying to run %(zenmap)s with a non-root user!
Some %(nmap)s options need root privileges to work.''') % { Some %(nmap)s options need root privileges to work.''') % {
zenmap = APP_DISPLAY_NAME, nmap = NMAP_DISPLAY_NAME} 'zenmap': APP_DISPLAY_NAME, 'nmap': NMAP_DISPLAY_NAME}
HIGAlertDialog.__init__(self, message_format=_('Non-root user'), HIGAlertDialog.__init__(self, message_format=_('Non-root user'),
secondary_text=warning_text) secondary_text=warning_text)

View File

@@ -899,8 +899,8 @@ This scan has not been run yet. Start the scan with the "Scan" button first.'))
'An error occurred when saving to\n%(configfile)s' 'An error occurred when saving to\n%(configfile)s'
'\nThe error was: %(error)s.' '\nThe error was: %(error)s.'
) % { ) % {
configfile = Path.user_config_file, 'configfile': Path.user_config_file,
error = config_parser.failed 'error': config_parser.failed
}) })
alert.run() alert.run()
alert.destroy() alert.destroy()
@@ -949,7 +949,7 @@ This scan has not been run yet. Start the scan with the "Scan" button first.'))
There was an error loading the documentation file %(helpfile)s (%(error)s). See the \ There was an error loading the documentation file %(helpfile)s (%(error)s). See the \
online documentation at %(url)s.\ online documentation at %(url)s.\
""") % { """) % {
helpfile = doc_path, error = str(e), url = APP_DOCUMENTATION_SITE}) 'helpfile': doc_path, 'error': str(e), 'url': APP_DOCUMENTATION_SITE})
d.run() d.run()
d.destroy() d.destroy()

View File

@@ -686,8 +686,8 @@ class ScanInterface(HIGVBox):
self.filter_bar.set_information_text( self.filter_bar.set_information_text(
_("%(num_shown)d/%(total)d hosts shown") % { _("%(num_shown)d/%(total)d hosts shown") % {
num_shown = len(self.inventory.get_hosts_up()), 'num_shown': len(self.inventory.get_hosts_up()),
total = len(NetworkInventory.get_hosts_up(self.inventory)) 'total': len(NetworkInventory.get_hosts_up(self.inventory))
}) })
mode = self.scan_result.scan_host_view.mode mode = self.scan_result.scan_host_view.mode

View File

@@ -140,7 +140,7 @@ class TopologyPage(HIGVBox):
self.slow_label.set_text(_("""\ self.slow_label.set_text(_("""\
Topology is disabled because too many hosts can cause it Topology is disabled because too many hosts can cause it
to run slowly. The limit is %(limit)d hosts and there are %(num)d.\ to run slowly. The limit is %(limit)d hosts and there are %(num)d.\
""" % {limit = SLOW_LIMIT, num = len(hosts_up)})) """ % {'limit': SLOW_LIMIT, 'num': len(hosts_up)}))
if len(hosts_up) <= SLOW_LIMIT: if len(hosts_up) <= SLOW_LIMIT:
self.radialnet.show() self.radialnet.show()