diff options
-rw-r--r-- | grc/core/Block.py | 22 | ||||
-rw-r--r-- | grc/core/Connection.py | 10 | ||||
-rw-r--r-- | grc/core/Element.py | 2 | ||||
-rw-r--r-- | grc/core/FlowGraph.py | 4 | ||||
-rw-r--r-- | grc/core/Param.py | 64 | ||||
-rw-r--r-- | grc/core/Platform.py | 20 | ||||
-rw-r--r-- | grc/core/Port.py | 20 | ||||
-rw-r--r-- | grc/core/utils/odict.py | 4 | ||||
-rw-r--r-- | grc/gui/Block.py | 2 | ||||
-rw-r--r-- | grc/gui/Executor.py | 2 | ||||
-rw-r--r-- | grc/gui/FlowGraph.py | 2 | ||||
-rw-r--r-- | grc/gui/ParserErrorsDialog.py | 2 | ||||
-rw-r--r-- | grc/gui/PropsDialog.py | 2 | ||||
-rw-r--r-- | grc/gui/Utils.py | 2 | ||||
-rw-r--r-- | grc/gui/VariableEditor.py | 2 | ||||
-rw-r--r--[-rwxr-xr-x] | grc/main.py | 0 |
16 files changed, 80 insertions, 80 deletions
diff --git a/grc/core/Block.py b/grc/core/Block.py index 8a683a2b6b..737142442b 100644 --- a/grc/core/Block.py +++ b/grc/core/Block.py @@ -41,7 +41,7 @@ def _get_elem(lst, key): try: return lst[_get_keys(lst).index(key)] except ValueError: - raise ValueError('Key "{}" not found in {}.'.format(key, _get_keys(lst))) + raise ValueError('Key "{0}" not found in {1}.'.format(key, _get_keys(lst))) class Block(Element): @@ -121,7 +121,7 @@ class Block(Element): key = param.get_key() # Test against repeated keys if key in self.get_param_keys(): - raise Exception('Key "{}" already exists in params'.format(key)) + raise Exception('Key "{0}" already exists in params'.format(key)) # Store the param self.get_params().append(param) # Create the source objects @@ -130,7 +130,7 @@ class Block(Element): key = source.get_key() # Test against repeated keys if key in self.get_source_keys(): - raise Exception('Key "{}" already exists in sources'.format(key)) + raise Exception('Key "{0}" already exists in sources'.format(key)) # Store the port self.get_sources().append(source) self.back_ofthe_bus(self.get_sources()) @@ -140,7 +140,7 @@ class Block(Element): key = sink.get_key() # Test against repeated keys if key in self.get_sink_keys(): - raise Exception('Key "{}" already exists in sinks'.format(key)) + raise Exception('Key "{0}" already exists in sinks'.format(key)) # Store the port self.get_sinks().append(sink) self.back_ofthe_bus(self.get_sinks()) @@ -250,9 +250,9 @@ class Block(Element): check_res = self.resolve_dependencies(check) try: if not self.get_parent().evaluate(check_res): - self.add_error_message('Check "{}" failed.'.format(check)) + self.add_error_message('Check "{0}" failed.'.format(check)) except: - self.add_error_message('Check "{}" did not evaluate.'.format(check)) + self.add_error_message('Check "{0}" did not evaluate.'.format(check)) # For variables check the value (only if var_value is used if self.is_variable and self._var_value != '$value': @@ -261,7 +261,7 @@ class Block(Element): value = self.get_var_value() self.get_parent().evaluate(value) except Exception as err: - self.add_error_message('Value "{}" cannot be evaluated:\n{}'.format(value, err)) + self.add_error_message('Value "{0}" cannot be evaluated:\n{1}'.format(value, err)) # check if this is a GUI block and matches the selected generate option current_generate_option = self.get_parent().get_option('generate_options') @@ -272,7 +272,7 @@ class Block(Element): self.get_name().upper().startswith(label) ) if block_requires_mode and current_generate_option not in valid_options: - self.add_error_message("Can't generate this block in mode: {} ".format( + self.add_error_message("Can't generate this block in mode: {0} ".format( repr(current_generate_option))) check_generate_mode('WX GUI', BLOCK_FLAG_NEED_WX_GUI, ('wx_gui',)) @@ -390,7 +390,7 @@ class Block(Element): callback = self.resolve_dependencies(callback) if 'self.' in callback: return callback - return 'self.{}.{}'.format(self.get_id(), callback) + return 'self.{0}.{1}'.format(self.get_id(), callback) return map(make_callback, self._callbacks) def is_virtual_sink(self): @@ -584,7 +584,7 @@ class Block(Element): return True def __str__(self): - return 'Block - {} - {}({})'.format(self.get_id(), self.get_name(), self.get_key()) + return 'Block - {0} - {1}({2})'.format(self.get_id(), self.get_name(), self.get_key()) def get_id(self): return self.get_param('id').get_value() @@ -699,7 +699,7 @@ class Block(Element): try: return str(Template(tmpl, n)) except Exception as err: - return "Template error: {}\n {}".format(tmpl, err) + return "Template error: {0}\n {1}".format(tmpl, err) ############################################## # Controller Modify diff --git a/grc/core/Connection.py b/grc/core/Connection.py index 3aa32ef183..49eae69c82 100644 --- a/grc/core/Connection.py +++ b/grc/core/Connection.py @@ -75,7 +75,7 @@ class Connection(Element): pass def __str__(self): - return 'Connection (\n\t{}\n\t\t{}\n\t{}\n\t\t{}\n)'.format( + return 'Connection (\n\t{0}\n\t\t{1}\n\t{2}\n\t\t{3}\n)'.format( self.get_source().get_parent(), self.get_source(), self.get_sink().get_parent(), @@ -102,7 +102,7 @@ class Connection(Element): source_domain = self.get_source().get_domain() sink_domain = self.get_sink().get_domain() if (source_domain, sink_domain) not in platform.connection_templates: - self.add_error_message('No connection known for domains "{}", "{}"'.format( + self.add_error_message('No connection known for domains "{0}", "{1}"'.format( source_domain, sink_domain)) too_many_other_sinks = ( not platform.domains.get(source_domain, []).get('multiple_sinks', False) and @@ -114,15 +114,15 @@ class Connection(Element): ) if too_many_other_sinks: self.add_error_message( - 'Domain "{}" can have only one downstream block'.format(source_domain)) + 'Domain "{0}" can have only one downstream block'.format(source_domain)) if too_many_other_sources: self.add_error_message( - 'Domain "{}" can have only one upstream block'.format(sink_domain)) + 'Domain "{0}" can have only one upstream block'.format(sink_domain)) source_size = Constants.TYPE_TO_SIZEOF[self.get_source().get_type()] * self.get_source().get_vlen() sink_size = Constants.TYPE_TO_SIZEOF[self.get_sink().get_type()] * self.get_sink().get_vlen() if source_size != sink_size: - self.add_error_message('Source IO size "{}" does not match sink IO size "{}".'.format(source_size, sink_size)) + self.add_error_message('Source IO size "{0}" does not match sink IO size "{1}".'.format(source_size, sink_size)) def get_enabled(self): """ diff --git a/grc/core/Element.py b/grc/core/Element.py index 67c36e12b4..d80753d8fa 100644 --- a/grc/core/Element.py +++ b/grc/core/Element.py @@ -66,7 +66,7 @@ class Element(object): error_messages = list(self._error_messages) # Make a copy for child in filter(lambda c: c.get_enabled() and not c.get_bypassed(), self.get_children()): for msg in child.get_error_messages(): - error_messages.append("{}:\n\t{}".format(child, msg.replace("\n", "\n\t"))) + error_messages.append("{0}:\n\t{1}".format(child, msg.replace("\n", "\n\t"))) return error_messages def rewrite(self): diff --git a/grc/core/FlowGraph.py b/grc/core/FlowGraph.py index 949eecaa71..48563eefb1 100644 --- a/grc/core/FlowGraph.py +++ b/grc/core/FlowGraph.py @@ -64,7 +64,7 @@ class FlowGraph(Element): self._options_block = self.new_block('options') def __str__(self): - return 'FlowGraph - {}({})'.format(self.get_option('title'), self.get_option('id')) + return 'FlowGraph - {0}({1})'.format(self.get_option('title'), self.get_option('id')) ############################################## # TODO: Move these to new generator package @@ -461,7 +461,7 @@ class FlowGraph(Element): self.connect(source_port, sink_port) except LookupError as e: Messages.send_error_load( - 'Connection between {}({}) and {}({}) could not be made.\n\t{}'.format( + 'Connection between {0}({1}) and {2}({3}) could not be made.\n\t{4}'.format( source_block_id, source_key, sink_block_id, sink_key, e)) errors = True diff --git a/grc/core/Param.py b/grc/core/Param.py index 201032d010..26f9d2f451 100644 --- a/grc/core/Param.py +++ b/grc/core/Param.py @@ -49,14 +49,14 @@ def _get_elem(lst, key): try: return lst[_get_keys(lst).index(key)] except ValueError: - raise ValueError('Key "{}" not found in {}.'.format(key, _get_keys(lst))) + raise ValueError('Key "{0}" not found in {1}.'.format(key, _get_keys(lst))) def num_to_str(num): """ Display logic for numbers """ def eng_notation(value, fmt='g'): """Convert a number to a string in engineering notation. E.g., 5e-9 -> 5n""" - template = '{:' + fmt + '}{}' + template = '{0:' + fmt + '}{1}' magnitude = abs(value) for exp, symbol in zip(range(9, -15-1, -3), 'GMk munpf'): factor = 10 ** exp @@ -92,15 +92,15 @@ class Option(Element): try: key, value = opt.split(':') except: - raise Exception('Error separating "{}" into key:value'.format(opt)) + raise Exception('Error separating "{0}" into key:value'.format(opt)) # Test against repeated keys if key in self._opts: - raise Exception('Key "{}" already exists in option'.format(key)) + raise Exception('Key "{0}" already exists in option'.format(key)) # Store the option self._opts[key] = value def __str__(self): - return 'Option {}({})'.format(self.get_name(), self.get_key()) + return 'Option {0}({1})'.format(self.get_name(), self.get_key()) def get_name(self): return self._name @@ -180,26 +180,26 @@ class Param(Element): key = option.get_key() # Test against repeated keys if key in self.get_option_keys(): - raise Exception('Key "{}" already exists in options'.format(key)) + raise Exception('Key "{0}" already exists in options'.format(key)) # Store the option self.get_options().append(option) # Test the enum options if self.is_enum(): # Test against options with identical keys if len(set(self.get_option_keys())) != len(self.get_options()): - raise Exception('Options keys "{}" are not unique.'.format(self.get_option_keys())) + raise Exception('Options keys "{0}" are not unique.'.format(self.get_option_keys())) # Test against inconsistent keys in options opt_keys = self.get_options()[0].get_opt_keys() for option in self.get_options(): if set(opt_keys) != set(option.get_opt_keys()): - raise Exception('Opt keys "{}" are not identical across all options.'.format(opt_keys)) + raise Exception('Opt keys "{0}" are not identical across all options.'.format(opt_keys)) # If a value is specified, it must be in the options keys if value or value in self.get_option_keys(): self._value = value else: self._value = self.get_option_keys()[0] if self.get_value() not in self.get_option_keys(): - raise Exception('The value "{}" is not in the possible values of "{}".'.format(self.get_value(), self.get_option_keys())) + raise Exception('The value "{0}" is not in the possible values of "{1}".'.format(self.get_value(), self.get_option_keys())) else: self._value = value or '' self._default = value @@ -290,7 +290,7 @@ class Param(Element): return self.get_value() def __str__(self): - return 'Param - {}({})'.format(self.get_name(), self.get_key()) + return 'Param - {0}({1})'.format(self.get_name(), self.get_key()) def get_color(self): """ @@ -366,7 +366,7 @@ class Param(Element): """ Element.validate(self) if self.get_type() not in self.get_types(): - self.add_error_message('Type "{}" is not a possible type.'.format(self.get_type())) + self.add_error_message('Type "{0}" is not a possible type.'.format(self.get_type())) self._evaluated = None try: @@ -405,30 +405,30 @@ class Param(Element): try: e = self.get_parent().get_parent().evaluate(v) except Exception, e: - raise Exception('Value "{}" cannot be evaluated:\n{}'.format(v, e)) + raise Exception('Value "{0}" cannot be evaluated:\n{1}'.format(v, e)) # Raise an exception if the data is invalid if t == 'raw': return e elif t == 'complex': if not isinstance(e, COMPLEX_TYPES): - raise Exception('Expression "{}" is invalid for type complex.'.format(str(e))) + raise Exception('Expression "{0}" is invalid for type complex.'.format(str(e))) return e elif t == 'real' or t == 'float': if not isinstance(e, REAL_TYPES): - raise Exception('Expression "{}" is invalid for type float.'.format(str(e))) + raise Exception('Expression "{0}" is invalid for type float.'.format(str(e))) return e elif t == 'int': if not isinstance(e, INT_TYPES): - raise Exception('Expression "{}" is invalid for type integer.'.format(str(e))) + raise Exception('Expression "{0}" is invalid for type integer.'.format(str(e))) return e elif t == 'hex': return hex(e) elif t == 'bool': if not isinstance(e, bool): - raise Exception('Expression "{}" is invalid for type bool.'.format(str(e))) + raise Exception('Expression "{0}" is invalid for type bool.'.format(str(e))) return e else: - raise TypeError('Type "{}" not handled'.format(t)) + raise TypeError('Type "{0}" not handled'.format(t)) ######################### # Numeric Vector Types ######################### @@ -440,28 +440,28 @@ class Param(Element): try: e = self.get_parent().get_parent().evaluate(v) except Exception, e: - raise Exception('Value "{}" cannot be evaluated:\n{}'.format(v, e)) + raise Exception('Value "{0}" cannot be evaluated:\n{1}'.format(v, e)) # Raise an exception if the data is invalid if t == 'complex_vector': if not isinstance(e, VECTOR_TYPES): self._lisitify_flag = True e = [e] if not all([isinstance(ei, COMPLEX_TYPES) for ei in e]): - raise Exception('Expression "{}" is invalid for type complex vector.'.format(str(e))) + raise Exception('Expression "{0}" is invalid for type complex vector.'.format(str(e))) return e elif t == 'real_vector' or t == 'float_vector': if not isinstance(e, VECTOR_TYPES): self._lisitify_flag = True e = [e] if not all([isinstance(ei, REAL_TYPES) for ei in e]): - raise Exception('Expression "{}" is invalid for type float vector.'.format(str(e))) + raise Exception('Expression "{0}" is invalid for type float vector.'.format(str(e))) return e elif t == 'int_vector': if not isinstance(e, VECTOR_TYPES): self._lisitify_flag = True e = [e] if not all([isinstance(ei, INT_TYPES) for ei in e]): - raise Exception('Expression "{}" is invalid for type integer vector.'.format(str(e))) + raise Exception('Expression "{0}" is invalid for type integer vector.'.format(str(e))) return e ######################### # String Types @@ -484,14 +484,14 @@ class Param(Element): elif t == 'id': # Can python use this as a variable? if not _check_id_matcher.match(v): - raise Exception('ID "{}" must begin with a letter and may contain letters, numbers, and underscores.'.format(v)) + raise Exception('ID "{0}" must begin with a letter and may contain letters, numbers, and underscores.'.format(v)) ids = [param.get_value() for param in self.get_all_params(t)] # Id should only appear once, or zero times if block is disabled if ids.count(v) > 1: - raise Exception('ID "{}" is not unique.'.format(v)) + raise Exception('ID "{0}" is not unique.'.format(v)) if v in ID_BLACKLIST: - raise Exception('ID "{}" is blacklisted.'.format(v)) + raise Exception('ID "{0}" is blacklisted.'.format(v)) return v ######################### @@ -507,11 +507,11 @@ class Param(Element): if self.get_parent().is_virtual_sink(): # Id should only appear once, or zero times if block is disabled if ids.count(v) > 1: - raise Exception('Stream ID "{}" is not unique.'.format(v)) + raise Exception('Stream ID "{0}" is not unique.'.format(v)) # Check that the virtual source's steam id is found if self.get_parent().is_virtual_source(): if v not in ids: - raise Exception('Stream ID "{}" is not found.'.format(v)) + raise Exception('Stream ID "{0}" is not found.'.format(v)) return v ######################### @@ -581,7 +581,7 @@ class Param(Element): for param in params: for parent, cell in param._hostage_cells: if (parent, cell) in self._hostage_cells: - raise Exception('Another graphical element is using parent "{}", cell "{}".'.format(str(parent), str(cell))) + raise Exception('Another graphical element is using parent "{0}", cell "{1}".'.format(str(parent), str(cell))) return e ######################### # Notebook Page Type @@ -602,11 +602,11 @@ class Param(Element): try: notebook_block = filter(lambda b: b.get_id() == notebook_id, notebook_blocks)[0] except: - raise Exception('Notebook id "{}" is not an existing notebook id.'.format(notebook_id)) + raise Exception('Notebook id "{0}" is not an existing notebook id.'.format(notebook_id)) # Check that page index exists if int(page_index) not in range(len(notebook_block.get_param('labels').evaluate())): - raise Exception('Page index "{}" is not a valid index number.'.format(page_index)) + raise Exception('Page index "{0}" is not a valid index number.'.format(page_index)) return notebook_id, page_index ######################### @@ -618,14 +618,14 @@ class Param(Element): try: exec v in n except ImportError: - raise Exception('Import "{}" failed.'.format(v)) + raise Exception('Import "{0}" failed.'.format(v)) except Exception: - raise Exception('Bad import syntax: "{}".'.format(v)) + raise Exception('Bad import syntax: "{0}".'.format(v)) return filter(lambda k: str(k) != '__builtins__', n.keys()) ######################### else: - raise TypeError('Type "{}" not handled'.format(t)) + raise TypeError('Type "{0}" not handled'.format(t)) def to_code(self): """ diff --git a/grc/core/Platform.py b/grc/core/Platform.py index 9b25e67d65..416e61615f 100644 --- a/grc/core/Platform.py +++ b/grc/core/Platform.py @@ -78,7 +78,7 @@ class Platform(Element): self.build_block_library() def __str__(self): - return 'Platform - {}({})'.format(self.config.key, self.config.name) + return 'Platform - {0}({1})'.format(self.config.key, self.config.name) @staticmethod def find_file_in_paths(filename, paths, cwd): @@ -116,18 +116,18 @@ class Platform(Element): if not flow_graph.get_option('generate_options').startswith('hb'): raise Exception('Not a hier block') except Exception as e: - Messages.send('>>> Load Error: {}: {}\n'.format(file_path, str(e))) + Messages.send('>>> Load Error: {0}: {1}\n'.format(file_path, str(e))) return False finally: self._auto_hier_block_generate_chain.discard(file_path) Messages.set_indent(len(self._auto_hier_block_generate_chain)) try: - Messages.send('>>> Generating: {}\n'.format(file_path)) + Messages.send('>>> Generating: {0}\n'.format(file_path)) generator = self.Generator(flow_graph, file_path) generator.write() except Exception as e: - Messages.send('>>> Generate Error: {}: {}\n'.format(file_path, str(e))) + Messages.send('>>> Generate Error: {0}: {1}\n'.format(file_path, str(e))) return False self.load_block_xml(generator.get_file_path_xml()) @@ -195,7 +195,7 @@ class Platform(Element): block = self.Block(self._flow_graph, n) key = block.get_key() if key in self.blocks: - print >> sys.stderr, 'Warning: Block with key "{}" already exists.\n\tIgnoring: {}'.format(key, xml_file) + print >> sys.stderr, 'Warning: Block with key "{0}" already exists.\n\tIgnoring: {1}'.format(key, xml_file) else: # Store the block self.blocks[key] = block self._blocks_n[key] = n @@ -230,10 +230,10 @@ class Platform(Element): key = n.find('key') if not key: - print >> sys.stderr, 'Warning: Domain with emtpy key.\n\tIgnoring: {}'.format(xml_file) + print >> sys.stderr, 'Warning: Domain with emtpy key.\n\tIgnoring: {0}'.format(xml_file) return if key in self.domains: # test against repeated keys - print >> sys.stderr, 'Warning: Domain with key "{}" already exists.\n\tIgnoring: {}'.format(key, xml_file) + print >> sys.stderr, 'Warning: Domain with key "{0}" already exists.\n\tIgnoring: {1}'.format(key, xml_file) return #to_bool = lambda s, d: d if s is None else s.lower() not in ('false', 'off', '0', '') @@ -248,7 +248,7 @@ class Platform(Element): gtk.gdk.color_parse(color) except (ValueError, ImportError): if color: # no color is okay, default set in GUI - print >> sys.stderr, 'Warning: Can\'t parse color code "{}" for domain "{}" '.format(color, key) + print >> sys.stderr, 'Warning: Can\'t parse color code "{0}" for domain "{1}" '.format(color, key) color = None self.domains[key] = dict( @@ -260,9 +260,9 @@ class Platform(Element): for connection_n in n.findall('connection'): key = (connection_n.find('source_domain'), connection_n.find('sink_domain')) if not all(key): - print >> sys.stderr, 'Warning: Empty domain key(s) in connection template.\n\t{}'.format(xml_file) + print >> sys.stderr, 'Warning: Empty domain key(s) in connection template.\n\t{0}'.format(xml_file) elif key in self.connection_templates: - print >> sys.stderr, 'Warning: Connection template "{}" already exists.\n\t{}'.format(key, xml_file) + print >> sys.stderr, 'Warning: Connection template "{0}" already exists.\n\t{1}'.format(key, xml_file) else: self.connection_templates[key] = connection_n.find('make') or '' diff --git a/grc/core/Port.py b/grc/core/Port.py index 6a8f484082..8808bc4dbd 100644 --- a/grc/core/Port.py +++ b/grc/core/Port.py @@ -32,7 +32,7 @@ def _get_source_from_virtual_sink_port(vsp): return _get_source_from_virtual_source_port( vsp.get_enabled_connections()[0].get_source()) except: - raise Exception('Could not resolve source for virtual sink port {}'.format(vsp)) + raise Exception('Could not resolve source for virtual sink port {0}'.format(vsp)) def _get_source_from_virtual_source_port(vsp, traversed=[]): @@ -43,7 +43,7 @@ def _get_source_from_virtual_source_port(vsp, traversed=[]): if not vsp.get_parent().is_virtual_source(): return vsp if vsp in traversed: - raise Exception('Loop found when resolving virtual source {}'.format(vsp)) + raise Exception('Loop found when resolving virtual source {0}'.format(vsp)) try: return _get_source_from_virtual_source_port( _get_source_from_virtual_sink_port( @@ -57,7 +57,7 @@ def _get_source_from_virtual_source_port(vsp, traversed=[]): ), traversed + [vsp], ) except: - raise Exception('Could not resolve source for virtual source port {}'.format(vsp)) + raise Exception('Could not resolve source for virtual source port {0}'.format(vsp)) def _get_sink_from_virtual_source_port(vsp): @@ -70,7 +70,7 @@ def _get_sink_from_virtual_source_port(vsp): return _get_sink_from_virtual_sink_port( vsp.get_enabled_connections()[0].get_sink()) except: - raise Exception('Could not resolve source for virtual source port {}'.format(vsp)) + raise Exception('Could not resolve source for virtual source port {0}'.format(vsp)) def _get_sink_from_virtual_sink_port(vsp, traversed=[]): @@ -81,7 +81,7 @@ def _get_sink_from_virtual_sink_port(vsp, traversed=[]): if not vsp.get_parent().is_virtual_sink(): return vsp if vsp in traversed: - raise Exception('Loop found when resolving virtual sink {}'.format(vsp)) + raise Exception('Loop found when resolving virtual sink {0}'.format(vsp)) try: return _get_sink_from_virtual_sink_port( _get_sink_from_virtual_source_port( @@ -95,7 +95,7 @@ def _get_sink_from_virtual_sink_port(vsp, traversed=[]): ), traversed + [vsp], ) except: - raise Exception('Could not resolve source for virtual sink port {}'.format(vsp)) + raise Exception('Could not resolve source for virtual sink port {0}'.format(vsp)) class Port(Element): @@ -142,9 +142,9 @@ class Port(Element): def __str__(self): if self.is_source: - return 'Source - {}({})'.format(self.get_name(), self.get_key()) + return 'Source - {0}({1})'.format(self.get_name(), self.get_key()) if self.is_sink: - return 'Sink - {}({})'.format(self.get_name(), self.get_key()) + return 'Sink - {0}({1})'.format(self.get_name(), self.get_key()) def get_types(self): return Constants.TYPE_TO_SIZEOF.keys() @@ -155,10 +155,10 @@ class Port(Element): def validate(self): Element.validate(self) if self.get_type() not in self.get_types(): - self.add_error_message('Type "{}" is not a possible type.'.format(self.get_type())) + self.add_error_message('Type "{0}" is not a possible type.'.format(self.get_type())) platform = self.get_parent().get_parent().get_parent() if self.get_domain() not in platform.domains: - self.add_error_message('Domain key "{}" is not registered.'.format(self.get_domain())) + self.add_error_message('Domain key "{0}" is not registered.'.format(self.get_domain())) if not self.get_enabled_connections() and not self.get_optional(): self.add_error_message('Port is not connected.') # Message port logic diff --git a/grc/core/utils/odict.py b/grc/core/utils/odict.py index 85927e869f..9d69082600 100644 --- a/grc/core/utils/odict.py +++ b/grc/core/utils/odict.py @@ -59,7 +59,7 @@ class odict(DictMixin): """ index = (pos_key is None) and len(self._keys) or self._keys.index(pos_key) if key in self._keys: - raise KeyError('Cannot insert, key "{}" already exists'.format(str(key))) + raise KeyError('Cannot insert, key "{0}" already exists'.format(str(key))) self._keys.insert(index+1, key) self._data[key] = val @@ -75,7 +75,7 @@ class odict(DictMixin): """ index = (pos_key is not None) and self._keys.index(pos_key) or 0 if key in self._keys: - raise KeyError('Cannot insert, key "{}" already exists'.format(str(key))) + raise KeyError('Cannot insert, key "{0}" already exists'.format(str(key))) self._keys.insert(index, key) self._data[key] = val diff --git a/grc/gui/Block.py b/grc/gui/Block.py index 55c8805fae..b9fc12b782 100644 --- a/grc/gui/Block.py +++ b/grc/gui/Block.py @@ -274,7 +274,7 @@ class Block(Element, _Block): # Show the flowgraph complexity on the top block if enabled if Actions.TOGGLE_SHOW_FLOWGRAPH_COMPLEXITY.get_active() and self.get_key() == "options": complexity = calculate_flowgraph_complexity(self.get_parent()) - complexity = "Complexity: {}bal".format(num_to_str(complexity)) + complexity = "Complexity: {0}bal".format(num_to_str(complexity)) layout = gtk.DrawingArea().create_pango_layout('') layout.set_markup(Utils.parse_template(COMMENT_COMPLEXITY_MARKUP_TMPL, diff --git a/grc/gui/Executor.py b/grc/gui/Executor.py index bf9eecb9a8..f91a341541 100644 --- a/grc/gui/Executor.py +++ b/grc/gui/Executor.py @@ -65,7 +65,7 @@ class ExecFlowGraphThread(threading.Thread): filename=shlex_quote(generator.file_path)) run_command_args = shlex.split(run_command) except Exception as e: - raise ValueError("Can't parse run command {!r}: {}".format(run_command, e)) + raise ValueError("Can't parse run command {!r}: {0}".format(run_command, e)) # When in no gui mode on linux, use a graphical terminal (looks nice) xterm_executable = find_executable(self.xterm_executable) diff --git a/grc/gui/FlowGraph.py b/grc/gui/FlowGraph.py index f98aec41d5..44a8ae24a9 100644 --- a/grc/gui/FlowGraph.py +++ b/grc/gui/FlowGraph.py @@ -77,7 +77,7 @@ class FlowGraph(Element, _Flowgraph): a unique id """ for index in count(): - block_id = '{}_{}'.format(base_id, index) + block_id = '{0}_{1}'.format(base_id, index) if block_id not in (b.get_id() for b in self.blocks): break return block_id diff --git a/grc/gui/ParserErrorsDialog.py b/grc/gui/ParserErrorsDialog.py index 68ee459414..57485eda93 100644 --- a/grc/gui/ParserErrorsDialog.py +++ b/grc/gui/ParserErrorsDialog.py @@ -83,7 +83,7 @@ class ParserErrorsDialog(gtk.Dialog): em = self.tree_store.append(parent, ["Line {e.line}: {e.message}".format(e=error)]) if code: self.tree_store.append(em, ["\n".join( - "{} {}{}".format(line, code[line - 1].replace("\t", " ").strip("\n"), + "{0} {1}{2}".format(line, code[line - 1].replace("\t", " ").strip("\n"), " " * 20 + "<!-- ERROR -->" if line == error.line else "") for line in range(error.line - 2, error.line + 3) if 0 < line <= len(code) )]) diff --git a/grc/gui/PropsDialog.py b/grc/gui/PropsDialog.py index 7c66a77a54..0e7005d7a7 100644 --- a/grc/gui/PropsDialog.py +++ b/grc/gui/PropsDialog.py @@ -265,7 +265,7 @@ class PropsDialog(gtk.Dialog): insert('\n\n# Variables\n', block.get_var_make()) insert('\n\n# Blocks\n', block.get_make()) if src: - insert('\n\n# External Code ({}.py)\n'.format(block.get_id()), src) + insert('\n\n# External Code ({0}.py)\n'.format(block.get_id()), src) def _handle_key_press(self, widget, event): """ diff --git a/grc/gui/Utils.py b/grc/gui/Utils.py index 51b9b19e9f..80dcb4283a 100644 --- a/grc/gui/Utils.py +++ b/grc/gui/Utils.py @@ -97,7 +97,7 @@ def encode(value): character. """ - valid_utf8 = value.decode('utf-8', errors='replace').encode('utf-8') + valid_utf8 = value.decode('utf-8', 'replace').encode('utf-8') return gobject.markup_escape_text(valid_utf8) diff --git a/grc/gui/VariableEditor.py b/grc/gui/VariableEditor.py index 7721f3bda6..362a7f687d 100644 --- a/grc/gui/VariableEditor.py +++ b/grc/gui/VariableEditor.py @@ -270,7 +270,7 @@ class VariableEditor(gtk.VBox): # Create a context menu to confirm the delete operation confirmation_menu = gtk.Menu() block_id = self._block.get_param('id').get_value().replace("_", "__") - confirm = gtk.MenuItem("Delete {}".format(block_id)) + confirm = gtk.MenuItem("Delete {0}".format(block_id)) confirm.connect('activate', self.handle_action, self.DELETE_BLOCK) confirmation_menu.add(confirm) confirmation_menu.show_all() diff --git a/grc/main.py b/grc/main.py index ae7a0ce115..ae7a0ce115 100755..100644 --- a/grc/main.py +++ b/grc/main.py |