(self)
Parse all components lines before </Nnet3>
Parse all components lines before </Nnet3>
Parse all components lines before < / Nnet3 >
def parse_component_lines(self):
        """Parse all components lines before </Nnet3>"""
        num = 0
        while True:
            line = next(self._line_buffer)
            pos = 0
            tok, pos = read_next_token(line, pos)
            if tok is None:
                line = next(self._line_buffer)
                pos = 0
                if line is None:
                    _LOG.error("unexpected EOF on line:\n {}".format(line))
                    break
                else:
                    tok, pos = read_next_token(line, pos)
            if tok == '<ComponentName>':
                component_pos = pos
                component_name, pos = read_next_token(line, pos)

                component_type, pos = read_component_type(line, pos)
                assert is_component_type(component_type)
                component_dict, line, pos = self.read_component(line,
                                                                pos,
                                                                component_type)
                if component_dict is not None:
                    if component_name in self._components_by_name:
                        config_dict = self._components_by_name[component_name]
                        new_dict = merge_two_dicts(config_dict, component_dict)
                        self._components_by_name[component_name] = new_dict
                        num += 1
                else:
                    _LOG.error("{0}: error reading component with name {1}"
                               " at position {2}"
                               .format(sys.argv[0],
                                       component_name,
                                       component_pos))
            elif tok == Nnet3End:
                _LOG.info("finished parsing nnet3 (%s) components." % num)
                assert num == self._num_components
                break
            else:
                _LOG.error("{0}: error reading Component:"
                           " at position {1}, expected <ComponentName>,"
                           " got: {2}"
                           .format(sys.argv[0], pos, tok))
                break
def parse_component_lines ( self ) : num = 0 while True : line = next ( self . _line_buffer ) pos = 0 tok , pos = read_next_token ( line , pos ) if tok is None : line = next ( self . _line_buffer ) pos = 0 if line is None : _LOG . error ( "unexpected EOF on line:\n {}" . format ( line ) ) break else : tok , pos = read_next_token ( line , pos ) if tok == '<ComponentName>' : component_pos = pos component_name , pos = read_next_token ( line , pos ) component_type , pos = read_component_type ( line , pos ) assert is_component_type ( component_type ) component_dict , line , pos = self . read_component ( line , pos , component_type ) if component_dict is not None : if component_name in self . _components_by_name : config_dict = self . _components_by_name [ component_name ] new_dict = merge_two_dicts ( config_dict , component_dict ) self . _components_by_name [ component_name ] = new_dict num += 1 else : _LOG . error ( "{0}: error reading component with name {1}" " at position {2}" . format ( sys . argv [ 0 ] , component_name , component_pos ) ) elif tok == Nnet3End : _LOG . info ( "finished parsing nnet3 (%s) components." % num ) assert num == self . _num_components break else : _LOG . error ( "{0}: error reading Component:" " at position {1}, expected <ComponentName>," " got: {2}" . format ( sys . argv [ 0 ] , pos , tok ) ) break