diff options
64 files changed, 3512 insertions, 1577 deletions
diff --git a/gr-utils/bindtool/__init__.py b/gr-utils/bindtool/__init__.py index 81eafae2e6..8bed5d5069 100644 --- a/gr-utils/bindtool/__init__.py +++ b/gr-utils/bindtool/__init__.py @@ -1 +1 @@ -from .core.generator import BindingGenerator
\ No newline at end of file +from .core.generator import BindingGenerator diff --git a/gr-utils/bindtool/core/base.py b/gr-utils/bindtool/core/base.py index f7e713f034..24213a25a5 100644 --- a/gr-utils/bindtool/core/base.py +++ b/gr-utils/bindtool/core/base.py @@ -1,9 +1,8 @@ - class BindTool(object): - + target_bindings = 'pybind11' - + def __init__(self): - pass
\ No newline at end of file + pass diff --git a/gr-utils/bindtool/core/generator.py b/gr-utils/bindtool/core/generator.py index feceb29705..79c56213d4 100644 --- a/gr-utils/bindtool/core/generator.py +++ b/gr-utils/bindtool/core/generator.py @@ -18,11 +18,12 @@ from datetime import datetime import hashlib import re + class BindingGenerator: - def __init__(self, prefix, namespace, prefix_include_root, output_dir="", define_symbols=None, addl_includes= None, - match_include_structure=False, catch_exceptions=True, write_json_output=False, status_output=None, - flag_automatic=False, flag_pygccxml=False, update_hash_only=False): + def __init__(self, prefix, namespace, prefix_include_root, output_dir="", define_symbols=None, addl_includes=None, + match_include_structure=False, catch_exceptions=True, write_json_output=False, status_output=None, + flag_automatic=False, flag_pygccxml=False, update_hash_only=False): """Initialize BindingGenerator prefix -- path to installed gnuradio prefix (use gr.prefix() if unsure) namespace -- desired namespace to parse e.g. ['gr','module_name'] @@ -33,14 +34,14 @@ class BindingGenerator: output_dir -- path where bindings will be placed define_symbols -- comma separated tuple of defines addl_includes -- comma separated list of additional include directories (default "") - match_include_structure -- + match_include_structure -- If set to False, a bindings/ dir will be placed directly under the specified output_dir If set to True, the directory structure under include/ will be mirrored - update_hash_only -- If set to true, only update the hash in the pybind + update_hash_only -- If set to true, only update the hash in the pybind """ self.header_extensions = ['.h', '.hh', '.hpp'] - self.define_symbols=define_symbols + self.define_symbols = define_symbols self.addl_include = addl_includes self.prefix = prefix self.namespace = namespace @@ -81,7 +82,6 @@ class BindingGenerator: tpl = Template(filename=os.path.join(current_path, '..', 'templates', 'generic_python_cc.mako')) - return tpl.render( license=license, header_info=header_info, @@ -134,7 +134,7 @@ class BindingGenerator: header_info = json.load(fp) return header_info - def fix_file_hash(self, file_to_process): + def fix_file_hash(self, file_to_process): """Update the hash in blockname_python.cc python bindings""" output_dir = self.get_output_dir(file_to_process) @@ -151,14 +151,13 @@ class BindingGenerator: with open(binding_pathname_cc, 'r') as f: file_contents = f.read() - new_file_contents = re.sub(r'BINDTOOL_HEADER_FILE_HASH\([a-zA-Z0-9]+\)', - f"BINDTOOL_HEADER_FILE_HASH({newhash})", file_contents) + new_file_contents = re.sub(r'BINDTOOL_HEADER_FILE_HASH\([a-zA-Z0-9]+\)', + f"BINDTOOL_HEADER_FILE_HASH({newhash})", file_contents) with open(binding_pathname_cc, 'w') as updated_f: updated_f.write(new_file_contents) print(f"Update hash in {binding_pathname_cc} to {newhash}") - def gen_file_binding(self, file_to_process): """Produce the blockname_python.cc python bindings""" output_dir = self.get_output_dir(file_to_process) @@ -166,7 +165,7 @@ class BindingGenerator: base_name = os.path.splitext(os.path.basename(file_to_process))[0] module_include_path = os.path.abspath(os.path.dirname(file_to_process)) top_include_path = os.path.join( - module_include_path.split('include'+os.path.sep)[0], 'include') + module_include_path.split('include' + os.path.sep)[0], 'include') include_paths = ','.join( (module_include_path, top_include_path)) @@ -180,10 +179,10 @@ class BindingGenerator: include_paths = ','.join((include_paths, self.addl_include)) parser = GenericHeaderParser( - define_symbols = self.define_symbols, include_paths=include_paths, file_path=file_to_process) + define_symbols=self.define_symbols, include_paths=include_paths, file_path=file_to_process) try: header_info = parser.get_header_info(self.namespace) - + if self.write_json_output: self.write_json(header_info, base_name, output_dir) self.write_pybind_cc(header_info, base_name, output_dir) @@ -211,9 +210,9 @@ class BindingGenerator: output_dir = self.output_dir rel_path_after_include = "" if self.match_include_structure: - if 'include'+os.path.sep in filename: + if 'include' + os.path.sep in filename: rel_path_after_include = os.path.split( - filename.split('include'+os.path.sep)[-1])[0] + filename.split('include' + os.path.sep)[-1])[0] output_dir = os.path.join( self.output_dir, rel_path_after_include, 'bindings') @@ -301,7 +300,7 @@ class BindingGenerator: def gen_bindings(self, module_dir): """Generate bindings for an entire GR module - Produces CMakeLists.txt, python_bindings.cc, and blockname_python.cc + Produces CMakeLists.txt, python_bindings.cc, and blockname_python.cc for each block in the module module_dir -- path to the include directory where the public headers live diff --git a/gr-utils/bindtool/scripts/bind_from_json.py b/gr-utils/bindtool/scripts/bind_from_json.py index 863b40f5b4..cfaf2842df 100644 --- a/gr-utils/bindtool/scripts/bind_from_json.py +++ b/gr-utils/bindtool/scripts/bind_from_json.py @@ -3,7 +3,8 @@ import os from gnuradio.bindtool import BindingGenerator import pathlib -parser = argparse.ArgumentParser(description='Bind a GR header file from the generated json') +parser = argparse.ArgumentParser( + description='Bind a GR header file from the generated json') parser.add_argument('pathnames', type=str, nargs='+', help='Json files to bind') @@ -12,4 +13,4 @@ args = parser.parse_args() bg = BindingGenerator() for p in args.pathnames: - bg.bind_from_json(p)
\ No newline at end of file + bg.bind_from_json(p) diff --git a/gr-utils/bindtool/scripts/bind_gr_module.py b/gr-utils/bindtool/scripts/bind_gr_module.py index 297e0d920b..577216d9a4 100644 --- a/gr-utils/bindtool/scripts/bind_gr_module.py +++ b/gr-utils/bindtool/scripts/bind_gr_module.py @@ -12,7 +12,7 @@ parser.add_argument('--output_dir', default=tempfile.gettempdir(), help='Output directory of generated bindings') parser.add_argument('--prefix', help='Prefix of Installed GNU Radio') parser.add_argument('--src', help='Directory of gnuradio source tree', - default=os.path.dirname(os.path.abspath(__file__))+'/../../..') + default=os.path.dirname(os.path.abspath(__file__)) + '/../../..') parser.add_argument( '--include', help='Additional Include Dirs, comma separated', default='') args = parser.parse_args() @@ -24,9 +24,9 @@ args = parser.parse_args() # /usr/include/x86_64-linux-gnu/qt5/QtCore,/usr/include/x86_64-linux-gnu/qt5/QtWidgets,/usr/include/qwt qtgui # To generate UHD requires adding the UHD headers, e.g. -# python3 /share/gnuradio/grpybind/src/gnuradio/gr-utils/python/bindtool/scripts/bind_gr_module.py -# --prefix /share/gnuradio/grpybind -# --include $UHD_PATH,$UHD_PATH/utils,$UHD_PATH/types,$UHD_PATH/transport,$UHD_PATH/usrp_clock,$UHD_PATH/rfnoc +# python3 /share/gnuradio/grpybind/src/gnuradio/gr-utils/python/bindtool/scripts/bind_gr_module.py +# --prefix /share/gnuradio/grpybind +# --include $UHD_PATH,$UHD_PATH/utils,$UHD_PATH/types,$UHD_PATH/transport,$UHD_PATH/usrp_clock,$UHD_PATH/rfnoc # --output_dir /share/tmp/take5 uhd @@ -38,10 +38,10 @@ output_dir = args.output_dir includes = args.include for name in args.names: if name not in ['gr', 'pmt']: - namespace = ['gr', name.replace("-","_")] + namespace = ['gr', name.replace("-", "_")] module_dir = os.path.abspath( - os.path.join(args.src, 'gr-'+name, 'include')) - prefix_include_root = 'gnuradio/'+name # pmt, gnuradio/digital, etc. + os.path.join(args.src, 'gr-' + name, 'include')) + prefix_include_root = 'gnuradio/' + name # pmt, gnuradio/digital, etc. else: namespace = [name] module_dir = os.path.abspath(os.path.join( diff --git a/gr-utils/bindtool/scripts/bind_intree_file.py b/gr-utils/bindtool/scripts/bind_intree_file.py index 774f118402..026a702e00 100644 --- a/gr-utils/bindtool/scripts/bind_intree_file.py +++ b/gr-utils/bindtool/scripts/bind_intree_file.py @@ -14,7 +14,7 @@ parser.add_argument('--output_dir', default=tempfile.gettempdir(), help='Output directory of generated bindings') parser.add_argument('--prefix', help='Prefix of Installed GNU Radio') parser.add_argument('--src', help='Directory of gnuradio source tree', - default=os.path.dirname(os.path.abspath(__file__))+'/../../..') + default=os.path.dirname(os.path.abspath(__file__)) + '/../../..') parser.add_argument( '--filename', help="File to be parsed") @@ -41,7 +41,7 @@ name = args.module if name not in ['gr', 'pmt']: namespace = ['gr', name] - prefix_include_root = 'gnuradio/'+name # pmt, gnuradio/digital, etc. + prefix_include_root = 'gnuradio/' + name # pmt, gnuradio/digital, etc. else: namespace = [name] if name == 'gr': @@ -54,6 +54,7 @@ with warnings.catch_warnings(): bg = BindingGenerator(args.prefix, namespace, prefix_include_root, output_dir, addl_includes=','.join(args.include), catch_exceptions=False, write_json_output=False, status_output=args.status, - flag_automatic=True if args.flag_automatic.lower() in ['1','true'] else False, - flag_pygccxml=True if args.flag_pygccxml.lower() in ['1','true'] else False) + flag_automatic=True if args.flag_automatic.lower() in [ + '1', 'true'] else False, + flag_pygccxml=True if args.flag_pygccxml.lower() in ['1', 'true'] else False) bg.gen_file_binding(args.filename) diff --git a/gr-utils/bindtool/scripts/header_utils.py b/gr-utils/bindtool/scripts/header_utils.py index 4071f6fa86..94b16ceb6b 100644 --- a/gr-utils/bindtool/scripts/header_utils.py +++ b/gr-utils/bindtool/scripts/header_utils.py @@ -7,7 +7,7 @@ import re class PybindHeaderParser: def __init__(self, pathname): try: - with open(pathname,'r') as f: + with open(pathname, 'r') as f: self.file_txt = f.read() except: self.file_txt = "" @@ -42,10 +42,10 @@ class PybindHeaderParser: except: return None - def get_header_file_hash(self): try: - m = re.search(r'BINDTOOL_HEADER_FILE_HASH\(([^\s]*)\)', self.file_txt) + m = re.search( + r'BINDTOOL_HEADER_FILE_HASH\(([^\s]*)\)', self.file_txt) if (m): return m.group(1) else: @@ -57,17 +57,19 @@ class PybindHeaderParser: return f'{self.get_flag_automatic()};{self.get_flag_pygccxml()};{self.get_header_filename()};{self.get_header_file_hash()};' - def argParse(): """Parses commandline args.""" - desc='Reads the parameters from the comment block in the pybind files' + desc = 'Reads the parameters from the comment block in the pybind files' parser = ArgumentParser(description=desc) - - parser.add_argument("function", help="Operation to perform on comment block of pybind file", choices=["flag_auto","flag_pygccxml","header_filename","header_file_hash","all"]) - parser.add_argument("pathname", help="Pathname of pybind c++ file to read, e.g. blockname_python.cc") + + parser.add_argument("function", help="Operation to perform on comment block of pybind file", choices=[ + "flag_auto", "flag_pygccxml", "header_filename", "header_file_hash", "all"]) + parser.add_argument( + "pathname", help="Pathname of pybind c++ file to read, e.g. blockname_python.cc") return parser.parse_args() + if __name__ == "__main__": # Parse command line options and set up doxyxml. args = argParse() @@ -81,6 +83,6 @@ if __name__ == "__main__": elif args.function == "header_filename": print(pbhp.get_header_filename()) elif args.function == "header_file_hash": - print(pbhp.get_header_file_hash()) + print(pbhp.get_header_file_hash()) elif args.function == "all": - print(pbhp.get_flags())
\ No newline at end of file + print(pbhp.get_flags()) diff --git a/gr-utils/blocktool/__main__.py b/gr-utils/blocktool/__main__.py index 6cd8845ae5..7a59e4af72 100644 --- a/gr-utils/blocktool/__main__.py +++ b/gr-utils/blocktool/__main__.py @@ -3,7 +3,7 @@ # This file is part of GNU Radio # # SPDX-License-Identifier: GPL-2.0-or-later -# +# # """ main function to run the blocktool api from the command line. """ diff --git a/gr-utils/blocktool/cli.py b/gr-utils/blocktool/cli.py index 2f298df472..295f088d93 100644 --- a/gr-utils/blocktool/cli.py +++ b/gr-utils/blocktool/cli.py @@ -83,7 +83,7 @@ def json_generator(parser, **kwargs): header = parser.filename.split('.')[0] block = parser.modname.split('-')[-1] if kwargs['output']: - json_file = os.path.join('.', block+'_'+header + '.json') + json_file = os.path.join('.', block + '_' + header + '.json') with open(json_file, 'w') as _file: json.dump(parser.parsed_data, _file, indent=4) else: @@ -117,7 +117,7 @@ def parse_directory(**kwargs): json_generator(parse_dir, **kwargs) except: logging.basicConfig(level=logging.DEBUG, - filename=os.path.join('.', dir_name+'_log.out')) + filename=os.path.join('.', dir_name + '_log.out')) logging.exception( 'Log for Exception raised for the header: {}\n'.format(header)) click.secho('Parsing unsuccessful: {}'.format( diff --git a/gr-utils/blocktool/core/comments.py b/gr-utils/blocktool/core/comments.py index 7973165b0d..2e2a1709dd 100644 --- a/gr-utils/blocktool/core/comments.py +++ b/gr-utils/blocktool/core/comments.py @@ -90,7 +90,7 @@ def read_comments(self): _index = lines.index(line) if _index is not None: - _index = _index+1 + _index = _index + 1 for num in range(_index, len(lines)): if Constants.END_BLOCKTOOL in lines[num]: break @@ -192,7 +192,7 @@ def add_comments(self): if _index is None: with open(self.target_file, 'a') as header: header.write('\n') - header.write('/* '+Constants.BLOCKTOOL + '\n') + header.write('/* ' + Constants.BLOCKTOOL + '\n') header.write('input_signature: ' + parsed_io['input']['signature'] + '\n') header.write('input_min_streams: ' + diff --git a/gr-utils/blocktool/core/iosignature.py b/gr-utils/blocktool/core/iosignature.py index 604772cedd..23bad17cce 100644 --- a/gr-utils/blocktool/core/iosignature.py +++ b/gr-utils/blocktool/core/iosignature.py @@ -57,10 +57,10 @@ def io_signature(impl_file): for signature in Constants.SIGNATURE_LIST: if signature in io_func[0] and parsed_io['input']['signature'] is None: parsed_io['input']['signature'] = signature - io_func[0] = io_func[0].lstrip(signature+' (') + io_func[0] = io_func[0].lstrip(signature + ' (') if signature in io_func[1] and parsed_io['output']['signature'] is None: parsed_io['output']['signature'] = signature - io_func[1] = io_func[1].lstrip(signature+' (') + io_func[1] = io_func[1].lstrip(signature + ' (') io_elements = [] for _io in io_func: _io = _io.split(',') @@ -151,7 +151,7 @@ def message_port(impl_file): if re.findall(r'"([^"]*)"', port)[0]: input_port.append(re.findall(r'"([^"]*)"', port)[0]) else: - input_port.append(port[port.find('(')+1:port.rfind(')')]) + input_port.append(port[port.find('(') + 1:port.rfind(')')]) _temp_port = ''.join(map(str, input_port)) input_port.clear() input_port.append(_temp_port) @@ -164,7 +164,7 @@ def message_port(impl_file): if re.findall(r'"([^"]*)"', port)[0]: output_port.append(re.findall(r'"([^"]*)"', port)[0]) else: - output_port.append(port[port.find('(')+1:port.rfind(')')]) + output_port.append(port[port.find('(') + 1:port.rfind(')')]) _temp_port = ''.join(map(str, output_port)) output_port.clear() output_port.append(_temp_port) diff --git a/gr-utils/blocktool/core/parseheader.py b/gr-utils/blocktool/core/parseheader.py index a8ef6dadab..d6babd5f1d 100644 --- a/gr-utils/blocktool/core/parseheader.py +++ b/gr-utils/blocktool/core/parseheader.py @@ -9,6 +9,11 @@ """ Module to generate AST for the headers and parse it """ +from ..core import Constants +from ..core.comments import read_comments, add_comments, exist_comments +from ..core.iosignature import io_signature, message_port +from ..core.base import BlockToolException, BlockTool +import time import os import re import codecs @@ -16,7 +21,6 @@ import logging PYGCCXML_AVAILABLE = False # ugly hack to make pygccxml work with Python >= 3.8 -import time try: time.clock except: @@ -27,10 +31,6 @@ try: except: pass -from ..core.base import BlockToolException, BlockTool -from ..core.iosignature import io_signature, message_port -from ..core.comments import read_comments, add_comments, exist_comments -from ..core import Constants LOGGER = logging.getLogger(__name__) @@ -79,7 +79,7 @@ class BlockHeaderParser(BlockTool): if dirs.path.endswith('lib'): self.impldir = dirs.path self.impl_file = os.path.join(self.impldir, - self.filename.split('.')[0]+'_impl.cc') + self.filename.split('.')[0] + '_impl.cc') def validate(self): """ Override the Blocktool validate function """ @@ -283,11 +283,11 @@ class BlockHeaderParser(BlockTool): self.parsed_data['member_functions'] = [] query_methods = declarations.access_type_matcher_t('public') functions = main_class.member_functions(function=query_methods, - allow_empty=True, - header_file=self.target_file) + allow_empty=True, + header_file=self.target_file) if functions: for fcn in functions: - if str(fcn.name) not in [main_class.name, '~'+main_class.name, 'make']: + if str(fcn.name) not in [main_class.name, '~' + main_class.name, 'make']: fcn_args = { "name": str(fcn.name), "arguments": [] @@ -299,7 +299,8 @@ class BlockHeaderParser(BlockTool): "default": argument.default_value } fcn_args['arguments'].append(args.copy()) - self.parsed_data['member_functions'].append(fcn_args.copy()) + self.parsed_data['member_functions'].append( + fcn_args.copy()) except RuntimeError: self.parsed_data['member_functions'] = [] diff --git a/gr-utils/blocktool/core/parseheader_generic.py b/gr-utils/blocktool/core/parseheader_generic.py index c28c6824c7..0e00ba56f8 100644 --- a/gr-utils/blocktool/core/parseheader_generic.py +++ b/gr-utils/blocktool/core/parseheader_generic.py @@ -9,6 +9,7 @@ """ Module to generate AST for the headers and parse it """ +import time import os import re import codecs @@ -22,7 +23,6 @@ from ..core import Constants LOGGER = logging.getLogger(__name__) PYGCCXML_AVAILABLE = False # ugly hack to make pygccxml work with Python >= 3.8 -import time try: time.clock except: @@ -35,6 +35,7 @@ except: from ...modtool.tools import ParserCCBlock from ...modtool.cli import ModToolException + class GenericHeaderParser(BlockTool): """ : Single argument required: file_path @@ -47,7 +48,7 @@ class GenericHeaderParser(BlockTool): name = 'Block Parse Header' description = 'Create a parsed output from a block header file' - def __init__(self, file_path=None, blocktool_comments=False, define_symbols=None, include_paths=None, **kwargs): + def __init__(self, file_path=None, blocktool_comments=False, define_symbols=None, include_paths=None, **kwargs): """ __init__ """ BlockTool.__init__(self, **kwargs) self.parsed_data = {} @@ -63,8 +64,6 @@ class GenericHeaderParser(BlockTool): file_path = os.path.abspath(file_path) self.target_file = file_path - - self.initialize() self.validate() @@ -84,7 +83,7 @@ class GenericHeaderParser(BlockTool): if not os.path.basename(self.module).startswith(Constants.GR): self.module = os.path.abspath( os.path.join(self.module, os.pardir)) - + self.modname = os.path.basename(self.module) self.filename = os.path.basename(self.target_file) self.targetdir = os.path.dirname(self.target_file) @@ -104,9 +103,10 @@ class GenericHeaderParser(BlockTool): fname_h))[0] fname_cc = blockname + '_impl' + '.cc' contains_modulename = blockname.startswith( - self.modname+'_') - blockname = blockname.replace(self.modname+'_', '', 1) - fname_cc = os.path.join(fname_h.split('include')[0],'lib',fname_cc) + self.modname + '_') + blockname = blockname.replace(self.modname + '_', '', 1) + fname_cc = os.path.join(fname_h.split( + 'include')[0], 'lib', fname_cc) return (blockname, fname_cc, contains_modulename) # Go, go, go LOGGER.info("Making GRC bindings for {}...".format(fname_h)) @@ -123,7 +123,7 @@ class GenericHeaderParser(BlockTool): "Can't open some of the files necessary to parse {}.".format(fname_cc)) if contains_modulename: - return (parser.read_params(), parser.read_io_signature(), self.modname+'_'+blockname) + return (parser.read_params(), parser.read_io_signature(), self.modname + '_' + blockname) else: return (parser.read_params(), parser.read_io_signature(), blockname) @@ -171,7 +171,7 @@ class GenericHeaderParser(BlockTool): allow_empty=True, recursive=False, header_file=self.target_file) for fcn in functions: - if str(fcn.name) not in [class_decl.name, '~'+class_decl.name]: + if str(fcn.name) not in [class_decl.name, '~' + class_decl.name]: member_functions.append(self.parse_function(fcn)) class_dict['member_functions'] = member_functions @@ -295,17 +295,17 @@ class GenericHeaderParser(BlockTool): mf_dict = { "name": "make", - "return_type": "::".join(namespace_to_parse + [blockname,"sptr"]), + "return_type": "::".join(namespace_to_parse + [blockname, "sptr"]), "has_static": "1" } - + args = [] - + for p in params: arg_dict = { - "name":p['key'], - "dtype":p['type'], - "default":p['default'] + "name": p['key'], + "dtype": p['type'], + "default": p['default'] } args.append(arg_dict) @@ -341,7 +341,8 @@ class GenericHeaderParser(BlockTool): raise BlockToolException('namespace cannot be none') self.parsed_data['target_namespace'] = namespace_to_parse - self.parsed_data['namespace'] = self.parse_namespace(main_namespace) + self.parsed_data['namespace'] = self.parse_namespace( + main_namespace) # except RuntimeError: # raise BlockToolException( diff --git a/gr-utils/modtool/cli/add.py b/gr-utils/modtool/cli/add.py index 8078f61a0a..4a5a4f374c 100644 --- a/gr-utils/modtool/cli/add.py +++ b/gr-utils/modtool/cli/add.py @@ -43,14 +43,15 @@ def cli(**kwargs): """Adds a block to the out-of-tree module.""" kwargs['cli'] = True self = ModToolAdd(**kwargs) - click.secho("GNU Radio module name identified: " + self.info['modname'], fg='green') + click.secho("GNU Radio module name identified: " + + self.info['modname'], fg='green') get_blockname(self) get_blocktype(self) get_lang(self) info_lang = {'cpp': 'C++', 'python': 'Python'}[self.info['lang']] click.secho(f"Language: {info_lang}", fg='green') - if ((self.skip_subdirs['lib'] and self.info['lang'] == 'cpp') - or (self.skip_subdirs['python'] and self.info['lang'] == 'python')): + if ((self.skip_subdirs['lib'] and self.info['lang'] == 'cpp') or + (self.skip_subdirs['python'] and self.info['lang'] == 'python')): raise ModToolException('Missing or skipping relevant subdir.') click.secho("Block/code identifier: " + self.info['blockname'], fg='green') if not self.license_file: @@ -60,12 +61,13 @@ def cli(**kwargs): get_py_qa(self) get_cpp_qa(self) if self.info['version'] == 'autofoo' and not self.skip_cmakefiles: - click.secho("Warning: Autotools modules are not supported. "+ + click.secho("Warning: Autotools modules are not supported. " + "Files will be created, but Makefiles will not be edited.", fg='yellow') self.skip_cmakefiles = True run(self) + def get_blocktype(self): """ Get the blocktype of the block to be added """ if self.info['blocktype'] is None: @@ -74,7 +76,9 @@ def get_blocktype(self): while self.info['blocktype'] not in self.block_types: self.info['blocktype'] = cli_input("Enter block type: ") if self.info['blocktype'] not in self.block_types: - click.secho('Must be one of ' + str(self.block_types), fg='yellow') + click.secho('Must be one of ' + + str(self.block_types), fg='yellow') + def get_lang(self): """ Get the Programming Language of the block to be added """ @@ -85,20 +89,24 @@ def get_lang(self): if self.info['lang'] == 'c++': self.info['lang'] = 'cpp' + def get_blockname(self): """ Get the blockname""" if not self.info['blockname'] or self.info['blockname'].isspace(): while not self.info['blockname'] or self.info['blockname'].isspace(): - self.info['blockname'] = cli_input("Enter name of block/code (without module name prefix): ") + self.info['blockname'] = cli_input( + "Enter name of block/code (without module name prefix): ") validate_name('block', self.info['blockname']) - self.info['fullblockname'] = self.info['modname'] + '_' + self.info['blockname'] + self.info['fullblockname'] = self.info['modname'] + \ + '_' + self.info['blockname'] fname_grc = self.info['fullblockname'] + '.block.yml' for block in os.scandir('./grc/'): if block.is_file(): s = block.name if s == fname_grc: raise ModToolException('Block Already Present.') - + + def get_copyrightholder(self): """ Get the copyrightholder of the block to be added """ if not self.info['copyrightholder'] or self.info['copyrightholder'].isspace(): @@ -109,31 +117,36 @@ def get_copyrightholder(self): else: copyright_candidates = (user, 'GNU Radio') with SequenceCompleter(copyright_candidates): - self.info['copyrightholder'] = cli_input("Please specify the copyright holder: ") + self.info['copyrightholder'] = cli_input( + "Please specify the copyright holder: ") if not self.info['copyrightholder'] or self.info['copyrightholder'].isspace(): self.info['copyrightholder'] = f'gr-{self.info["modname"]} author' elif self.info['is_component']: click.secho("For GNU Radio components the FSF is added as copyright holder", fg='cyan') + def get_arglist(self): """ Get the argument list of the block to be added """ if self.info['arglist'] is None: self.info['arglist'] = click.prompt(click.style( 'Enter valid argument list, including default arguments: \n', fg='cyan'), - prompt_suffix='', - default='', - show_default=False) + prompt_suffix='', + default='', + show_default=False) + def get_py_qa(self): """ Get a boolean value for addition of py_qa """ if self.add_py_qa is None: if not (self.info['blocktype'] in ('noblock') or self.skip_subdirs['python']): - self.add_py_qa = ask_yes_no(click.style('Add Python QA code?', fg='cyan'), True) + self.add_py_qa = ask_yes_no(click.style( + 'Add Python QA code?', fg='cyan'), True) else: self.add_py_qa = False + def get_cpp_qa(self): """ Get a boolean value for addition of cpp_qa """ if self.add_cc_qa is None: diff --git a/gr-utils/modtool/cli/base.py b/gr-utils/modtool/cli/base.py index 7b8c223751..19a70e1d45 100644 --- a/gr-utils/modtool/cli/base.py +++ b/gr-utils/modtool/cli/base.py @@ -26,7 +26,8 @@ from gnuradio import gr class ModToolException(ClickException): """ Exception class for enhanced CLI interface """ - def show(self, file = None): + + def show(self, file=None): """ displays the colored message """ click.secho(f'ModToolException: {self.format_message()}', fg='red') @@ -71,6 +72,7 @@ class ClickHandler(StreamHandler): StreamHandler which overrides some of its functional definitions to add colors to the stream output """ + def emit(self, record): """ Writes message to the stream """ colormap = { @@ -134,7 +136,8 @@ def common_params(func): return wrapper -block_name = click.argument('blockname', nargs=1, required=False, metavar="BLOCK_NAME") +block_name = click.argument( + 'blockname', nargs=1, required=False, metavar="BLOCK_NAME") @with_plugins(iter_entry_points('gnuradio.modtool.cli.plugins')) diff --git a/gr-utils/modtool/cli/bind.py b/gr-utils/modtool/cli/bind.py index 9ff401dc6d..89a980297b 100644 --- a/gr-utils/modtool/cli/bind.py +++ b/gr-utils/modtool/cli/bind.py @@ -27,14 +27,13 @@ from .base import common_params, block_name, run, cli_input @click.command('bind', short_help=ModToolGenBindings.description) @click.option('-o', '--output', is_flag=True, - help = 'If given, a file with desired output format will be generated') -@click.option('--addl_includes', default = None, - help = 'Comma separated list of additional include directories (default None)') + help='If given, a file with desired output format will be generated') +@click.option('--addl_includes', default=None, + help='Comma separated list of additional include directories (default None)') @click.option('-D', '--define_symbols', multiple=True, default=None, - help = 'Set precompiler defines') -@click.option('-u', '--update-hash-only', is_flag = True, - help = 'If given, only the hash in the binding will be updated') - + help='Set precompiler defines') +@click.option('-u', '--update-hash-only', is_flag=True, + help='If given, only the hash in the binding will be updated') @common_params @block_name def cli(**kwargs): @@ -44,15 +43,18 @@ def cli(**kwargs): """ kwargs['cli'] = True self = ModToolGenBindings(**kwargs) - click.secho("GNU Radio module name identified: " + self.info['modname'], fg='green') + click.secho("GNU Radio module name identified: " + + self.info['modname'], fg='green') get_pattern(self) run(self) + def get_pattern(self): """ Get the regex pattern for block(s) to be parsed """ if self.info['pattern'] is None: block_candidates = get_block_candidates() with SequenceCompleter(block_candidates): - self.info['pattern'] = cli_input('Which blocks do you want to parse? (Regex): ') + self.info['pattern'] = cli_input( + 'Which blocks do you want to parse? (Regex): ') if not self.info['pattern'] or self.info['pattern'].isspace(): self.info['pattern'] = '.' diff --git a/gr-utils/modtool/cli/disable.py b/gr-utils/modtool/cli/disable.py index 136b4e0ee6..093128f5ce 100644 --- a/gr-utils/modtool/cli/disable.py +++ b/gr-utils/modtool/cli/disable.py @@ -23,15 +23,18 @@ def cli(**kwargs): """Disable a block (comments out CMake entries for files)""" kwargs['cli'] = True self = ModToolDisable(**kwargs) - click.secho("GNU Radio module name identified: " + self.info['modname'], fg='green') + click.secho("GNU Radio module name identified: " + + self.info['modname'], fg='green') get_pattern(self) run(self) + def get_pattern(self): """ Get the regex pattern for block(s) to be disabled """ if self.info['pattern'] is None: block_candidates = get_block_candidates() with SequenceCompleter(block_candidates): - self.info['pattern'] = cli_input('Which blocks do you want to disable? (Regex): ') + self.info['pattern'] = cli_input( + 'Which blocks do you want to disable? (Regex): ') if not self.info['pattern'] or self.info['pattern'].isspace(): self.info['pattern'] = '.' diff --git a/gr-utils/modtool/cli/makeyaml.py b/gr-utils/modtool/cli/makeyaml.py index c3019cb4fe..8ea99365ec 100644 --- a/gr-utils/modtool/cli/makeyaml.py +++ b/gr-utils/modtool/cli/makeyaml.py @@ -43,7 +43,8 @@ def cli(**kwargs): if kwargs['blocktool']: kwargs['modtool'] = True if kwargs['blockname'] is None: - raise BlockToolException('Missing argument FILE PATH with blocktool flag') + raise BlockToolException( + 'Missing argument FILE PATH with blocktool flag') kwargs['file_path'] = os.path.abspath(kwargs['blockname']) if os.path.isfile(kwargs['file_path']): parse_yml = BlockHeaderParser(**kwargs) @@ -55,15 +56,18 @@ def cli(**kwargs): raise BlockToolException('Invalid file path.') else: self = ModToolMakeYAML(**kwargs) - click.secho("GNU Radio module name identified: " + self.info['modname'], fg='green') + click.secho("GNU Radio module name identified: " + + self.info['modname'], fg='green') get_pattern(self) run(self) + def get_pattern(self): """ Get the regex pattern for block(s) to be parsed """ if self.info['pattern'] is None: block_candidates = get_block_candidates() with SequenceCompleter(block_candidates): - self.info['pattern'] = cli_input('Which blocks do you want to parse? (Regex): ') + self.info['pattern'] = cli_input( + 'Which blocks do you want to parse? (Regex): ') if not self.info['pattern'] or self.info['pattern'].isspace(): self.info['pattern'] = '.' diff --git a/gr-utils/modtool/cli/newmod.py b/gr-utils/modtool/cli/newmod.py index 80194ff995..c5d91a9557 100644 --- a/gr-utils/modtool/cli/newmod.py +++ b/gr-utils/modtool/cli/newmod.py @@ -18,6 +18,7 @@ from gnuradio import gr from ..core import ModToolNewModule, validate_name from .base import common_params, run, cli_input, ModToolException + @click.command('newmod', short_help=ModToolNewModule.description) @click.option('--srcdir', help="Source directory for the module template.") @@ -37,15 +38,17 @@ def cli(**kwargs): try: os.stat(self.dir) except OSError: - pass # This is what should happen + pass # This is what should happen else: raise ModToolException('The given directory exists.') if self.srcdir is None: - self.srcdir = os.path.join(gr.prefix(),'share','gnuradio','modtool','templates','gr-newmod') + self.srcdir = os.path.join( + gr.prefix(), 'share', 'gnuradio', 'modtool', 'templates', 'gr-newmod') if not os.path.isdir(self.srcdir): raise ModToolException('Could not find gr-newmod source dir.') run(self) + def get_modname(self): """ Get the name of the new module to be added """ if self.info['modname'] is None: diff --git a/gr-utils/modtool/cli/rename.py b/gr-utils/modtool/cli/rename.py index 0e70867f39..0909e8b644 100644 --- a/gr-utils/modtool/cli/rename.py +++ b/gr-utils/modtool/cli/rename.py @@ -31,36 +31,42 @@ def cli(**kwargs): """ kwargs['cli'] = True self = ModToolRename(**kwargs) - click.secho("GNU Radio module name identified: " + self.info['modname'], fg='green') + click.secho("GNU Radio module name identified: " + + self.info['modname'], fg='green') # first make sure the old block name is provided get_oldname(self) - click.secho("Block/code to rename identifier: " + self.info['oldname'], fg='green') - self.info['fulloldname'] = self.info['modname'] + '_' + self.info['oldname'] + click.secho("Block/code to rename identifier: " + + self.info['oldname'], fg='green') + self.info['fulloldname'] = self.info['modname'] + \ + '_' + self.info['oldname'] # now get the new block name get_newname(self) click.secho("Block/code identifier: " + self.info['newname'], fg='green') - self.info['fullnewname'] = self.info['modname'] + '_' + self.info['newname'] + self.info['fullnewname'] = self.info['modname'] + \ + '_' + self.info['newname'] run(self) + def get_oldname(self): """ Get the old block name to be replaced """ block_candidates = get_block_candidates() if self.info['oldname'] is None: with SequenceCompleter(block_candidates): while not self.info['oldname'] or self.info['oldname'].isspace(): - self.info['oldname'] = cli_input("Enter name of block/code to rename "+ + self.info['oldname'] = cli_input("Enter name of block/code to rename " + "(without module name prefix): ") if self.info['oldname'] not in block_candidates: choices = [x for x in block_candidates if self.info['oldname'] in x] if len(choices) > 0: - click.secho("Suggested alternatives: "+str(choices), fg='yellow') + click.secho("Suggested alternatives: " + str(choices), fg='yellow') raise ModToolException("Blockname for renaming does not exists!") validate_name('block', self.info['oldname']) + def get_newname(self): """ Get the new block name """ if self.info['newname'] is None: while not self.info['newname'] or self.info['newname'].isspace(): - self.info['newname'] = cli_input("Enter name of block/code "+ + self.info['newname'] = cli_input("Enter name of block/code " + "(without module name prefix): ") validate_name('block', self.info['newname']) diff --git a/gr-utils/modtool/cli/rm.py b/gr-utils/modtool/cli/rm.py index 30eadb5052..5f86c62f24 100644 --- a/gr-utils/modtool/cli/rm.py +++ b/gr-utils/modtool/cli/rm.py @@ -23,15 +23,18 @@ def cli(**kwargs): """ Remove block (delete files and remove Makefile entries) """ kwargs['cli'] = True self = ModToolRemove(**kwargs) - click.secho("GNU Radio module name identified: " + self.info['modname'], fg='green') + click.secho("GNU Radio module name identified: " + + self.info['modname'], fg='green') get_pattern(self) run(self) + def get_pattern(self): """ Returns the regex pattern for block(s) to be removed """ if self.info['pattern'] is None: block_candidates = get_block_candidates() with SequenceCompleter(block_candidates): - self.info['pattern'] = cli_input('Which blocks do you want to delete? (Regex): ') + self.info['pattern'] = cli_input( + 'Which blocks do you want to delete? (Regex): ') if not self.info['pattern'] or self.info['pattern'].isspace(): self.info['pattern'] = '.' diff --git a/gr-utils/modtool/cli/update.py b/gr-utils/modtool/cli/update.py index 70a7185e7d..cb45828ed1 100644 --- a/gr-utils/modtool/cli/update.py +++ b/gr-utils/modtool/cli/update.py @@ -26,10 +26,12 @@ def cli(**kwargs): """ Update the XML bindings to YAML bindings """ kwargs['cli'] = True self = ModToolUpdate(**kwargs) - click.secho("GNU Radio module name identified: " + self.info['modname'], fg='green') + click.secho("GNU Radio module name identified: " + + self.info['modname'], fg='green') get_blockname(self) run(self) + def get_blockname(self): """ Returns the blockname for block to be updated """ if self.info['complete']: @@ -37,11 +39,12 @@ def get_blockname(self): block_candidates = get_xml_candidates() if self.info['blockname'] is None: with SequenceCompleter(block_candidates): - self.info['blockname'] = cli_input('Which block do you wish to update? : ') + self.info['blockname'] = cli_input( + 'Which block do you wish to update? : ') if not self.info['blockname'] or self.info['blockname'].isspace(): raise ModToolException('Block name not specified!') if self.info['blockname'] not in block_candidates: choices = [x for x in block_candidates if self.info['blockname'] in x] if len(choices) > 0: - click.secho("Suggested alternatives: "+str(choices), fg='yellow') + click.secho("Suggested alternatives: " + str(choices), fg='yellow') raise ModToolException("The XML bindings does not exists!") diff --git a/gr-utils/modtool/core/add.py b/gr-utils/modtool/core/add.py index b998b19ba4..3a323ad6e5 100644 --- a/gr-utils/modtool/core/add.py +++ b/gr-utils/modtool/core/add.py @@ -25,15 +25,16 @@ logger = logging.getLogger(__name__) def clang_format(s): try: - p = subprocess.Popen(["clang-format"], stdin=subprocess.PIPE, stdout=subprocess.PIPE) - out, err = p.communicate(s.encode('utf-8')) - if p.returncode != 0: - print("Failed to run clang-format: %s", err) - return s - return out.decode('utf-8') + p = subprocess.Popen( + ["clang-format"], stdin=subprocess.PIPE, stdout=subprocess.PIPE) + out, err = p.communicate(s.encode('utf-8')) + if p.returncode != 0: + print("Failed to run clang-format: %s", err) + return s + return out.decode('utf-8') except (RuntimeError, FileNotFoundError) as e: - print("Failed to run clang-format: %s", e) - return s + print("Failed to run clang-format: %s", e) + return s class ModToolAdd(ModTool): @@ -41,7 +42,7 @@ class ModToolAdd(ModTool): name = 'add' description = 'Add new block into a module.' block_types = ('sink', 'source', 'sync', 'decimator', 'interpolator', - 'general', 'tagged_stream', 'hier', 'noblock') + 'general', 'tagged_stream', 'hier', 'noblock') language_candidates = ('cpp', 'python', 'c++') def __init__(self, blockname=None, block_type=None, lang=None, copyright=None, @@ -69,24 +70,28 @@ class ModToolAdd(ModTool): if self.info['lang'] not in self.language_candidates: raise ModToolException('Invalid programming language.') if self.info['blocktype'] == 'tagged_stream' and self.info['lang'] == 'python': - raise ModToolException('Tagged Stream Blocks for Python currently unsupported') + raise ModToolException( + 'Tagged Stream Blocks for Python currently unsupported') if self.info['blockname'] is None: raise ModToolException('Blockname not specified.') validate_name('block', self.info['blockname']) if not isinstance(self.add_py_qa, bool): - raise ModToolException('Expected a boolean value for add_python_qa.') + raise ModToolException( + 'Expected a boolean value for add_python_qa.') if not isinstance(self.add_cc_qa, bool): raise ModToolException('Expected a boolean value for add_cpp_qa.') if not isinstance(self.skip_cmakefiles, bool): - raise ModToolException('Expected a boolean value for skip_cmakefiles.') + raise ModToolException( + 'Expected a boolean value for skip_cmakefiles.') def assign(self): if self.info['lang'] == 'c++': self.info['lang'] = 'cpp' - if ((self.skip_subdirs['lib'] and self.info['lang'] == 'cpp') - or (self.skip_subdirs['python'] and self.info['lang'] == 'python')): + if ((self.skip_subdirs['lib'] and self.info['lang'] == 'cpp') or + (self.skip_subdirs['python'] and self.info['lang'] == 'python')): raise ModToolException('Missing or skipping relevant subdir.') - self.info['fullblockname'] = self.info['modname'] + '_' + self.info['blockname'] + self.info['fullblockname'] = self.info['modname'] + \ + '_' + self.info['blockname'] if not self.license_file: if self.info['copyrightholder'] is None: self.info['copyrightholder'] = '<+YOU OR YOUR COMPANY+>' @@ -105,7 +110,7 @@ class ModToolAdd(ModTool): top directory 3) The default license. """ if self.license_file is not None \ - and os.path.isfile(self.license_file): + and os.path.isfile(self.license_file): with open(self.license_file) as f: return f.read() elif os.path.isfile('LICENSE'): @@ -123,9 +128,9 @@ class ModToolAdd(ModTool): """ Shorthand for writing a substituted template to a file""" path_to_file = os.path.join(path, fname) logger.info(f"Adding file '{path_to_file}'...") - formatter = lambda x: x + def formatter(x): return x if fname.endswith('.cc') or fname.endswith('.h'): - formatter = clang_format + formatter = clang_format with open(path_to_file, 'w') as f: f.write(formatter(render_template(tpl, **self.info))) self.scm.add_files((path_to_file,)) @@ -138,14 +143,14 @@ class ModToolAdd(ModTool): self.assign() has_pybind = ( - self.info['lang'] == 'cpp' - and not self.skip_subdirs['python'] + self.info['lang'] == 'cpp' and + not self.skip_subdirs['python'] ) has_grc = False if self.info['lang'] == 'cpp': self._run_lib() has_grc = has_pybind - else: # Python + else: # Python self._run_python() if self.info['blocktype'] != 'noblock': has_grc = True @@ -159,10 +164,10 @@ class ModToolAdd(ModTool): def _run_cc_qa(self): " Add C++ QA files for 3.7 API if intructed from _run_lib" blockname_ = self.info['blockname'] - fname_qa_h = f'qa_{blockname_}.h' + fname_qa_h = f'qa_{blockname_}.h' fname_qa_cc = f'qa_{blockname_}.cc' self._write_tpl('qa_cpp', 'lib', fname_qa_cc) - self._write_tpl('qa_h', 'lib', fname_qa_h) + self._write_tpl('qa_h', 'lib', fname_qa_h) modname_ = self.info['modname'] if self.skip_cmakefiles: return @@ -191,7 +196,7 @@ class ModToolAdd(ModTool): return try: append_re_line_sequence(self._file['cmlib'], - fr'list\(APPEND test_{modname_}_sources.*\n', + fr'list\(APPEND test_{modname_}_sources.*\n', f'qa_{blockname_}.cc') self.scm.mark_files_updated((self._file['cmlib'],)) except IOError: @@ -210,25 +215,28 @@ class ModToolAdd(ModTool): fname_h = self.info['blockname'] + '.h' fname_cc = self.info['blockname'] + '.cc' if self.info['blocktype'] in ('source', 'sink', 'sync', 'decimator', - 'interpolator', 'general', 'hier', 'tagged_stream'): + 'interpolator', 'general', 'hier', 'tagged_stream'): fname_cc = self.info['blockname'] + '_impl.cc' - self._write_tpl('block_impl_h', 'lib', self.info['blockname'] + '_impl.h') + self._write_tpl('block_impl_h', 'lib', + self.info['blockname'] + '_impl.h') self._write_tpl('block_impl_cpp', 'lib', fname_cc) - self._write_tpl('block_def_h', self.info['includedir'], fname_h) - else: # Pre-3.7 or autotools - fname_h = self.info['fullblockname'] + '.h' + self._write_tpl('block_def_h', self.info['includedir'], fname_h) + else: # Pre-3.7 or autotools + fname_h = self.info['fullblockname'] + '.h' fname_cc = self.info['fullblockname'] + '.cc' - self._write_tpl('block_h36', self.info['includedir'], fname_h) - self._write_tpl('block_cpp36', 'lib', fname_cc) + self._write_tpl('block_h36', self.info['includedir'], fname_h) + self._write_tpl('block_cpp36', 'lib', fname_cc) if self.add_cc_qa: - if self.info['version'] in ['38','310']: + if self.info['version'] in ['38', '310']: self._run_cc_qa_boostutf() elif self.info['version'] == '37': self._run_cc_qa() elif self.info['version'] == '36': - logger.warning("Warning: C++ QA files not supported for 3.6-style OOTs.") + logger.warning( + "Warning: C++ QA files not supported for 3.6-style OOTs.") elif self.info['version'] == 'autofoo': - logger.warning("Warning: C++ QA files not supported for autotools.") + logger.warning( + "Warning: C++ QA files not supported for autotools.") if not self.skip_cmakefiles: ed = CMakeFileEditor(self._file['cmlib']) cmake_list_var = '[a-z]*_?' + self.info['modname'] + '_sources' @@ -236,42 +244,46 @@ class ModToolAdd(ModTool): ed.append_value('add_library', fname_cc) ed.write() ed = CMakeFileEditor(self._file['cminclude']) - ed.append_value('install', fname_h, to_ignore_end='DESTINATION[^()]+') + ed.append_value('install', fname_h, + to_ignore_end='DESTINATION[^()]+') ed.write() - self.scm.mark_files_updated((self._file['cminclude'], self._file['cmlib'])) + self.scm.mark_files_updated( + (self._file['cminclude'], self._file['cmlib'])) def _run_pybind(self): """ Do everything that needs doing in the python bindings subdir. - - add blockname_python.cc + - add blockname_python.cc - add reference and call to bind_blockname() - include them into CMakeLists.txt """ - - bindings_dir = os.path.join(self.info['pydir'],'bindings') + + bindings_dir = os.path.join(self.info['pydir'], 'bindings') # Generate bindings cc file fname_cc = self.info['blockname'] + '_python.cc' - fname_pydoc_h = os.path.join('docstrings',self.info['blockname'] + '_pydoc_template.h') + fname_pydoc_h = os.path.join( + 'docstrings', self.info['blockname'] + '_pydoc_template.h') # Update python_bindings.cc ed = CPPFileEditor(self._file['ccpybind']) - ed.append_value('// BINDING_FUNCTION_PROTOTYPES(', '// ) END BINDING_FUNCTION_PROTOTYPES', - 'void bind_' + self.info['blockname'] + '(py::module& m);') - ed.append_value('// BINDING_FUNCTION_CALLS(', '// ) END BINDING_FUNCTION_CALLS', - 'bind_' + self.info['blockname'] + '(m);') + ed.append_value('// BINDING_FUNCTION_PROTOTYPES(', '// ) END BINDING_FUNCTION_PROTOTYPES', + 'void bind_' + self.info['blockname'] + '(py::module& m);') + ed.append_value('// BINDING_FUNCTION_CALLS(', '// ) END BINDING_FUNCTION_CALLS', + 'bind_' + self.info['blockname'] + '(m);') ed.write() self.scm.mark_files_updated((self._file['ccpybind'])) if self.info['version'] in ['310']: - prefix_include_root = '/'.join(('gnuradio',self.info['modname'])) + prefix_include_root = '/'.join(('gnuradio', self.info['modname'])) else: prefix_include_root = self.info['modname'] - bg = BindingGenerator(prefix=gr.prefix(), namespace=['gr',self.info['modname']], prefix_include_root=prefix_include_root) + bg = BindingGenerator(prefix=gr.prefix(), namespace=[ + 'gr', self.info['modname']], prefix_include_root=prefix_include_root) block_base = "" if self.info['blocktype'] in ('source', 'sink', 'sync', 'decimator', - 'interpolator', 'general', 'hier', 'tagged_stream'): + 'interpolator', 'general', 'hier', 'tagged_stream'): block_base = code_generator.GRTYPELIST[self.info['blocktype']] import hashlib @@ -296,7 +308,7 @@ class ModToolAdd(ModTool): "member_functions": [ { "name": "make", - "return_type": "::".join(("gr",self.info['modname'],self.info['blockname'],"sptr")), + "return_type": "::".join(("gr", self.info['modname'], self.info['blockname'], "sptr")), "has_static": "1", "arguments": [] } @@ -319,14 +331,14 @@ class ModToolAdd(ModTool): } } # def gen_pybind_cc(self, header_info, base_name): - pydoc_txt = bg.gen_pydoc_h(header_info,self.info['blockname']) - path_to_file = os.path.join(bindings_dir, fname_pydoc_h) + pydoc_txt = bg.gen_pydoc_h(header_info, self.info['blockname']) + path_to_file = os.path.join(bindings_dir, fname_pydoc_h) logger.info("Adding file '{}'...".format(path_to_file)) with open(path_to_file, 'w') as f: f.write(pydoc_txt) self.scm.add_files((path_to_file,)) - cc_txt = bg.gen_pybind_cc(header_info,self.info['blockname']) + cc_txt = bg.gen_pybind_cc(header_info, self.info['blockname']) path_to_file = os.path.join(bindings_dir, fname_cc) logger.info("Adding file '{}'...".format(path_to_file)) with open(path_to_file, 'w') as f: @@ -335,8 +347,10 @@ class ModToolAdd(ModTool): if not self.skip_cmakefiles: ed = CMakeFileEditor(self._file['cmpybind']) - cmake_list_var = 'APPEND {}_python_files'.format(self.info['modname']) - ed.append_value('list', fname_cc, to_ignore_start=cmake_list_var, to_ignore_end='python_bindings.cc') + cmake_list_var = 'APPEND {}_python_files'.format( + self.info['modname']) + ed.append_value('list', fname_cc, to_ignore_start=cmake_list_var, + to_ignore_end='python_bindings.cc') ed.write() self.scm.mark_files_updated((self._file['cmpybind'])) @@ -349,13 +363,14 @@ class ModToolAdd(ModTool): fname_py_qa = 'qa_' + self.info['blockname'] + '.py' self._write_tpl('qa_python', self.info['pydir'], fname_py_qa) os.chmod(os.path.join(self.info['pydir'], fname_py_qa), 0o755) - self.scm.mark_files_updated((os.path.join(self.info['pydir'], fname_py_qa),)) + self.scm.mark_files_updated( + (os.path.join(self.info['pydir'], fname_py_qa),)) if self.skip_cmakefiles or CMakeFileEditor(self._file['cmpython']).check_for_glob('qa_*.py'): return logger.info(f'Editing {self.info["pydir"]}/CMakeLists.txt...') with open(self._file['cmpython'], 'a') as f: f.write( - 'GR_ADD_TEST(qa_%s ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/%s)\n' % \ + 'GR_ADD_TEST(qa_%s ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/%s)\n' % (self.info['blockname'], fname_py_qa)) self.scm.mark_files_updated((self._file['cmpython'],)) @@ -376,7 +391,8 @@ class ModToolAdd(ModTool): if self.skip_cmakefiles: return ed = CMakeFileEditor(self._file['cmpython']) - ed.append_value('GR_PYTHON_INSTALL', fname_py, to_ignore_end='DESTINATION[^()]+') + ed.append_value('GR_PYTHON_INSTALL', fname_py, + to_ignore_end='DESTINATION[^()]+') ed.write() self.scm.mark_files_updated((self._file['cmpython'],)) @@ -392,6 +408,7 @@ class ModToolAdd(ModTool): if self.skip_cmakefiles or ed.check_for_glob('*.yml'): return logger.info("Editing grc/CMakeLists.txt...") - ed.append_value('install', fname_grc, to_ignore_end='DESTINATION[^()]+') + ed.append_value('install', fname_grc, + to_ignore_end='DESTINATION[^()]+') ed.write() self.scm.mark_files_updated((self._file['cmgrc'],)) diff --git a/gr-utils/modtool/core/base.py b/gr-utils/modtool/core/base.py index 0fe7ed016d..873a9d8eab 100644 --- a/gr-utils/modtool/core/base.py +++ b/gr-utils/modtool/core/base.py @@ -47,7 +47,8 @@ class ModToolException(Exception): def validate_name(kind, name): """ Checks that block, module etc names are alphanumeric. """ if not re.fullmatch('[a-zA-Z0-9_]+', name): - raise ModToolException("Invalid {} name '{}': names can only contain letters, numbers and underscores".format(kind, name)) + raise ModToolException( + "Invalid {} name '{}': names can only contain letters, numbers and underscores".format(kind, name)) class ModTool(object): @@ -101,19 +102,22 @@ class ModTool(object): def _assign(self): if not self._check_directory(self.dir): - raise ModToolException('No GNU Radio module found in the given directory.') + raise ModToolException( + 'No GNU Radio module found in the given directory.') if self.info['modname'] is None: self.info['modname'] = get_modname() if self.info['modname'] is None: - raise ModToolException('No GNU Radio module found in the given directory.') + raise ModToolException( + 'No GNU Radio module found in the given directory.') if self.info['version'] == '36' and ( os.path.isdir(os.path.join('include', self.info['modname'])) or - os.path.isdir(os.path.join('include', 'gnuradio', self.info['modname'])) - ): + os.path.isdir(os.path.join( + 'include', 'gnuradio', self.info['modname'])) + ): self.info['version'] = '37' if not os.path.isfile(os.path.join('cmake', 'Modules', 'FindCppUnit.cmake')): self.info['version'] = '38' - if os.path.isdir(os.path.join('include','gnuradio', self.info['modname'])): + if os.path.isdir(os.path.join('include', 'gnuradio', self.info['modname'])): self.info['version'] = '310' if self.skip_subdirs['lib'] or not self.has_subdirs['lib']: self.skip_subdirs['lib'] = True @@ -132,38 +136,47 @@ class ModTool(object): self.info['pydir'] = 'python' if os.path.isdir(os.path.join('python', self.info['modname'])): self.info['pydir'] = os.path.join('python', self.info['modname']) - self._file['qalib'] = os.path.join('lib', f'qa_{self.info["modname"]}.cc') - self._file['pyinit'] = os.path.join(self.info['pydir'], '__init__.py') - self._file['cmlib'] = os.path.join('lib', 'CMakeLists.txt') - self._file['cmgrc'] = os.path.join('grc', 'CMakeLists.txt') - self._file['cmpython'] = os.path.join(self.info['pydir'], 'CMakeLists.txt') - self._file['cmpybind'] = os.path.join(self.info['pydir'], 'bindings', 'CMakeLists.txt') - self._file['ccpybind'] = os.path.join(self.info['pydir'], 'bindings', 'python_bindings.cc') + self._file['qalib'] = os.path.join( + 'lib', f'qa_{self.info["modname"]}.cc') + self._file['pyinit'] = os.path.join(self.info['pydir'], '__init__.py') + self._file['cmlib'] = os.path.join('lib', 'CMakeLists.txt') + self._file['cmgrc'] = os.path.join('grc', 'CMakeLists.txt') + self._file['cmpython'] = os.path.join( + self.info['pydir'], 'CMakeLists.txt') + self._file['cmpybind'] = os.path.join( + self.info['pydir'], 'bindings', 'CMakeLists.txt') + self._file['ccpybind'] = os.path.join( + self.info['pydir'], 'bindings', 'python_bindings.cc') if self.info['is_component']: - self.info['includedir'] = os.path.join('include', 'gnuradio', self.info['modname']) + self.info['includedir'] = os.path.join( + 'include', 'gnuradio', self.info['modname']) elif self.info['version'] in ('37', '38'): - self.info['includedir'] = os.path.join('include', self.info['modname']) + self.info['includedir'] = os.path.join( + 'include', self.info['modname']) elif self.info['version'] in ('310'): - self.info['includedir'] = os.path.join('include', 'gnuradio', self.info['modname']) + self.info['includedir'] = os.path.join( + 'include', 'gnuradio', self.info['modname']) else: self.info['includedir'] = 'include' - self._file['cminclude'] = os.path.join(self.info['includedir'], 'CMakeLists.txt') - + self._file['cminclude'] = os.path.join( + self.info['includedir'], 'CMakeLists.txt') def _setup_scm(self, mode='active'): """ Initialize source control management. """ - self.options = SimpleNamespace(scm_mode = self._scm) + self.options = SimpleNamespace(scm_mode=self._scm) if mode == 'active': - self.scm = SCMRepoFactory(self.options, '.').make_active_scm_manager() + self.scm = SCMRepoFactory( + self.options, '.').make_active_scm_manager() else: - self.scm = SCMRepoFactory(self.options, '.').make_empty_scm_manager() + self.scm = SCMRepoFactory( + self.options, '.').make_empty_scm_manager() if self.scm is None: logger.error("Error: Can't set up SCM.") exit(1) def _check_directory(self, directory): """ Guesses if dir is a valid GNU Radio module directory by looking for - CMakeLists.txt and at least one of the subdirs lib/, and python/ + CMakeLists.txt and at least one of the subdirs lib/, and python/ Changes the directory, if valid. """ has_makefile = False try: @@ -177,10 +190,12 @@ class ModTool(object): if os.path.isfile(f) and f == 'CMakeLists.txt': with open(f) as filetext: if re.search(r'find_package\(Gnuradio', filetext.read()) is not None: - self.info['version'] = '36' # Might be 37, check that later + # Might be 37, check that later + self.info['version'] = '36' has_makefile = True elif re.search('GR_REGISTER_COMPONENT', filetext.read()) is not None: - self.info['version'] = '36' # Might be 37, check that later + # Might be 37, check that later + self.info['version'] = '36' self.info['is_component'] = True has_makefile = True # TODO search for autofoo diff --git a/gr-utils/modtool/core/bind.py b/gr-utils/modtool/core/bind.py index 2adf4d002d..ac0989bc9f 100644 --- a/gr-utils/modtool/core/bind.py +++ b/gr-utils/modtool/core/bind.py @@ -9,7 +9,6 @@ """ Module to call bindtool and create Python bindings """ - import os import logging import warnings @@ -29,6 +28,7 @@ from gnuradio import gr logger = logging.getLogger(__name__) + class ModToolGenBindings(ModTool): """ Make YAML file for GRC block bindings """ name = 'bind' @@ -65,19 +65,22 @@ class ModToolGenBindings(ModTool): blocknames_to_process.append(self.info['blockname']) elif self.info['pattern']: # A regex resembling one or several blocks were given - blocknames_to_process = get_block_names(self.info['pattern'], self.info['modname']) + blocknames_to_process = get_block_names( + self.info['pattern'], self.info['modname']) else: raise ModToolException("No block name or regex was specified!") if self.info['version'] in ['310']: - prefix_include_root = '/'.join(('gnuradio',self.info['modname'])) + prefix_include_root = '/'.join(('gnuradio', + self.info['modname'])) else: prefix_include_root = self.info['modname'] - files_to_process = [os.path.join(self.dir, self.info['includedir'], f'{blockname}.h') for blockname in blocknames_to_process] + files_to_process = [os.path.join( + self.dir, self.info['includedir'], f'{blockname}.h') for blockname in blocknames_to_process] bg = BindingGenerator(prefix=gr.prefix(), namespace=[ - 'gr', self.info['modname']], prefix_include_root=prefix_include_root, output_dir=self.info['pydir'], - define_symbols=self.info['define_symbols'], addl_includes=self.info['addl_includes'], update_hash_only=self.info['update_hash_only']) + 'gr', self.info['modname']], prefix_include_root=prefix_include_root, output_dir=self.info['pydir'], + define_symbols=self.info['define_symbols'], addl_includes=self.info['addl_includes'], update_hash_only=self.info['update_hash_only']) for file_to_process in files_to_process: if self.info['update_hash_only']: bg.fix_file_hash(file_to_process) diff --git a/gr-utils/modtool/core/disable.py b/gr-utils/modtool/core/disable.py index 23698e4300..cb74948f2a 100644 --- a/gr-utils/modtool/core/disable.py +++ b/gr-utils/modtool/core/disable.py @@ -39,40 +39,50 @@ class ModToolDisable(ModTool): """ Go, go, go! """ def _handle_py_qa(cmake, fname): """ Do stuff for py qa """ - cmake.comment_out_lines('GR_ADD_TEST.*'+fname) + cmake.comment_out_lines('GR_ADD_TEST.*' + fname) self.scm.mark_file_updated(cmake.filename) return True + def _handle_py_mod(cmake, fname): """ Do stuff for py extra files """ try: with open(self._file['pyinit']) as f: initfile = f.read() except IOError: - logger.warning("Could not edit __init__.py, that might be a problem.") + logger.warning( + "Could not edit __init__.py, that might be a problem.") return False pymodname = os.path.splitext(fname)[0] - initfile = re.sub(r'((from|import)\s+\b'+pymodname+r'\b)', r'#\1', initfile) + initfile = re.sub( + r'((from|import)\s+\b' + pymodname + r'\b)', r'#\1', initfile) with open(self._file['pyinit'], 'w') as f: f.write(initfile) self.scm.mark_file_updated(self._file['pyinit']) return False + def _handle_cc_qa(cmake, fname): """ Do stuff for cc qa """ if self.info['version'] == '37': - cmake.comment_out_lines(r'\$\{CMAKE_CURRENT_SOURCE_DIR\}/'+fname) + cmake.comment_out_lines( + r'\$\{CMAKE_CURRENT_SOURCE_DIR\}/' + fname) fname_base = os.path.splitext(fname)[0] - ed = CMakeFileEditor(self._file['qalib']) # Abusing the CMakeFileEditor... - ed.comment_out_lines(fr'#include\s+"{fname_base}.h"', comment_str='//') - ed.comment_out_lines(fr'{fname_base}::suite\(\)', comment_str='//') + # Abusing the CMakeFileEditor... + ed = CMakeFileEditor(self._file['qalib']) + ed.comment_out_lines( + fr'#include\s+"{fname_base}.h"', comment_str='//') + ed.comment_out_lines( + fr'{fname_base}::suite\(\)', comment_str='//') ed.write() self.scm.mark_file_updated(self._file['qalib']) - elif self.info['version'] in ['38','310']: + elif self.info['version'] in ['38', '310']: fname_qa_cc = f'qa_{self.info["blockname"]}.cc' cmake.comment_out_lines(fname_qa_cc) elif self.info['version'] == '36': - cmake.comment_out_lines('add_executable.*'+fname) - cmake.comment_out_lines('target_link_libraries.*'+os.path.splitext(fname)[0]) - cmake.comment_out_lines('GR_ADD_TEST.*'+os.path.splitext(fname)[0]) + cmake.comment_out_lines('add_executable.*' + fname) + cmake.comment_out_lines( + 'target_link_libraries.*' + os.path.splitext(fname)[0]) + cmake.comment_out_lines( + 'GR_ADD_TEST.*' + os.path.splitext(fname)[0]) self.scm.mark_file_updated(cmake.filename) return True @@ -83,9 +93,9 @@ class ModToolDisable(ModTool): from ..cli import cli_input # List of special rules: 0: subdir, 1: filename re match, 2: callback special_treatments = ( - ('python', r'qa.+py$', _handle_py_qa), - ('python', r'^(?!qa).+py$', _handle_py_mod), - ('lib', r'qa.+\.cc$', _handle_cc_qa) + ('python', r'qa.+py$', _handle_py_qa), + ('python', r'^(?!qa).+py$', _handle_py_mod), + ('lib', r'qa.+\.cc$', _handle_cc_qa) ) for subdir in self._subdirs: if self.skip_subdirs[subdir]: @@ -119,7 +129,8 @@ class ModToolDisable(ModTool): for fname in filenames: file_disabled = False if not yes: - ans = cli_input(f"Really disable {fname}? [Y/n/a/q]: ").lower().strip() + ans = cli_input( + f"Really disable {fname}? [Y/n/a/q]: ").lower().strip() if ans == 'a': yes = True if ans == 'q': @@ -132,5 +143,7 @@ class ModToolDisable(ModTool): if not file_disabled: cmake.disable_file(fname) cmake.write() - self.scm.mark_files_updated((os.path.join(subdir, 'CMakeLists.txt'),)) - logger.warning("Careful: 'gr_modtool disable' does not resolve dependencies.") + self.scm.mark_files_updated( + (os.path.join(subdir, 'CMakeLists.txt'),)) + logger.warning( + "Careful: 'gr_modtool disable' does not resolve dependencies.") diff --git a/gr-utils/modtool/core/info.py b/gr-utils/modtool/core/info.py index c45b0f04c9..45fd4ef343 100644 --- a/gr-utils/modtool/core/info.py +++ b/gr-utils/modtool/core/info.py @@ -32,19 +32,22 @@ class ModToolInfo(ModTool): mod_info = dict() mod_info['base_dir'] = self._get_base_dir(self._directory) if mod_info['base_dir'] is None: - raise ModToolException('{}' if self._python_readable else "No module found.") + raise ModToolException( + '{}' if self._python_readable else "No module found.") os.chdir(mod_info['base_dir']) mod_info['modname'] = get_modname() if mod_info['modname'] is None: - raise ModToolException('{}' if self._python_readable else "No module found.") + raise ModToolException( + '{}' if self._python_readable else "No module found.") if self.info['version'] == '36' and ( os.path.isdir(os.path.join('include', mod_info['modname'])) or - os.path.isdir(os.path.join('include', 'gnuradio', mod_info['modname'])) - ): + os.path.isdir(os.path.join( + 'include', 'gnuradio', mod_info['modname'])) + ): self.info['version'] = '37' if not os.path.isfile(os.path.join('cmake', 'Modules', 'FindCppUnit.cmake')): self.info['version'] = '38' - if os.path.isdir(os.path.join('include','gnuradio', self.info['modname'])): + if os.path.isdir(os.path.join('include', 'gnuradio', self.info['modname'])): self.info['version'] = '310' mod_info['version'] = self.info['version'] if 'is_component' in list(self.info.keys()) and self.info['is_component']: @@ -52,7 +55,8 @@ class ModToolInfo(ModTool): mod_info['incdirs'] = [] mod_incl_dir = os.path.join(mod_info['base_dir'], 'include') if os.path.isdir(os.path.join(mod_incl_dir, mod_info['modname'])): - mod_info['incdirs'].append(os.path.join(mod_incl_dir, mod_info['modname'])) + mod_info['incdirs'].append(os.path.join( + mod_incl_dir, mod_info['modname'])) else: mod_info['incdirs'].append(mod_incl_dir) build_dir = self._get_build_dir(mod_info) @@ -102,32 +106,35 @@ class ModToolInfo(ModTool): path_or_internal = {True: 'INTERNAL', False: 'PATH'}['is_component' in list(mod_info.keys())] try: - cmakecache_fid = open(os.path.join(mod_info['build_dir'], 'CMakeCache.txt')) + cmakecache_fid = open(os.path.join( + mod_info['build_dir'], 'CMakeCache.txt')) for line in cmakecache_fid: if line.find(f'GNURADIO_RUNTIME_INCLUDE_DIRS:{path_or_internal}') != -1: - inc_dirs += line.replace(f'GNURADIO_RUNTIME_INCLUDE_DIRS:{path_or_internal}=', '').strip().split(';') + inc_dirs += line.replace( + f'GNURADIO_RUNTIME_INCLUDE_DIRS:{path_or_internal}=', '').strip().split(';') except IOError: pass if not inc_dirs and self._suggested_dirs is not None: - inc_dirs = [os.path.normpath(path) for path in self._suggested_dirs.split(':') if os.path.isdir(path)] + inc_dirs = [os.path.normpath(path) for path in self._suggested_dirs.split( + ':') if os.path.isdir(path)] return inc_dirs def _pretty_print(elf, mod_info): """ Output the module info in human-readable format """ index_names = {'base_dir': 'Base directory', - 'modname': 'Module name', - 'is_component': 'Is GR component', + 'modname': 'Module name', + 'is_component': 'Is GR component', 'build_dir': 'Build directory', 'incdirs': 'Include directories'} for key in list(mod_info.keys()): if key == 'version': version = { - '36': 'pre-3.7', - '37': 'post-3.7', - '38': 'post-3.8', - '310': 'post-3.10', - 'autofoo': 'Autotools (pre-3.5)' - }[mod_info['version']] + '36': 'pre-3.7', + '37': 'post-3.7', + '38': 'post-3.8', + '310': 'post-3.10', + 'autofoo': 'Autotools (pre-3.5)' + }[mod_info['version']] print(f" API version: {version}") else: print('%19s: %s' % (index_names[key], mod_info[key])) diff --git a/gr-utils/modtool/core/makeyaml.py b/gr-utils/modtool/core/makeyaml.py index 88ba4cdf82..f5baa319bd 100644 --- a/gr-utils/modtool/core/makeyaml.py +++ b/gr-utils/modtool/core/makeyaml.py @@ -73,7 +73,8 @@ class ModToolMakeYAML(ModTool): # This portion will be covered by the CLI if not self.cli: self.validate() - logger.warning("Warning: This is an experimental feature. Don't expect any magic.") + logger.warning( + "Warning: This is an experimental feature. Don't expect any magic.") # 1) Go through lib/ if not self.skip_subdirs['lib']: if self.info['version'] in ('37', '38', '310'): @@ -158,7 +159,8 @@ class ModToolMakeYAML(ModTool): ed = CMakeFileEditor(self._file['cmgrc']) if re.search(fname_yml, ed.cfile) is None and not ed.check_for_glob('*.yml'): logger.info("Adding GRC bindings to grc/CMakeLists.txt...") - ed.append_value('install', fname_yml, to_ignore_end='DESTINATION[^()]+') + ed.append_value('install', fname_yml, + to_ignore_end='DESTINATION[^()]+') ed.write() self.scm.mark_files_updated(self._file['cmgrc']) @@ -186,26 +188,30 @@ class ModToolMakeYAML(ModTool): def _get_blockdata(fname_cc): """ Return the block name and the header file name from the .cc file name """ - blockname = os.path.splitext(os.path.basename(fname_cc.replace('_impl.', '.')))[0] + blockname = os.path.splitext(os.path.basename( + fname_cc.replace('_impl.', '.')))[0] fname_h = (blockname + '.h').replace('_impl.', '.') - contains_modulename = blockname.startswith(self.info['modname']+'_') - blockname = blockname.replace(self.info['modname']+'_', '', 1) + contains_modulename = blockname.startswith( + self.info['modname'] + '_') + blockname = blockname.replace(self.info['modname'] + '_', '', 1) return (blockname, fname_h, contains_modulename) # Go, go, go logger.info(f"Making GRC bindings for {fname_cc}...") (blockname, fname_h, contains_modulename) = _get_blockdata(fname_cc) try: parser = ParserCCBlock(fname_cc, - os.path.join(self.info['includedir'], fname_h), + os.path.join( + self.info['includedir'], fname_h), blockname, self.info['version'], _type_translate ) except IOError: - raise ModToolException(f"Can't open some of the files necessary to parse {fname_cc}.") + raise ModToolException( + f"Can't open some of the files necessary to parse {fname_cc}.") if contains_modulename: - return (parser.read_params(), parser.read_io_signature(), self.info['modname']+'_'+blockname) + return (parser.read_params(), parser.read_io_signature(), self.info['modname'] + '_' + blockname) else: return (parser.read_params(), parser.read_io_signature(), blockname) @@ -218,14 +224,14 @@ def yaml_generator(self, **kwargs): block = self.modname.split('-')[-1] label = header.split('_') del label[-1] - yml_file = os.path.join('.', block+'_'+header+'.block.yml') + yml_file = os.path.join('.', block + '_' + header + '.block.yml') _header = (('id', f'{block}_{ header}'), ('label', ' '.join(label).upper()), ('category', f'[{block.capitalize()}]'), ('flags', '[python, cpp]') ) params_list = [ - '${'+s['name']+'}' for s in self.parsed_data['properties'] if self.parsed_data['properties']] + '${' + s['name'] + '}' for s in self.parsed_data['properties'] if self.parsed_data['properties']] str_ = ', '.join(params_list) _templates = [('imports', f'from gnuradio import {block}'), ('make', f'{block}.{ header}({str_})') @@ -237,10 +243,10 @@ def yaml_generator(self, **kwargs): arguments = [] for args in param['arguments_type']: arguments.append(args['name']) - arg_list = ['${'+s+'}' for s in arguments if arguments] + arg_list = ['${' + s + '}' for s in arguments if arguments] arg_ = ', '.join(arg_list) list_callbacks.append( - param['name']+f'({arg_})') + param['name'] + f'({arg_})') callback_key = ('callbacks') callbacks = (callback_key, tuple(list_callbacks)) _templates.append(callbacks) @@ -277,11 +283,11 @@ def yaml_generator(self, **kwargs): elif i_sig is Constants.MAKE2: input_sig['domain'] = 'stream' input_sig['dtype'] = self.parsed_data['io_signature']['input']['sizeof_stream_item' + - str(port+1)] + str(port + 1)] elif i_sig is Constants.MAKE3: input_sig['domain'] = 'stream' input_sig['dtype'] = self.parsed_data['io_signature']['input']['sizeof_stream_item' + - str(port+1)] + str(port + 1)] elif i_sig is Constants.MAKEV: input_sig['domain'] = 'stream' input_sig['dtype'] = self.parsed_data['io_signature']['input']['sizeof_stream_items'] @@ -307,11 +313,11 @@ def yaml_generator(self, **kwargs): elif o_sig is Constants.MAKE2: output_sig['domain'] = 'stream' output_sig['dtype'] = self.parsed_data['io_signature']['output']['sizeof_stream_item' + - str(port+1)] + str(port + 1)] elif o_sig is Constants.MAKE3: output_sig['domain'] = 'stream' output_sig['dtype'] = self.parsed_data['io_signature']['output']['sizeof_stream_item' + - str(port+1)] + str(port + 1)] elif o_sig is Constants.MAKEV: output_sig['domain'] = 'stream' output_sig['dtype'] = self.parsed_data['io_signature']['output']['sizeof_stream_items'] @@ -325,11 +331,12 @@ def yaml_generator(self, **kwargs): output_signature.append(m_output_sig) if output_signature: data['outputs'] = output_signature - + param_ = ', '.join(params_list) _cpp_templates = [('includes', '#include <gnuradio/{block}/{self.filename}>'), ('declarations', '{block}::{ header}::sptr ${{id}}'), - ('make', 'this->${{id}} = {block}::{ header}::make({param_})') + ('make', + 'this->${{id}} = {block}::{ header}::make({param_})') ] if self.parsed_data['methods']: @@ -338,10 +345,10 @@ def yaml_generator(self, **kwargs): arguments = [] for args in param['arguments_type']: arguments.append(args['name']) - arg_list = ['${'+s+'}' for s in arguments if arguments] + arg_list = ['${' + s + '}' for s in arguments if arguments] arg_ = ', '.join(arg_list) list_callbacks.append( - param['name']+f'({arg_})') + param['name'] + f'({arg_})') callback_key = ('callbacks') callbacks = (callback_key, tuple(list_callbacks)) _cpp_templates.append(callbacks) diff --git a/gr-utils/modtool/core/newmod.py b/gr-utils/modtool/core/newmod.py index 0496958990..455d068f6c 100644 --- a/gr-utils/modtool/core/newmod.py +++ b/gr-utils/modtool/core/newmod.py @@ -20,10 +20,12 @@ from .base import ModTool, ModToolException, validate_name logger = logging.getLogger(__name__) + class ModToolNewModule(ModTool): """ Create a new out-of-tree module """ name = 'newmod' description = 'Create new empty module, use add to add blocks.' + def __init__(self, module_name=None, srcdir=None, **kwargs): ModTool.__init__(self, None, module_name, **kwargs) # Don't call ModTool._validate(), that assumes an existing module. @@ -33,7 +35,8 @@ class ModToolNewModule(ModTool): def assign(self): self.dir = os.path.join(self.directory, f'gr-{self.info["modname"]}') if self.srcdir is None: - self.srcdir = os.path.join(gr.prefix(),'share','gnuradio','modtool','templates','gr-newmod') + self.srcdir = os.path.join( + gr.prefix(), 'share', 'gnuradio', 'modtool', 'templates', 'gr-newmod') def validate(self): """ Validates the arguments """ @@ -43,11 +46,12 @@ class ModToolNewModule(ModTool): try: os.stat(self.dir) except OSError: - pass # This is what should happen + pass # This is what should happen else: raise ModToolException('The given directory exists.') if not os.path.isdir(self.srcdir): - raise ModToolException('Could not find gr-newmod source dir \'' + self.srcdir + '\'') + raise ModToolException( + 'Could not find gr-newmod source dir \'' + self.srcdir + '\'') def run(self): """ @@ -64,10 +68,10 @@ class ModToolNewModule(ModTool): try: shutil.copytree(self.srcdir, self.dir) try: - shutil.copyfile(os.path.join(gr.prefix(), 'share', 'gnuradio', 'clang-format.conf'), - os.path.join(self.dir, '.clang-format')) + shutil.copyfile(os.path.join(gr.prefix(), 'share', 'gnuradio', 'clang-format.conf'), + os.path.join(self.dir, '.clang-format')) except FileNotFoundError as e: - logger.info(f'Failed to copy .clang-format: {e}') + logger.info(f'Failed to copy .clang-format: {e}') os.chdir(self.dir) except OSError: raise ModToolException(f'Could not create directory {self.dir}.') @@ -87,11 +91,15 @@ class ModToolNewModule(ModTool): for filename in files: f = os.path.join(root, filename) if filename.find('howto') != -1: - os.rename(f, os.path.join(root, filename.replace('howto', self.info['modname']))) + os.rename(f, os.path.join( + root, filename.replace('howto', self.info['modname']))) if os.path.basename(root) == 'howto': - os.rename(root, os.path.join(os.path.dirname(root), self.info['modname'])) + os.rename(root, os.path.join( + os.path.dirname(root), self.info['modname'])) logger.info("Done.") if self.scm.init_repo(path_to_repo="."): - logger.info("Created repository... you might want to commit before continuing.") - logger.info("Use 'gr_modtool add' to add a new block to this currently empty module.") + logger.info( + "Created repository... you might want to commit before continuing.") + logger.info( + "Use 'gr_modtool add' to add a new block to this currently empty module.") diff --git a/gr-utils/modtool/core/rename.py b/gr-utils/modtool/core/rename.py index da032ed022..0c7fd46a51 100644 --- a/gr-utils/modtool/core/rename.py +++ b/gr-utils/modtool/core/rename.py @@ -37,15 +37,16 @@ class ModToolRename(ModTool): block_candidates = get_block_candidates() if self.info['oldname'] not in block_candidates: choices = [x for x in block_candidates if self.info['oldname'] in x] - if len(choices)>0: - print("Suggested alternatives: "+str(choices)) + if len(choices) > 0: + print("Suggested alternatives: " + str(choices)) raise ModToolException("Blockname for renaming does not exists!") if not self.info['newname']: raise ModToolException('New blockname (new_name) not specified.') validate_name('new block', self.info['newname']) def assign(self): - self.info['fullnewname'] = self.info['modname'] + '_' + self.info['newname'] + self.info['fullnewname'] = self.info['modname'] + \ + '_' + self.info['newname'] def run(self): """ Go, go, go. """ @@ -56,7 +57,8 @@ class ModToolRename(ModTool): module = self.info['modname'] oldname = self.info['oldname'] newname = self.info['newname'] - logger.info(f"In module '{module}' rename block '{oldname}' to '{newname}'") + logger.info( + f"In module '{module}' rename block '{oldname}' to '{newname}'") self._run_grc_rename(self.info['modname'], oldname, newname) self._run_python_qa(self.info['modname'], oldname, newname) self._run_python(self.info['modname'], oldname, newname) @@ -72,7 +74,8 @@ class ModToolRename(ModTool): hfile = './lib/' + old + '_impl.h' self._run_file_replace(ccfile, old, new) self._run_file_replace(hfile, old, new) - self._run_file_replace(hfile, old.upper(), new.upper()) # take care of include guards + # take care of include guards + self._run_file_replace(hfile, old.upper(), new.upper()) self._run_cmakelists('./lib/', old, new, '_impl.cc') self._run_cmakelists('./lib/', old, new, '_impl.h') self._run_file_rename('./lib/', old, new, '_impl.cc') @@ -99,7 +102,8 @@ class ModToolRename(ModTool): path = self.info['includedir'] filename = os.path.join(path, old + '.h') self._run_file_replace(filename, old, new) - self._run_file_replace(filename, old.upper(), new.upper()) # take care of include guards + # take care of include guards + self._run_file_replace(filename, old.upper(), new.upper()) self._run_cmakelists(path, old, new, '.h') self._run_file_rename(path, old, new, '.h') @@ -117,7 +121,7 @@ class ModToolRename(ModTool): logger.info("Not a Python block, nothing to do here...") def _run_pybind(self, module, old, new): - path = os.path.join(self.info['pydir'],'bindings') + path = os.path.join(self.info['pydir'], 'bindings') filename = os.path.join(path, old + '_python.cc') self._run_file_replace(filename, old, new) self._run_file_rename(path, old, new, '_python.cc') @@ -125,7 +129,8 @@ class ModToolRename(ModTool): # update the hash in the new file import hashlib hasher = hashlib.md5() - header_filename = os.path.join(self.info['includedir'], new + '.h') # note this requires _run_pybind to be called after _run_include + # note this requires _run_pybind to be called after _run_include + header_filename = os.path.join(self.info['includedir'], new + '.h') with open(header_filename, 'rb') as file_in: buf = file_in.read() hasher.update(buf) @@ -141,7 +146,8 @@ class ModToolRename(ModTool): f.write(file_txt) filename = path + 'python_bindings.cc' - self._run_file_replace(filename, ' bind_' + old + '\\(', ' bind_' + new + '(') + self._run_file_replace(filename, ' bind_' + + old + '\\(', ' bind_' + new + '(') path = os.path.join(path, 'docstrings') filename = os.path.join(path, old + '_pydoc_template.h') @@ -159,13 +165,16 @@ class ModToolRename(ModTool): def _run_grc_rename(self, module, old, new): grcfile = './grc/' + module + '_' + old + '.block.yml' self._run_file_replace(grcfile, old, new) - self._run_cmakelists('./grc/', module + '_' + old, module + '_' + new, '.block.yml') - self._run_file_rename('./grc/', module + '_' + old, module + '_' + new, '.block.yml') + self._run_cmakelists('./grc/', module + '_' + old, + module + '_' + new, '.block.yml') + self._run_file_rename('./grc/', module + '_' + old, + module + '_' + new, '.block.yml') def _run_cmakelists(self, path, first, second, suffix): filename = os.path.join(path, 'CMakeLists.txt') # space character and suffix ensures similiarly named blocks are not mixed up - nsubs = self._run_file_replace(filename, ' ' + first + suffix, ' ' + second + suffix) + nsubs = self._run_file_replace( + filename, ' ' + first + suffix, ' ' + second + suffix) if nsubs < 1: logger.info(f"'{first}' wasn't in '{filename}'.") @@ -186,7 +195,8 @@ class ModToolRename(ModTool): if not os.path.isfile(filename): return False else: - logger.info(f"In '{filename}' renaming occurrences of '{old}' to '{new}'") + logger.info( + f"In '{filename}' renaming occurrences of '{old}' to '{new}'") with open(filename) as f: cfile = f.read() diff --git a/gr-utils/modtool/core/rm.py b/gr-utils/modtool/core/rm.py index 8c9b17612b..f96bb2fabd 100644 --- a/gr-utils/modtool/core/rm.py +++ b/gr-utils/modtool/core/rm.py @@ -43,6 +43,7 @@ class ModToolRemove(ModTool): self.validate() else: from ..cli import cli_input + def _remove_cc_test_case(filename=None, ed=None): """ Special function that removes the occurrences of a qa*.cc file from the CMakeLists.txt. """ @@ -56,19 +57,19 @@ class ModToolRemove(ModTool): fr'^#include "{filename}"\s*$') remove_pattern_from_file(self._file['qalib'], fr'^\s*s->addTest\(gr::{modname_}::{base}::suite\(\)\);\s*$' - ) + ) self.scm.mark_file_updated(self._file['qalib']) elif ext == '.cc': ed.remove_value('list', r'\$\{CMAKE_CURRENT_SOURCE_DIR\}/%s' % filename, to_ignore_start=f'APPEND test_{modname_}_sources') self.scm.mark_file_updated(ed.filename) - elif self.info['version'] in ['38','310']: + elif self.info['version'] in ['38', '310']: (base, ext) = os.path.splitext(filename) if ext == '.cc': ed.remove_value( 'list', filename, - to_ignore_start=f'APPEND test_{modname_}_sources' ) + to_ignore_start=f'APPEND test_{modname_}_sources') self.scm.mark_file_updated(ed.filename) else: filebase = os.path.splitext(filename)[0] @@ -92,12 +93,16 @@ class ModToolRemove(ModTool): py_files_deleted = self._run_subdir(self.info['pydir'], ('*.py',), ('GR_PYTHON_INSTALL',), cmakeedit_func=_remove_py_test_case) for f in py_files_deleted: - remove_pattern_from_file(self._file['pyinit'], fr'.*import\s+{f[:-3]}.*') - remove_pattern_from_file(self._file['pyinit'], fr'.*from\s+{f[:-3]}\s+import.*\n') + remove_pattern_from_file( + self._file['pyinit'], fr'.*import\s+{f[:-3]}.*') + remove_pattern_from_file( + self._file['pyinit'], fr'.*from\s+{f[:-3]}\s+import.*\n') - pb_files_deleted = self._run_subdir(os.path.join(self.info['pydir'],'bindings'), ('*.cc',), ('list',)) + pb_files_deleted = self._run_subdir(os.path.join( + self.info['pydir'], 'bindings'), ('*.cc',), ('list',)) - pbdoc_files_deleted = self._run_subdir(os.path.join(self.info['pydir'],'bindings','docstrings'), ('*.h',), ('',)) + pbdoc_files_deleted = self._run_subdir(os.path.join( + self.info['pydir'], 'bindings', 'docstrings'), ('*.h',), ('',)) # Update python_bindings.cc blocknames_to_delete = [] @@ -106,22 +111,24 @@ class ModToolRemove(ModTool): blocknames_to_delete.append(self.info['blockname']) elif self.info['pattern']: # A regex resembling one or several blocks were given - blocknames_to_delete = get_block_names(self.info['pattern'], self.info['modname']) + blocknames_to_delete = get_block_names( + self.info['pattern'], self.info['modname']) else: raise ModToolException("No block name or regex was specified!") for blockname in blocknames_to_delete: ed = CPPFileEditor(self._file['ccpybind']) - ed.remove_value('// BINDING_FUNCTION_PROTOTYPES(', '// ) END BINDING_FUNCTION_PROTOTYPES', - 'void bind_' + blockname + '(py::module& m);') - ed.remove_value('// BINDING_FUNCTION_CALLS(', '// ) END BINDING_FUNCTION_CALLS', - 'bind_' + blockname + '(m);') + ed.remove_value('// BINDING_FUNCTION_PROTOTYPES(', '// ) END BINDING_FUNCTION_PROTOTYPES', + 'void bind_' + blockname + '(py::module& m);') + ed.remove_value('// BINDING_FUNCTION_CALLS(', '// ) END BINDING_FUNCTION_CALLS', + 'bind_' + blockname + '(m);') ed.write() if not self.skip_subdirs['lib']: self._run_subdir('lib', ('*.cc', '*.h'), ('add_library', 'list'), cmakeedit_func=_remove_cc_test_case) if not self.skip_subdirs['include']: - incl_files_deleted = self._run_subdir(self.info['includedir'], ('*.h',), ('install',)) + incl_files_deleted = self._run_subdir( + self.info['includedir'], ('*.h',), ('install',)) if not self.skip_subdirs['grc']: self._run_subdir('grc', ('*.yml',), ('install',)) @@ -146,9 +153,9 @@ class ModToolRemove(ModTool): blockname_pattern = '' if path == self.info['pydir']: blockname_pattern = f"^(qa_)?{self.info['blockname']}.py$" - elif path == os.path.join(self.info['pydir'],'bindings'): + elif path == os.path.join(self.info['pydir'], 'bindings'): blockname_pattern = f"^{self.info['blockname']}_python.cc$" - elif path == os.path.join(self.info['pydir'],'bindings','docstrings'): + elif path == os.path.join(self.info['pydir'], 'bindings', 'docstrings'): blockname_pattern = f"^{self.info['blockname']}_pydoc_template.h$" elif path == 'lib': blockname_pattern = f"^{self.info['blockname']}_impl(\\.h|\\.cc)$" @@ -173,7 +180,8 @@ class ModToolRemove(ModTool): for f in files_filt: b = os.path.basename(f) if not yes and self.cli: - ans = cli_input(f"Really delete {f}? [Y/n/a/q]: ").lower().strip() + ans = cli_input( + f"Really delete {f}? [Y/n/a/q]: ").lower().strip() if ans == 'a': yes = True if ans == 'q': @@ -187,7 +195,8 @@ class ModToolRemove(ModTool): if (os.path.exists(f'{path}/CMakeLists.txt')): ed = CMakeFileEditor(f'{path}/CMakeLists.txt') - logger.info(f"Deleting occurrences of {b} from {path}/CMakeLists.txt...") + logger.info( + f"Deleting occurrences of {b} from {path}/CMakeLists.txt...") for var in makefile_vars: ed.remove_value(var, b) if cmakeedit_func is not None: diff --git a/gr-utils/modtool/core/update.py b/gr-utils/modtool/core/update.py index 73e0060f61..ee8b78179e 100644 --- a/gr-utils/modtool/core/update.py +++ b/gr-utils/modtool/core/update.py @@ -42,7 +42,6 @@ class ModToolUpdate(ModTool): self.info['complete'] = complete self.info['include_blacklisted'] = include_blacklisted - def validate(self): """ Validates the arguments """ ModTool._validate(self) @@ -52,16 +51,18 @@ class ModToolUpdate(ModTool): raise ModToolException('Block name not specified!') block_candidates = get_xml_candidates() if self.info['blockname'] not in block_candidates: - choices = [x for x in block_candidates if self.info['blockname'] in x] + choices = [ + x for x in block_candidates if self.info['blockname'] in x] if len(choices) > 0: - print("Suggested alternatives: "+str(choices)) + print("Suggested alternatives: " + str(choices)) raise ModToolException("The XML bindings does not exists!") def run(self): from gnuradio.grc.converter import Converter if not self.cli: self.validate() - logger.warning("Warning: This is an experimental feature. Please verify the bindings.") + logger.warning( + "Warning: This is an experimental feature. Please verify the bindings.") module_name = self.info['modname'] path = './grc/' conv = Converter(path, path) @@ -72,10 +73,10 @@ class ModToolUpdate(ModTool): for blockname in blocks: xml_file = f"{module_name}_{blockname}.xml" yml_file = f"{module_name}_{blockname}.block.yml" - if not conv.load_block_xml(path+xml_file, self.info["include_blacklisted"]): + if not conv.load_block_xml(path + xml_file, self.info["include_blacklisted"]): continue logger.info(f"Converted {xml_file} to {yml_file}") - os.remove(path+xml_file) + os.remove(path + xml_file) nsubs = self._run_cmakelists(xml_file, yml_file) if nsubs > 1: logger.warning("Changed more than expected for the block '%s' in the CMakeLists.txt. " diff --git a/gr-utils/modtool/templates/gr-newmod/docs/doxygen/doxyxml/__init__.py b/gr-utils/modtool/templates/gr-newmod/docs/doxygen/doxyxml/__init__.py index d8ff40daaa..a50b52f70d 100644 --- a/gr-utils/modtool/templates/gr-newmod/docs/doxygen/doxyxml/__init__.py +++ b/gr-utils/modtool/templates/gr-newmod/docs/doxygen/doxyxml/__init__.py @@ -55,6 +55,7 @@ u'Outputs the vital aadvark statistics.' from .doxyindex import DoxyIndex, DoxyFunction, DoxyParam, DoxyClass, DoxyFile, DoxyNamespace, DoxyGroup, DoxyFriend, DoxyOther + def _test(): import os this_dir = os.path.dirname(globals()['__file__']) @@ -66,5 +67,6 @@ def _test(): import doctest return doctest.testmod() + if __name__ == "__main__": _test() diff --git a/gr-utils/modtool/templates/gr-newmod/docs/doxygen/doxyxml/base.py b/gr-utils/modtool/templates/gr-newmod/docs/doxygen/doxyxml/base.py index b2c00955cc..9502929332 100644 --- a/gr-utils/modtool/templates/gr-newmod/docs/doxygen/doxyxml/base.py +++ b/gr-utils/modtool/templates/gr-newmod/docs/doxygen/doxyxml/base.py @@ -83,8 +83,8 @@ class Base(object): for cls in self.mem_classes: if cls.can_parse(mem): return cls - raise Exception(("Did not find a class for object '%s'." \ - % (mem.get_name()))) + raise Exception(("Did not find a class for object '%s'." + % (mem.get_name()))) def convert_mem(self, mem): try: diff --git a/gr-utils/modtool/templates/gr-newmod/docs/doxygen/doxyxml/doxyindex.py b/gr-utils/modtool/templates/gr-newmod/docs/doxygen/doxyxml/doxyindex.py index 53e9a63cd5..56b744660c 100644 --- a/gr-utils/modtool/templates/gr-newmod/docs/doxygen/doxyxml/doxyindex.py +++ b/gr-utils/modtool/templates/gr-newmod/docs/doxygen/doxyxml/doxyindex.py @@ -18,6 +18,7 @@ from .generated import index from .base import Base from .text import description + class DoxyIndex(Base): """ Parses a doxygen xml directory. @@ -48,7 +49,6 @@ class DoxyIndex(Base): class DoxyCompMem(Base): - kind = None def __init__(self, *args, **kwargs): @@ -84,9 +84,11 @@ class DoxyCompMem(Base): class DoxyCompound(DoxyCompMem): pass + class DoxyMember(DoxyCompMem): pass + class DoxyFunction(DoxyMember): __module__ = "gnuradio.utils.doxyxml" @@ -107,9 +109,11 @@ class DoxyFunction(DoxyMember): self._data['params'].append(DoxyParam(prm)) brief_description = property(lambda self: self.data()['brief_description']) - detailed_description = property(lambda self: self.data()['detailed_description']) + detailed_description = property( + lambda self: self.data()['detailed_description']) params = property(lambda self: self.data()['params']) + Base.mem_classes.append(DoxyFunction) @@ -134,9 +138,11 @@ class DoxyParam(DoxyMember): return '\n\n'.join(descriptions) brief_description = property(lambda self: self.data()['brief_description']) - detailed_description = property(lambda self: self.data()['detailed_description']) + detailed_description = property( + lambda self: self.data()['detailed_description']) name = property(lambda self: self.data()['declname']) + class DoxyParameterItem(DoxyMember): """A different representation of a parameter in Doxygen.""" @@ -178,9 +184,11 @@ class DoxyClass(DoxyCompound): self.process_memberdefs() brief_description = property(lambda self: self.data()['brief_description']) - detailed_description = property(lambda self: self.data()['detailed_description']) + detailed_description = property( + lambda self: self.data()['detailed_description']) params = property(lambda self: self.data()['params']) + Base.mem_classes.append(DoxyClass) @@ -201,7 +209,9 @@ class DoxyFile(DoxyCompound): self.process_memberdefs() brief_description = property(lambda self: self.data()['brief_description']) - detailed_description = property(lambda self: self.data()['detailed_description']) + detailed_description = property( + lambda self: self.data()['detailed_description']) + Base.mem_classes.append(DoxyFile) @@ -222,6 +232,7 @@ class DoxyNamespace(DoxyCompound): return self.process_memberdefs() + Base.mem_classes.append(DoxyNamespace) @@ -265,6 +276,7 @@ class DoxyFriend(DoxyMember): kind = 'friend' + Base.mem_classes.append(DoxyFriend) @@ -279,4 +291,5 @@ class DoxyOther(Base): def can_parse(cls, obj): return obj.kind in cls.kinds + Base.mem_classes.append(DoxyOther) diff --git a/gr-utils/modtool/templates/gr-newmod/docs/doxygen/doxyxml/generated/compound.py b/gr-utils/modtool/templates/gr-newmod/docs/doxygen/doxyxml/generated/compound.py index 294f0216e7..321328bcb7 100644 --- a/gr-utils/modtool/templates/gr-newmod/docs/doxygen/doxyxml/generated/compound.py +++ b/gr-utils/modtool/templates/gr-newmod/docs/doxygen/doxyxml/generated/compound.py @@ -22,13 +22,15 @@ class DoxygenTypeSub(supermod.DoxygenType): return self.compounddef.find(details) + supermod.DoxygenType.subclass = DoxygenTypeSub # end class DoxygenTypeSub class compounddefTypeSub(supermod.compounddefType): def __init__(self, kind=None, prot=None, id=None, compoundname='', title='', basecompoundref=None, derivedcompoundref=None, includes=None, includedby=None, incdepgraph=None, invincdepgraph=None, innerdir=None, innerfile=None, innerclass=None, innernamespace=None, innerpage=None, innergroup=None, templateparamlist=None, sectiondef=None, briefdescription=None, detaileddescription=None, inheritancegraph=None, collaborationgraph=None, programlisting=None, location=None, listofallmembers=None): - supermod.compounddefType.__init__(self, kind, prot, id, compoundname, title, basecompoundref, derivedcompoundref, includes, includedby, incdepgraph, invincdepgraph, innerdir, innerfile, innerclass, innernamespace, innerpage, innergroup, templateparamlist, sectiondef, briefdescription, detaileddescription, inheritancegraph, collaborationgraph, programlisting, location, listofallmembers) + supermod.compounddefType.__init__(self, kind, prot, id, compoundname, title, basecompoundref, derivedcompoundref, includes, includedby, incdepgraph, invincdepgraph, innerdir, innerfile, innerclass, + innernamespace, innerpage, innergroup, templateparamlist, sectiondef, briefdescription, detaileddescription, inheritancegraph, collaborationgraph, programlisting, location, listofallmembers) def find(self, details): @@ -48,13 +50,18 @@ supermod.compounddefType.subclass = compounddefTypeSub class listofallmembersTypeSub(supermod.listofallmembersType): def __init__(self, member=None): supermod.listofallmembersType.__init__(self, member) + + supermod.listofallmembersType.subclass = listofallmembersTypeSub # end class listofallmembersTypeSub class memberRefTypeSub(supermod.memberRefType): def __init__(self, virt=None, prot=None, refid=None, ambiguityscope=None, scope='', name=''): - supermod.memberRefType.__init__(self, virt, prot, refid, ambiguityscope, scope, name) + supermod.memberRefType.__init__( + self, virt, prot, refid, ambiguityscope, scope, name) + + supermod.memberRefType.subclass = memberRefTypeSub # end class memberRefTypeSub @@ -62,6 +69,8 @@ supermod.memberRefType.subclass = memberRefTypeSub class compoundRefTypeSub(supermod.compoundRefType): def __init__(self, virt=None, prot=None, refid=None, valueOf_='', mixedclass_=None, content_=None): supermod.compoundRefType.__init__(self, mixedclass_, content_) + + supermod.compoundRefType.subclass = compoundRefTypeSub # end class compoundRefTypeSub @@ -69,6 +78,8 @@ supermod.compoundRefType.subclass = compoundRefTypeSub class reimplementTypeSub(supermod.reimplementType): def __init__(self, refid=None, valueOf_='', mixedclass_=None, content_=None): supermod.reimplementType.__init__(self, mixedclass_, content_) + + supermod.reimplementType.subclass = reimplementTypeSub # end class reimplementTypeSub @@ -76,6 +87,8 @@ supermod.reimplementType.subclass = reimplementTypeSub class incTypeSub(supermod.incType): def __init__(self, local=None, refid=None, valueOf_='', mixedclass_=None, content_=None): supermod.incType.__init__(self, mixedclass_, content_) + + supermod.incType.subclass = incTypeSub # end class incTypeSub @@ -83,23 +96,26 @@ supermod.incType.subclass = incTypeSub class refTypeSub(supermod.refType): def __init__(self, prot=None, refid=None, valueOf_='', mixedclass_=None, content_=None): supermod.refType.__init__(self, mixedclass_, content_) + + supermod.refType.subclass = refTypeSub # end class refTypeSub - class refTextTypeSub(supermod.refTextType): def __init__(self, refid=None, kindref=None, external=None, valueOf_='', mixedclass_=None, content_=None): supermod.refTextType.__init__(self, mixedclass_, content_) + supermod.refTextType.subclass = refTextTypeSub # end class refTextTypeSub -class sectiondefTypeSub(supermod.sectiondefType): +class sectiondefTypeSub(supermod.sectiondefType): def __init__(self, kind=None, header='', description=None, memberdef=None): - supermod.sectiondefType.__init__(self, kind, header, description, memberdef) + supermod.sectiondefType.__init__( + self, kind, header, description, memberdef) def find(self, details): @@ -116,7 +132,10 @@ supermod.sectiondefType.subclass = sectiondefTypeSub class memberdefTypeSub(supermod.memberdefType): def __init__(self, initonly=None, kind=None, volatile=None, const=None, raise_=None, virt=None, readable=None, prot=None, explicit=None, new=None, final=None, writable=None, add=None, static=None, remove=None, sealed=None, mutable=None, gettable=None, inline=None, settable=None, id=None, templateparamlist=None, type_=None, definition='', argsstring='', name='', read='', write='', bitfield='', reimplements=None, reimplementedby=None, param=None, enumvalue=None, initializer=None, exceptions=None, briefdescription=None, detaileddescription=None, inbodydescription=None, location=None, references=None, referencedby=None): - supermod.memberdefType.__init__(self, initonly, kind, volatile, const, raise_, virt, readable, prot, explicit, new, final, writable, add, static, remove, sealed, mutable, gettable, inline, settable, id, templateparamlist, type_, definition, argsstring, name, read, write, bitfield, reimplements, reimplementedby, param, enumvalue, initializer, exceptions, briefdescription, detaileddescription, inbodydescription, location, references, referencedby) + supermod.memberdefType.__init__(self, initonly, kind, volatile, const, raise_, virt, readable, prot, explicit, new, final, writable, add, static, remove, sealed, mutable, gettable, inline, settable, id, templateparamlist, type_, + definition, argsstring, name, read, write, bitfield, reimplements, reimplementedby, param, enumvalue, initializer, exceptions, briefdescription, detaileddescription, inbodydescription, location, references, referencedby) + + supermod.memberdefType.subclass = memberdefTypeSub # end class memberdefTypeSub @@ -124,6 +143,8 @@ supermod.memberdefType.subclass = memberdefTypeSub class descriptionTypeSub(supermod.descriptionType): def __init__(self, title='', para=None, sect1=None, internal=None, mixedclass_=None, content_=None): supermod.descriptionType.__init__(self, mixedclass_, content_) + + supermod.descriptionType.subclass = descriptionTypeSub # end class descriptionTypeSub @@ -131,6 +152,8 @@ supermod.descriptionType.subclass = descriptionTypeSub class enumvalueTypeSub(supermod.enumvalueType): def __init__(self, prot=None, id=None, name='', initializer=None, briefdescription=None, detaileddescription=None, mixedclass_=None, content_=None): supermod.enumvalueType.__init__(self, mixedclass_, content_) + + supermod.enumvalueType.subclass = enumvalueTypeSub # end class enumvalueTypeSub @@ -138,13 +161,18 @@ supermod.enumvalueType.subclass = enumvalueTypeSub class templateparamlistTypeSub(supermod.templateparamlistType): def __init__(self, param=None): supermod.templateparamlistType.__init__(self, param) + + supermod.templateparamlistType.subclass = templateparamlistTypeSub # end class templateparamlistTypeSub class paramTypeSub(supermod.paramType): def __init__(self, type_=None, declname='', defname='', array='', defval=None, briefdescription=None): - supermod.paramType.__init__(self, type_, declname, defname, array, defval, briefdescription) + supermod.paramType.__init__( + self, type_, declname, defname, array, defval, briefdescription) + + supermod.paramType.subclass = paramTypeSub # end class paramTypeSub @@ -152,6 +180,8 @@ supermod.paramType.subclass = paramTypeSub class linkedTextTypeSub(supermod.linkedTextType): def __init__(self, ref=None, mixedclass_=None, content_=None): supermod.linkedTextType.__init__(self, mixedclass_, content_) + + supermod.linkedTextType.subclass = linkedTextTypeSub # end class linkedTextTypeSub @@ -159,6 +189,8 @@ supermod.linkedTextType.subclass = linkedTextTypeSub class graphTypeSub(supermod.graphType): def __init__(self, node=None): supermod.graphType.__init__(self, node) + + supermod.graphType.subclass = graphTypeSub # end class graphTypeSub @@ -166,6 +198,8 @@ supermod.graphType.subclass = graphTypeSub class nodeTypeSub(supermod.nodeType): def __init__(self, id=None, label='', link=None, childnode=None): supermod.nodeType.__init__(self, id, label, link, childnode) + + supermod.nodeType.subclass = nodeTypeSub # end class nodeTypeSub @@ -173,6 +207,8 @@ supermod.nodeType.subclass = nodeTypeSub class childnodeTypeSub(supermod.childnodeType): def __init__(self, relation=None, refid=None, edgelabel=None): supermod.childnodeType.__init__(self, relation, refid, edgelabel) + + supermod.childnodeType.subclass = childnodeTypeSub # end class childnodeTypeSub @@ -180,6 +216,8 @@ supermod.childnodeType.subclass = childnodeTypeSub class linkTypeSub(supermod.linkType): def __init__(self, refid=None, external=None, valueOf_=''): supermod.linkType.__init__(self, refid, external) + + supermod.linkType.subclass = linkTypeSub # end class linkTypeSub @@ -187,13 +225,18 @@ supermod.linkType.subclass = linkTypeSub class listingTypeSub(supermod.listingType): def __init__(self, codeline=None): supermod.listingType.__init__(self, codeline) + + supermod.listingType.subclass = listingTypeSub # end class listingTypeSub class codelineTypeSub(supermod.codelineType): def __init__(self, external=None, lineno=None, refkind=None, refid=None, highlight=None): - supermod.codelineType.__init__(self, external, lineno, refkind, refid, highlight) + supermod.codelineType.__init__( + self, external, lineno, refkind, refid, highlight) + + supermod.codelineType.subclass = codelineTypeSub # end class codelineTypeSub @@ -201,6 +244,8 @@ supermod.codelineType.subclass = codelineTypeSub class highlightTypeSub(supermod.highlightType): def __init__(self, class_=None, sp=None, ref=None, mixedclass_=None, content_=None): supermod.highlightType.__init__(self, mixedclass_, content_) + + supermod.highlightType.subclass = highlightTypeSub # end class highlightTypeSub @@ -208,13 +253,18 @@ supermod.highlightType.subclass = highlightTypeSub class referenceTypeSub(supermod.referenceType): def __init__(self, endline=None, startline=None, refid=None, compoundref=None, valueOf_='', mixedclass_=None, content_=None): supermod.referenceType.__init__(self, mixedclass_, content_) + + supermod.referenceType.subclass = referenceTypeSub # end class referenceTypeSub class locationTypeSub(supermod.locationType): def __init__(self, bodystart=None, line=None, bodyend=None, bodyfile=None, file=None, valueOf_=''): - supermod.locationType.__init__(self, bodystart, line, bodyend, bodyfile, file) + supermod.locationType.__init__( + self, bodystart, line, bodyend, bodyfile, file) + + supermod.locationType.subclass = locationTypeSub # end class locationTypeSub @@ -222,6 +272,8 @@ supermod.locationType.subclass = locationTypeSub class docSect1TypeSub(supermod.docSect1Type): def __init__(self, id=None, title='', para=None, sect2=None, internal=None, mixedclass_=None, content_=None): supermod.docSect1Type.__init__(self, mixedclass_, content_) + + supermod.docSect1Type.subclass = docSect1TypeSub # end class docSect1TypeSub @@ -229,6 +281,8 @@ supermod.docSect1Type.subclass = docSect1TypeSub class docSect2TypeSub(supermod.docSect2Type): def __init__(self, id=None, title='', para=None, sect3=None, internal=None, mixedclass_=None, content_=None): supermod.docSect2Type.__init__(self, mixedclass_, content_) + + supermod.docSect2Type.subclass = docSect2TypeSub # end class docSect2TypeSub @@ -236,6 +290,8 @@ supermod.docSect2Type.subclass = docSect2TypeSub class docSect3TypeSub(supermod.docSect3Type): def __init__(self, id=None, title='', para=None, sect4=None, internal=None, mixedclass_=None, content_=None): supermod.docSect3Type.__init__(self, mixedclass_, content_) + + supermod.docSect3Type.subclass = docSect3TypeSub # end class docSect3TypeSub @@ -243,6 +299,8 @@ supermod.docSect3Type.subclass = docSect3TypeSub class docSect4TypeSub(supermod.docSect4Type): def __init__(self, id=None, title='', para=None, internal=None, mixedclass_=None, content_=None): supermod.docSect4Type.__init__(self, mixedclass_, content_) + + supermod.docSect4Type.subclass = docSect4TypeSub # end class docSect4TypeSub @@ -250,6 +308,8 @@ supermod.docSect4Type.subclass = docSect4TypeSub class docInternalTypeSub(supermod.docInternalType): def __init__(self, para=None, sect1=None, mixedclass_=None, content_=None): supermod.docInternalType.__init__(self, mixedclass_, content_) + + supermod.docInternalType.subclass = docInternalTypeSub # end class docInternalTypeSub @@ -257,6 +317,8 @@ supermod.docInternalType.subclass = docInternalTypeSub class docInternalS1TypeSub(supermod.docInternalS1Type): def __init__(self, para=None, sect2=None, mixedclass_=None, content_=None): supermod.docInternalS1Type.__init__(self, mixedclass_, content_) + + supermod.docInternalS1Type.subclass = docInternalS1TypeSub # end class docInternalS1TypeSub @@ -264,6 +326,8 @@ supermod.docInternalS1Type.subclass = docInternalS1TypeSub class docInternalS2TypeSub(supermod.docInternalS2Type): def __init__(self, para=None, sect3=None, mixedclass_=None, content_=None): supermod.docInternalS2Type.__init__(self, mixedclass_, content_) + + supermod.docInternalS2Type.subclass = docInternalS2TypeSub # end class docInternalS2TypeSub @@ -271,6 +335,8 @@ supermod.docInternalS2Type.subclass = docInternalS2TypeSub class docInternalS3TypeSub(supermod.docInternalS3Type): def __init__(self, para=None, sect3=None, mixedclass_=None, content_=None): supermod.docInternalS3Type.__init__(self, mixedclass_, content_) + + supermod.docInternalS3Type.subclass = docInternalS3TypeSub # end class docInternalS3TypeSub @@ -278,6 +344,8 @@ supermod.docInternalS3Type.subclass = docInternalS3TypeSub class docInternalS4TypeSub(supermod.docInternalS4Type): def __init__(self, para=None, mixedclass_=None, content_=None): supermod.docInternalS4Type.__init__(self, mixedclass_, content_) + + supermod.docInternalS4Type.subclass = docInternalS4TypeSub # end class docInternalS4TypeSub @@ -285,6 +353,8 @@ supermod.docInternalS4Type.subclass = docInternalS4TypeSub class docURLLinkSub(supermod.docURLLink): def __init__(self, url=None, valueOf_='', mixedclass_=None, content_=None): supermod.docURLLink.__init__(self, mixedclass_, content_) + + supermod.docURLLink.subclass = docURLLinkSub # end class docURLLinkSub @@ -292,6 +362,8 @@ supermod.docURLLink.subclass = docURLLinkSub class docAnchorTypeSub(supermod.docAnchorType): def __init__(self, id=None, valueOf_='', mixedclass_=None, content_=None): supermod.docAnchorType.__init__(self, mixedclass_, content_) + + supermod.docAnchorType.subclass = docAnchorTypeSub # end class docAnchorTypeSub @@ -299,6 +371,8 @@ supermod.docAnchorType.subclass = docAnchorTypeSub class docFormulaTypeSub(supermod.docFormulaType): def __init__(self, id=None, valueOf_='', mixedclass_=None, content_=None): supermod.docFormulaType.__init__(self, mixedclass_, content_) + + supermod.docFormulaType.subclass = docFormulaTypeSub # end class docFormulaTypeSub @@ -306,6 +380,8 @@ supermod.docFormulaType.subclass = docFormulaTypeSub class docIndexEntryTypeSub(supermod.docIndexEntryType): def __init__(self, primaryie='', secondaryie=''): supermod.docIndexEntryType.__init__(self, primaryie, secondaryie) + + supermod.docIndexEntryType.subclass = docIndexEntryTypeSub # end class docIndexEntryTypeSub @@ -313,6 +389,8 @@ supermod.docIndexEntryType.subclass = docIndexEntryTypeSub class docListTypeSub(supermod.docListType): def __init__(self, listitem=None): supermod.docListType.__init__(self, listitem) + + supermod.docListType.subclass = docListTypeSub # end class docListTypeSub @@ -320,6 +398,8 @@ supermod.docListType.subclass = docListTypeSub class docListItemTypeSub(supermod.docListItemType): def __init__(self, para=None): supermod.docListItemType.__init__(self, para) + + supermod.docListItemType.subclass = docListItemTypeSub # end class docListItemTypeSub @@ -327,6 +407,8 @@ supermod.docListItemType.subclass = docListItemTypeSub class docSimpleSectTypeSub(supermod.docSimpleSectType): def __init__(self, kind=None, title=None, para=None): supermod.docSimpleSectType.__init__(self, kind, title, para) + + supermod.docSimpleSectType.subclass = docSimpleSectTypeSub # end class docSimpleSectTypeSub @@ -334,6 +416,8 @@ supermod.docSimpleSectType.subclass = docSimpleSectTypeSub class docVarListEntryTypeSub(supermod.docVarListEntryType): def __init__(self, term=None): supermod.docVarListEntryType.__init__(self, term) + + supermod.docVarListEntryType.subclass = docVarListEntryTypeSub # end class docVarListEntryTypeSub @@ -341,6 +425,8 @@ supermod.docVarListEntryType.subclass = docVarListEntryTypeSub class docRefTextTypeSub(supermod.docRefTextType): def __init__(self, refid=None, kindref=None, external=None, valueOf_='', mixedclass_=None, content_=None): supermod.docRefTextType.__init__(self, mixedclass_, content_) + + supermod.docRefTextType.subclass = docRefTextTypeSub # end class docRefTextTypeSub @@ -348,6 +434,8 @@ supermod.docRefTextType.subclass = docRefTextTypeSub class docTableTypeSub(supermod.docTableType): def __init__(self, rows=None, cols=None, row=None, caption=None): supermod.docTableType.__init__(self, rows, cols, row, caption) + + supermod.docTableType.subclass = docTableTypeSub # end class docTableTypeSub @@ -355,6 +443,8 @@ supermod.docTableType.subclass = docTableTypeSub class docRowTypeSub(supermod.docRowType): def __init__(self, entry=None): supermod.docRowType.__init__(self, entry) + + supermod.docRowType.subclass = docRowTypeSub # end class docRowTypeSub @@ -362,6 +452,8 @@ supermod.docRowType.subclass = docRowTypeSub class docEntryTypeSub(supermod.docEntryType): def __init__(self, thead=None, para=None): supermod.docEntryType.__init__(self, thead, para) + + supermod.docEntryType.subclass = docEntryTypeSub # end class docEntryTypeSub @@ -369,6 +461,8 @@ supermod.docEntryType.subclass = docEntryTypeSub class docHeadingTypeSub(supermod.docHeadingType): def __init__(self, level=None, valueOf_='', mixedclass_=None, content_=None): supermod.docHeadingType.__init__(self, mixedclass_, content_) + + supermod.docHeadingType.subclass = docHeadingTypeSub # end class docHeadingTypeSub @@ -376,6 +470,8 @@ supermod.docHeadingType.subclass = docHeadingTypeSub class docImageTypeSub(supermod.docImageType): def __init__(self, width=None, type_=None, name=None, height=None, valueOf_='', mixedclass_=None, content_=None): supermod.docImageType.__init__(self, mixedclass_, content_) + + supermod.docImageType.subclass = docImageTypeSub # end class docImageTypeSub @@ -383,6 +479,8 @@ supermod.docImageType.subclass = docImageTypeSub class docDotFileTypeSub(supermod.docDotFileType): def __init__(self, name=None, valueOf_='', mixedclass_=None, content_=None): supermod.docDotFileType.__init__(self, mixedclass_, content_) + + supermod.docDotFileType.subclass = docDotFileTypeSub # end class docDotFileTypeSub @@ -390,6 +488,8 @@ supermod.docDotFileType.subclass = docDotFileTypeSub class docTocItemTypeSub(supermod.docTocItemType): def __init__(self, id=None, valueOf_='', mixedclass_=None, content_=None): supermod.docTocItemType.__init__(self, mixedclass_, content_) + + supermod.docTocItemType.subclass = docTocItemTypeSub # end class docTocItemTypeSub @@ -397,6 +497,8 @@ supermod.docTocItemType.subclass = docTocItemTypeSub class docTocListTypeSub(supermod.docTocListType): def __init__(self, tocitem=None): supermod.docTocListType.__init__(self, tocitem) + + supermod.docTocListType.subclass = docTocListTypeSub # end class docTocListTypeSub @@ -404,6 +506,8 @@ supermod.docTocListType.subclass = docTocListTypeSub class docLanguageTypeSub(supermod.docLanguageType): def __init__(self, langid=None, para=None): supermod.docLanguageType.__init__(self, langid, para) + + supermod.docLanguageType.subclass = docLanguageTypeSub # end class docLanguageTypeSub @@ -411,13 +515,18 @@ supermod.docLanguageType.subclass = docLanguageTypeSub class docParamListTypeSub(supermod.docParamListType): def __init__(self, kind=None, parameteritem=None): supermod.docParamListType.__init__(self, kind, parameteritem) + + supermod.docParamListType.subclass = docParamListTypeSub # end class docParamListTypeSub class docParamListItemSub(supermod.docParamListItem): def __init__(self, parameternamelist=None, parameterdescription=None): - supermod.docParamListItem.__init__(self, parameternamelist, parameterdescription) + supermod.docParamListItem.__init__( + self, parameternamelist, parameterdescription) + + supermod.docParamListItem.subclass = docParamListItemSub # end class docParamListItemSub @@ -425,6 +534,8 @@ supermod.docParamListItem.subclass = docParamListItemSub class docParamNameListSub(supermod.docParamNameList): def __init__(self, parametername=None): supermod.docParamNameList.__init__(self, parametername) + + supermod.docParamNameList.subclass = docParamNameListSub # end class docParamNameListSub @@ -432,6 +543,8 @@ supermod.docParamNameList.subclass = docParamNameListSub class docParamNameSub(supermod.docParamName): def __init__(self, direction=None, ref=None, mixedclass_=None, content_=None): supermod.docParamName.__init__(self, mixedclass_, content_) + + supermod.docParamName.subclass = docParamNameSub # end class docParamNameSub @@ -439,6 +552,8 @@ supermod.docParamName.subclass = docParamNameSub class docXRefSectTypeSub(supermod.docXRefSectType): def __init__(self, id=None, xreftitle=None, xrefdescription=None): supermod.docXRefSectType.__init__(self, id, xreftitle, xrefdescription) + + supermod.docXRefSectType.subclass = docXRefSectTypeSub # end class docXRefSectTypeSub @@ -446,6 +561,8 @@ supermod.docXRefSectType.subclass = docXRefSectTypeSub class docCopyTypeSub(supermod.docCopyType): def __init__(self, link=None, para=None, sect1=None, internal=None): supermod.docCopyType.__init__(self, link, para, sect1, internal) + + supermod.docCopyType.subclass = docCopyTypeSub # end class docCopyTypeSub @@ -453,9 +570,12 @@ supermod.docCopyType.subclass = docCopyTypeSub class docCharTypeSub(supermod.docCharType): def __init__(self, char=None, valueOf_=''): supermod.docCharType.__init__(self, char) + + supermod.docCharType.subclass = docCharTypeSub # end class docCharTypeSub + class docParaTypeSub(supermod.docParaType): def __init__(self, char=None, valueOf_=''): supermod.docParaType.__init__(self, char) @@ -469,7 +589,7 @@ class docParaTypeSub(supermod.docParaType): if child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, - MixedContainer.TypeNone, '', child_.nodeValue) + MixedContainer.TypeNone, '', child_.nodeValue) self.content.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ nodeName_ == "ref": @@ -492,7 +612,6 @@ supermod.docParaType.subclass = docParaTypeSub # end class docParaTypeSub - def parse(inFilename): doc = minidom.parse(inFilename) rootNode = doc.documentElement diff --git a/gr-utils/modtool/templates/gr-newmod/docs/doxygen/doxyxml/generated/compoundsuper.py b/gr-utils/modtool/templates/gr-newmod/docs/doxygen/doxyxml/generated/compoundsuper.py index 05c49281fe..40f548aab0 100644 --- a/gr-utils/modtool/templates/gr-newmod/docs/doxygen/doxyxml/generated/compoundsuper.py +++ b/gr-utils/modtool/templates/gr-newmod/docs/doxygen/doxyxml/generated/compoundsuper.py @@ -24,12 +24,16 @@ except ImportError as exp: class GeneratedsSuper(object): def format_string(self, input_data, input_name=''): return input_data + def format_integer(self, input_data, input_name=''): return '%d' % input_data + def format_float(self, input_data, input_name=''): return '%f' % input_data + def format_double(self, input_data, input_name=''): return '%e' % input_data + def format_boolean(self, input_data, input_name=''): return '%s' % input_data @@ -41,9 +45,9 @@ except ImportError as exp: ## from IPython.Shell import IPShellEmbed ## args = '' -## ipshell = IPShellEmbed(args, +# ipshell = IPShellEmbed(args, ## banner = 'Dropping into IPython', -## exit_msg = 'Leaving Interpreter, back to program.') +# exit_msg = 'Leaving Interpreter, back to program.') # Then use the following line where and when you want to drop into the # IPython shell: @@ -59,10 +63,12 @@ ExternalEncoding = 'ascii' # Support/utility functions. # + def showIndent(outfile, level): for idx in range(level): outfile.write(' ') + def quote_xml(inStr): s1 = (isinstance(inStr, str) and inStr or '%s' % inStr) @@ -71,6 +77,7 @@ def quote_xml(inStr): s1 = s1.replace('>', '>') return s1 + def quote_attrib(inStr): s1 = (isinstance(inStr, str) and inStr or '%s' % inStr) @@ -86,6 +93,7 @@ def quote_attrib(inStr): s1 = '"%s"' % s1 return s1 + def quote_python(inStr): s1 = inStr if s1.find("'") == -1: @@ -117,26 +125,33 @@ class MixedContainer(object): TypeDecimal = 5 TypeDouble = 6 TypeBoolean = 7 + def __init__(self, category, content_type, name, value): self.category = category self.content_type = content_type self.name = name self.value = value + def getCategory(self): return self.category + def getContenttype(self, content_type): return self.content_type + def getValue(self): return self.value + def getName(self): return self.name + def export(self, outfile, level, name, namespace): if self.category == MixedContainer.CategoryText: outfile.write(self.value) elif self.category == MixedContainer.CategorySimple: self.exportSimple(outfile, level, name) else: # category == MixedContainer.CategoryComplex - self.value.export(outfile, level, namespace,name) + self.value.export(outfile, level, namespace, name) + def exportSimple(self, outfile, level, name): if self.content_type == MixedContainer.TypeString: outfile.write('<%s>%s</%s>' % (self.name, self.value, self.name)) @@ -148,19 +163,20 @@ class MixedContainer(object): outfile.write('<%s>%f</%s>' % (self.name, self.value, self.name)) elif self.content_type == MixedContainer.TypeDouble: outfile.write('<%s>%g</%s>' % (self.name, self.value, self.name)) + def exportLiteral(self, outfile, level, name): if self.category == MixedContainer.CategoryText: showIndent(outfile, level) - outfile.write('MixedContainer(%d, %d, "%s", "%s"),\n' % \ - (self.category, self.content_type, self.name, self.value)) + outfile.write('MixedContainer(%d, %d, "%s", "%s"),\n' % + (self.category, self.content_type, self.name, self.value)) elif self.category == MixedContainer.CategorySimple: showIndent(outfile, level) - outfile.write('MixedContainer(%d, %d, "%s", "%s"),\n' % \ - (self.category, self.content_type, self.name, self.value)) + outfile.write('MixedContainer(%d, %d, "%s", "%s"),\n' % + (self.category, self.content_type, self.name, self.value)) else: # category == MixedContainer.CategoryComplex showIndent(outfile, level) - outfile.write('MixedContainer(%d, %d, "%s",\n' % \ - (self.category, self.content_type, self.name,)) + outfile.write('MixedContainer(%d, %d, "%s",\n' % + (self.category, self.content_type, self.name,)) self.value.exportLiteral(outfile, level + 1) showIndent(outfile, level) outfile.write(')\n') @@ -171,6 +187,7 @@ class _MemberSpec(object): self.name = name self.data_type = data_type self.container = container + def set_name(self, name): self.name = name def get_name(self): return self.name def set_data_type(self, data_type): self.data_type = data_type @@ -186,9 +203,11 @@ class _MemberSpec(object): class DoxygenType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, version=None, compounddef=None): self.version = version self.compounddef = compounddef + def factory(*args_, **kwargs_): if DoxygenType.subclass: return DoxygenType.subclass(*args_, **kwargs_) @@ -199,6 +218,7 @@ class DoxygenType(GeneratedsSuper): def set_compounddef(self, compounddef): self.compounddef = compounddef def get_version(self): return self.version def set_version(self, version): self.version = version + def export(self, outfile, level, namespace_='', name_='DoxygenType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) @@ -210,27 +230,34 @@ class DoxygenType(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='DoxygenType'): outfile.write(' version=%s' % (quote_attrib(self.version), )) + def exportChildren(self, outfile, level, namespace_='', name_='DoxygenType'): if self.compounddef: - self.compounddef.export(outfile, level, namespace_, name_='compounddef') + self.compounddef.export( + outfile, level, namespace_, name_='compounddef') + def hasContent_(self): if ( self.compounddef is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='DoxygenType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): if self.version is not None: showIndent(outfile, level) outfile.write('version = "%s",\n' % (self.version,)) + def exportLiteralChildren(self, outfile, level, name_): if self.compounddef: showIndent(outfile, level) @@ -238,18 +265,21 @@ class DoxygenType(GeneratedsSuper): self.compounddef.exportLiteral(outfile, level, name_='compounddef') showIndent(outfile, level) outfile.write('),\n') + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): if attrs.get('version'): self.version = attrs.get('version').value + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'compounddef': + nodeName_ == 'compounddef': obj_ = compounddefType.factory() obj_.build(child_) self.set_compounddef(obj_) @@ -259,6 +289,7 @@ class DoxygenType(GeneratedsSuper): class compounddefType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, kind=None, prot=None, id=None, compoundname=None, title=None, basecompoundref=None, derivedcompoundref=None, includes=None, includedby=None, incdepgraph=None, invincdepgraph=None, innerdir=None, innerfile=None, innerclass=None, innernamespace=None, innerpage=None, innergroup=None, templateparamlist=None, sectiondef=None, briefdescription=None, detaileddescription=None, inheritancegraph=None, collaborationgraph=None, programlisting=None, location=None, listofallmembers=None): self.kind = kind self.prot = prot @@ -319,6 +350,7 @@ class compounddefType(GeneratedsSuper): self.programlisting = programlisting self.location = location self.listofallmembers = listofallmembers + def factory(*args_, **kwargs_): if compounddefType.subclass: return compounddefType.subclass(*args_, **kwargs_) @@ -330,13 +362,23 @@ class compounddefType(GeneratedsSuper): def get_title(self): return self.title def set_title(self, title): self.title = title def get_basecompoundref(self): return self.basecompoundref - def set_basecompoundref(self, basecompoundref): self.basecompoundref = basecompoundref + def set_basecompoundref( + self, basecompoundref): self.basecompoundref = basecompoundref + def add_basecompoundref(self, value): self.basecompoundref.append(value) - def insert_basecompoundref(self, index, value): self.basecompoundref[index] = value + def insert_basecompoundref( + self, index, value): self.basecompoundref[index] = value + def get_derivedcompoundref(self): return self.derivedcompoundref - def set_derivedcompoundref(self, derivedcompoundref): self.derivedcompoundref = derivedcompoundref - def add_derivedcompoundref(self, value): self.derivedcompoundref.append(value) - def insert_derivedcompoundref(self, index, value): self.derivedcompoundref[index] = value + + def set_derivedcompoundref( + self, derivedcompoundref): self.derivedcompoundref = derivedcompoundref + + def add_derivedcompoundref( + self, value): self.derivedcompoundref.append(value) + def insert_derivedcompoundref( + self, index, value): self.derivedcompoundref[index] = value + def get_includes(self): return self.includes def set_includes(self, includes): self.includes = includes def add_includes(self, value): self.includes.append(value) @@ -348,7 +390,9 @@ class compounddefType(GeneratedsSuper): def get_incdepgraph(self): return self.incdepgraph def set_incdepgraph(self, incdepgraph): self.incdepgraph = incdepgraph def get_invincdepgraph(self): return self.invincdepgraph - def set_invincdepgraph(self, invincdepgraph): self.invincdepgraph = invincdepgraph + def set_invincdepgraph( + self, invincdepgraph): self.invincdepgraph = invincdepgraph + def get_innerdir(self): return self.innerdir def set_innerdir(self, innerdir): self.innerdir = innerdir def add_innerdir(self, value): self.innerdir.append(value) @@ -362,9 +406,13 @@ class compounddefType(GeneratedsSuper): def add_innerclass(self, value): self.innerclass.append(value) def insert_innerclass(self, index, value): self.innerclass[index] = value def get_innernamespace(self): return self.innernamespace - def set_innernamespace(self, innernamespace): self.innernamespace = innernamespace + def set_innernamespace( + self, innernamespace): self.innernamespace = innernamespace + def add_innernamespace(self, value): self.innernamespace.append(value) - def insert_innernamespace(self, index, value): self.innernamespace[index] = value + def insert_innernamespace( + self, index, value): self.innernamespace[index] = value + def get_innerpage(self): return self.innerpage def set_innerpage(self, innerpage): self.innerpage = innerpage def add_innerpage(self, value): self.innerpage.append(value) @@ -374,35 +422,51 @@ class compounddefType(GeneratedsSuper): def add_innergroup(self, value): self.innergroup.append(value) def insert_innergroup(self, index, value): self.innergroup[index] = value def get_templateparamlist(self): return self.templateparamlist - def set_templateparamlist(self, templateparamlist): self.templateparamlist = templateparamlist + def set_templateparamlist( + self, templateparamlist): self.templateparamlist = templateparamlist + def get_sectiondef(self): return self.sectiondef def set_sectiondef(self, sectiondef): self.sectiondef = sectiondef def add_sectiondef(self, value): self.sectiondef.append(value) def insert_sectiondef(self, index, value): self.sectiondef[index] = value def get_briefdescription(self): return self.briefdescription - def set_briefdescription(self, briefdescription): self.briefdescription = briefdescription + def set_briefdescription( + self, briefdescription): self.briefdescription = briefdescription + def get_detaileddescription(self): return self.detaileddescription - def set_detaileddescription(self, detaileddescription): self.detaileddescription = detaileddescription + def set_detaileddescription( + self, detaileddescription): self.detaileddescription = detaileddescription + def get_inheritancegraph(self): return self.inheritancegraph - def set_inheritancegraph(self, inheritancegraph): self.inheritancegraph = inheritancegraph + def set_inheritancegraph( + self, inheritancegraph): self.inheritancegraph = inheritancegraph + def get_collaborationgraph(self): return self.collaborationgraph - def set_collaborationgraph(self, collaborationgraph): self.collaborationgraph = collaborationgraph + def set_collaborationgraph( + self, collaborationgraph): self.collaborationgraph = collaborationgraph + def get_programlisting(self): return self.programlisting - def set_programlisting(self, programlisting): self.programlisting = programlisting + def set_programlisting( + self, programlisting): self.programlisting = programlisting + def get_location(self): return self.location def set_location(self, location): self.location = location def get_listofallmembers(self): return self.listofallmembers - def set_listofallmembers(self, listofallmembers): self.listofallmembers = listofallmembers + def set_listofallmembers( + self, listofallmembers): self.listofallmembers = listofallmembers + def get_kind(self): return self.kind def set_kind(self, kind): self.kind = kind def get_prot(self): return self.prot def set_prot(self, prot): self.prot = prot def get_id(self): return self.id def set_id(self, id): self.id = id + def export(self, outfile, level, namespace_='', name_='compounddefType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) - self.exportAttributes(outfile, level, namespace_, name_='compounddefType') + self.exportAttributes(outfile, level, namespace_, + name_='compounddefType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) @@ -410,32 +474,41 @@ class compounddefType(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='compounddefType'): if self.kind is not None: outfile.write(' kind=%s' % (quote_attrib(self.kind), )) if self.prot is not None: outfile.write(' prot=%s' % (quote_attrib(self.prot), )) if self.id is not None: - outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), )) + outfile.write(' id=%s' % (self.format_string(quote_attrib( + self.id).encode(ExternalEncoding), input_name='id'), )) + def exportChildren(self, outfile, level, namespace_='', name_='compounddefType'): if self.compoundname is not None: showIndent(outfile, level) - outfile.write('<%scompoundname>%s</%scompoundname>\n' % (namespace_, self.format_string(quote_xml(self.compoundname).encode(ExternalEncoding), input_name='compoundname'), namespace_)) + outfile.write('<%scompoundname>%s</%scompoundname>\n' % (namespace_, self.format_string( + quote_xml(self.compoundname).encode(ExternalEncoding), input_name='compoundname'), namespace_)) if self.title is not None: showIndent(outfile, level) - outfile.write('<%stitle>%s</%stitle>\n' % (namespace_, self.format_string(quote_xml(self.title).encode(ExternalEncoding), input_name='title'), namespace_)) + outfile.write('<%stitle>%s</%stitle>\n' % (namespace_, self.format_string( + quote_xml(self.title).encode(ExternalEncoding), input_name='title'), namespace_)) for basecompoundref_ in self.basecompoundref: - basecompoundref_.export(outfile, level, namespace_, name_='basecompoundref') + basecompoundref_.export( + outfile, level, namespace_, name_='basecompoundref') for derivedcompoundref_ in self.derivedcompoundref: - derivedcompoundref_.export(outfile, level, namespace_, name_='derivedcompoundref') + derivedcompoundref_.export( + outfile, level, namespace_, name_='derivedcompoundref') for includes_ in self.includes: includes_.export(outfile, level, namespace_, name_='includes') for includedby_ in self.includedby: includedby_.export(outfile, level, namespace_, name_='includedby') if self.incdepgraph: - self.incdepgraph.export(outfile, level, namespace_, name_='incdepgraph') + self.incdepgraph.export( + outfile, level, namespace_, name_='incdepgraph') if self.invincdepgraph: - self.invincdepgraph.export(outfile, level, namespace_, name_='invincdepgraph') + self.invincdepgraph.export( + outfile, level, namespace_, name_='invincdepgraph') for innerdir_ in self.innerdir: innerdir_.export(outfile, level, namespace_, name_='innerdir') for innerfile_ in self.innerfile: @@ -443,29 +516,38 @@ class compounddefType(GeneratedsSuper): for innerclass_ in self.innerclass: innerclass_.export(outfile, level, namespace_, name_='innerclass') for innernamespace_ in self.innernamespace: - innernamespace_.export(outfile, level, namespace_, name_='innernamespace') + innernamespace_.export( + outfile, level, namespace_, name_='innernamespace') for innerpage_ in self.innerpage: innerpage_.export(outfile, level, namespace_, name_='innerpage') for innergroup_ in self.innergroup: innergroup_.export(outfile, level, namespace_, name_='innergroup') if self.templateparamlist: - self.templateparamlist.export(outfile, level, namespace_, name_='templateparamlist') + self.templateparamlist.export( + outfile, level, namespace_, name_='templateparamlist') for sectiondef_ in self.sectiondef: sectiondef_.export(outfile, level, namespace_, name_='sectiondef') if self.briefdescription: - self.briefdescription.export(outfile, level, namespace_, name_='briefdescription') + self.briefdescription.export( + outfile, level, namespace_, name_='briefdescription') if self.detaileddescription: - self.detaileddescription.export(outfile, level, namespace_, name_='detaileddescription') + self.detaileddescription.export( + outfile, level, namespace_, name_='detaileddescription') if self.inheritancegraph: - self.inheritancegraph.export(outfile, level, namespace_, name_='inheritancegraph') + self.inheritancegraph.export( + outfile, level, namespace_, name_='inheritancegraph') if self.collaborationgraph: - self.collaborationgraph.export(outfile, level, namespace_, name_='collaborationgraph') + self.collaborationgraph.export( + outfile, level, namespace_, name_='collaborationgraph') if self.programlisting: - self.programlisting.export(outfile, level, namespace_, name_='programlisting') + self.programlisting.export( + outfile, level, namespace_, name_='programlisting') if self.location: self.location.export(outfile, level, namespace_, name_='location') if self.listofallmembers: - self.listofallmembers.export(outfile, level, namespace_, name_='listofallmembers') + self.listofallmembers.export( + outfile, level, namespace_, name_='listofallmembers') + def hasContent_(self): if ( self.compoundname is not None or @@ -491,15 +573,17 @@ class compounddefType(GeneratedsSuper): self.programlisting is not None or self.location is not None or self.listofallmembers is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='compounddefType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): if self.kind is not None: showIndent(outfile, level) @@ -510,9 +594,11 @@ class compounddefType(GeneratedsSuper): if self.id is not None: showIndent(outfile, level) outfile.write('id = %s,\n' % (self.id,)) + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) - outfile.write('compoundname=%s,\n' % quote_python(self.compoundname).encode(ExternalEncoding)) + outfile.write('compoundname=%s,\n' % quote_python( + self.compoundname).encode(ExternalEncoding)) if self.title: showIndent(outfile, level) outfile.write('title=model_.xsd_string(\n') @@ -525,7 +611,8 @@ class compounddefType(GeneratedsSuper): for basecompoundref in self.basecompoundref: showIndent(outfile, level) outfile.write('model_.basecompoundref(\n') - basecompoundref.exportLiteral(outfile, level, name_='basecompoundref') + basecompoundref.exportLiteral( + outfile, level, name_='basecompoundref') showIndent(outfile, level) outfile.write('),\n') level -= 1 @@ -537,7 +624,8 @@ class compounddefType(GeneratedsSuper): for derivedcompoundref in self.derivedcompoundref: showIndent(outfile, level) outfile.write('model_.derivedcompoundref(\n') - derivedcompoundref.exportLiteral(outfile, level, name_='derivedcompoundref') + derivedcompoundref.exportLiteral( + outfile, level, name_='derivedcompoundref') showIndent(outfile, level) outfile.write('),\n') level -= 1 @@ -576,7 +664,8 @@ class compounddefType(GeneratedsSuper): if self.invincdepgraph: showIndent(outfile, level) outfile.write('invincdepgraph=model_.graphType(\n') - self.invincdepgraph.exportLiteral(outfile, level, name_='invincdepgraph') + self.invincdepgraph.exportLiteral( + outfile, level, name_='invincdepgraph') showIndent(outfile, level) outfile.write('),\n') showIndent(outfile, level) @@ -621,7 +710,8 @@ class compounddefType(GeneratedsSuper): for innernamespace in self.innernamespace: showIndent(outfile, level) outfile.write('model_.innernamespace(\n') - innernamespace.exportLiteral(outfile, level, name_='innernamespace') + innernamespace.exportLiteral( + outfile, level, name_='innernamespace') showIndent(outfile, level) outfile.write('),\n') level -= 1 @@ -654,7 +744,8 @@ class compounddefType(GeneratedsSuper): if self.templateparamlist: showIndent(outfile, level) outfile.write('templateparamlist=model_.templateparamlistType(\n') - self.templateparamlist.exportLiteral(outfile, level, name_='templateparamlist') + self.templateparamlist.exportLiteral( + outfile, level, name_='templateparamlist') showIndent(outfile, level) outfile.write('),\n') showIndent(outfile, level) @@ -672,31 +763,36 @@ class compounddefType(GeneratedsSuper): if self.briefdescription: showIndent(outfile, level) outfile.write('briefdescription=model_.descriptionType(\n') - self.briefdescription.exportLiteral(outfile, level, name_='briefdescription') + self.briefdescription.exportLiteral( + outfile, level, name_='briefdescription') showIndent(outfile, level) outfile.write('),\n') if self.detaileddescription: showIndent(outfile, level) outfile.write('detaileddescription=model_.descriptionType(\n') - self.detaileddescription.exportLiteral(outfile, level, name_='detaileddescription') + self.detaileddescription.exportLiteral( + outfile, level, name_='detaileddescription') showIndent(outfile, level) outfile.write('),\n') if self.inheritancegraph: showIndent(outfile, level) outfile.write('inheritancegraph=model_.graphType(\n') - self.inheritancegraph.exportLiteral(outfile, level, name_='inheritancegraph') + self.inheritancegraph.exportLiteral( + outfile, level, name_='inheritancegraph') showIndent(outfile, level) outfile.write('),\n') if self.collaborationgraph: showIndent(outfile, level) outfile.write('collaborationgraph=model_.graphType(\n') - self.collaborationgraph.exportLiteral(outfile, level, name_='collaborationgraph') + self.collaborationgraph.exportLiteral( + outfile, level, name_='collaborationgraph') showIndent(outfile, level) outfile.write('),\n') if self.programlisting: showIndent(outfile, level) outfile.write('programlisting=model_.listingType(\n') - self.programlisting.exportLiteral(outfile, level, name_='programlisting') + self.programlisting.exportLiteral( + outfile, level, name_='programlisting') showIndent(outfile, level) outfile.write('),\n') if self.location: @@ -708,15 +804,18 @@ class compounddefType(GeneratedsSuper): if self.listofallmembers: showIndent(outfile, level) outfile.write('listofallmembers=model_.listofallmembersType(\n') - self.listofallmembers.exportLiteral(outfile, level, name_='listofallmembers') + self.listofallmembers.exportLiteral( + outfile, level, name_='listofallmembers') showIndent(outfile, level) outfile.write('),\n') + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): if attrs.get('kind'): self.kind = attrs.get('kind').value @@ -724,120 +823,121 @@ class compounddefType(GeneratedsSuper): self.prot = attrs.get('prot').value if attrs.get('id'): self.id = attrs.get('id').value + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'compoundname': + nodeName_ == 'compoundname': compoundname_ = '' for text__content_ in child_.childNodes: compoundname_ += text__content_.nodeValue self.compoundname = compoundname_ elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'title': + nodeName_ == 'title': obj_ = docTitleType.factory() obj_.build(child_) self.set_title(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'basecompoundref': + nodeName_ == 'basecompoundref': obj_ = compoundRefType.factory() obj_.build(child_) self.basecompoundref.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'derivedcompoundref': + nodeName_ == 'derivedcompoundref': obj_ = compoundRefType.factory() obj_.build(child_) self.derivedcompoundref.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'includes': + nodeName_ == 'includes': obj_ = incType.factory() obj_.build(child_) self.includes.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'includedby': + nodeName_ == 'includedby': obj_ = incType.factory() obj_.build(child_) self.includedby.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'incdepgraph': + nodeName_ == 'incdepgraph': obj_ = graphType.factory() obj_.build(child_) self.set_incdepgraph(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'invincdepgraph': + nodeName_ == 'invincdepgraph': obj_ = graphType.factory() obj_.build(child_) self.set_invincdepgraph(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'innerdir': + nodeName_ == 'innerdir': obj_ = refType.factory() obj_.build(child_) self.innerdir.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'innerfile': + nodeName_ == 'innerfile': obj_ = refType.factory() obj_.build(child_) self.innerfile.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'innerclass': + nodeName_ == 'innerclass': obj_ = refType.factory() obj_.build(child_) self.innerclass.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'innernamespace': + nodeName_ == 'innernamespace': obj_ = refType.factory() obj_.build(child_) self.innernamespace.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'innerpage': + nodeName_ == 'innerpage': obj_ = refType.factory() obj_.build(child_) self.innerpage.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'innergroup': + nodeName_ == 'innergroup': obj_ = refType.factory() obj_.build(child_) self.innergroup.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'templateparamlist': + nodeName_ == 'templateparamlist': obj_ = templateparamlistType.factory() obj_.build(child_) self.set_templateparamlist(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'sectiondef': + nodeName_ == 'sectiondef': obj_ = sectiondefType.factory() obj_.build(child_) self.sectiondef.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'briefdescription': + nodeName_ == 'briefdescription': obj_ = descriptionType.factory() obj_.build(child_) self.set_briefdescription(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'detaileddescription': + nodeName_ == 'detaileddescription': obj_ = descriptionType.factory() obj_.build(child_) self.set_detaileddescription(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'inheritancegraph': + nodeName_ == 'inheritancegraph': obj_ = graphType.factory() obj_.build(child_) self.set_inheritancegraph(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'collaborationgraph': + nodeName_ == 'collaborationgraph': obj_ = graphType.factory() obj_.build(child_) self.set_collaborationgraph(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'programlisting': + nodeName_ == 'programlisting': obj_ = listingType.factory() obj_.build(child_) self.set_programlisting(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'location': + nodeName_ == 'location': obj_ = locationType.factory() obj_.build(child_) self.set_location(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'listofallmembers': + nodeName_ == 'listofallmembers': obj_ = listofallmembersType.factory() obj_.build(child_) self.set_listofallmembers(obj_) @@ -847,11 +947,13 @@ class compounddefType(GeneratedsSuper): class listofallmembersType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, member=None): if member is None: self.member = [] else: self.member = member + def factory(*args_, **kwargs_): if listofallmembersType.subclass: return listofallmembersType.subclass(*args_, **kwargs_) @@ -862,10 +964,12 @@ class listofallmembersType(GeneratedsSuper): def set_member(self, member): self.member = member def add_member(self, value): self.member.append(value) def insert_member(self, index, value): self.member[index] = value + def export(self, outfile, level, namespace_='', name_='listofallmembersType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) - self.exportAttributes(outfile, level, namespace_, name_='listofallmembersType') + self.exportAttributes(outfile, level, namespace_, + name_='listofallmembersType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) @@ -873,25 +977,31 @@ class listofallmembersType(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='listofallmembersType'): pass + def exportChildren(self, outfile, level, namespace_='', name_='listofallmembersType'): for member_ in self.member: member_.export(outfile, level, namespace_, name_='member') + def hasContent_(self): if ( self.member is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='listofallmembersType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): pass + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('member=[\n') @@ -905,17 +1015,20 @@ class listofallmembersType(GeneratedsSuper): level -= 1 showIndent(outfile, level) outfile.write('],\n') + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): pass + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'member': + nodeName_ == 'member': obj_ = memberRefType.factory() obj_.build(child_) self.member.append(obj_) @@ -925,6 +1038,7 @@ class listofallmembersType(GeneratedsSuper): class memberRefType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, virt=None, prot=None, refid=None, ambiguityscope=None, scope=None, name=None): self.virt = virt self.prot = prot @@ -932,6 +1046,7 @@ class memberRefType(GeneratedsSuper): self.ambiguityscope = ambiguityscope self.scope = scope self.name = name + def factory(*args_, **kwargs_): if memberRefType.subclass: return memberRefType.subclass(*args_, **kwargs_) @@ -949,11 +1064,15 @@ class memberRefType(GeneratedsSuper): def get_refid(self): return self.refid def set_refid(self, refid): self.refid = refid def get_ambiguityscope(self): return self.ambiguityscope - def set_ambiguityscope(self, ambiguityscope): self.ambiguityscope = ambiguityscope + + def set_ambiguityscope( + self, ambiguityscope): self.ambiguityscope = ambiguityscope + def export(self, outfile, level, namespace_='', name_='memberRefType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) - self.exportAttributes(outfile, level, namespace_, name_='memberRefType') + self.exportAttributes(outfile, level, namespace_, + name_='memberRefType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) @@ -961,35 +1080,44 @@ class memberRefType(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='memberRefType'): if self.virt is not None: outfile.write(' virt=%s' % (quote_attrib(self.virt), )) if self.prot is not None: outfile.write(' prot=%s' % (quote_attrib(self.prot), )) if self.refid is not None: - outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), )) + outfile.write(' refid=%s' % (self.format_string(quote_attrib( + self.refid).encode(ExternalEncoding), input_name='refid'), )) if self.ambiguityscope is not None: - outfile.write(' ambiguityscope=%s' % (self.format_string(quote_attrib(self.ambiguityscope).encode(ExternalEncoding), input_name='ambiguityscope'), )) + outfile.write(' ambiguityscope=%s' % (self.format_string(quote_attrib( + self.ambiguityscope).encode(ExternalEncoding), input_name='ambiguityscope'), )) + def exportChildren(self, outfile, level, namespace_='', name_='memberRefType'): if self.scope is not None: showIndent(outfile, level) - outfile.write('<%sscope>%s</%sscope>\n' % (namespace_, self.format_string(quote_xml(self.scope).encode(ExternalEncoding), input_name='scope'), namespace_)) + outfile.write('<%sscope>%s</%sscope>\n' % (namespace_, self.format_string( + quote_xml(self.scope).encode(ExternalEncoding), input_name='scope'), namespace_)) if self.name is not None: showIndent(outfile, level) - outfile.write('<%sname>%s</%sname>\n' % (namespace_, self.format_string(quote_xml(self.name).encode(ExternalEncoding), input_name='name'), namespace_)) + outfile.write('<%sname>%s</%sname>\n' % (namespace_, self.format_string( + quote_xml(self.name).encode(ExternalEncoding), input_name='name'), namespace_)) + def hasContent_(self): if ( self.scope is not None or self.name is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='memberRefType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): if self.virt is not None: showIndent(outfile, level) @@ -1003,17 +1131,22 @@ class memberRefType(GeneratedsSuper): if self.ambiguityscope is not None: showIndent(outfile, level) outfile.write('ambiguityscope = %s,\n' % (self.ambiguityscope,)) + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) - outfile.write('scope=%s,\n' % quote_python(self.scope).encode(ExternalEncoding)) + outfile.write('scope=%s,\n' % quote_python( + self.scope).encode(ExternalEncoding)) showIndent(outfile, level) - outfile.write('name=%s,\n' % quote_python(self.name).encode(ExternalEncoding)) + outfile.write('name=%s,\n' % quote_python( + self.name).encode(ExternalEncoding)) + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): if attrs.get('virt'): self.virt = attrs.get('virt').value @@ -1023,15 +1156,16 @@ class memberRefType(GeneratedsSuper): self.refid = attrs.get('refid').value if attrs.get('ambiguityscope'): self.ambiguityscope = attrs.get('ambiguityscope').value + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'scope': + nodeName_ == 'scope': scope_ = '' for text__content_ in child_.childNodes: scope_ += text__content_.nodeValue self.scope = scope_ elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'name': + nodeName_ == 'name': name_ = '' for text__content_ in child_.childNodes: name_ += text__content_.nodeValue @@ -1042,8 +1176,10 @@ class memberRefType(GeneratedsSuper): class scope(GeneratedsSuper): subclass = None superclass = None + def __init__(self, valueOf_=''): self.valueOf_ = valueOf_ + def factory(*args_, **kwargs_): if scope.subclass: return scope.subclass(*args_, **kwargs_) @@ -1052,6 +1188,7 @@ class scope(GeneratedsSuper): factory = staticmethod(factory) def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='scope', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) @@ -1063,33 +1200,40 @@ class scope(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='scope'): pass + def exportChildren(self, outfile, level, namespace_='', name_='scope'): - if self.valueOf_.find('![CDATA')>-1: - value=quote_xml('%s' % self.valueOf_) - value=value.replace('![CDATA','<![CDATA') - value=value.replace(']]',']]>') + if self.valueOf_.find('![CDATA') > -1: + value = quote_xml('%s' % self.valueOf_) + value = value.replace('![CDATA', '<![CDATA') + value = value.replace(']]', ']]>') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): if ( self.valueOf_ is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='scope'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): pass + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) @@ -1097,21 +1241,25 @@ class scope(GeneratedsSuper): for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): pass + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: - self.valueOf_ += '![CDATA['+child_.nodeValue+']]' + self.valueOf_ += '![CDATA[' + child_.nodeValue + ']]' # end class scope class name(GeneratedsSuper): subclass = None superclass = None + def __init__(self, valueOf_=''): self.valueOf_ = valueOf_ + def factory(*args_, **kwargs_): if name.subclass: return name.subclass(*args_, **kwargs_) @@ -1120,6 +1268,7 @@ class name(GeneratedsSuper): factory = staticmethod(factory) def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='name', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) @@ -1131,33 +1280,40 @@ class name(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='name'): pass + def exportChildren(self, outfile, level, namespace_='', name_='name'): - if self.valueOf_.find('![CDATA')>-1: - value=quote_xml('%s' % self.valueOf_) - value=value.replace('![CDATA','<![CDATA') - value=value.replace(']]',']]>') + if self.valueOf_.find('![CDATA') > -1: + value = quote_xml('%s' % self.valueOf_) + value = value.replace('![CDATA', '<![CDATA') + value = value.replace(']]', ']]>') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): if ( self.valueOf_ is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='name'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): pass + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) @@ -1165,19 +1321,22 @@ class name(GeneratedsSuper): for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): pass + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: - self.valueOf_ += '![CDATA['+child_.nodeValue+']]' + self.valueOf_ += '![CDATA[' + child_.nodeValue + ']]' # end class name class compoundRefType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, virt=None, prot=None, refid=None, valueOf_='', mixedclass_=None, content_=None): self.virt = virt self.prot = prot @@ -1190,6 +1349,7 @@ class compoundRefType(GeneratedsSuper): self.content_ = [] else: self.content_ = content_ + def factory(*args_, **kwargs_): if compoundRefType.subclass: return compoundRefType.subclass(*args_, **kwargs_) @@ -1204,40 +1364,48 @@ class compoundRefType(GeneratedsSuper): def set_refid(self, refid): self.refid = refid def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='compoundRefType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) - self.exportAttributes(outfile, level, namespace_, name_='compoundRefType') + self.exportAttributes(outfile, level, namespace_, + name_='compoundRefType') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('</%s%s>\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='compoundRefType'): if self.virt is not None: outfile.write(' virt=%s' % (quote_attrib(self.virt), )) if self.prot is not None: outfile.write(' prot=%s' % (quote_attrib(self.prot), )) if self.refid is not None: - outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), )) + outfile.write(' refid=%s' % (self.format_string(quote_attrib( + self.refid).encode(ExternalEncoding), input_name='refid'), )) + def exportChildren(self, outfile, level, namespace_='', name_='compoundRefType'): - if self.valueOf_.find('![CDATA')>-1: - value=quote_xml('%s' % self.valueOf_) - value=value.replace('![CDATA','<![CDATA') - value=value.replace(']]',']]>') + if self.valueOf_.find('![CDATA') > -1: + value = quote_xml('%s' % self.valueOf_) + value = value.replace('![CDATA', '<![CDATA') + value = value.replace(']]', ']]>') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): if ( self.valueOf_ is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='compoundRefType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): if self.virt is not None: showIndent(outfile, level) @@ -1248,9 +1416,11 @@ class compoundRefType(GeneratedsSuper): if self.refid is not None: showIndent(outfile, level) outfile.write('refid = %s,\n' % (self.refid,)) + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) @@ -1258,6 +1428,7 @@ class compoundRefType(GeneratedsSuper): for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): if attrs.get('virt'): self.virt = attrs.get('virt').value @@ -1265,21 +1436,23 @@ class compoundRefType(GeneratedsSuper): self.prot = attrs.get('prot').value if attrs.get('refid'): self.refid = attrs.get('refid').value + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, - MixedContainer.TypeNone, '', child_.nodeValue) + MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: - self.valueOf_ += '![CDATA['+child_.nodeValue+']]' + self.valueOf_ += '![CDATA[' + child_.nodeValue + ']]' # end class compoundRefType class reimplementType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, refid=None, valueOf_='', mixedclass_=None, content_=None): self.refid = refid if mixedclass_ is None: @@ -1290,6 +1463,7 @@ class reimplementType(GeneratedsSuper): self.content_ = [] else: self.content_ = content_ + def factory(*args_, **kwargs_): if reimplementType.subclass: return reimplementType.subclass(*args_, **kwargs_) @@ -1300,43 +1474,53 @@ class reimplementType(GeneratedsSuper): def set_refid(self, refid): self.refid = refid def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='reimplementType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) - self.exportAttributes(outfile, level, namespace_, name_='reimplementType') + self.exportAttributes(outfile, level, namespace_, + name_='reimplementType') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('</%s%s>\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='reimplementType'): if self.refid is not None: - outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), )) + outfile.write(' refid=%s' % (self.format_string(quote_attrib( + self.refid).encode(ExternalEncoding), input_name='refid'), )) + def exportChildren(self, outfile, level, namespace_='', name_='reimplementType'): - if self.valueOf_.find('![CDATA')>-1: - value=quote_xml('%s' % self.valueOf_) - value=value.replace('![CDATA','<![CDATA') - value=value.replace(']]',']]>') + if self.valueOf_.find('![CDATA') > -1: + value = quote_xml('%s' % self.valueOf_) + value = value.replace('![CDATA', '<![CDATA') + value = value.replace(']]', ']]>') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): if ( self.valueOf_ is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='reimplementType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): if self.refid is not None: showIndent(outfile, level) outfile.write('refid = %s,\n' % (self.refid,)) + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) @@ -1344,24 +1528,27 @@ class reimplementType(GeneratedsSuper): for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): if attrs.get('refid'): self.refid = attrs.get('refid').value + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, - MixedContainer.TypeNone, '', child_.nodeValue) + MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: - self.valueOf_ += '![CDATA['+child_.nodeValue+']]' + self.valueOf_ += '![CDATA[' + child_.nodeValue + ']]' # end class reimplementType class incType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, local=None, refid=None, valueOf_='', mixedclass_=None, content_=None): self.local = local self.refid = refid @@ -1373,6 +1560,7 @@ class incType(GeneratedsSuper): self.content_ = [] else: self.content_ = content_ + def factory(*args_, **kwargs_): if incType.subclass: return incType.subclass(*args_, **kwargs_) @@ -1385,6 +1573,7 @@ class incType(GeneratedsSuper): def set_refid(self, refid): self.refid = refid def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='incType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) @@ -1392,31 +1581,37 @@ class incType(GeneratedsSuper): outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('</%s%s>\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='incType'): if self.local is not None: outfile.write(' local=%s' % (quote_attrib(self.local), )) if self.refid is not None: - outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), )) + outfile.write(' refid=%s' % (self.format_string(quote_attrib( + self.refid).encode(ExternalEncoding), input_name='refid'), )) + def exportChildren(self, outfile, level, namespace_='', name_='incType'): - if self.valueOf_.find('![CDATA')>-1: - value=quote_xml('%s' % self.valueOf_) - value=value.replace('![CDATA','<![CDATA') - value=value.replace(']]',']]>') + if self.valueOf_.find('![CDATA') > -1: + value = quote_xml('%s' % self.valueOf_) + value = value.replace('![CDATA', '<![CDATA') + value = value.replace(']]', ']]>') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): if ( self.valueOf_ is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='incType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): if self.local is not None: showIndent(outfile, level) @@ -1424,9 +1619,11 @@ class incType(GeneratedsSuper): if self.refid is not None: showIndent(outfile, level) outfile.write('refid = %s,\n' % (self.refid,)) + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) @@ -1434,26 +1631,29 @@ class incType(GeneratedsSuper): for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): if attrs.get('local'): self.local = attrs.get('local').value if attrs.get('refid'): self.refid = attrs.get('refid').value + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, - MixedContainer.TypeNone, '', child_.nodeValue) + MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: - self.valueOf_ += '![CDATA['+child_.nodeValue+']]' + self.valueOf_ += '![CDATA[' + child_.nodeValue + ']]' # end class incType class refType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, prot=None, refid=None, valueOf_='', mixedclass_=None, content_=None): self.prot = prot self.refid = refid @@ -1465,6 +1665,7 @@ class refType(GeneratedsSuper): self.content_ = [] else: self.content_ = content_ + def factory(*args_, **kwargs_): if refType.subclass: return refType.subclass(*args_, **kwargs_) @@ -1477,6 +1678,7 @@ class refType(GeneratedsSuper): def set_refid(self, refid): self.refid = refid def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='refType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) @@ -1484,31 +1686,37 @@ class refType(GeneratedsSuper): outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('</%s%s>\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='refType'): if self.prot is not None: outfile.write(' prot=%s' % (quote_attrib(self.prot), )) if self.refid is not None: - outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), )) + outfile.write(' refid=%s' % (self.format_string(quote_attrib( + self.refid).encode(ExternalEncoding), input_name='refid'), )) + def exportChildren(self, outfile, level, namespace_='', name_='refType'): - if self.valueOf_.find('![CDATA')>-1: - value=quote_xml('%s' % self.valueOf_) - value=value.replace('![CDATA','<![CDATA') - value=value.replace(']]',']]>') + if self.valueOf_.find('![CDATA') > -1: + value = quote_xml('%s' % self.valueOf_) + value = value.replace('![CDATA', '<![CDATA') + value = value.replace(']]', ']]>') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): if ( self.valueOf_ is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='refType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): if self.prot is not None: showIndent(outfile, level) @@ -1516,9 +1724,11 @@ class refType(GeneratedsSuper): if self.refid is not None: showIndent(outfile, level) outfile.write('refid = %s,\n' % (self.refid,)) + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) @@ -1526,26 +1736,29 @@ class refType(GeneratedsSuper): for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): if attrs.get('prot'): self.prot = attrs.get('prot').value if attrs.get('refid'): self.refid = attrs.get('refid').value + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, - MixedContainer.TypeNone, '', child_.nodeValue) + MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: - self.valueOf_ += '![CDATA['+child_.nodeValue+']]' + self.valueOf_ += '![CDATA[' + child_.nodeValue + ']]' # end class refType class refTextType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, refid=None, kindref=None, external=None, valueOf_='', mixedclass_=None, content_=None): self.refid = refid self.kindref = kindref @@ -1558,6 +1771,7 @@ class refTextType(GeneratedsSuper): self.content_ = [] else: self.content_ = content_ + def factory(*args_, **kwargs_): if refTextType.subclass: return refTextType.subclass(*args_, **kwargs_) @@ -1572,6 +1786,7 @@ class refTextType(GeneratedsSuper): def set_external(self, external): self.external = external def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='refTextType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) @@ -1579,33 +1794,40 @@ class refTextType(GeneratedsSuper): outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('</%s%s>\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='refTextType'): if self.refid is not None: - outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), )) + outfile.write(' refid=%s' % (self.format_string(quote_attrib( + self.refid).encode(ExternalEncoding), input_name='refid'), )) if self.kindref is not None: outfile.write(' kindref=%s' % (quote_attrib(self.kindref), )) if self.external is not None: - outfile.write(' external=%s' % (self.format_string(quote_attrib(self.external).encode(ExternalEncoding), input_name='external'), )) + outfile.write(' external=%s' % (self.format_string(quote_attrib( + self.external).encode(ExternalEncoding), input_name='external'), )) + def exportChildren(self, outfile, level, namespace_='', name_='refTextType'): - if self.valueOf_.find('![CDATA')>-1: - value=quote_xml('%s' % self.valueOf_) - value=value.replace('![CDATA','<![CDATA') - value=value.replace(']]',']]>') + if self.valueOf_.find('![CDATA') > -1: + value = quote_xml('%s' % self.valueOf_) + value = value.replace('![CDATA', '<![CDATA') + value = value.replace(']]', ']]>') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): if ( self.valueOf_ is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='refTextType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): if self.refid is not None: showIndent(outfile, level) @@ -1616,9 +1838,11 @@ class refTextType(GeneratedsSuper): if self.external is not None: showIndent(outfile, level) outfile.write('external = %s,\n' % (self.external,)) + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) @@ -1626,6 +1850,7 @@ class refTextType(GeneratedsSuper): for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): if attrs.get('refid'): self.refid = attrs.get('refid').value @@ -1633,21 +1858,23 @@ class refTextType(GeneratedsSuper): self.kindref = attrs.get('kindref').value if attrs.get('external'): self.external = attrs.get('external').value + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, - MixedContainer.TypeNone, '', child_.nodeValue) + MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: - self.valueOf_ += '![CDATA['+child_.nodeValue+']]' + self.valueOf_ += '![CDATA[' + child_.nodeValue + ']]' # end class refTextType class sectiondefType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, kind=None, header=None, description=None, memberdef=None): self.kind = kind self.header = header @@ -1656,6 +1883,7 @@ class sectiondefType(GeneratedsSuper): self.memberdef = [] else: self.memberdef = memberdef + def factory(*args_, **kwargs_): if sectiondefType.subclass: return sectiondefType.subclass(*args_, **kwargs_) @@ -1672,10 +1900,12 @@ class sectiondefType(GeneratedsSuper): def insert_memberdef(self, index, value): self.memberdef[index] = value def get_kind(self): return self.kind def set_kind(self, kind): self.kind = kind + def export(self, outfile, level, namespace_='', name_='sectiondefType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) - self.exportAttributes(outfile, level, namespace_, name_='sectiondefType') + self.exportAttributes(outfile, level, namespace_, + name_='sectiondefType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) @@ -1683,38 +1913,47 @@ class sectiondefType(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='sectiondefType'): if self.kind is not None: outfile.write(' kind=%s' % (quote_attrib(self.kind), )) + def exportChildren(self, outfile, level, namespace_='', name_='sectiondefType'): if self.header is not None: showIndent(outfile, level) - outfile.write('<%sheader>%s</%sheader>\n' % (namespace_, self.format_string(quote_xml(self.header).encode(ExternalEncoding), input_name='header'), namespace_)) + outfile.write('<%sheader>%s</%sheader>\n' % (namespace_, self.format_string( + quote_xml(self.header).encode(ExternalEncoding), input_name='header'), namespace_)) if self.description: - self.description.export(outfile, level, namespace_, name_='description') + self.description.export( + outfile, level, namespace_, name_='description') for memberdef_ in self.memberdef: memberdef_.export(outfile, level, namespace_, name_='memberdef') + def hasContent_(self): if ( self.header is not None or self.description is not None or self.memberdef is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='sectiondefType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): if self.kind is not None: showIndent(outfile, level) outfile.write('kind = "%s",\n' % (self.kind,)) + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) - outfile.write('header=%s,\n' % quote_python(self.header).encode(ExternalEncoding)) + outfile.write('header=%s,\n' % quote_python( + self.header).encode(ExternalEncoding)) if self.description: showIndent(outfile, level) outfile.write('description=model_.descriptionType(\n') @@ -1733,29 +1972,32 @@ class sectiondefType(GeneratedsSuper): level -= 1 showIndent(outfile, level) outfile.write('],\n') + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): if attrs.get('kind'): self.kind = attrs.get('kind').value + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'header': + nodeName_ == 'header': header_ = '' for text__content_ in child_.childNodes: header_ += text__content_.nodeValue self.header = header_ elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'description': + nodeName_ == 'description': obj_ = descriptionType.factory() obj_.build(child_) self.set_description(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'memberdef': + nodeName_ == 'memberdef': obj_ = memberdefType.factory() obj_.build(child_) self.memberdef.append(obj_) @@ -1765,6 +2007,7 @@ class sectiondefType(GeneratedsSuper): class memberdefType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, initonly=None, kind=None, volatile=None, const=None, raisexx=None, virt=None, readable=None, prot=None, explicit=None, new=None, final=None, writable=None, add=None, static=None, remove=None, sealed=None, mutable=None, gettable=None, inline=None, settable=None, id=None, templateparamlist=None, type_=None, definition=None, argsstring=None, name=None, read=None, write=None, bitfield=None, reimplements=None, reimplementedby=None, param=None, enumvalue=None, initializer=None, exceptions=None, briefdescription=None, detaileddescription=None, inbodydescription=None, location=None, references=None, referencedby=None): self.initonly = initonly self.kind = kind @@ -1825,6 +2068,7 @@ class memberdefType(GeneratedsSuper): self.referencedby = [] else: self.referencedby = referencedby + def factory(*args_, **kwargs_): if memberdefType.subclass: return memberdefType.subclass(*args_, **kwargs_) @@ -1832,7 +2076,9 @@ class memberdefType(GeneratedsSuper): return memberdefType(*args_, **kwargs_) factory = staticmethod(factory) def get_templateparamlist(self): return self.templateparamlist - def set_templateparamlist(self, templateparamlist): self.templateparamlist = templateparamlist + def set_templateparamlist( + self, templateparamlist): self.templateparamlist = templateparamlist + def get_type(self): return self.type_ def set_type(self, type_): self.type_ = type_ def get_definition(self): return self.definition @@ -1850,11 +2096,17 @@ class memberdefType(GeneratedsSuper): def get_reimplements(self): return self.reimplements def set_reimplements(self, reimplements): self.reimplements = reimplements def add_reimplements(self, value): self.reimplements.append(value) - def insert_reimplements(self, index, value): self.reimplements[index] = value + def insert_reimplements( + self, index, value): self.reimplements[index] = value + def get_reimplementedby(self): return self.reimplementedby - def set_reimplementedby(self, reimplementedby): self.reimplementedby = reimplementedby + def set_reimplementedby( + self, reimplementedby): self.reimplementedby = reimplementedby + def add_reimplementedby(self, value): self.reimplementedby.append(value) - def insert_reimplementedby(self, index, value): self.reimplementedby[index] = value + def insert_reimplementedby( + self, index, value): self.reimplementedby[index] = value + def get_param(self): return self.param def set_param(self, param): self.param = param def add_param(self, value): self.param.append(value) @@ -1868,11 +2120,17 @@ class memberdefType(GeneratedsSuper): def get_exceptions(self): return self.exceptions def set_exceptions(self, exceptions): self.exceptions = exceptions def get_briefdescription(self): return self.briefdescription - def set_briefdescription(self, briefdescription): self.briefdescription = briefdescription + def set_briefdescription( + self, briefdescription): self.briefdescription = briefdescription + def get_detaileddescription(self): return self.detaileddescription - def set_detaileddescription(self, detaileddescription): self.detaileddescription = detaileddescription + def set_detaileddescription( + self, detaileddescription): self.detaileddescription = detaileddescription + def get_inbodydescription(self): return self.inbodydescription - def set_inbodydescription(self, inbodydescription): self.inbodydescription = inbodydescription + def set_inbodydescription( + self, inbodydescription): self.inbodydescription = inbodydescription + def get_location(self): return self.location def set_location(self, location): self.location = location def get_references(self): return self.references @@ -1882,7 +2140,9 @@ class memberdefType(GeneratedsSuper): def get_referencedby(self): return self.referencedby def set_referencedby(self, referencedby): self.referencedby = referencedby def add_referencedby(self, value): self.referencedby.append(value) - def insert_referencedby(self, index, value): self.referencedby[index] = value + def insert_referencedby( + self, index, value): self.referencedby[index] = value + def get_initonly(self): return self.initonly def set_initonly(self, initonly): self.initonly = initonly def get_kind(self): return self.kind @@ -1925,10 +2185,12 @@ class memberdefType(GeneratedsSuper): def set_settable(self, settable): self.settable = settable def get_id(self): return self.id def set_id(self, id): self.id = id + def export(self, outfile, level, namespace_='', name_='memberdefType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) - self.exportAttributes(outfile, level, namespace_, name_='memberdefType') + self.exportAttributes(outfile, level, namespace_, + name_='memberdefType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) @@ -1936,6 +2198,7 @@ class memberdefType(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='memberdefType'): if self.initonly is not None: outfile.write(' initonly=%s' % (quote_attrib(self.initonly), )) @@ -1978,54 +2241,73 @@ class memberdefType(GeneratedsSuper): if self.settable is not None: outfile.write(' settable=%s' % (quote_attrib(self.settable), )) if self.id is not None: - outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), )) + outfile.write(' id=%s' % (self.format_string(quote_attrib( + self.id).encode(ExternalEncoding), input_name='id'), )) + def exportChildren(self, outfile, level, namespace_='', name_='memberdefType'): if self.templateparamlist: - self.templateparamlist.export(outfile, level, namespace_, name_='templateparamlist') + self.templateparamlist.export( + outfile, level, namespace_, name_='templateparamlist') if self.type_: self.type_.export(outfile, level, namespace_, name_='type') if self.definition is not None: showIndent(outfile, level) - outfile.write('<%sdefinition>%s</%sdefinition>\n' % (namespace_, self.format_string(quote_xml(self.definition).encode(ExternalEncoding), input_name='definition'), namespace_)) + outfile.write('<%sdefinition>%s</%sdefinition>\n' % (namespace_, self.format_string( + quote_xml(self.definition).encode(ExternalEncoding), input_name='definition'), namespace_)) if self.argsstring is not None: showIndent(outfile, level) - outfile.write('<%sargsstring>%s</%sargsstring>\n' % (namespace_, self.format_string(quote_xml(self.argsstring).encode(ExternalEncoding), input_name='argsstring'), namespace_)) + outfile.write('<%sargsstring>%s</%sargsstring>\n' % (namespace_, self.format_string( + quote_xml(self.argsstring).encode(ExternalEncoding), input_name='argsstring'), namespace_)) if self.name is not None: showIndent(outfile, level) - outfile.write('<%sname>%s</%sname>\n' % (namespace_, self.format_string(quote_xml(self.name).encode(ExternalEncoding), input_name='name'), namespace_)) + outfile.write('<%sname>%s</%sname>\n' % (namespace_, self.format_string( + quote_xml(self.name).encode(ExternalEncoding), input_name='name'), namespace_)) if self.read is not None: showIndent(outfile, level) - outfile.write('<%sread>%s</%sread>\n' % (namespace_, self.format_string(quote_xml(self.read).encode(ExternalEncoding), input_name='read'), namespace_)) + outfile.write('<%sread>%s</%sread>\n' % (namespace_, self.format_string( + quote_xml(self.read).encode(ExternalEncoding), input_name='read'), namespace_)) if self.write is not None: showIndent(outfile, level) - outfile.write('<%swrite>%s</%swrite>\n' % (namespace_, self.format_string(quote_xml(self.write).encode(ExternalEncoding), input_name='write'), namespace_)) + outfile.write('<%swrite>%s</%swrite>\n' % (namespace_, self.format_string( + quote_xml(self.write).encode(ExternalEncoding), input_name='write'), namespace_)) if self.bitfield is not None: showIndent(outfile, level) - outfile.write('<%sbitfield>%s</%sbitfield>\n' % (namespace_, self.format_string(quote_xml(self.bitfield).encode(ExternalEncoding), input_name='bitfield'), namespace_)) + outfile.write('<%sbitfield>%s</%sbitfield>\n' % (namespace_, self.format_string( + quote_xml(self.bitfield).encode(ExternalEncoding), input_name='bitfield'), namespace_)) for reimplements_ in self.reimplements: - reimplements_.export(outfile, level, namespace_, name_='reimplements') + reimplements_.export( + outfile, level, namespace_, name_='reimplements') for reimplementedby_ in self.reimplementedby: - reimplementedby_.export(outfile, level, namespace_, name_='reimplementedby') + reimplementedby_.export( + outfile, level, namespace_, name_='reimplementedby') for param_ in self.param: param_.export(outfile, level, namespace_, name_='param') for enumvalue_ in self.enumvalue: enumvalue_.export(outfile, level, namespace_, name_='enumvalue') if self.initializer: - self.initializer.export(outfile, level, namespace_, name_='initializer') + self.initializer.export( + outfile, level, namespace_, name_='initializer') if self.exceptions: - self.exceptions.export(outfile, level, namespace_, name_='exceptions') + self.exceptions.export( + outfile, level, namespace_, name_='exceptions') if self.briefdescription: - self.briefdescription.export(outfile, level, namespace_, name_='briefdescription') + self.briefdescription.export( + outfile, level, namespace_, name_='briefdescription') if self.detaileddescription: - self.detaileddescription.export(outfile, level, namespace_, name_='detaileddescription') + self.detaileddescription.export( + outfile, level, namespace_, name_='detaileddescription') if self.inbodydescription: - self.inbodydescription.export(outfile, level, namespace_, name_='inbodydescription') + self.inbodydescription.export( + outfile, level, namespace_, name_='inbodydescription') if self.location: - self.location.export(outfile, level, namespace_, name_='location', ) + self.location.export( + outfile, level, namespace_, name_='location', ) for references_ in self.references: references_.export(outfile, level, namespace_, name_='references') for referencedby_ in self.referencedby: - referencedby_.export(outfile, level, namespace_, name_='referencedby') + referencedby_.export( + outfile, level, namespace_, name_='referencedby') + def hasContent_(self): if ( self.templateparamlist is not None or @@ -2048,15 +2330,17 @@ class memberdefType(GeneratedsSuper): self.location is not None or self.references is not None or self.referencedby is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='memberdefType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): if self.initonly is not None: showIndent(outfile, level) @@ -2121,11 +2405,13 @@ class memberdefType(GeneratedsSuper): if self.id is not None: showIndent(outfile, level) outfile.write('id = %s,\n' % (self.id,)) + def exportLiteralChildren(self, outfile, level, name_): if self.templateparamlist: showIndent(outfile, level) outfile.write('templateparamlist=model_.templateparamlistType(\n') - self.templateparamlist.exportLiteral(outfile, level, name_='templateparamlist') + self.templateparamlist.exportLiteral( + outfile, level, name_='templateparamlist') showIndent(outfile, level) outfile.write('),\n') if self.type_: @@ -2135,17 +2421,23 @@ class memberdefType(GeneratedsSuper): showIndent(outfile, level) outfile.write('),\n') showIndent(outfile, level) - outfile.write('definition=%s,\n' % quote_python(self.definition).encode(ExternalEncoding)) + outfile.write('definition=%s,\n' % quote_python( + self.definition).encode(ExternalEncoding)) showIndent(outfile, level) - outfile.write('argsstring=%s,\n' % quote_python(self.argsstring).encode(ExternalEncoding)) + outfile.write('argsstring=%s,\n' % quote_python( + self.argsstring).encode(ExternalEncoding)) showIndent(outfile, level) - outfile.write('name=%s,\n' % quote_python(self.name).encode(ExternalEncoding)) + outfile.write('name=%s,\n' % quote_python( + self.name).encode(ExternalEncoding)) showIndent(outfile, level) - outfile.write('read=%s,\n' % quote_python(self.read).encode(ExternalEncoding)) + outfile.write('read=%s,\n' % quote_python( + self.read).encode(ExternalEncoding)) showIndent(outfile, level) - outfile.write('write=%s,\n' % quote_python(self.write).encode(ExternalEncoding)) + outfile.write('write=%s,\n' % quote_python( + self.write).encode(ExternalEncoding)) showIndent(outfile, level) - outfile.write('bitfield=%s,\n' % quote_python(self.bitfield).encode(ExternalEncoding)) + outfile.write('bitfield=%s,\n' % quote_python( + self.bitfield).encode(ExternalEncoding)) showIndent(outfile, level) outfile.write('reimplements=[\n') level += 1 @@ -2164,7 +2456,8 @@ class memberdefType(GeneratedsSuper): for reimplementedby in self.reimplementedby: showIndent(outfile, level) outfile.write('model_.reimplementedby(\n') - reimplementedby.exportLiteral(outfile, level, name_='reimplementedby') + reimplementedby.exportLiteral( + outfile, level, name_='reimplementedby') showIndent(outfile, level) outfile.write('),\n') level -= 1 @@ -2209,19 +2502,22 @@ class memberdefType(GeneratedsSuper): if self.briefdescription: showIndent(outfile, level) outfile.write('briefdescription=model_.descriptionType(\n') - self.briefdescription.exportLiteral(outfile, level, name_='briefdescription') + self.briefdescription.exportLiteral( + outfile, level, name_='briefdescription') showIndent(outfile, level) outfile.write('),\n') if self.detaileddescription: showIndent(outfile, level) outfile.write('detaileddescription=model_.descriptionType(\n') - self.detaileddescription.exportLiteral(outfile, level, name_='detaileddescription') + self.detaileddescription.exportLiteral( + outfile, level, name_='detaileddescription') showIndent(outfile, level) outfile.write('),\n') if self.inbodydescription: showIndent(outfile, level) outfile.write('inbodydescription=model_.descriptionType(\n') - self.inbodydescription.exportLiteral(outfile, level, name_='inbodydescription') + self.inbodydescription.exportLiteral( + outfile, level, name_='inbodydescription') showIndent(outfile, level) outfile.write('),\n') if self.location: @@ -2254,12 +2550,14 @@ class memberdefType(GeneratedsSuper): level -= 1 showIndent(outfile, level) outfile.write('],\n') + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): if attrs.get('initonly'): self.initonly = attrs.get('initonly').value @@ -2303,110 +2601,111 @@ class memberdefType(GeneratedsSuper): self.settable = attrs.get('settable').value if attrs.get('id'): self.id = attrs.get('id').value + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'templateparamlist': + nodeName_ == 'templateparamlist': obj_ = templateparamlistType.factory() obj_.build(child_) self.set_templateparamlist(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'type': + nodeName_ == 'type': obj_ = linkedTextType.factory() obj_.build(child_) self.set_type(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'definition': + nodeName_ == 'definition': definition_ = '' for text__content_ in child_.childNodes: definition_ += text__content_.nodeValue self.definition = definition_ elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'argsstring': + nodeName_ == 'argsstring': argsstring_ = '' for text__content_ in child_.childNodes: argsstring_ += text__content_.nodeValue self.argsstring = argsstring_ elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'name': + nodeName_ == 'name': name_ = '' for text__content_ in child_.childNodes: name_ += text__content_.nodeValue self.name = name_ elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'read': + nodeName_ == 'read': read_ = '' for text__content_ in child_.childNodes: read_ += text__content_.nodeValue self.read = read_ elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'write': + nodeName_ == 'write': write_ = '' for text__content_ in child_.childNodes: write_ += text__content_.nodeValue self.write = write_ elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'bitfield': + nodeName_ == 'bitfield': bitfield_ = '' for text__content_ in child_.childNodes: bitfield_ += text__content_.nodeValue self.bitfield = bitfield_ elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'reimplements': + nodeName_ == 'reimplements': obj_ = reimplementType.factory() obj_.build(child_) self.reimplements.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'reimplementedby': + nodeName_ == 'reimplementedby': obj_ = reimplementType.factory() obj_.build(child_) self.reimplementedby.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'param': + nodeName_ == 'param': obj_ = paramType.factory() obj_.build(child_) self.param.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'enumvalue': + nodeName_ == 'enumvalue': obj_ = enumvalueType.factory() obj_.build(child_) self.enumvalue.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'initializer': + nodeName_ == 'initializer': obj_ = linkedTextType.factory() obj_.build(child_) self.set_initializer(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'exceptions': + nodeName_ == 'exceptions': obj_ = linkedTextType.factory() obj_.build(child_) self.set_exceptions(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'briefdescription': + nodeName_ == 'briefdescription': obj_ = descriptionType.factory() obj_.build(child_) self.set_briefdescription(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'detaileddescription': + nodeName_ == 'detaileddescription': obj_ = descriptionType.factory() obj_.build(child_) self.set_detaileddescription(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'inbodydescription': + nodeName_ == 'inbodydescription': obj_ = descriptionType.factory() obj_.build(child_) self.set_inbodydescription(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'location': + nodeName_ == 'location': obj_ = locationType.factory() obj_.build(child_) self.set_location(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'references': + nodeName_ == 'references': obj_ = referenceType.factory() obj_.build(child_) self.references.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'referencedby': + nodeName_ == 'referencedby': obj_ = referenceType.factory() obj_.build(child_) self.referencedby.append(obj_) @@ -2416,8 +2715,10 @@ class memberdefType(GeneratedsSuper): class definition(GeneratedsSuper): subclass = None superclass = None + def __init__(self, valueOf_=''): self.valueOf_ = valueOf_ + def factory(*args_, **kwargs_): if definition.subclass: return definition.subclass(*args_, **kwargs_) @@ -2426,6 +2727,7 @@ class definition(GeneratedsSuper): factory = staticmethod(factory) def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='definition', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) @@ -2437,33 +2739,40 @@ class definition(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='definition'): pass + def exportChildren(self, outfile, level, namespace_='', name_='definition'): - if self.valueOf_.find('![CDATA')>-1: - value=quote_xml('%s' % self.valueOf_) - value=value.replace('![CDATA','<![CDATA') - value=value.replace(']]',']]>') + if self.valueOf_.find('![CDATA') > -1: + value = quote_xml('%s' % self.valueOf_) + value = value.replace('![CDATA', '<![CDATA') + value = value.replace(']]', ']]>') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): if ( self.valueOf_ is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='definition'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): pass + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) @@ -2471,21 +2780,25 @@ class definition(GeneratedsSuper): for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): pass + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: - self.valueOf_ += '![CDATA['+child_.nodeValue+']]' + self.valueOf_ += '![CDATA[' + child_.nodeValue + ']]' # end class definition class argsstring(GeneratedsSuper): subclass = None superclass = None + def __init__(self, valueOf_=''): self.valueOf_ = valueOf_ + def factory(*args_, **kwargs_): if argsstring.subclass: return argsstring.subclass(*args_, **kwargs_) @@ -2494,6 +2807,7 @@ class argsstring(GeneratedsSuper): factory = staticmethod(factory) def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='argsstring', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) @@ -2505,33 +2819,40 @@ class argsstring(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='argsstring'): pass + def exportChildren(self, outfile, level, namespace_='', name_='argsstring'): - if self.valueOf_.find('![CDATA')>-1: - value=quote_xml('%s' % self.valueOf_) - value=value.replace('![CDATA','<![CDATA') - value=value.replace(']]',']]>') + if self.valueOf_.find('![CDATA') > -1: + value = quote_xml('%s' % self.valueOf_) + value = value.replace('![CDATA', '<![CDATA') + value = value.replace(']]', ']]>') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): if ( self.valueOf_ is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='argsstring'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): pass + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) @@ -2539,21 +2860,25 @@ class argsstring(GeneratedsSuper): for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): pass + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: - self.valueOf_ += '![CDATA['+child_.nodeValue+']]' + self.valueOf_ += '![CDATA[' + child_.nodeValue + ']]' # end class argsstring class read(GeneratedsSuper): subclass = None superclass = None + def __init__(self, valueOf_=''): self.valueOf_ = valueOf_ + def factory(*args_, **kwargs_): if read.subclass: return read.subclass(*args_, **kwargs_) @@ -2562,6 +2887,7 @@ class read(GeneratedsSuper): factory = staticmethod(factory) def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='read', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) @@ -2573,33 +2899,40 @@ class read(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='read'): pass + def exportChildren(self, outfile, level, namespace_='', name_='read'): - if self.valueOf_.find('![CDATA')>-1: - value=quote_xml('%s' % self.valueOf_) - value=value.replace('![CDATA','<![CDATA') - value=value.replace(']]',']]>') + if self.valueOf_.find('![CDATA') > -1: + value = quote_xml('%s' % self.valueOf_) + value = value.replace('![CDATA', '<![CDATA') + value = value.replace(']]', ']]>') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): if ( self.valueOf_ is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='read'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): pass + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) @@ -2607,21 +2940,25 @@ class read(GeneratedsSuper): for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): pass + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: - self.valueOf_ += '![CDATA['+child_.nodeValue+']]' + self.valueOf_ += '![CDATA[' + child_.nodeValue + ']]' # end class read class write(GeneratedsSuper): subclass = None superclass = None + def __init__(self, valueOf_=''): self.valueOf_ = valueOf_ + def factory(*args_, **kwargs_): if write.subclass: return write.subclass(*args_, **kwargs_) @@ -2630,6 +2967,7 @@ class write(GeneratedsSuper): factory = staticmethod(factory) def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='write', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) @@ -2641,33 +2979,40 @@ class write(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='write'): pass + def exportChildren(self, outfile, level, namespace_='', name_='write'): - if self.valueOf_.find('![CDATA')>-1: - value=quote_xml('%s' % self.valueOf_) - value=value.replace('![CDATA','<![CDATA') - value=value.replace(']]',']]>') + if self.valueOf_.find('![CDATA') > -1: + value = quote_xml('%s' % self.valueOf_) + value = value.replace('![CDATA', '<![CDATA') + value = value.replace(']]', ']]>') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): if ( self.valueOf_ is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='write'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): pass + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) @@ -2675,21 +3020,25 @@ class write(GeneratedsSuper): for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): pass + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: - self.valueOf_ += '![CDATA['+child_.nodeValue+']]' + self.valueOf_ += '![CDATA[' + child_.nodeValue + ']]' # end class write class bitfield(GeneratedsSuper): subclass = None superclass = None + def __init__(self, valueOf_=''): self.valueOf_ = valueOf_ + def factory(*args_, **kwargs_): if bitfield.subclass: return bitfield.subclass(*args_, **kwargs_) @@ -2698,6 +3047,7 @@ class bitfield(GeneratedsSuper): factory = staticmethod(factory) def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='bitfield', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) @@ -2709,33 +3059,40 @@ class bitfield(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='bitfield'): pass + def exportChildren(self, outfile, level, namespace_='', name_='bitfield'): - if self.valueOf_.find('![CDATA')>-1: - value=quote_xml('%s' % self.valueOf_) - value=value.replace('![CDATA','<![CDATA') - value=value.replace(']]',']]>') + if self.valueOf_.find('![CDATA') > -1: + value = quote_xml('%s' % self.valueOf_) + value = value.replace('![CDATA', '<![CDATA') + value = value.replace(']]', ']]>') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): if ( self.valueOf_ is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='bitfield'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): pass + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) @@ -2743,19 +3100,22 @@ class bitfield(GeneratedsSuper): for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): pass + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: - self.valueOf_ += '![CDATA['+child_.nodeValue+']]' + self.valueOf_ += '![CDATA[' + child_.nodeValue + ']]' # end class bitfield class descriptionType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, title=None, para=None, sect1=None, internal=None, mixedclass_=None, content_=None): if mixedclass_ is None: self.mixedclass_ = MixedContainer @@ -2765,6 +3125,7 @@ class descriptionType(GeneratedsSuper): self.content_ = [] else: self.content_ = content_ + def factory(*args_, **kwargs_): if descriptionType.subclass: return descriptionType.subclass(*args_, **kwargs_) @@ -2783,35 +3144,43 @@ class descriptionType(GeneratedsSuper): def insert_sect1(self, index, value): self.sect1[index] = value def get_internal(self): return self.internal def set_internal(self, internal): self.internal = internal + def export(self, outfile, level, namespace_='', name_='descriptionType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) - self.exportAttributes(outfile, level, namespace_, name_='descriptionType') + self.exportAttributes(outfile, level, namespace_, + name_='descriptionType') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('</%s%s>\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='descriptionType'): pass + def exportChildren(self, outfile, level, namespace_='', name_='descriptionType'): for item_ in self.content_: item_.export(outfile, level, item_.name, namespace_) + def hasContent_(self): if ( self.title is not None or self.para is not None or self.sect1 is not None or self.internal is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='descriptionType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): pass + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('content_ = [\n') @@ -2837,46 +3206,49 @@ class descriptionType(GeneratedsSuper): item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): pass + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'title': + nodeName_ == 'title': childobj_ = docTitleType.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, - MixedContainer.TypeNone, 'title', childobj_) + MixedContainer.TypeNone, 'title', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'para': + nodeName_ == 'para': childobj_ = docParaType.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, - MixedContainer.TypeNone, 'para', childobj_) + MixedContainer.TypeNone, 'para', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'sect1': + nodeName_ == 'sect1': childobj_ = docSect1Type.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, - MixedContainer.TypeNone, 'sect1', childobj_) + MixedContainer.TypeNone, 'sect1', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'internal': + nodeName_ == 'internal': childobj_ = docInternalType.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, - MixedContainer.TypeNone, 'internal', childobj_) + MixedContainer.TypeNone, 'internal', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, - MixedContainer.TypeNone, '', child_.nodeValue) + MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) # end class descriptionType @@ -2884,6 +3256,7 @@ class descriptionType(GeneratedsSuper): class enumvalueType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, prot=None, id=None, name=None, initializer=None, briefdescription=None, detaileddescription=None, mixedclass_=None, content_=None): self.prot = prot self.id = id @@ -2895,6 +3268,7 @@ class enumvalueType(GeneratedsSuper): self.content_ = [] else: self.content_ = content_ + def factory(*args_, **kwargs_): if enumvalueType.subclass: return enumvalueType.subclass(*args_, **kwargs_) @@ -2906,43 +3280,55 @@ class enumvalueType(GeneratedsSuper): def get_initializer(self): return self.initializer def set_initializer(self, initializer): self.initializer = initializer def get_briefdescription(self): return self.briefdescription - def set_briefdescription(self, briefdescription): self.briefdescription = briefdescription + def set_briefdescription( + self, briefdescription): self.briefdescription = briefdescription + def get_detaileddescription(self): return self.detaileddescription - def set_detaileddescription(self, detaileddescription): self.detaileddescription = detaileddescription + def set_detaileddescription( + self, detaileddescription): self.detaileddescription = detaileddescription + def get_prot(self): return self.prot def set_prot(self, prot): self.prot = prot def get_id(self): return self.id def set_id(self, id): self.id = id + def export(self, outfile, level, namespace_='', name_='enumvalueType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) - self.exportAttributes(outfile, level, namespace_, name_='enumvalueType') + self.exportAttributes(outfile, level, namespace_, + name_='enumvalueType') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('</%s%s>\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='enumvalueType'): if self.prot is not None: outfile.write(' prot=%s' % (quote_attrib(self.prot), )) if self.id is not None: - outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), )) + outfile.write(' id=%s' % (self.format_string(quote_attrib( + self.id).encode(ExternalEncoding), input_name='id'), )) + def exportChildren(self, outfile, level, namespace_='', name_='enumvalueType'): for item_ in self.content_: item_.export(outfile, level, item_.name, namespace_) + def hasContent_(self): if ( self.name is not None or self.initializer is not None or self.briefdescription is not None or self.detaileddescription is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='enumvalueType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): if self.prot is not None: showIndent(outfile, level) @@ -2950,6 +3336,7 @@ class enumvalueType(GeneratedsSuper): if self.id is not None: showIndent(outfile, level) outfile.write('id = %s,\n' % (self.id,)) + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('content_ = [\n') @@ -2975,51 +3362,54 @@ class enumvalueType(GeneratedsSuper): item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): if attrs.get('prot'): self.prot = attrs.get('prot').value if attrs.get('id'): self.id = attrs.get('id').value + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'name': + nodeName_ == 'name': value_ = [] for text_ in child_.childNodes: value_.append(text_.nodeValue) valuestr_ = ''.join(value_) obj_ = self.mixedclass_(MixedContainer.CategorySimple, - MixedContainer.TypeString, 'name', valuestr_) + MixedContainer.TypeString, 'name', valuestr_) self.content_.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'initializer': + nodeName_ == 'initializer': childobj_ = linkedTextType.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, - MixedContainer.TypeNone, 'initializer', childobj_) + MixedContainer.TypeNone, 'initializer', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'briefdescription': + nodeName_ == 'briefdescription': childobj_ = descriptionType.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, - MixedContainer.TypeNone, 'briefdescription', childobj_) + MixedContainer.TypeNone, 'briefdescription', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'detaileddescription': + nodeName_ == 'detaileddescription': childobj_ = descriptionType.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, - MixedContainer.TypeNone, 'detaileddescription', childobj_) + MixedContainer.TypeNone, 'detaileddescription', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, - MixedContainer.TypeNone, '', child_.nodeValue) + MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) # end class enumvalueType @@ -3027,11 +3417,13 @@ class enumvalueType(GeneratedsSuper): class templateparamlistType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, param=None): if param is None: self.param = [] else: self.param = param + def factory(*args_, **kwargs_): if templateparamlistType.subclass: return templateparamlistType.subclass(*args_, **kwargs_) @@ -3042,10 +3434,12 @@ class templateparamlistType(GeneratedsSuper): def set_param(self, param): self.param = param def add_param(self, value): self.param.append(value) def insert_param(self, index, value): self.param[index] = value + def export(self, outfile, level, namespace_='', name_='templateparamlistType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) - self.exportAttributes(outfile, level, namespace_, name_='templateparamlistType') + self.exportAttributes(outfile, level, namespace_, + name_='templateparamlistType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) @@ -3053,25 +3447,31 @@ class templateparamlistType(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='templateparamlistType'): pass + def exportChildren(self, outfile, level, namespace_='', name_='templateparamlistType'): for param_ in self.param: param_.export(outfile, level, namespace_, name_='param') + def hasContent_(self): if ( self.param is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='templateparamlistType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): pass + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('param=[\n') @@ -3085,17 +3485,20 @@ class templateparamlistType(GeneratedsSuper): level -= 1 showIndent(outfile, level) outfile.write('],\n') + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): pass + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'param': + nodeName_ == 'param': obj_ = paramType.factory() obj_.build(child_) self.param.append(obj_) @@ -3105,6 +3508,7 @@ class templateparamlistType(GeneratedsSuper): class paramType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, type_=None, declname=None, defname=None, array=None, defval=None, briefdescription=None): self.type_ = type_ self.declname = declname @@ -3112,6 +3516,7 @@ class paramType(GeneratedsSuper): self.array = array self.defval = defval self.briefdescription = briefdescription + def factory(*args_, **kwargs_): if paramType.subclass: return paramType.subclass(*args_, **kwargs_) @@ -3129,7 +3534,10 @@ class paramType(GeneratedsSuper): def get_defval(self): return self.defval def set_defval(self, defval): self.defval = defval def get_briefdescription(self): return self.briefdescription - def set_briefdescription(self, briefdescription): self.briefdescription = briefdescription + + def set_briefdescription( + self, briefdescription): self.briefdescription = briefdescription + def export(self, outfile, level, namespace_='', name_='paramType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) @@ -3141,24 +3549,31 @@ class paramType(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='paramType'): pass + def exportChildren(self, outfile, level, namespace_='', name_='paramType'): if self.type_: self.type_.export(outfile, level, namespace_, name_='type') if self.declname is not None: showIndent(outfile, level) - outfile.write('<%sdeclname>%s</%sdeclname>\n' % (namespace_, self.format_string(quote_xml(self.declname).encode(ExternalEncoding), input_name='declname'), namespace_)) + outfile.write('<%sdeclname>%s</%sdeclname>\n' % (namespace_, self.format_string( + quote_xml(self.declname).encode(ExternalEncoding), input_name='declname'), namespace_)) if self.defname is not None: showIndent(outfile, level) - outfile.write('<%sdefname>%s</%sdefname>\n' % (namespace_, self.format_string(quote_xml(self.defname).encode(ExternalEncoding), input_name='defname'), namespace_)) + outfile.write('<%sdefname>%s</%sdefname>\n' % (namespace_, self.format_string( + quote_xml(self.defname).encode(ExternalEncoding), input_name='defname'), namespace_)) if self.array is not None: showIndent(outfile, level) - outfile.write('<%sarray>%s</%sarray>\n' % (namespace_, self.format_string(quote_xml(self.array).encode(ExternalEncoding), input_name='array'), namespace_)) + outfile.write('<%sarray>%s</%sarray>\n' % (namespace_, self.format_string( + quote_xml(self.array).encode(ExternalEncoding), input_name='array'), namespace_)) if self.defval: self.defval.export(outfile, level, namespace_, name_='defval') if self.briefdescription: - self.briefdescription.export(outfile, level, namespace_, name_='briefdescription') + self.briefdescription.export( + outfile, level, namespace_, name_='briefdescription') + def hasContent_(self): if ( self.type_ is not None or @@ -3167,17 +3582,20 @@ class paramType(GeneratedsSuper): self.array is not None or self.defval is not None or self.briefdescription is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='paramType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): pass + def exportLiteralChildren(self, outfile, level, name_): if self.type_: showIndent(outfile, level) @@ -3186,11 +3604,14 @@ class paramType(GeneratedsSuper): showIndent(outfile, level) outfile.write('),\n') showIndent(outfile, level) - outfile.write('declname=%s,\n' % quote_python(self.declname).encode(ExternalEncoding)) + outfile.write('declname=%s,\n' % quote_python( + self.declname).encode(ExternalEncoding)) showIndent(outfile, level) - outfile.write('defname=%s,\n' % quote_python(self.defname).encode(ExternalEncoding)) + outfile.write('defname=%s,\n' % quote_python( + self.defname).encode(ExternalEncoding)) showIndent(outfile, level) - outfile.write('array=%s,\n' % quote_python(self.array).encode(ExternalEncoding)) + outfile.write('array=%s,\n' % quote_python( + self.array).encode(ExternalEncoding)) if self.defval: showIndent(outfile, level) outfile.write('defval=model_.linkedTextType(\n') @@ -3200,48 +3621,52 @@ class paramType(GeneratedsSuper): if self.briefdescription: showIndent(outfile, level) outfile.write('briefdescription=model_.descriptionType(\n') - self.briefdescription.exportLiteral(outfile, level, name_='briefdescription') + self.briefdescription.exportLiteral( + outfile, level, name_='briefdescription') showIndent(outfile, level) outfile.write('),\n') + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): pass + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'type': + nodeName_ == 'type': obj_ = linkedTextType.factory() obj_.build(child_) self.set_type(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'declname': + nodeName_ == 'declname': declname_ = '' for text__content_ in child_.childNodes: declname_ += text__content_.nodeValue self.declname = declname_ elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'defname': + nodeName_ == 'defname': defname_ = '' for text__content_ in child_.childNodes: defname_ += text__content_.nodeValue self.defname = defname_ elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'array': + nodeName_ == 'array': array_ = '' for text__content_ in child_.childNodes: array_ += text__content_.nodeValue self.array = array_ elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'defval': + nodeName_ == 'defval': obj_ = linkedTextType.factory() obj_.build(child_) self.set_defval(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'briefdescription': + nodeName_ == 'briefdescription': obj_ = descriptionType.factory() obj_.build(child_) self.set_briefdescription(obj_) @@ -3251,8 +3676,10 @@ class paramType(GeneratedsSuper): class declname(GeneratedsSuper): subclass = None superclass = None + def __init__(self, valueOf_=''): self.valueOf_ = valueOf_ + def factory(*args_, **kwargs_): if declname.subclass: return declname.subclass(*args_, **kwargs_) @@ -3261,6 +3688,7 @@ class declname(GeneratedsSuper): factory = staticmethod(factory) def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='declname', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) @@ -3272,33 +3700,40 @@ class declname(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='declname'): pass + def exportChildren(self, outfile, level, namespace_='', name_='declname'): - if self.valueOf_.find('![CDATA')>-1: - value=quote_xml('%s' % self.valueOf_) - value=value.replace('![CDATA','<![CDATA') - value=value.replace(']]',']]>') + if self.valueOf_.find('![CDATA') > -1: + value = quote_xml('%s' % self.valueOf_) + value = value.replace('![CDATA', '<![CDATA') + value = value.replace(']]', ']]>') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): if ( self.valueOf_ is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='declname'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): pass + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) @@ -3306,21 +3741,25 @@ class declname(GeneratedsSuper): for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): pass + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: - self.valueOf_ += '![CDATA['+child_.nodeValue+']]' + self.valueOf_ += '![CDATA[' + child_.nodeValue + ']]' # end class declname class defname(GeneratedsSuper): subclass = None superclass = None + def __init__(self, valueOf_=''): self.valueOf_ = valueOf_ + def factory(*args_, **kwargs_): if defname.subclass: return defname.subclass(*args_, **kwargs_) @@ -3329,6 +3768,7 @@ class defname(GeneratedsSuper): factory = staticmethod(factory) def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='defname', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) @@ -3340,33 +3780,40 @@ class defname(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='defname'): pass + def exportChildren(self, outfile, level, namespace_='', name_='defname'): - if self.valueOf_.find('![CDATA')>-1: - value=quote_xml('%s' % self.valueOf_) - value=value.replace('![CDATA','<![CDATA') - value=value.replace(']]',']]>') + if self.valueOf_.find('![CDATA') > -1: + value = quote_xml('%s' % self.valueOf_) + value = value.replace('![CDATA', '<![CDATA') + value = value.replace(']]', ']]>') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): if ( self.valueOf_ is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='defname'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): pass + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) @@ -3374,21 +3821,25 @@ class defname(GeneratedsSuper): for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): pass + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: - self.valueOf_ += '![CDATA['+child_.nodeValue+']]' + self.valueOf_ += '![CDATA[' + child_.nodeValue + ']]' # end class defname class array(GeneratedsSuper): subclass = None superclass = None + def __init__(self, valueOf_=''): self.valueOf_ = valueOf_ + def factory(*args_, **kwargs_): if array.subclass: return array.subclass(*args_, **kwargs_) @@ -3397,6 +3848,7 @@ class array(GeneratedsSuper): factory = staticmethod(factory) def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='array', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) @@ -3408,33 +3860,40 @@ class array(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='array'): pass + def exportChildren(self, outfile, level, namespace_='', name_='array'): - if self.valueOf_.find('![CDATA')>-1: - value=quote_xml('%s' % self.valueOf_) - value=value.replace('![CDATA','<![CDATA') - value=value.replace(']]',']]>') + if self.valueOf_.find('![CDATA') > -1: + value = quote_xml('%s' % self.valueOf_) + value = value.replace('![CDATA', '<![CDATA') + value = value.replace(']]', ']]>') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): if ( self.valueOf_ is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='array'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): pass + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) @@ -3442,19 +3901,22 @@ class array(GeneratedsSuper): for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): pass + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: - self.valueOf_ += '![CDATA['+child_.nodeValue+']]' + self.valueOf_ += '![CDATA[' + child_.nodeValue + ']]' # end class array class linkedTextType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, ref=None, mixedclass_=None, content_=None): if mixedclass_ is None: self.mixedclass_ = MixedContainer @@ -3464,6 +3926,7 @@ class linkedTextType(GeneratedsSuper): self.content_ = [] else: self.content_ = content_ + def factory(*args_, **kwargs_): if linkedTextType.subclass: return linkedTextType.subclass(*args_, **kwargs_) @@ -3474,32 +3937,40 @@ class linkedTextType(GeneratedsSuper): def set_ref(self, ref): self.ref = ref def add_ref(self, value): self.ref.append(value) def insert_ref(self, index, value): self.ref[index] = value + def export(self, outfile, level, namespace_='', name_='linkedTextType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) - self.exportAttributes(outfile, level, namespace_, name_='linkedTextType') + self.exportAttributes(outfile, level, namespace_, + name_='linkedTextType') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('</%s%s>\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='linkedTextType'): pass + def exportChildren(self, outfile, level, namespace_='', name_='linkedTextType'): for item_ in self.content_: item_.export(outfile, level, item_.name, namespace_) + def hasContent_(self): if ( self.ref is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='linkedTextType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): pass + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('content_ = [\n') @@ -3507,25 +3978,28 @@ class linkedTextType(GeneratedsSuper): item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): pass + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'ref': + nodeName_ == 'ref': childobj_ = docRefTextType.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, - MixedContainer.TypeNone, 'ref', childobj_) + MixedContainer.TypeNone, 'ref', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, - MixedContainer.TypeNone, '', child_.nodeValue) + MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) # end class linkedTextType @@ -3533,11 +4007,13 @@ class linkedTextType(GeneratedsSuper): class graphType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, node=None): if node is None: self.node = [] else: self.node = node + def factory(*args_, **kwargs_): if graphType.subclass: return graphType.subclass(*args_, **kwargs_) @@ -3548,6 +4024,7 @@ class graphType(GeneratedsSuper): def set_node(self, node): self.node = node def add_node(self, value): self.node.append(value) def insert_node(self, index, value): self.node[index] = value + def export(self, outfile, level, namespace_='', name_='graphType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) @@ -3559,25 +4036,31 @@ class graphType(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='graphType'): pass + def exportChildren(self, outfile, level, namespace_='', name_='graphType'): for node_ in self.node: node_.export(outfile, level, namespace_, name_='node') + def hasContent_(self): if ( self.node is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='graphType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): pass + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('node=[\n') @@ -3591,17 +4074,20 @@ class graphType(GeneratedsSuper): level -= 1 showIndent(outfile, level) outfile.write('],\n') + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): pass + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'node': + nodeName_ == 'node': obj_ = nodeType.factory() obj_.build(child_) self.node.append(obj_) @@ -3611,6 +4097,7 @@ class graphType(GeneratedsSuper): class nodeType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, id=None, label=None, link=None, childnode=None): self.id = id self.label = label @@ -3619,6 +4106,7 @@ class nodeType(GeneratedsSuper): self.childnode = [] else: self.childnode = childnode + def factory(*args_, **kwargs_): if nodeType.subclass: return nodeType.subclass(*args_, **kwargs_) @@ -3635,6 +4123,7 @@ class nodeType(GeneratedsSuper): def insert_childnode(self, index, value): self.childnode[index] = value def get_id(self): return self.id def set_id(self, id): self.id = id + def export(self, outfile, level, namespace_='', name_='nodeType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) @@ -3646,38 +4135,47 @@ class nodeType(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='nodeType'): if self.id is not None: - outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), )) + outfile.write(' id=%s' % (self.format_string(quote_attrib( + self.id).encode(ExternalEncoding), input_name='id'), )) + def exportChildren(self, outfile, level, namespace_='', name_='nodeType'): if self.label is not None: showIndent(outfile, level) - outfile.write('<%slabel>%s</%slabel>\n' % (namespace_, self.format_string(quote_xml(self.label).encode(ExternalEncoding), input_name='label'), namespace_)) + outfile.write('<%slabel>%s</%slabel>\n' % (namespace_, self.format_string( + quote_xml(self.label).encode(ExternalEncoding), input_name='label'), namespace_)) if self.link: self.link.export(outfile, level, namespace_, name_='link') for childnode_ in self.childnode: childnode_.export(outfile, level, namespace_, name_='childnode') + def hasContent_(self): if ( self.label is not None or self.link is not None or self.childnode is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='nodeType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): if self.id is not None: showIndent(outfile, level) outfile.write('id = %s,\n' % (self.id,)) + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) - outfile.write('label=%s,\n' % quote_python(self.label).encode(ExternalEncoding)) + outfile.write('label=%s,\n' % quote_python( + self.label).encode(ExternalEncoding)) if self.link: showIndent(outfile, level) outfile.write('link=model_.linkType(\n') @@ -3696,29 +4194,32 @@ class nodeType(GeneratedsSuper): level -= 1 showIndent(outfile, level) outfile.write('],\n') + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): if attrs.get('id'): self.id = attrs.get('id').value + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'label': + nodeName_ == 'label': label_ = '' for text__content_ in child_.childNodes: label_ += text__content_.nodeValue self.label = label_ elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'link': + nodeName_ == 'link': obj_ = linkType.factory() obj_.build(child_) self.set_link(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'childnode': + nodeName_ == 'childnode': obj_ = childnodeType.factory() obj_.build(child_) self.childnode.append(obj_) @@ -3728,8 +4229,10 @@ class nodeType(GeneratedsSuper): class label(GeneratedsSuper): subclass = None superclass = None + def __init__(self, valueOf_=''): self.valueOf_ = valueOf_ + def factory(*args_, **kwargs_): if label.subclass: return label.subclass(*args_, **kwargs_) @@ -3738,6 +4241,7 @@ class label(GeneratedsSuper): factory = staticmethod(factory) def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='label', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) @@ -3749,33 +4253,40 @@ class label(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='label'): pass + def exportChildren(self, outfile, level, namespace_='', name_='label'): - if self.valueOf_.find('![CDATA')>-1: - value=quote_xml('%s' % self.valueOf_) - value=value.replace('![CDATA','<![CDATA') - value=value.replace(']]',']]>') + if self.valueOf_.find('![CDATA') > -1: + value = quote_xml('%s' % self.valueOf_) + value = value.replace('![CDATA', '<![CDATA') + value = value.replace(']]', ']]>') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): if ( self.valueOf_ is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='label'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): pass + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) @@ -3783,19 +4294,22 @@ class label(GeneratedsSuper): for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): pass + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: - self.valueOf_ += '![CDATA['+child_.nodeValue+']]' + self.valueOf_ += '![CDATA[' + child_.nodeValue + ']]' # end class label class childnodeType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, relation=None, refid=None, edgelabel=None): self.relation = relation self.refid = refid @@ -3803,6 +4317,7 @@ class childnodeType(GeneratedsSuper): self.edgelabel = [] else: self.edgelabel = edgelabel + def factory(*args_, **kwargs_): if childnodeType.subclass: return childnodeType.subclass(*args_, **kwargs_) @@ -3817,10 +4332,12 @@ class childnodeType(GeneratedsSuper): def set_relation(self, relation): self.relation = relation def get_refid(self): return self.refid def set_refid(self, refid): self.refid = refid + def export(self, outfile, level, namespace_='', name_='childnodeType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) - self.exportAttributes(outfile, level, namespace_, name_='childnodeType') + self.exportAttributes(outfile, level, namespace_, + name_='childnodeType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) @@ -3828,27 +4345,34 @@ class childnodeType(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='childnodeType'): if self.relation is not None: outfile.write(' relation=%s' % (quote_attrib(self.relation), )) if self.refid is not None: - outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), )) + outfile.write(' refid=%s' % (self.format_string(quote_attrib( + self.refid).encode(ExternalEncoding), input_name='refid'), )) + def exportChildren(self, outfile, level, namespace_='', name_='childnodeType'): for edgelabel_ in self.edgelabel: showIndent(outfile, level) - outfile.write('<%sedgelabel>%s</%sedgelabel>\n' % (namespace_, self.format_string(quote_xml(edgelabel_).encode(ExternalEncoding), input_name='edgelabel'), namespace_)) + outfile.write('<%sedgelabel>%s</%sedgelabel>\n' % (namespace_, self.format_string( + quote_xml(edgelabel_).encode(ExternalEncoding), input_name='edgelabel'), namespace_)) + def hasContent_(self): if ( self.edgelabel is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='childnodeType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): if self.relation is not None: showIndent(outfile, level) @@ -3856,30 +4380,35 @@ class childnodeType(GeneratedsSuper): if self.refid is not None: showIndent(outfile, level) outfile.write('refid = %s,\n' % (self.refid,)) + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('edgelabel=[\n') level += 1 for edgelabel in self.edgelabel: showIndent(outfile, level) - outfile.write('%s,\n' % quote_python(edgelabel).encode(ExternalEncoding)) + outfile.write('%s,\n' % quote_python( + edgelabel).encode(ExternalEncoding)) level -= 1 showIndent(outfile, level) outfile.write('],\n') + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): if attrs.get('relation'): self.relation = attrs.get('relation').value if attrs.get('refid'): self.refid = attrs.get('refid').value + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'edgelabel': + nodeName_ == 'edgelabel': edgelabel_ = '' for text__content_ in child_.childNodes: edgelabel_ += text__content_.nodeValue @@ -3890,8 +4419,10 @@ class childnodeType(GeneratedsSuper): class edgelabel(GeneratedsSuper): subclass = None superclass = None + def __init__(self, valueOf_=''): self.valueOf_ = valueOf_ + def factory(*args_, **kwargs_): if edgelabel.subclass: return edgelabel.subclass(*args_, **kwargs_) @@ -3900,6 +4431,7 @@ class edgelabel(GeneratedsSuper): factory = staticmethod(factory) def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='edgelabel', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) @@ -3911,33 +4443,40 @@ class edgelabel(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='edgelabel'): pass + def exportChildren(self, outfile, level, namespace_='', name_='edgelabel'): - if self.valueOf_.find('![CDATA')>-1: - value=quote_xml('%s' % self.valueOf_) - value=value.replace('![CDATA','<![CDATA') - value=value.replace(']]',']]>') + if self.valueOf_.find('![CDATA') > -1: + value = quote_xml('%s' % self.valueOf_) + value = value.replace('![CDATA', '<![CDATA') + value = value.replace(']]', ']]>') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): if ( self.valueOf_ is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='edgelabel'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): pass + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) @@ -3945,23 +4484,27 @@ class edgelabel(GeneratedsSuper): for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): pass + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: - self.valueOf_ += '![CDATA['+child_.nodeValue+']]' + self.valueOf_ += '![CDATA[' + child_.nodeValue + ']]' # end class edgelabel class linkType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, refid=None, external=None, valueOf_=''): self.refid = refid self.external = external self.valueOf_ = valueOf_ + def factory(*args_, **kwargs_): if linkType.subclass: return linkType.subclass(*args_, **kwargs_) @@ -3974,6 +4517,7 @@ class linkType(GeneratedsSuper): def set_external(self, external): self.external = external def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='linkType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) @@ -3985,31 +4529,38 @@ class linkType(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='linkType'): if self.refid is not None: - outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), )) + outfile.write(' refid=%s' % (self.format_string(quote_attrib( + self.refid).encode(ExternalEncoding), input_name='refid'), )) if self.external is not None: - outfile.write(' external=%s' % (self.format_string(quote_attrib(self.external).encode(ExternalEncoding), input_name='external'), )) + outfile.write(' external=%s' % (self.format_string(quote_attrib( + self.external).encode(ExternalEncoding), input_name='external'), )) + def exportChildren(self, outfile, level, namespace_='', name_='linkType'): - if self.valueOf_.find('![CDATA')>-1: - value=quote_xml('%s' % self.valueOf_) - value=value.replace('![CDATA','<![CDATA') - value=value.replace(']]',']]>') + if self.valueOf_.find('![CDATA') > -1: + value = quote_xml('%s' % self.valueOf_) + value = value.replace('![CDATA', '<![CDATA') + value = value.replace(']]', ']]>') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): if ( self.valueOf_ is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='linkType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): if self.refid is not None: showIndent(outfile, level) @@ -4017,9 +4568,11 @@ class linkType(GeneratedsSuper): if self.external is not None: showIndent(outfile, level) outfile.write('external = %s,\n' % (self.external,)) + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) @@ -4027,27 +4580,31 @@ class linkType(GeneratedsSuper): for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): if attrs.get('refid'): self.refid = attrs.get('refid').value if attrs.get('external'): self.external = attrs.get('external').value + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: - self.valueOf_ += '![CDATA['+child_.nodeValue+']]' + self.valueOf_ += '![CDATA[' + child_.nodeValue + ']]' # end class linkType class listingType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, codeline=None): if codeline is None: self.codeline = [] else: self.codeline = codeline + def factory(*args_, **kwargs_): if listingType.subclass: return listingType.subclass(*args_, **kwargs_) @@ -4058,6 +4615,7 @@ class listingType(GeneratedsSuper): def set_codeline(self, codeline): self.codeline = codeline def add_codeline(self, value): self.codeline.append(value) def insert_codeline(self, index, value): self.codeline[index] = value + def export(self, outfile, level, namespace_='', name_='listingType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) @@ -4069,25 +4627,31 @@ class listingType(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='listingType'): pass + def exportChildren(self, outfile, level, namespace_='', name_='listingType'): for codeline_ in self.codeline: codeline_.export(outfile, level, namespace_, name_='codeline') + def hasContent_(self): if ( self.codeline is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='listingType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): pass + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('codeline=[\n') @@ -4101,17 +4665,20 @@ class listingType(GeneratedsSuper): level -= 1 showIndent(outfile, level) outfile.write('],\n') + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): pass + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'codeline': + nodeName_ == 'codeline': obj_ = codelineType.factory() obj_.build(child_) self.codeline.append(obj_) @@ -4121,6 +4688,7 @@ class listingType(GeneratedsSuper): class codelineType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, external=None, lineno=None, refkind=None, refid=None, highlight=None): self.external = external self.lineno = lineno @@ -4130,6 +4698,7 @@ class codelineType(GeneratedsSuper): self.highlight = [] else: self.highlight = highlight + def factory(*args_, **kwargs_): if codelineType.subclass: return codelineType.subclass(*args_, **kwargs_) @@ -4148,6 +4717,7 @@ class codelineType(GeneratedsSuper): def set_refkind(self, refkind): self.refkind = refkind def get_refid(self): return self.refid def set_refid(self, refid): self.refid = refid + def export(self, outfile, level, namespace_='', name_='codelineType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) @@ -4159,30 +4729,37 @@ class codelineType(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='codelineType'): if self.external is not None: outfile.write(' external=%s' % (quote_attrib(self.external), )) if self.lineno is not None: - outfile.write(' lineno="%s"' % self.format_integer(self.lineno, input_name='lineno')) + outfile.write(' lineno="%s"' % self.format_integer( + self.lineno, input_name='lineno')) if self.refkind is not None: outfile.write(' refkind=%s' % (quote_attrib(self.refkind), )) if self.refid is not None: - outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), )) + outfile.write(' refid=%s' % (self.format_string(quote_attrib( + self.refid).encode(ExternalEncoding), input_name='refid'), )) + def exportChildren(self, outfile, level, namespace_='', name_='codelineType'): for highlight_ in self.highlight: highlight_.export(outfile, level, namespace_, name_='highlight') + def hasContent_(self): if ( self.highlight is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='codelineType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): if self.external is not None: showIndent(outfile, level) @@ -4196,6 +4773,7 @@ class codelineType(GeneratedsSuper): if self.refid is not None: showIndent(outfile, level) outfile.write('refid = %s,\n' % (self.refid,)) + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('highlight=[\n') @@ -4209,12 +4787,14 @@ class codelineType(GeneratedsSuper): level -= 1 showIndent(outfile, level) outfile.write('],\n') + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): if attrs.get('external'): self.external = attrs.get('external').value @@ -4227,9 +4807,10 @@ class codelineType(GeneratedsSuper): self.refkind = attrs.get('refkind').value if attrs.get('refid'): self.refid = attrs.get('refid').value + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'highlight': + nodeName_ == 'highlight': obj_ = highlightType.factory() obj_.build(child_) self.highlight.append(obj_) @@ -4239,6 +4820,7 @@ class codelineType(GeneratedsSuper): class highlightType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, classxx=None, sp=None, ref=None, mixedclass_=None, content_=None): self.classxx = classxx if mixedclass_ is None: @@ -4249,6 +4831,7 @@ class highlightType(GeneratedsSuper): self.content_ = [] else: self.content_ = content_ + def factory(*args_, **kwargs_): if highlightType.subclass: return highlightType.subclass(*args_, **kwargs_) @@ -4265,36 +4848,44 @@ class highlightType(GeneratedsSuper): def insert_ref(self, index, value): self.ref[index] = value def get_class(self): return self.classxx def set_class(self, classxx): self.classxx = classxx + def export(self, outfile, level, namespace_='', name_='highlightType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) - self.exportAttributes(outfile, level, namespace_, name_='highlightType') + self.exportAttributes(outfile, level, namespace_, + name_='highlightType') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('</%s%s>\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='highlightType'): if self.classxx is not None: outfile.write(' class=%s' % (quote_attrib(self.classxx), )) + def exportChildren(self, outfile, level, namespace_='', name_='highlightType'): for item_ in self.content_: item_.export(outfile, level, item_.name, namespace_) + def hasContent_(self): if ( self.sp is not None or self.ref is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='highlightType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): if self.classxx is not None: showIndent(outfile, level) outfile.write('classxx = "%s",\n' % (self.classxx,)) + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('content_ = [\n') @@ -4308,35 +4899,38 @@ class highlightType(GeneratedsSuper): item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): if attrs.get('class'): self.classxx = attrs.get('class').value + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'sp': + nodeName_ == 'sp': value_ = [] for text_ in child_.childNodes: value_.append(text_.nodeValue) valuestr_ = ''.join(value_) obj_ = self.mixedclass_(MixedContainer.CategorySimple, - MixedContainer.TypeString, 'sp', valuestr_) + MixedContainer.TypeString, 'sp', valuestr_) self.content_.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'ref': + nodeName_ == 'ref': childobj_ = docRefTextType.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, - MixedContainer.TypeNone, 'ref', childobj_) + MixedContainer.TypeNone, 'ref', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, - MixedContainer.TypeNone, '', child_.nodeValue) + MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) # end class highlightType @@ -4344,8 +4938,10 @@ class highlightType(GeneratedsSuper): class sp(GeneratedsSuper): subclass = None superclass = None + def __init__(self, valueOf_=''): self.valueOf_ = valueOf_ + def factory(*args_, **kwargs_): if sp.subclass: return sp.subclass(*args_, **kwargs_) @@ -4354,6 +4950,7 @@ class sp(GeneratedsSuper): factory = staticmethod(factory) def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='sp', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) @@ -4365,33 +4962,40 @@ class sp(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='sp'): pass + def exportChildren(self, outfile, level, namespace_='', name_='sp'): - if self.valueOf_.find('![CDATA')>-1: - value=quote_xml('%s' % self.valueOf_) - value=value.replace('![CDATA','<![CDATA') - value=value.replace(']]',']]>') + if self.valueOf_.find('![CDATA') > -1: + value = quote_xml('%s' % self.valueOf_) + value = value.replace('![CDATA', '<![CDATA') + value = value.replace(']]', ']]>') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): if ( self.valueOf_ is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='sp'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): pass + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) @@ -4399,19 +5003,22 @@ class sp(GeneratedsSuper): for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): pass + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: - self.valueOf_ += '![CDATA['+child_.nodeValue+']]' + self.valueOf_ += '![CDATA[' + child_.nodeValue + ']]' # end class sp class referenceType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, endline=None, startline=None, refid=None, compoundref=None, valueOf_='', mixedclass_=None, content_=None): self.endline = endline self.startline = startline @@ -4425,6 +5032,7 @@ class referenceType(GeneratedsSuper): self.content_ = [] else: self.content_ = content_ + def factory(*args_, **kwargs_): if referenceType.subclass: return referenceType.subclass(*args_, **kwargs_) @@ -4441,42 +5049,53 @@ class referenceType(GeneratedsSuper): def set_compoundref(self, compoundref): self.compoundref = compoundref def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='referenceType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) - self.exportAttributes(outfile, level, namespace_, name_='referenceType') + self.exportAttributes(outfile, level, namespace_, + name_='referenceType') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('</%s%s>\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='referenceType'): if self.endline is not None: - outfile.write(' endline="%s"' % self.format_integer(self.endline, input_name='endline')) + outfile.write(' endline="%s"' % self.format_integer( + self.endline, input_name='endline')) if self.startline is not None: - outfile.write(' startline="%s"' % self.format_integer(self.startline, input_name='startline')) + outfile.write(' startline="%s"' % self.format_integer( + self.startline, input_name='startline')) if self.refid is not None: - outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), )) + outfile.write(' refid=%s' % (self.format_string(quote_attrib( + self.refid).encode(ExternalEncoding), input_name='refid'), )) if self.compoundref is not None: - outfile.write(' compoundref=%s' % (self.format_string(quote_attrib(self.compoundref).encode(ExternalEncoding), input_name='compoundref'), )) + outfile.write(' compoundref=%s' % (self.format_string(quote_attrib( + self.compoundref).encode(ExternalEncoding), input_name='compoundref'), )) + def exportChildren(self, outfile, level, namespace_='', name_='referenceType'): - if self.valueOf_.find('![CDATA')>-1: - value=quote_xml('%s' % self.valueOf_) - value=value.replace('![CDATA','<![CDATA') - value=value.replace(']]',']]>') + if self.valueOf_.find('![CDATA') > -1: + value = quote_xml('%s' % self.valueOf_) + value = value.replace('![CDATA', '<![CDATA') + value = value.replace(']]', ']]>') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): if ( self.valueOf_ is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='referenceType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): if self.endline is not None: showIndent(outfile, level) @@ -4490,9 +5109,11 @@ class referenceType(GeneratedsSuper): if self.compoundref is not None: showIndent(outfile, level) outfile.write('compoundref = %s,\n' % (self.compoundref,)) + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) @@ -4500,6 +5121,7 @@ class referenceType(GeneratedsSuper): for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): if attrs.get('endline'): try: @@ -4515,21 +5137,23 @@ class referenceType(GeneratedsSuper): self.refid = attrs.get('refid').value if attrs.get('compoundref'): self.compoundref = attrs.get('compoundref').value + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, - MixedContainer.TypeNone, '', child_.nodeValue) + MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: - self.valueOf_ += '![CDATA['+child_.nodeValue+']]' + self.valueOf_ += '![CDATA[' + child_.nodeValue + ']]' # end class referenceType class locationType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, bodystart=None, line=None, bodyend=None, bodyfile=None, file=None, valueOf_=''): self.bodystart = bodystart self.line = line @@ -4537,6 +5161,7 @@ class locationType(GeneratedsSuper): self.bodyfile = bodyfile self.file = file self.valueOf_ = valueOf_ + def factory(*args_, **kwargs_): if locationType.subclass: return locationType.subclass(*args_, **kwargs_) @@ -4555,6 +5180,7 @@ class locationType(GeneratedsSuper): def set_file(self, file): self.file = file def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='locationType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) @@ -4566,37 +5192,47 @@ class locationType(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='locationType'): if self.bodystart is not None: - outfile.write(' bodystart="%s"' % self.format_integer(self.bodystart, input_name='bodystart')) + outfile.write(' bodystart="%s"' % self.format_integer( + self.bodystart, input_name='bodystart')) if self.line is not None: - outfile.write(' line="%s"' % self.format_integer(self.line, input_name='line')) + outfile.write(' line="%s"' % self.format_integer( + self.line, input_name='line')) if self.bodyend is not None: - outfile.write(' bodyend="%s"' % self.format_integer(self.bodyend, input_name='bodyend')) + outfile.write(' bodyend="%s"' % self.format_integer( + self.bodyend, input_name='bodyend')) if self.bodyfile is not None: - outfile.write(' bodyfile=%s' % (self.format_string(quote_attrib(self.bodyfile).encode(ExternalEncoding), input_name='bodyfile'), )) + outfile.write(' bodyfile=%s' % (self.format_string(quote_attrib( + self.bodyfile).encode(ExternalEncoding), input_name='bodyfile'), )) if self.file is not None: - outfile.write(' file=%s' % (self.format_string(quote_attrib(self.file).encode(ExternalEncoding), input_name='file'), )) + outfile.write(' file=%s' % (self.format_string(quote_attrib( + self.file).encode(ExternalEncoding), input_name='file'), )) + def exportChildren(self, outfile, level, namespace_='', name_='locationType'): - if self.valueOf_.find('![CDATA')>-1: - value=quote_xml('%s' % self.valueOf_) - value=value.replace('![CDATA','<![CDATA') - value=value.replace(']]',']]>') + if self.valueOf_.find('![CDATA') > -1: + value = quote_xml('%s' % self.valueOf_) + value = value.replace('![CDATA', '<![CDATA') + value = value.replace(']]', ']]>') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): if ( self.valueOf_ is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='locationType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): if self.bodystart is not None: showIndent(outfile, level) @@ -4613,9 +5249,11 @@ class locationType(GeneratedsSuper): if self.file is not None: showIndent(outfile, level) outfile.write('file = %s,\n' % (self.file,)) + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) @@ -4623,6 +5261,7 @@ class locationType(GeneratedsSuper): for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): if attrs.get('bodystart'): try: @@ -4643,17 +5282,19 @@ class locationType(GeneratedsSuper): self.bodyfile = attrs.get('bodyfile').value if attrs.get('file'): self.file = attrs.get('file').value + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: - self.valueOf_ += '![CDATA['+child_.nodeValue+']]' + self.valueOf_ += '![CDATA[' + child_.nodeValue + ']]' # end class locationType class docSect1Type(GeneratedsSuper): subclass = None superclass = None + def __init__(self, id=None, title=None, para=None, sect2=None, internal=None, mixedclass_=None, content_=None): self.id = id if mixedclass_ is None: @@ -4664,6 +5305,7 @@ class docSect1Type(GeneratedsSuper): self.content_ = [] else: self.content_ = content_ + def factory(*args_, **kwargs_): if docSect1Type.subclass: return docSect1Type.subclass(*args_, **kwargs_) @@ -4684,6 +5326,7 @@ class docSect1Type(GeneratedsSuper): def set_internal(self, internal): self.internal = internal def get_id(self): return self.id def set_id(self, id): self.id = id + def export(self, outfile, level, namespace_='', name_='docSect1Type', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) @@ -4691,31 +5334,38 @@ class docSect1Type(GeneratedsSuper): outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('</%s%s>\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='docSect1Type'): if self.id is not None: - outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), )) + outfile.write(' id=%s' % (self.format_string(quote_attrib( + self.id).encode(ExternalEncoding), input_name='id'), )) + def exportChildren(self, outfile, level, namespace_='', name_='docSect1Type'): for item_ in self.content_: item_.export(outfile, level, item_.name, namespace_) + def hasContent_(self): if ( self.title is not None or self.para is not None or self.sect2 is not None or self.internal is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='docSect1Type'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): if self.id is not None: showIndent(outfile, level) outfile.write('id = %s,\n' % (self.id,)) + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('content_ = [\n') @@ -4741,47 +5391,50 @@ class docSect1Type(GeneratedsSuper): item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): if attrs.get('id'): self.id = attrs.get('id').value + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'title': + nodeName_ == 'title': childobj_ = docTitleType.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, - MixedContainer.TypeNone, 'title', childobj_) + MixedContainer.TypeNone, 'title', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'para': + nodeName_ == 'para': childobj_ = docParaType.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, - MixedContainer.TypeNone, 'para', childobj_) + MixedContainer.TypeNone, 'para', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'sect2': + nodeName_ == 'sect2': childobj_ = docSect2Type.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, - MixedContainer.TypeNone, 'sect2', childobj_) + MixedContainer.TypeNone, 'sect2', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'internal': + nodeName_ == 'internal': childobj_ = docInternalS1Type.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, - MixedContainer.TypeNone, 'internal', childobj_) + MixedContainer.TypeNone, 'internal', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, - MixedContainer.TypeNone, '', child_.nodeValue) + MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) # end class docSect1Type @@ -4789,6 +5442,7 @@ class docSect1Type(GeneratedsSuper): class docSect2Type(GeneratedsSuper): subclass = None superclass = None + def __init__(self, id=None, title=None, para=None, sect3=None, internal=None, mixedclass_=None, content_=None): self.id = id if mixedclass_ is None: @@ -4799,6 +5453,7 @@ class docSect2Type(GeneratedsSuper): self.content_ = [] else: self.content_ = content_ + def factory(*args_, **kwargs_): if docSect2Type.subclass: return docSect2Type.subclass(*args_, **kwargs_) @@ -4819,6 +5474,7 @@ class docSect2Type(GeneratedsSuper): def set_internal(self, internal): self.internal = internal def get_id(self): return self.id def set_id(self, id): self.id = id + def export(self, outfile, level, namespace_='', name_='docSect2Type', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) @@ -4826,31 +5482,38 @@ class docSect2Type(GeneratedsSuper): outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('</%s%s>\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='docSect2Type'): if self.id is not None: - outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), )) + outfile.write(' id=%s' % (self.format_string(quote_attrib( + self.id).encode(ExternalEncoding), input_name='id'), )) + def exportChildren(self, outfile, level, namespace_='', name_='docSect2Type'): for item_ in self.content_: item_.export(outfile, level, item_.name, namespace_) + def hasContent_(self): if ( self.title is not None or self.para is not None or self.sect3 is not None or self.internal is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='docSect2Type'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): if self.id is not None: showIndent(outfile, level) outfile.write('id = %s,\n' % (self.id,)) + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('content_ = [\n') @@ -4876,47 +5539,50 @@ class docSect2Type(GeneratedsSuper): item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): if attrs.get('id'): self.id = attrs.get('id').value + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'title': + nodeName_ == 'title': childobj_ = docTitleType.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, - MixedContainer.TypeNone, 'title', childobj_) + MixedContainer.TypeNone, 'title', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'para': + nodeName_ == 'para': childobj_ = docParaType.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, - MixedContainer.TypeNone, 'para', childobj_) + MixedContainer.TypeNone, 'para', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'sect3': + nodeName_ == 'sect3': childobj_ = docSect3Type.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, - MixedContainer.TypeNone, 'sect3', childobj_) + MixedContainer.TypeNone, 'sect3', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'internal': + nodeName_ == 'internal': childobj_ = docInternalS2Type.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, - MixedContainer.TypeNone, 'internal', childobj_) + MixedContainer.TypeNone, 'internal', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, - MixedContainer.TypeNone, '', child_.nodeValue) + MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) # end class docSect2Type @@ -4924,6 +5590,7 @@ class docSect2Type(GeneratedsSuper): class docSect3Type(GeneratedsSuper): subclass = None superclass = None + def __init__(self, id=None, title=None, para=None, sect4=None, internal=None, mixedclass_=None, content_=None): self.id = id if mixedclass_ is None: @@ -4934,6 +5601,7 @@ class docSect3Type(GeneratedsSuper): self.content_ = [] else: self.content_ = content_ + def factory(*args_, **kwargs_): if docSect3Type.subclass: return docSect3Type.subclass(*args_, **kwargs_) @@ -4954,6 +5622,7 @@ class docSect3Type(GeneratedsSuper): def set_internal(self, internal): self.internal = internal def get_id(self): return self.id def set_id(self, id): self.id = id + def export(self, outfile, level, namespace_='', name_='docSect3Type', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) @@ -4961,31 +5630,38 @@ class docSect3Type(GeneratedsSuper): outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('</%s%s>\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='docSect3Type'): if self.id is not None: - outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), )) + outfile.write(' id=%s' % (self.format_string(quote_attrib( + self.id).encode(ExternalEncoding), input_name='id'), )) + def exportChildren(self, outfile, level, namespace_='', name_='docSect3Type'): for item_ in self.content_: item_.export(outfile, level, item_.name, namespace_) + def hasContent_(self): if ( self.title is not None or self.para is not None or self.sect4 is not None or self.internal is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='docSect3Type'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): if self.id is not None: showIndent(outfile, level) outfile.write('id = %s,\n' % (self.id,)) + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('content_ = [\n') @@ -5011,47 +5687,50 @@ class docSect3Type(GeneratedsSuper): item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): if attrs.get('id'): self.id = attrs.get('id').value + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'title': + nodeName_ == 'title': childobj_ = docTitleType.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, - MixedContainer.TypeNone, 'title', childobj_) + MixedContainer.TypeNone, 'title', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'para': + nodeName_ == 'para': childobj_ = docParaType.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, - MixedContainer.TypeNone, 'para', childobj_) + MixedContainer.TypeNone, 'para', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'sect4': + nodeName_ == 'sect4': childobj_ = docSect4Type.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, - MixedContainer.TypeNone, 'sect4', childobj_) + MixedContainer.TypeNone, 'sect4', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'internal': + nodeName_ == 'internal': childobj_ = docInternalS3Type.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, - MixedContainer.TypeNone, 'internal', childobj_) + MixedContainer.TypeNone, 'internal', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, - MixedContainer.TypeNone, '', child_.nodeValue) + MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) # end class docSect3Type @@ -5059,6 +5738,7 @@ class docSect3Type(GeneratedsSuper): class docSect4Type(GeneratedsSuper): subclass = None superclass = None + def __init__(self, id=None, title=None, para=None, internal=None, mixedclass_=None, content_=None): self.id = id if mixedclass_ is None: @@ -5069,6 +5749,7 @@ class docSect4Type(GeneratedsSuper): self.content_ = [] else: self.content_ = content_ + def factory(*args_, **kwargs_): if docSect4Type.subclass: return docSect4Type.subclass(*args_, **kwargs_) @@ -5085,6 +5766,7 @@ class docSect4Type(GeneratedsSuper): def set_internal(self, internal): self.internal = internal def get_id(self): return self.id def set_id(self, id): self.id = id + def export(self, outfile, level, namespace_='', name_='docSect4Type', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) @@ -5092,30 +5774,37 @@ class docSect4Type(GeneratedsSuper): outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('</%s%s>\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='docSect4Type'): if self.id is not None: - outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), )) + outfile.write(' id=%s' % (self.format_string(quote_attrib( + self.id).encode(ExternalEncoding), input_name='id'), )) + def exportChildren(self, outfile, level, namespace_='', name_='docSect4Type'): for item_ in self.content_: item_.export(outfile, level, item_.name, namespace_) + def hasContent_(self): if ( self.title is not None or self.para is not None or self.internal is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='docSect4Type'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): if self.id is not None: showIndent(outfile, level) outfile.write('id = %s,\n' % (self.id,)) + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('content_ = [\n') @@ -5135,40 +5824,43 @@ class docSect4Type(GeneratedsSuper): item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): if attrs.get('id'): self.id = attrs.get('id').value + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'title': + nodeName_ == 'title': childobj_ = docTitleType.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, - MixedContainer.TypeNone, 'title', childobj_) + MixedContainer.TypeNone, 'title', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'para': + nodeName_ == 'para': childobj_ = docParaType.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, - MixedContainer.TypeNone, 'para', childobj_) + MixedContainer.TypeNone, 'para', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'internal': + nodeName_ == 'internal': childobj_ = docInternalS4Type.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, - MixedContainer.TypeNone, 'internal', childobj_) + MixedContainer.TypeNone, 'internal', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, - MixedContainer.TypeNone, '', child_.nodeValue) + MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) # end class docSect4Type @@ -5176,6 +5868,7 @@ class docSect4Type(GeneratedsSuper): class docInternalType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, para=None, sect1=None, mixedclass_=None, content_=None): if mixedclass_ is None: self.mixedclass_ = MixedContainer @@ -5185,6 +5878,7 @@ class docInternalType(GeneratedsSuper): self.content_ = [] else: self.content_ = content_ + def factory(*args_, **kwargs_): if docInternalType.subclass: return docInternalType.subclass(*args_, **kwargs_) @@ -5199,33 +5893,41 @@ class docInternalType(GeneratedsSuper): def set_sect1(self, sect1): self.sect1 = sect1 def add_sect1(self, value): self.sect1.append(value) def insert_sect1(self, index, value): self.sect1[index] = value + def export(self, outfile, level, namespace_='', name_='docInternalType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) - self.exportAttributes(outfile, level, namespace_, name_='docInternalType') + self.exportAttributes(outfile, level, namespace_, + name_='docInternalType') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('</%s%s>\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='docInternalType'): pass + def exportChildren(self, outfile, level, namespace_='', name_='docInternalType'): for item_ in self.content_: item_.export(outfile, level, item_.name, namespace_) + def hasContent_(self): if ( self.para is not None or self.sect1 is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='docInternalType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): pass + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('content_ = [\n') @@ -5239,32 +5941,35 @@ class docInternalType(GeneratedsSuper): item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): pass + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'para': + nodeName_ == 'para': childobj_ = docParaType.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, - MixedContainer.TypeNone, 'para', childobj_) + MixedContainer.TypeNone, 'para', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'sect1': + nodeName_ == 'sect1': childobj_ = docSect1Type.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, - MixedContainer.TypeNone, 'sect1', childobj_) + MixedContainer.TypeNone, 'sect1', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, - MixedContainer.TypeNone, '', child_.nodeValue) + MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) # end class docInternalType @@ -5272,6 +5977,7 @@ class docInternalType(GeneratedsSuper): class docInternalS1Type(GeneratedsSuper): subclass = None superclass = None + def __init__(self, para=None, sect2=None, mixedclass_=None, content_=None): if mixedclass_ is None: self.mixedclass_ = MixedContainer @@ -5281,6 +5987,7 @@ class docInternalS1Type(GeneratedsSuper): self.content_ = [] else: self.content_ = content_ + def factory(*args_, **kwargs_): if docInternalS1Type.subclass: return docInternalS1Type.subclass(*args_, **kwargs_) @@ -5295,33 +6002,41 @@ class docInternalS1Type(GeneratedsSuper): def set_sect2(self, sect2): self.sect2 = sect2 def add_sect2(self, value): self.sect2.append(value) def insert_sect2(self, index, value): self.sect2[index] = value + def export(self, outfile, level, namespace_='', name_='docInternalS1Type', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) - self.exportAttributes(outfile, level, namespace_, name_='docInternalS1Type') + self.exportAttributes(outfile, level, namespace_, + name_='docInternalS1Type') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('</%s%s>\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='docInternalS1Type'): pass + def exportChildren(self, outfile, level, namespace_='', name_='docInternalS1Type'): for item_ in self.content_: item_.export(outfile, level, item_.name, namespace_) + def hasContent_(self): if ( self.para is not None or self.sect2 is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='docInternalS1Type'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): pass + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('content_ = [\n') @@ -5335,32 +6050,35 @@ class docInternalS1Type(GeneratedsSuper): item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): pass + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'para': + nodeName_ == 'para': childobj_ = docParaType.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, - MixedContainer.TypeNone, 'para', childobj_) + MixedContainer.TypeNone, 'para', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'sect2': + nodeName_ == 'sect2': childobj_ = docSect2Type.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, - MixedContainer.TypeNone, 'sect2', childobj_) + MixedContainer.TypeNone, 'sect2', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, - MixedContainer.TypeNone, '', child_.nodeValue) + MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) # end class docInternalS1Type @@ -5368,6 +6086,7 @@ class docInternalS1Type(GeneratedsSuper): class docInternalS2Type(GeneratedsSuper): subclass = None superclass = None + def __init__(self, para=None, sect3=None, mixedclass_=None, content_=None): if mixedclass_ is None: self.mixedclass_ = MixedContainer @@ -5377,6 +6096,7 @@ class docInternalS2Type(GeneratedsSuper): self.content_ = [] else: self.content_ = content_ + def factory(*args_, **kwargs_): if docInternalS2Type.subclass: return docInternalS2Type.subclass(*args_, **kwargs_) @@ -5391,33 +6111,41 @@ class docInternalS2Type(GeneratedsSuper): def set_sect3(self, sect3): self.sect3 = sect3 def add_sect3(self, value): self.sect3.append(value) def insert_sect3(self, index, value): self.sect3[index] = value + def export(self, outfile, level, namespace_='', name_='docInternalS2Type', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) - self.exportAttributes(outfile, level, namespace_, name_='docInternalS2Type') + self.exportAttributes(outfile, level, namespace_, + name_='docInternalS2Type') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('</%s%s>\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='docInternalS2Type'): pass + def exportChildren(self, outfile, level, namespace_='', name_='docInternalS2Type'): for item_ in self.content_: item_.export(outfile, level, item_.name, namespace_) + def hasContent_(self): if ( self.para is not None or self.sect3 is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='docInternalS2Type'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): pass + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('content_ = [\n') @@ -5431,32 +6159,35 @@ class docInternalS2Type(GeneratedsSuper): item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): pass + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'para': + nodeName_ == 'para': childobj_ = docParaType.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, - MixedContainer.TypeNone, 'para', childobj_) + MixedContainer.TypeNone, 'para', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'sect3': + nodeName_ == 'sect3': childobj_ = docSect3Type.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, - MixedContainer.TypeNone, 'sect3', childobj_) + MixedContainer.TypeNone, 'sect3', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, - MixedContainer.TypeNone, '', child_.nodeValue) + MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) # end class docInternalS2Type @@ -5464,6 +6195,7 @@ class docInternalS2Type(GeneratedsSuper): class docInternalS3Type(GeneratedsSuper): subclass = None superclass = None + def __init__(self, para=None, sect3=None, mixedclass_=None, content_=None): if mixedclass_ is None: self.mixedclass_ = MixedContainer @@ -5473,6 +6205,7 @@ class docInternalS3Type(GeneratedsSuper): self.content_ = [] else: self.content_ = content_ + def factory(*args_, **kwargs_): if docInternalS3Type.subclass: return docInternalS3Type.subclass(*args_, **kwargs_) @@ -5487,33 +6220,41 @@ class docInternalS3Type(GeneratedsSuper): def set_sect3(self, sect3): self.sect3 = sect3 def add_sect3(self, value): self.sect3.append(value) def insert_sect3(self, index, value): self.sect3[index] = value + def export(self, outfile, level, namespace_='', name_='docInternalS3Type', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) - self.exportAttributes(outfile, level, namespace_, name_='docInternalS3Type') + self.exportAttributes(outfile, level, namespace_, + name_='docInternalS3Type') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('</%s%s>\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='docInternalS3Type'): pass + def exportChildren(self, outfile, level, namespace_='', name_='docInternalS3Type'): for item_ in self.content_: item_.export(outfile, level, item_.name, namespace_) + def hasContent_(self): if ( self.para is not None or self.sect3 is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='docInternalS3Type'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): pass + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('content_ = [\n') @@ -5527,32 +6268,35 @@ class docInternalS3Type(GeneratedsSuper): item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): pass + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'para': + nodeName_ == 'para': childobj_ = docParaType.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, - MixedContainer.TypeNone, 'para', childobj_) + MixedContainer.TypeNone, 'para', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'sect3': + nodeName_ == 'sect3': childobj_ = docSect4Type.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, - MixedContainer.TypeNone, 'sect3', childobj_) + MixedContainer.TypeNone, 'sect3', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, - MixedContainer.TypeNone, '', child_.nodeValue) + MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) # end class docInternalS3Type @@ -5560,6 +6304,7 @@ class docInternalS3Type(GeneratedsSuper): class docInternalS4Type(GeneratedsSuper): subclass = None superclass = None + def __init__(self, para=None, mixedclass_=None, content_=None): if mixedclass_ is None: self.mixedclass_ = MixedContainer @@ -5569,6 +6314,7 @@ class docInternalS4Type(GeneratedsSuper): self.content_ = [] else: self.content_ = content_ + def factory(*args_, **kwargs_): if docInternalS4Type.subclass: return docInternalS4Type.subclass(*args_, **kwargs_) @@ -5579,32 +6325,40 @@ class docInternalS4Type(GeneratedsSuper): def set_para(self, para): self.para = para def add_para(self, value): self.para.append(value) def insert_para(self, index, value): self.para[index] = value + def export(self, outfile, level, namespace_='', name_='docInternalS4Type', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) - self.exportAttributes(outfile, level, namespace_, name_='docInternalS4Type') + self.exportAttributes(outfile, level, namespace_, + name_='docInternalS4Type') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('</%s%s>\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='docInternalS4Type'): pass + def exportChildren(self, outfile, level, namespace_='', name_='docInternalS4Type'): for item_ in self.content_: item_.export(outfile, level, item_.name, namespace_) + def hasContent_(self): if ( self.para is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='docInternalS4Type'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): pass + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('content_ = [\n') @@ -5612,25 +6366,28 @@ class docInternalS4Type(GeneratedsSuper): item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): pass + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'para': + nodeName_ == 'para': childobj_ = docParaType.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, - MixedContainer.TypeNone, 'para', childobj_) + MixedContainer.TypeNone, 'para', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, - MixedContainer.TypeNone, '', child_.nodeValue) + MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) # end class docInternalS4Type @@ -5638,6 +6395,7 @@ class docInternalS4Type(GeneratedsSuper): class docTitleType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, valueOf_='', mixedclass_=None, content_=None): if mixedclass_ is None: self.mixedclass_ = MixedContainer @@ -5647,6 +6405,7 @@ class docTitleType(GeneratedsSuper): self.content_ = [] else: self.content_ = content_ + def factory(*args_, **kwargs_): if docTitleType.subclass: return docTitleType.subclass(*args_, **kwargs_) @@ -5655,6 +6414,7 @@ class docTitleType(GeneratedsSuper): factory = staticmethod(factory) def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='docTitleType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) @@ -5662,33 +6422,40 @@ class docTitleType(GeneratedsSuper): outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('</%s%s>\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='docTitleType'): pass + def exportChildren(self, outfile, level, namespace_='', name_='docTitleType'): - if self.valueOf_.find('![CDATA')>-1: - value=quote_xml('%s' % self.valueOf_) - value=value.replace('![CDATA','<![CDATA') - value=value.replace(']]',']]>') + if self.valueOf_.find('![CDATA') > -1: + value = quote_xml('%s' % self.valueOf_) + value = value.replace('![CDATA', '<![CDATA') + value = value.replace(']]', ']]>') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): if ( self.valueOf_ is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='docTitleType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): pass + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) @@ -5696,23 +6463,26 @@ class docTitleType(GeneratedsSuper): for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): pass + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, - MixedContainer.TypeNone, '', child_.nodeValue) + MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: - self.valueOf_ += '![CDATA['+child_.nodeValue+']]' + self.valueOf_ += '![CDATA[' + child_.nodeValue + ']]' # end class docTitleType class docParaType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, valueOf_='', mixedclass_=None, content_=None): if mixedclass_ is None: self.mixedclass_ = MixedContainer @@ -5722,6 +6492,7 @@ class docParaType(GeneratedsSuper): self.content_ = [] else: self.content_ = content_ + def factory(*args_, **kwargs_): if docParaType.subclass: return docParaType.subclass(*args_, **kwargs_) @@ -5730,6 +6501,7 @@ class docParaType(GeneratedsSuper): factory = staticmethod(factory) def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='docParaType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) @@ -5737,33 +6509,40 @@ class docParaType(GeneratedsSuper): outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('</%s%s>\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='docParaType'): pass + def exportChildren(self, outfile, level, namespace_='', name_='docParaType'): - if self.valueOf_.find('![CDATA')>-1: - value=quote_xml('%s' % self.valueOf_) - value=value.replace('![CDATA','<![CDATA') - value=value.replace(']]',']]>') + if self.valueOf_.find('![CDATA') > -1: + value = quote_xml('%s' % self.valueOf_) + value = value.replace('![CDATA', '<![CDATA') + value = value.replace(']]', ']]>') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): if ( self.valueOf_ is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='docParaType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): pass + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) @@ -5771,23 +6550,26 @@ class docParaType(GeneratedsSuper): for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): pass + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, - MixedContainer.TypeNone, '', child_.nodeValue) + MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: - self.valueOf_ += '![CDATA['+child_.nodeValue+']]' + self.valueOf_ += '![CDATA[' + child_.nodeValue + ']]' # end class docParaType class docMarkupType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, valueOf_='', mixedclass_=None, content_=None): if mixedclass_ is None: self.mixedclass_ = MixedContainer @@ -5797,6 +6579,7 @@ class docMarkupType(GeneratedsSuper): self.content_ = [] else: self.content_ = content_ + def factory(*args_, **kwargs_): if docMarkupType.subclass: return docMarkupType.subclass(*args_, **kwargs_) @@ -5805,40 +6588,49 @@ class docMarkupType(GeneratedsSuper): factory = staticmethod(factory) def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='docMarkupType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) - self.exportAttributes(outfile, level, namespace_, name_='docMarkupType') + self.exportAttributes(outfile, level, namespace_, + name_='docMarkupType') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('</%s%s>\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='docMarkupType'): pass + def exportChildren(self, outfile, level, namespace_='', name_='docMarkupType'): - if self.valueOf_.find('![CDATA')>-1: - value=quote_xml('%s' % self.valueOf_) - value=value.replace('![CDATA','<![CDATA') - value=value.replace(']]',']]>') + if self.valueOf_.find('![CDATA') > -1: + value = quote_xml('%s' % self.valueOf_) + value = value.replace('![CDATA', '<![CDATA') + value = value.replace(']]', ']]>') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): if ( self.valueOf_ is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='docMarkupType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): pass + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) @@ -5846,23 +6638,26 @@ class docMarkupType(GeneratedsSuper): for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): pass + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, - MixedContainer.TypeNone, '', child_.nodeValue) + MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: - self.valueOf_ += '![CDATA['+child_.nodeValue+']]' + self.valueOf_ += '![CDATA[' + child_.nodeValue + ']]' # end class docMarkupType class docURLLink(GeneratedsSuper): subclass = None superclass = None + def __init__(self, url=None, valueOf_='', mixedclass_=None, content_=None): self.url = url if mixedclass_ is None: @@ -5873,6 +6668,7 @@ class docURLLink(GeneratedsSuper): self.content_ = [] else: self.content_ = content_ + def factory(*args_, **kwargs_): if docURLLink.subclass: return docURLLink.subclass(*args_, **kwargs_) @@ -5883,6 +6679,7 @@ class docURLLink(GeneratedsSuper): def set_url(self, url): self.url = url def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='docURLLink', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) @@ -5890,36 +6687,44 @@ class docURLLink(GeneratedsSuper): outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('</%s%s>\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='docURLLink'): if self.url is not None: - outfile.write(' url=%s' % (self.format_string(quote_attrib(self.url).encode(ExternalEncoding), input_name='url'), )) + outfile.write(' url=%s' % (self.format_string(quote_attrib( + self.url).encode(ExternalEncoding), input_name='url'), )) + def exportChildren(self, outfile, level, namespace_='', name_='docURLLink'): - if self.valueOf_.find('![CDATA')>-1: - value=quote_xml('%s' % self.valueOf_) - value=value.replace('![CDATA','<![CDATA') - value=value.replace(']]',']]>') + if self.valueOf_.find('![CDATA') > -1: + value = quote_xml('%s' % self.valueOf_) + value = value.replace('![CDATA', '<![CDATA') + value = value.replace(']]', ']]>') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): if ( self.valueOf_ is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='docURLLink'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): if self.url is not None: showIndent(outfile, level) outfile.write('url = %s,\n' % (self.url,)) + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) @@ -5927,24 +6732,27 @@ class docURLLink(GeneratedsSuper): for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): if attrs.get('url'): self.url = attrs.get('url').value + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, - MixedContainer.TypeNone, '', child_.nodeValue) + MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: - self.valueOf_ += '![CDATA['+child_.nodeValue+']]' + self.valueOf_ += '![CDATA[' + child_.nodeValue + ']]' # end class docURLLink class docAnchorType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, id=None, valueOf_='', mixedclass_=None, content_=None): self.id = id if mixedclass_ is None: @@ -5955,6 +6763,7 @@ class docAnchorType(GeneratedsSuper): self.content_ = [] else: self.content_ = content_ + def factory(*args_, **kwargs_): if docAnchorType.subclass: return docAnchorType.subclass(*args_, **kwargs_) @@ -5965,43 +6774,53 @@ class docAnchorType(GeneratedsSuper): def set_id(self, id): self.id = id def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='docAnchorType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) - self.exportAttributes(outfile, level, namespace_, name_='docAnchorType') + self.exportAttributes(outfile, level, namespace_, + name_='docAnchorType') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('</%s%s>\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='docAnchorType'): if self.id is not None: - outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), )) + outfile.write(' id=%s' % (self.format_string(quote_attrib( + self.id).encode(ExternalEncoding), input_name='id'), )) + def exportChildren(self, outfile, level, namespace_='', name_='docAnchorType'): - if self.valueOf_.find('![CDATA')>-1: - value=quote_xml('%s' % self.valueOf_) - value=value.replace('![CDATA','<![CDATA') - value=value.replace(']]',']]>') + if self.valueOf_.find('![CDATA') > -1: + value = quote_xml('%s' % self.valueOf_) + value = value.replace('![CDATA', '<![CDATA') + value = value.replace(']]', ']]>') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): if ( self.valueOf_ is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='docAnchorType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): if self.id is not None: showIndent(outfile, level) outfile.write('id = %s,\n' % (self.id,)) + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) @@ -6009,24 +6828,27 @@ class docAnchorType(GeneratedsSuper): for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): if attrs.get('id'): self.id = attrs.get('id').value + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, - MixedContainer.TypeNone, '', child_.nodeValue) + MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: - self.valueOf_ += '![CDATA['+child_.nodeValue+']]' + self.valueOf_ += '![CDATA[' + child_.nodeValue + ']]' # end class docAnchorType class docFormulaType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, id=None, valueOf_='', mixedclass_=None, content_=None): self.id = id if mixedclass_ is None: @@ -6037,6 +6859,7 @@ class docFormulaType(GeneratedsSuper): self.content_ = [] else: self.content_ = content_ + def factory(*args_, **kwargs_): if docFormulaType.subclass: return docFormulaType.subclass(*args_, **kwargs_) @@ -6047,43 +6870,53 @@ class docFormulaType(GeneratedsSuper): def set_id(self, id): self.id = id def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='docFormulaType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) - self.exportAttributes(outfile, level, namespace_, name_='docFormulaType') + self.exportAttributes(outfile, level, namespace_, + name_='docFormulaType') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('</%s%s>\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='docFormulaType'): if self.id is not None: - outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), )) + outfile.write(' id=%s' % (self.format_string(quote_attrib( + self.id).encode(ExternalEncoding), input_name='id'), )) + def exportChildren(self, outfile, level, namespace_='', name_='docFormulaType'): - if self.valueOf_.find('![CDATA')>-1: - value=quote_xml('%s' % self.valueOf_) - value=value.replace('![CDATA','<![CDATA') - value=value.replace(']]',']]>') + if self.valueOf_.find('![CDATA') > -1: + value = quote_xml('%s' % self.valueOf_) + value = value.replace('![CDATA', '<![CDATA') + value = value.replace(']]', ']]>') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): if ( self.valueOf_ is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='docFormulaType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): if self.id is not None: showIndent(outfile, level) outfile.write('id = %s,\n' % (self.id,)) + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) @@ -6091,27 +6924,31 @@ class docFormulaType(GeneratedsSuper): for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): if attrs.get('id'): self.id = attrs.get('id').value + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, - MixedContainer.TypeNone, '', child_.nodeValue) + MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: - self.valueOf_ += '![CDATA['+child_.nodeValue+']]' + self.valueOf_ += '![CDATA[' + child_.nodeValue + ']]' # end class docFormulaType class docIndexEntryType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, primaryie=None, secondaryie=None): self.primaryie = primaryie self.secondaryie = secondaryie + def factory(*args_, **kwargs_): if docIndexEntryType.subclass: return docIndexEntryType.subclass(*args_, **kwargs_) @@ -6122,10 +6959,12 @@ class docIndexEntryType(GeneratedsSuper): def set_primaryie(self, primaryie): self.primaryie = primaryie def get_secondaryie(self): return self.secondaryie def set_secondaryie(self, secondaryie): self.secondaryie = secondaryie + def export(self, outfile, level, namespace_='', name_='docIndexEntryType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) - self.exportAttributes(outfile, level, namespace_, name_='docIndexEntryType') + self.exportAttributes(outfile, level, namespace_, + name_='docIndexEntryType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) @@ -6133,52 +6972,65 @@ class docIndexEntryType(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='docIndexEntryType'): pass + def exportChildren(self, outfile, level, namespace_='', name_='docIndexEntryType'): if self.primaryie is not None: showIndent(outfile, level) - outfile.write('<%sprimaryie>%s</%sprimaryie>\n' % (namespace_, self.format_string(quote_xml(self.primaryie).encode(ExternalEncoding), input_name='primaryie'), namespace_)) + outfile.write('<%sprimaryie>%s</%sprimaryie>\n' % (namespace_, self.format_string( + quote_xml(self.primaryie).encode(ExternalEncoding), input_name='primaryie'), namespace_)) if self.secondaryie is not None: showIndent(outfile, level) - outfile.write('<%ssecondaryie>%s</%ssecondaryie>\n' % (namespace_, self.format_string(quote_xml(self.secondaryie).encode(ExternalEncoding), input_name='secondaryie'), namespace_)) + outfile.write('<%ssecondaryie>%s</%ssecondaryie>\n' % (namespace_, self.format_string( + quote_xml(self.secondaryie).encode(ExternalEncoding), input_name='secondaryie'), namespace_)) + def hasContent_(self): if ( self.primaryie is not None or self.secondaryie is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='docIndexEntryType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): pass + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) - outfile.write('primaryie=%s,\n' % quote_python(self.primaryie).encode(ExternalEncoding)) + outfile.write('primaryie=%s,\n' % quote_python( + self.primaryie).encode(ExternalEncoding)) showIndent(outfile, level) - outfile.write('secondaryie=%s,\n' % quote_python(self.secondaryie).encode(ExternalEncoding)) + outfile.write('secondaryie=%s,\n' % quote_python( + self.secondaryie).encode(ExternalEncoding)) + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): pass + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'primaryie': + nodeName_ == 'primaryie': primaryie_ = '' for text__content_ in child_.childNodes: primaryie_ += text__content_.nodeValue self.primaryie = primaryie_ elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'secondaryie': + nodeName_ == 'secondaryie': secondaryie_ = '' for text__content_ in child_.childNodes: secondaryie_ += text__content_.nodeValue @@ -6189,11 +7041,13 @@ class docIndexEntryType(GeneratedsSuper): class docListType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, listitem=None): if listitem is None: self.listitem = [] else: self.listitem = listitem + def factory(*args_, **kwargs_): if docListType.subclass: return docListType.subclass(*args_, **kwargs_) @@ -6204,6 +7058,7 @@ class docListType(GeneratedsSuper): def set_listitem(self, listitem): self.listitem = listitem def add_listitem(self, value): self.listitem.append(value) def insert_listitem(self, index, value): self.listitem[index] = value + def export(self, outfile, level, namespace_='', name_='docListType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) @@ -6215,25 +7070,31 @@ class docListType(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='docListType'): pass + def exportChildren(self, outfile, level, namespace_='', name_='docListType'): for listitem_ in self.listitem: listitem_.export(outfile, level, namespace_, name_='listitem') + def hasContent_(self): if ( self.listitem is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='docListType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): pass + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('listitem=[\n') @@ -6247,17 +7108,20 @@ class docListType(GeneratedsSuper): level -= 1 showIndent(outfile, level) outfile.write('],\n') + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): pass + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'listitem': + nodeName_ == 'listitem': obj_ = docListItemType.factory() obj_.build(child_) self.listitem.append(obj_) @@ -6267,11 +7131,13 @@ class docListType(GeneratedsSuper): class docListItemType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, para=None): if para is None: self.para = [] else: self.para = para + def factory(*args_, **kwargs_): if docListItemType.subclass: return docListItemType.subclass(*args_, **kwargs_) @@ -6282,10 +7148,12 @@ class docListItemType(GeneratedsSuper): def set_para(self, para): self.para = para def add_para(self, value): self.para.append(value) def insert_para(self, index, value): self.para[index] = value + def export(self, outfile, level, namespace_='', name_='docListItemType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) - self.exportAttributes(outfile, level, namespace_, name_='docListItemType') + self.exportAttributes(outfile, level, namespace_, + name_='docListItemType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) @@ -6293,25 +7161,31 @@ class docListItemType(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='docListItemType'): pass + def exportChildren(self, outfile, level, namespace_='', name_='docListItemType'): for para_ in self.para: para_.export(outfile, level, namespace_, name_='para') + def hasContent_(self): if ( self.para is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='docListItemType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): pass + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('para=[\n') @@ -6325,17 +7199,20 @@ class docListItemType(GeneratedsSuper): level -= 1 showIndent(outfile, level) outfile.write('],\n') + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): pass + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'para': + nodeName_ == 'para': obj_ = docParaType.factory() obj_.build(child_) self.para.append(obj_) @@ -6345,6 +7222,7 @@ class docListItemType(GeneratedsSuper): class docSimpleSectType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, kind=None, title=None, para=None): self.kind = kind self.title = title @@ -6352,6 +7230,7 @@ class docSimpleSectType(GeneratedsSuper): self.para = [] else: self.para = para + def factory(*args_, **kwargs_): if docSimpleSectType.subclass: return docSimpleSectType.subclass(*args_, **kwargs_) @@ -6366,10 +7245,12 @@ class docSimpleSectType(GeneratedsSuper): def insert_para(self, index, value): self.para[index] = value def get_kind(self): return self.kind def set_kind(self, kind): self.kind = kind + def export(self, outfile, level, namespace_='', name_='docSimpleSectType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) - self.exportAttributes(outfile, level, namespace_, name_='docSimpleSectType') + self.exportAttributes(outfile, level, namespace_, + name_='docSimpleSectType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) @@ -6377,31 +7258,37 @@ class docSimpleSectType(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='docSimpleSectType'): if self.kind is not None: outfile.write(' kind=%s' % (quote_attrib(self.kind), )) + def exportChildren(self, outfile, level, namespace_='', name_='docSimpleSectType'): if self.title: self.title.export(outfile, level, namespace_, name_='title') for para_ in self.para: para_.export(outfile, level, namespace_, name_='para') + def hasContent_(self): if ( self.title is not None or self.para is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='docSimpleSectType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): if self.kind is not None: showIndent(outfile, level) outfile.write('kind = "%s",\n' % (self.kind,)) + def exportLiteralChildren(self, outfile, level, name_): if self.title: showIndent(outfile, level) @@ -6421,23 +7308,26 @@ class docSimpleSectType(GeneratedsSuper): level -= 1 showIndent(outfile, level) outfile.write('],\n') + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): if attrs.get('kind'): self.kind = attrs.get('kind').value + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'title': + nodeName_ == 'title': obj_ = docTitleType.factory() obj_.build(child_) self.set_title(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'para': + nodeName_ == 'para': obj_ = docParaType.factory() obj_.build(child_) self.para.append(obj_) @@ -6447,8 +7337,10 @@ class docSimpleSectType(GeneratedsSuper): class docVarListEntryType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, term=None): self.term = term + def factory(*args_, **kwargs_): if docVarListEntryType.subclass: return docVarListEntryType.subclass(*args_, **kwargs_) @@ -6457,10 +7349,12 @@ class docVarListEntryType(GeneratedsSuper): factory = staticmethod(factory) def get_term(self): return self.term def set_term(self, term): self.term = term + def export(self, outfile, level, namespace_='', name_='docVarListEntryType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) - self.exportAttributes(outfile, level, namespace_, name_='docVarListEntryType') + self.exportAttributes(outfile, level, namespace_, + name_='docVarListEntryType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) @@ -6468,25 +7362,31 @@ class docVarListEntryType(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='docVarListEntryType'): pass + def exportChildren(self, outfile, level, namespace_='', name_='docVarListEntryType'): if self.term: self.term.export(outfile, level, namespace_, name_='term', ) + def hasContent_(self): if ( self.term is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='docVarListEntryType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): pass + def exportLiteralChildren(self, outfile, level, name_): if self.term: showIndent(outfile, level) @@ -6494,17 +7394,20 @@ class docVarListEntryType(GeneratedsSuper): self.term.exportLiteral(outfile, level, name_='term') showIndent(outfile, level) outfile.write('),\n') + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): pass + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'term': + nodeName_ == 'term': obj_ = docTitleType.factory() obj_.build(child_) self.set_term(obj_) @@ -6514,8 +7417,10 @@ class docVarListEntryType(GeneratedsSuper): class docVariableListType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, valueOf_=''): self.valueOf_ = valueOf_ + def factory(*args_, **kwargs_): if docVariableListType.subclass: return docVariableListType.subclass(*args_, **kwargs_) @@ -6524,10 +7429,12 @@ class docVariableListType(GeneratedsSuper): factory = staticmethod(factory) def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='docVariableListType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) - self.exportAttributes(outfile, level, namespace_, name_='docVariableListType') + self.exportAttributes(outfile, level, namespace_, + name_='docVariableListType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) @@ -6535,33 +7442,40 @@ class docVariableListType(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='docVariableListType'): pass + def exportChildren(self, outfile, level, namespace_='', name_='docVariableListType'): - if self.valueOf_.find('![CDATA')>-1: - value=quote_xml('%s' % self.valueOf_) - value=value.replace('![CDATA','<![CDATA') - value=value.replace(']]',']]>') + if self.valueOf_.find('![CDATA') > -1: + value = quote_xml('%s' % self.valueOf_) + value = value.replace('![CDATA', '<![CDATA') + value = value.replace(']]', ']]>') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): if ( self.valueOf_ is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='docVariableListType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): pass + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) @@ -6569,19 +7483,22 @@ class docVariableListType(GeneratedsSuper): for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): pass + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: - self.valueOf_ += '![CDATA['+child_.nodeValue+']]' + self.valueOf_ += '![CDATA[' + child_.nodeValue + ']]' # end class docVariableListType class docRefTextType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, refid=None, kindref=None, external=None, valueOf_='', mixedclass_=None, content_=None): self.refid = refid self.kindref = kindref @@ -6594,6 +7511,7 @@ class docRefTextType(GeneratedsSuper): self.content_ = [] else: self.content_ = content_ + def factory(*args_, **kwargs_): if docRefTextType.subclass: return docRefTextType.subclass(*args_, **kwargs_) @@ -6608,40 +7526,49 @@ class docRefTextType(GeneratedsSuper): def set_external(self, external): self.external = external def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='docRefTextType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) - self.exportAttributes(outfile, level, namespace_, name_='docRefTextType') + self.exportAttributes(outfile, level, namespace_, + name_='docRefTextType') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('</%s%s>\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='docRefTextType'): if self.refid is not None: - outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), )) + outfile.write(' refid=%s' % (self.format_string(quote_attrib( + self.refid).encode(ExternalEncoding), input_name='refid'), )) if self.kindref is not None: outfile.write(' kindref=%s' % (quote_attrib(self.kindref), )) if self.external is not None: - outfile.write(' external=%s' % (self.format_string(quote_attrib(self.external).encode(ExternalEncoding), input_name='external'), )) + outfile.write(' external=%s' % (self.format_string(quote_attrib( + self.external).encode(ExternalEncoding), input_name='external'), )) + def exportChildren(self, outfile, level, namespace_='', name_='docRefTextType'): - if self.valueOf_.find('![CDATA')>-1: - value=quote_xml('%s' % self.valueOf_) - value=value.replace('![CDATA','<![CDATA') - value=value.replace(']]',']]>') + if self.valueOf_.find('![CDATA') > -1: + value = quote_xml('%s' % self.valueOf_) + value = value.replace('![CDATA', '<![CDATA') + value = value.replace(']]', ']]>') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): if ( self.valueOf_ is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='docRefTextType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): if self.refid is not None: showIndent(outfile, level) @@ -6652,9 +7579,11 @@ class docRefTextType(GeneratedsSuper): if self.external is not None: showIndent(outfile, level) outfile.write('external = %s,\n' % (self.external,)) + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) @@ -6662,6 +7591,7 @@ class docRefTextType(GeneratedsSuper): for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): if attrs.get('refid'): self.refid = attrs.get('refid').value @@ -6669,21 +7599,23 @@ class docRefTextType(GeneratedsSuper): self.kindref = attrs.get('kindref').value if attrs.get('external'): self.external = attrs.get('external').value + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, - MixedContainer.TypeNone, '', child_.nodeValue) + MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: - self.valueOf_ += '![CDATA['+child_.nodeValue+']]' + self.valueOf_ += '![CDATA[' + child_.nodeValue + ']]' # end class docRefTextType class docTableType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, rows=None, cols=None, row=None, caption=None): self.rows = rows self.cols = cols @@ -6692,6 +7624,7 @@ class docTableType(GeneratedsSuper): else: self.row = row self.caption = caption + def factory(*args_, **kwargs_): if docTableType.subclass: return docTableType.subclass(*args_, **kwargs_) @@ -6708,6 +7641,7 @@ class docTableType(GeneratedsSuper): def set_rows(self, rows): self.rows = rows def get_cols(self): return self.cols def set_cols(self, cols): self.cols = cols + def export(self, outfile, level, namespace_='', name_='docTableType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) @@ -6719,29 +7653,36 @@ class docTableType(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='docTableType'): if self.rows is not None: - outfile.write(' rows="%s"' % self.format_integer(self.rows, input_name='rows')) + outfile.write(' rows="%s"' % self.format_integer( + self.rows, input_name='rows')) if self.cols is not None: - outfile.write(' cols="%s"' % self.format_integer(self.cols, input_name='cols')) + outfile.write(' cols="%s"' % self.format_integer( + self.cols, input_name='cols')) + def exportChildren(self, outfile, level, namespace_='', name_='docTableType'): for row_ in self.row: row_.export(outfile, level, namespace_, name_='row') if self.caption: self.caption.export(outfile, level, namespace_, name_='caption') + def hasContent_(self): if ( self.row is not None or self.caption is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='docTableType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): if self.rows is not None: showIndent(outfile, level) @@ -6749,6 +7690,7 @@ class docTableType(GeneratedsSuper): if self.cols is not None: showIndent(outfile, level) outfile.write('cols = %s,\n' % (self.cols,)) + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('row=[\n') @@ -6768,12 +7710,14 @@ class docTableType(GeneratedsSuper): self.caption.exportLiteral(outfile, level, name_='caption') showIndent(outfile, level) outfile.write('),\n') + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): if attrs.get('rows'): try: @@ -6785,14 +7729,15 @@ class docTableType(GeneratedsSuper): self.cols = int(attrs.get('cols').value) except ValueError as exp: raise ValueError('Bad integer attribute (cols): %s' % exp) + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'row': + nodeName_ == 'row': obj_ = docRowType.factory() obj_.build(child_) self.row.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'caption': + nodeName_ == 'caption': obj_ = docCaptionType.factory() obj_.build(child_) self.set_caption(obj_) @@ -6802,11 +7747,13 @@ class docTableType(GeneratedsSuper): class docRowType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, entry=None): if entry is None: self.entry = [] else: self.entry = entry + def factory(*args_, **kwargs_): if docRowType.subclass: return docRowType.subclass(*args_, **kwargs_) @@ -6817,6 +7764,7 @@ class docRowType(GeneratedsSuper): def set_entry(self, entry): self.entry = entry def add_entry(self, value): self.entry.append(value) def insert_entry(self, index, value): self.entry[index] = value + def export(self, outfile, level, namespace_='', name_='docRowType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) @@ -6828,25 +7776,31 @@ class docRowType(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='docRowType'): pass + def exportChildren(self, outfile, level, namespace_='', name_='docRowType'): for entry_ in self.entry: entry_.export(outfile, level, namespace_, name_='entry') + def hasContent_(self): if ( self.entry is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='docRowType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): pass + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('entry=[\n') @@ -6860,17 +7814,20 @@ class docRowType(GeneratedsSuper): level -= 1 showIndent(outfile, level) outfile.write('],\n') + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): pass + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'entry': + nodeName_ == 'entry': obj_ = docEntryType.factory() obj_.build(child_) self.entry.append(obj_) @@ -6880,12 +7837,14 @@ class docRowType(GeneratedsSuper): class docEntryType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, thead=None, para=None): self.thead = thead if para is None: self.para = [] else: self.para = para + def factory(*args_, **kwargs_): if docEntryType.subclass: return docEntryType.subclass(*args_, **kwargs_) @@ -6898,6 +7857,7 @@ class docEntryType(GeneratedsSuper): def insert_para(self, index, value): self.para[index] = value def get_thead(self): return self.thead def set_thead(self, thead): self.thead = thead + def export(self, outfile, level, namespace_='', name_='docEntryType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) @@ -6909,28 +7869,34 @@ class docEntryType(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='docEntryType'): if self.thead is not None: outfile.write(' thead=%s' % (quote_attrib(self.thead), )) + def exportChildren(self, outfile, level, namespace_='', name_='docEntryType'): for para_ in self.para: para_.export(outfile, level, namespace_, name_='para') + def hasContent_(self): if ( self.para is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='docEntryType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): if self.thead is not None: showIndent(outfile, level) outfile.write('thead = "%s",\n' % (self.thead,)) + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('para=[\n') @@ -6944,18 +7910,21 @@ class docEntryType(GeneratedsSuper): level -= 1 showIndent(outfile, level) outfile.write('],\n') + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): if attrs.get('thead'): self.thead = attrs.get('thead').value + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'para': + nodeName_ == 'para': obj_ = docParaType.factory() obj_.build(child_) self.para.append(obj_) @@ -6965,6 +7934,7 @@ class docEntryType(GeneratedsSuper): class docCaptionType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, valueOf_='', mixedclass_=None, content_=None): if mixedclass_ is None: self.mixedclass_ = MixedContainer @@ -6974,6 +7944,7 @@ class docCaptionType(GeneratedsSuper): self.content_ = [] else: self.content_ = content_ + def factory(*args_, **kwargs_): if docCaptionType.subclass: return docCaptionType.subclass(*args_, **kwargs_) @@ -6982,40 +7953,49 @@ class docCaptionType(GeneratedsSuper): factory = staticmethod(factory) def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='docCaptionType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) - self.exportAttributes(outfile, level, namespace_, name_='docCaptionType') + self.exportAttributes(outfile, level, namespace_, + name_='docCaptionType') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('</%s%s>\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='docCaptionType'): pass + def exportChildren(self, outfile, level, namespace_='', name_='docCaptionType'): - if self.valueOf_.find('![CDATA')>-1: - value=quote_xml('%s' % self.valueOf_) - value=value.replace('![CDATA','<![CDATA') - value=value.replace(']]',']]>') + if self.valueOf_.find('![CDATA') > -1: + value = quote_xml('%s' % self.valueOf_) + value = value.replace('![CDATA', '<![CDATA') + value = value.replace(']]', ']]>') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): if ( self.valueOf_ is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='docCaptionType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): pass + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) @@ -7023,23 +8003,26 @@ class docCaptionType(GeneratedsSuper): for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): pass + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, - MixedContainer.TypeNone, '', child_.nodeValue) + MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: - self.valueOf_ += '![CDATA['+child_.nodeValue+']]' + self.valueOf_ += '![CDATA[' + child_.nodeValue + ']]' # end class docCaptionType class docHeadingType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, level=None, valueOf_='', mixedclass_=None, content_=None): self.level = level if mixedclass_ is None: @@ -7050,6 +8033,7 @@ class docHeadingType(GeneratedsSuper): self.content_ = [] else: self.content_ = content_ + def factory(*args_, **kwargs_): if docHeadingType.subclass: return docHeadingType.subclass(*args_, **kwargs_) @@ -7060,43 +8044,53 @@ class docHeadingType(GeneratedsSuper): def set_level(self, level): self.level = level def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='docHeadingType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) - self.exportAttributes(outfile, level, namespace_, name_='docHeadingType') + self.exportAttributes(outfile, level, namespace_, + name_='docHeadingType') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('</%s%s>\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='docHeadingType'): if self.level is not None: - outfile.write(' level="%s"' % self.format_integer(self.level, input_name='level')) + outfile.write(' level="%s"' % self.format_integer( + self.level, input_name='level')) + def exportChildren(self, outfile, level, namespace_='', name_='docHeadingType'): - if self.valueOf_.find('![CDATA')>-1: - value=quote_xml('%s' % self.valueOf_) - value=value.replace('![CDATA','<![CDATA') - value=value.replace(']]',']]>') + if self.valueOf_.find('![CDATA') > -1: + value = quote_xml('%s' % self.valueOf_) + value = value.replace('![CDATA', '<![CDATA') + value = value.replace(']]', ']]>') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): if ( self.valueOf_ is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='docHeadingType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): if self.level is not None: showIndent(outfile, level) outfile.write('level = %s,\n' % (self.level,)) + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) @@ -7104,27 +8098,30 @@ class docHeadingType(GeneratedsSuper): for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): if attrs.get('level'): try: self.level = int(attrs.get('level').value) except ValueError as exp: raise ValueError('Bad integer attribute (level): %s' % exp) + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, - MixedContainer.TypeNone, '', child_.nodeValue) + MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: - self.valueOf_ += '![CDATA['+child_.nodeValue+']]' + self.valueOf_ += '![CDATA[' + child_.nodeValue + ']]' # end class docHeadingType class docImageType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, width=None, type_=None, name=None, height=None, valueOf_='', mixedclass_=None, content_=None): self.width = width self.type_ = type_ @@ -7138,6 +8135,7 @@ class docImageType(GeneratedsSuper): self.content_ = [] else: self.content_ = content_ + def factory(*args_, **kwargs_): if docImageType.subclass: return docImageType.subclass(*args_, **kwargs_) @@ -7154,6 +8152,7 @@ class docImageType(GeneratedsSuper): def set_height(self, height): self.height = height def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='docImageType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) @@ -7161,35 +8160,43 @@ class docImageType(GeneratedsSuper): outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('</%s%s>\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='docImageType'): if self.width is not None: - outfile.write(' width=%s' % (self.format_string(quote_attrib(self.width).encode(ExternalEncoding), input_name='width'), )) + outfile.write(' width=%s' % (self.format_string(quote_attrib( + self.width).encode(ExternalEncoding), input_name='width'), )) if self.type_ is not None: outfile.write(' type=%s' % (quote_attrib(self.type_), )) if self.name is not None: - outfile.write(' name=%s' % (self.format_string(quote_attrib(self.name).encode(ExternalEncoding), input_name='name'), )) + outfile.write(' name=%s' % (self.format_string(quote_attrib( + self.name).encode(ExternalEncoding), input_name='name'), )) if self.height is not None: - outfile.write(' height=%s' % (self.format_string(quote_attrib(self.height).encode(ExternalEncoding), input_name='height'), )) + outfile.write(' height=%s' % (self.format_string(quote_attrib( + self.height).encode(ExternalEncoding), input_name='height'), )) + def exportChildren(self, outfile, level, namespace_='', name_='docImageType'): - if self.valueOf_.find('![CDATA')>-1: - value=quote_xml('%s' % self.valueOf_) - value=value.replace('![CDATA','<![CDATA') - value=value.replace(']]',']]>') + if self.valueOf_.find('![CDATA') > -1: + value = quote_xml('%s' % self.valueOf_) + value = value.replace('![CDATA', '<![CDATA') + value = value.replace(']]', ']]>') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): if ( self.valueOf_ is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='docImageType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): if self.width is not None: showIndent(outfile, level) @@ -7203,9 +8210,11 @@ class docImageType(GeneratedsSuper): if self.height is not None: showIndent(outfile, level) outfile.write('height = %s,\n' % (self.height,)) + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) @@ -7213,6 +8222,7 @@ class docImageType(GeneratedsSuper): for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): if attrs.get('width'): self.width = attrs.get('width').value @@ -7222,21 +8232,23 @@ class docImageType(GeneratedsSuper): self.name = attrs.get('name').value if attrs.get('height'): self.height = attrs.get('height').value + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, - MixedContainer.TypeNone, '', child_.nodeValue) + MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: - self.valueOf_ += '![CDATA['+child_.nodeValue+']]' + self.valueOf_ += '![CDATA[' + child_.nodeValue + ']]' # end class docImageType class docDotFileType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, name=None, valueOf_='', mixedclass_=None, content_=None): self.name = name if mixedclass_ is None: @@ -7247,6 +8259,7 @@ class docDotFileType(GeneratedsSuper): self.content_ = [] else: self.content_ = content_ + def factory(*args_, **kwargs_): if docDotFileType.subclass: return docDotFileType.subclass(*args_, **kwargs_) @@ -7257,43 +8270,53 @@ class docDotFileType(GeneratedsSuper): def set_name(self, name): self.name = name def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='docDotFileType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) - self.exportAttributes(outfile, level, namespace_, name_='docDotFileType') + self.exportAttributes(outfile, level, namespace_, + name_='docDotFileType') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('</%s%s>\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='docDotFileType'): if self.name is not None: - outfile.write(' name=%s' % (self.format_string(quote_attrib(self.name).encode(ExternalEncoding), input_name='name'), )) + outfile.write(' name=%s' % (self.format_string(quote_attrib( + self.name).encode(ExternalEncoding), input_name='name'), )) + def exportChildren(self, outfile, level, namespace_='', name_='docDotFileType'): - if self.valueOf_.find('![CDATA')>-1: - value=quote_xml('%s' % self.valueOf_) - value=value.replace('![CDATA','<![CDATA') - value=value.replace(']]',']]>') + if self.valueOf_.find('![CDATA') > -1: + value = quote_xml('%s' % self.valueOf_) + value = value.replace('![CDATA', '<![CDATA') + value = value.replace(']]', ']]>') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): if ( self.valueOf_ is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='docDotFileType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): if self.name is not None: showIndent(outfile, level) outfile.write('name = %s,\n' % (self.name,)) + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) @@ -7301,24 +8324,27 @@ class docDotFileType(GeneratedsSuper): for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): if attrs.get('name'): self.name = attrs.get('name').value + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, - MixedContainer.TypeNone, '', child_.nodeValue) + MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: - self.valueOf_ += '![CDATA['+child_.nodeValue+']]' + self.valueOf_ += '![CDATA[' + child_.nodeValue + ']]' # end class docDotFileType class docTocItemType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, id=None, valueOf_='', mixedclass_=None, content_=None): self.id = id if mixedclass_ is None: @@ -7329,6 +8355,7 @@ class docTocItemType(GeneratedsSuper): self.content_ = [] else: self.content_ = content_ + def factory(*args_, **kwargs_): if docTocItemType.subclass: return docTocItemType.subclass(*args_, **kwargs_) @@ -7339,43 +8366,53 @@ class docTocItemType(GeneratedsSuper): def set_id(self, id): self.id = id def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='docTocItemType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) - self.exportAttributes(outfile, level, namespace_, name_='docTocItemType') + self.exportAttributes(outfile, level, namespace_, + name_='docTocItemType') outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('</%s%s>\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='docTocItemType'): if self.id is not None: - outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), )) + outfile.write(' id=%s' % (self.format_string(quote_attrib( + self.id).encode(ExternalEncoding), input_name='id'), )) + def exportChildren(self, outfile, level, namespace_='', name_='docTocItemType'): - if self.valueOf_.find('![CDATA')>-1: - value=quote_xml('%s' % self.valueOf_) - value=value.replace('![CDATA','<![CDATA') - value=value.replace(']]',']]>') + if self.valueOf_.find('![CDATA') > -1: + value = quote_xml('%s' % self.valueOf_) + value = value.replace('![CDATA', '<![CDATA') + value = value.replace(']]', ']]>') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): if ( self.valueOf_ is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='docTocItemType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): if self.id is not None: showIndent(outfile, level) outfile.write('id = %s,\n' % (self.id,)) + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) @@ -7383,29 +8420,33 @@ class docTocItemType(GeneratedsSuper): for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): if attrs.get('id'): self.id = attrs.get('id').value + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, - MixedContainer.TypeNone, '', child_.nodeValue) + MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: - self.valueOf_ += '![CDATA['+child_.nodeValue+']]' + self.valueOf_ += '![CDATA[' + child_.nodeValue + ']]' # end class docTocItemType class docTocListType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, tocitem=None): if tocitem is None: self.tocitem = [] else: self.tocitem = tocitem + def factory(*args_, **kwargs_): if docTocListType.subclass: return docTocListType.subclass(*args_, **kwargs_) @@ -7416,10 +8457,12 @@ class docTocListType(GeneratedsSuper): def set_tocitem(self, tocitem): self.tocitem = tocitem def add_tocitem(self, value): self.tocitem.append(value) def insert_tocitem(self, index, value): self.tocitem[index] = value + def export(self, outfile, level, namespace_='', name_='docTocListType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) - self.exportAttributes(outfile, level, namespace_, name_='docTocListType') + self.exportAttributes(outfile, level, namespace_, + name_='docTocListType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) @@ -7427,25 +8470,31 @@ class docTocListType(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='docTocListType'): pass + def exportChildren(self, outfile, level, namespace_='', name_='docTocListType'): for tocitem_ in self.tocitem: tocitem_.export(outfile, level, namespace_, name_='tocitem') + def hasContent_(self): if ( self.tocitem is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='docTocListType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): pass + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('tocitem=[\n') @@ -7459,17 +8508,20 @@ class docTocListType(GeneratedsSuper): level -= 1 showIndent(outfile, level) outfile.write('],\n') + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): pass + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'tocitem': + nodeName_ == 'tocitem': obj_ = docTocItemType.factory() obj_.build(child_) self.tocitem.append(obj_) @@ -7479,12 +8531,14 @@ class docTocListType(GeneratedsSuper): class docLanguageType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, langid=None, para=None): self.langid = langid if para is None: self.para = [] else: self.para = para + def factory(*args_, **kwargs_): if docLanguageType.subclass: return docLanguageType.subclass(*args_, **kwargs_) @@ -7497,10 +8551,12 @@ class docLanguageType(GeneratedsSuper): def insert_para(self, index, value): self.para[index] = value def get_langid(self): return self.langid def set_langid(self, langid): self.langid = langid + def export(self, outfile, level, namespace_='', name_='docLanguageType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) - self.exportAttributes(outfile, level, namespace_, name_='docLanguageType') + self.exportAttributes(outfile, level, namespace_, + name_='docLanguageType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) @@ -7508,28 +8564,35 @@ class docLanguageType(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='docLanguageType'): if self.langid is not None: - outfile.write(' langid=%s' % (self.format_string(quote_attrib(self.langid).encode(ExternalEncoding), input_name='langid'), )) + outfile.write(' langid=%s' % (self.format_string(quote_attrib( + self.langid).encode(ExternalEncoding), input_name='langid'), )) + def exportChildren(self, outfile, level, namespace_='', name_='docLanguageType'): for para_ in self.para: para_.export(outfile, level, namespace_, name_='para') + def hasContent_(self): if ( self.para is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='docLanguageType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): if self.langid is not None: showIndent(outfile, level) outfile.write('langid = %s,\n' % (self.langid,)) + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('para=[\n') @@ -7543,18 +8606,21 @@ class docLanguageType(GeneratedsSuper): level -= 1 showIndent(outfile, level) outfile.write('],\n') + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): if attrs.get('langid'): self.langid = attrs.get('langid').value + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'para': + nodeName_ == 'para': obj_ = docParaType.factory() obj_.build(child_) self.para.append(obj_) @@ -7564,12 +8630,14 @@ class docLanguageType(GeneratedsSuper): class docParamListType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, kind=None, parameteritem=None): self.kind = kind if parameteritem is None: self.parameteritem = [] else: self.parameteritem = parameteritem + def factory(*args_, **kwargs_): if docParamListType.subclass: return docParamListType.subclass(*args_, **kwargs_) @@ -7577,15 +8645,21 @@ class docParamListType(GeneratedsSuper): return docParamListType(*args_, **kwargs_) factory = staticmethod(factory) def get_parameteritem(self): return self.parameteritem - def set_parameteritem(self, parameteritem): self.parameteritem = parameteritem + def set_parameteritem( + self, parameteritem): self.parameteritem = parameteritem + def add_parameteritem(self, value): self.parameteritem.append(value) - def insert_parameteritem(self, index, value): self.parameteritem[index] = value + def insert_parameteritem( + self, index, value): self.parameteritem[index] = value + def get_kind(self): return self.kind def set_kind(self, kind): self.kind = kind + def export(self, outfile, level, namespace_='', name_='docParamListType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) - self.exportAttributes(outfile, level, namespace_, name_='docParamListType') + self.exportAttributes(outfile, level, namespace_, + name_='docParamListType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) @@ -7593,28 +8667,35 @@ class docParamListType(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='docParamListType'): if self.kind is not None: outfile.write(' kind=%s' % (quote_attrib(self.kind), )) + def exportChildren(self, outfile, level, namespace_='', name_='docParamListType'): for parameteritem_ in self.parameteritem: - parameteritem_.export(outfile, level, namespace_, name_='parameteritem') + parameteritem_.export( + outfile, level, namespace_, name_='parameteritem') + def hasContent_(self): if ( self.parameteritem is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='docParamListType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): if self.kind is not None: showIndent(outfile, level) outfile.write('kind = "%s",\n' % (self.kind,)) + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('parameteritem=[\n') @@ -7628,18 +8709,21 @@ class docParamListType(GeneratedsSuper): level -= 1 showIndent(outfile, level) outfile.write('],\n') + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): if attrs.get('kind'): self.kind = attrs.get('kind').value + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'parameteritem': + nodeName_ == 'parameteritem': obj_ = docParamListItem.factory() obj_.build(child_) self.parameteritem.append(obj_) @@ -7649,12 +8733,14 @@ class docParamListType(GeneratedsSuper): class docParamListItem(GeneratedsSuper): subclass = None superclass = None + def __init__(self, parameternamelist=None, parameterdescription=None): if parameternamelist is None: self.parameternamelist = [] else: self.parameternamelist = parameternamelist self.parameterdescription = parameterdescription + def factory(*args_, **kwargs_): if docParamListItem.subclass: return docParamListItem.subclass(*args_, **kwargs_) @@ -7662,15 +8748,25 @@ class docParamListItem(GeneratedsSuper): return docParamListItem(*args_, **kwargs_) factory = staticmethod(factory) def get_parameternamelist(self): return self.parameternamelist - def set_parameternamelist(self, parameternamelist): self.parameternamelist = parameternamelist - def add_parameternamelist(self, value): self.parameternamelist.append(value) - def insert_parameternamelist(self, index, value): self.parameternamelist[index] = value + + def set_parameternamelist( + self, parameternamelist): self.parameternamelist = parameternamelist + + def add_parameternamelist( + self, value): self.parameternamelist.append(value) + def insert_parameternamelist( + self, index, value): self.parameternamelist[index] = value + def get_parameterdescription(self): return self.parameterdescription - def set_parameterdescription(self, parameterdescription): self.parameterdescription = parameterdescription + + def set_parameterdescription( + self, parameterdescription): self.parameterdescription = parameterdescription + def export(self, outfile, level, namespace_='', name_='docParamListItem', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) - self.exportAttributes(outfile, level, namespace_, name_='docParamListItem') + self.exportAttributes(outfile, level, namespace_, + name_='docParamListItem') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) @@ -7678,28 +8774,36 @@ class docParamListItem(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='docParamListItem'): pass + def exportChildren(self, outfile, level, namespace_='', name_='docParamListItem'): for parameternamelist_ in self.parameternamelist: - parameternamelist_.export(outfile, level, namespace_, name_='parameternamelist') + parameternamelist_.export( + outfile, level, namespace_, name_='parameternamelist') if self.parameterdescription: - self.parameterdescription.export(outfile, level, namespace_, name_='parameterdescription', ) + self.parameterdescription.export( + outfile, level, namespace_, name_='parameterdescription', ) + def hasContent_(self): if ( self.parameternamelist is not None or self.parameterdescription is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='docParamListItem'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): pass + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('parameternamelist=[\n') @@ -7707,7 +8811,8 @@ class docParamListItem(GeneratedsSuper): for parameternamelist in self.parameternamelist: showIndent(outfile, level) outfile.write('model_.parameternamelist(\n') - parameternamelist.exportLiteral(outfile, level, name_='parameternamelist') + parameternamelist.exportLiteral( + outfile, level, name_='parameternamelist') showIndent(outfile, level) outfile.write('),\n') level -= 1 @@ -7716,25 +8821,29 @@ class docParamListItem(GeneratedsSuper): if self.parameterdescription: showIndent(outfile, level) outfile.write('parameterdescription=model_.descriptionType(\n') - self.parameterdescription.exportLiteral(outfile, level, name_='parameterdescription') + self.parameterdescription.exportLiteral( + outfile, level, name_='parameterdescription') showIndent(outfile, level) outfile.write('),\n') + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): pass + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'parameternamelist': + nodeName_ == 'parameternamelist': obj_ = docParamNameList.factory() obj_.build(child_) self.parameternamelist.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'parameterdescription': + nodeName_ == 'parameterdescription': obj_ = descriptionType.factory() obj_.build(child_) self.set_parameterdescription(obj_) @@ -7744,11 +8853,13 @@ class docParamListItem(GeneratedsSuper): class docParamNameList(GeneratedsSuper): subclass = None superclass = None + def __init__(self, parametername=None): if parametername is None: self.parametername = [] else: self.parametername = parametername + def factory(*args_, **kwargs_): if docParamNameList.subclass: return docParamNameList.subclass(*args_, **kwargs_) @@ -7756,13 +8867,19 @@ class docParamNameList(GeneratedsSuper): return docParamNameList(*args_, **kwargs_) factory = staticmethod(factory) def get_parametername(self): return self.parametername - def set_parametername(self, parametername): self.parametername = parametername + def set_parametername( + self, parametername): self.parametername = parametername + def add_parametername(self, value): self.parametername.append(value) - def insert_parametername(self, index, value): self.parametername[index] = value + + def insert_parametername( + self, index, value): self.parametername[index] = value + def export(self, outfile, level, namespace_='', name_='docParamNameList', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) - self.exportAttributes(outfile, level, namespace_, name_='docParamNameList') + self.exportAttributes(outfile, level, namespace_, + name_='docParamNameList') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) @@ -7770,25 +8887,32 @@ class docParamNameList(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='docParamNameList'): pass + def exportChildren(self, outfile, level, namespace_='', name_='docParamNameList'): for parametername_ in self.parametername: - parametername_.export(outfile, level, namespace_, name_='parametername') + parametername_.export( + outfile, level, namespace_, name_='parametername') + def hasContent_(self): if ( self.parametername is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='docParamNameList'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): pass + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('parametername=[\n') @@ -7802,17 +8926,20 @@ class docParamNameList(GeneratedsSuper): level -= 1 showIndent(outfile, level) outfile.write('],\n') + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): pass + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'parametername': + nodeName_ == 'parametername': obj_ = docParamName.factory() obj_.build(child_) self.parametername.append(obj_) @@ -7822,6 +8949,7 @@ class docParamNameList(GeneratedsSuper): class docParamName(GeneratedsSuper): subclass = None superclass = None + def __init__(self, direction=None, ref=None, mixedclass_=None, content_=None): self.direction = direction if mixedclass_ is None: @@ -7832,6 +8960,7 @@ class docParamName(GeneratedsSuper): self.content_ = [] else: self.content_ = content_ + def factory(*args_, **kwargs_): if docParamName.subclass: return docParamName.subclass(*args_, **kwargs_) @@ -7842,6 +8971,7 @@ class docParamName(GeneratedsSuper): def set_ref(self, ref): self.ref = ref def get_direction(self): return self.direction def set_direction(self, direction): self.direction = direction + def export(self, outfile, level, namespace_='', name_='docParamName', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) @@ -7849,28 +8979,34 @@ class docParamName(GeneratedsSuper): outfile.write('>') self.exportChildren(outfile, level + 1, namespace_, name_) outfile.write('</%s%s>\n' % (namespace_, name_)) + def exportAttributes(self, outfile, level, namespace_='', name_='docParamName'): if self.direction is not None: outfile.write(' direction=%s' % (quote_attrib(self.direction), )) + def exportChildren(self, outfile, level, namespace_='', name_='docParamName'): for item_ in self.content_: item_.export(outfile, level, item_.name, namespace_) + def hasContent_(self): if ( self.ref is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='docParamName'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): if self.direction is not None: showIndent(outfile, level) outfile.write('direction = "%s",\n' % (self.direction,)) + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('content_ = [\n') @@ -7878,26 +9014,29 @@ class docParamName(GeneratedsSuper): item_.exportLiteral(outfile, level, name_) showIndent(outfile, level) outfile.write('],\n') + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): if attrs.get('direction'): self.direction = attrs.get('direction').value + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'ref': + nodeName_ == 'ref': childobj_ = docRefTextType.factory() childobj_.build(child_) obj_ = self.mixedclass_(MixedContainer.CategoryComplex, - MixedContainer.TypeNone, 'ref', childobj_) + MixedContainer.TypeNone, 'ref', childobj_) self.content_.append(obj_) elif child_.nodeType == Node.TEXT_NODE: obj_ = self.mixedclass_(MixedContainer.CategoryText, - MixedContainer.TypeNone, '', child_.nodeValue) + MixedContainer.TypeNone, '', child_.nodeValue) self.content_.append(obj_) # end class docParamName @@ -7905,6 +9044,7 @@ class docParamName(GeneratedsSuper): class docXRefSectType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, id=None, xreftitle=None, xrefdescription=None): self.id = id if xreftitle is None: @@ -7912,6 +9052,7 @@ class docXRefSectType(GeneratedsSuper): else: self.xreftitle = xreftitle self.xrefdescription = xrefdescription + def factory(*args_, **kwargs_): if docXRefSectType.subclass: return docXRefSectType.subclass(*args_, **kwargs_) @@ -7923,13 +9064,17 @@ class docXRefSectType(GeneratedsSuper): def add_xreftitle(self, value): self.xreftitle.append(value) def insert_xreftitle(self, index, value): self.xreftitle[index] = value def get_xrefdescription(self): return self.xrefdescription - def set_xrefdescription(self, xrefdescription): self.xrefdescription = xrefdescription + def set_xrefdescription( + self, xrefdescription): self.xrefdescription = xrefdescription + def get_id(self): return self.id def set_id(self, id): self.id = id + def export(self, outfile, level, namespace_='', name_='docXRefSectType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) - self.exportAttributes(outfile, level, namespace_, name_='docXRefSectType') + self.exportAttributes(outfile, level, namespace_, + name_='docXRefSectType') if self.hasContent_(): outfile.write('>\n') self.exportChildren(outfile, level + 1, namespace_, name_) @@ -7937,66 +9082,80 @@ class docXRefSectType(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='docXRefSectType'): if self.id is not None: - outfile.write(' id=%s' % (self.format_string(quote_attrib(self.id).encode(ExternalEncoding), input_name='id'), )) + outfile.write(' id=%s' % (self.format_string(quote_attrib( + self.id).encode(ExternalEncoding), input_name='id'), )) + def exportChildren(self, outfile, level, namespace_='', name_='docXRefSectType'): for xreftitle_ in self.xreftitle: showIndent(outfile, level) - outfile.write('<%sxreftitle>%s</%sxreftitle>\n' % (namespace_, self.format_string(quote_xml(xreftitle_).encode(ExternalEncoding), input_name='xreftitle'), namespace_)) + outfile.write('<%sxreftitle>%s</%sxreftitle>\n' % (namespace_, self.format_string( + quote_xml(xreftitle_).encode(ExternalEncoding), input_name='xreftitle'), namespace_)) if self.xrefdescription: - self.xrefdescription.export(outfile, level, namespace_, name_='xrefdescription', ) + self.xrefdescription.export( + outfile, level, namespace_, name_='xrefdescription', ) + def hasContent_(self): if ( self.xreftitle is not None or self.xrefdescription is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='docXRefSectType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): if self.id is not None: showIndent(outfile, level) outfile.write('id = %s,\n' % (self.id,)) + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('xreftitle=[\n') level += 1 for xreftitle in self.xreftitle: showIndent(outfile, level) - outfile.write('%s,\n' % quote_python(xreftitle).encode(ExternalEncoding)) + outfile.write('%s,\n' % quote_python( + xreftitle).encode(ExternalEncoding)) level -= 1 showIndent(outfile, level) outfile.write('],\n') if self.xrefdescription: showIndent(outfile, level) outfile.write('xrefdescription=model_.descriptionType(\n') - self.xrefdescription.exportLiteral(outfile, level, name_='xrefdescription') + self.xrefdescription.exportLiteral( + outfile, level, name_='xrefdescription') showIndent(outfile, level) outfile.write('),\n') + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): if attrs.get('id'): self.id = attrs.get('id').value + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'xreftitle': + nodeName_ == 'xreftitle': xreftitle_ = '' for text__content_ in child_.childNodes: xreftitle_ += text__content_.nodeValue self.xreftitle.append(xreftitle_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'xrefdescription': + nodeName_ == 'xrefdescription': obj_ = descriptionType.factory() obj_.build(child_) self.set_xrefdescription(obj_) @@ -8006,6 +9165,7 @@ class docXRefSectType(GeneratedsSuper): class docCopyType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, link=None, para=None, sect1=None, internal=None): self.link = link if para is None: @@ -8017,6 +9177,7 @@ class docCopyType(GeneratedsSuper): else: self.sect1 = sect1 self.internal = internal + def factory(*args_, **kwargs_): if docCopyType.subclass: return docCopyType.subclass(*args_, **kwargs_) @@ -8035,6 +9196,7 @@ class docCopyType(GeneratedsSuper): def set_internal(self, internal): self.internal = internal def get_link(self): return self.link def set_link(self, link): self.link = link + def export(self, outfile, level, namespace_='', name_='docCopyType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) @@ -8046,9 +9208,12 @@ class docCopyType(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='docCopyType'): if self.link is not None: - outfile.write(' link=%s' % (self.format_string(quote_attrib(self.link).encode(ExternalEncoding), input_name='link'), )) + outfile.write(' link=%s' % (self.format_string(quote_attrib( + self.link).encode(ExternalEncoding), input_name='link'), )) + def exportChildren(self, outfile, level, namespace_='', name_='docCopyType'): for para_ in self.para: para_.export(outfile, level, namespace_, name_='para') @@ -8056,24 +9221,28 @@ class docCopyType(GeneratedsSuper): sect1_.export(outfile, level, namespace_, name_='sect1') if self.internal: self.internal.export(outfile, level, namespace_, name_='internal') + def hasContent_(self): if ( self.para is not None or self.sect1 is not None or self.internal is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='docCopyType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): if self.link is not None: showIndent(outfile, level) outfile.write('link = %s,\n' % (self.link,)) + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('para=[\n') @@ -8105,28 +9274,31 @@ class docCopyType(GeneratedsSuper): self.internal.exportLiteral(outfile, level, name_='internal') showIndent(outfile, level) outfile.write('),\n') + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): if attrs.get('link'): self.link = attrs.get('link').value + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'para': + nodeName_ == 'para': obj_ = docParaType.factory() obj_.build(child_) self.para.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'sect1': + nodeName_ == 'sect1': obj_ = docSect1Type.factory() obj_.build(child_) self.sect1.append(obj_) elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'internal': + nodeName_ == 'internal': obj_ = docInternalType.factory() obj_.build(child_) self.set_internal(obj_) @@ -8136,9 +9308,11 @@ class docCopyType(GeneratedsSuper): class docCharType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, char=None, valueOf_=''): self.char = char self.valueOf_ = valueOf_ + def factory(*args_, **kwargs_): if docCharType.subclass: return docCharType.subclass(*args_, **kwargs_) @@ -8149,6 +9323,7 @@ class docCharType(GeneratedsSuper): def set_char(self, char): self.char = char def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='docCharType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) @@ -8160,36 +9335,43 @@ class docCharType(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='docCharType'): if self.char is not None: outfile.write(' char=%s' % (quote_attrib(self.char), )) + def exportChildren(self, outfile, level, namespace_='', name_='docCharType'): - if self.valueOf_.find('![CDATA')>-1: - value=quote_xml('%s' % self.valueOf_) - value=value.replace('![CDATA','<![CDATA') - value=value.replace(']]',']]>') + if self.valueOf_.find('![CDATA') > -1: + value = quote_xml('%s' % self.valueOf_) + value = value.replace('![CDATA', '<![CDATA') + value = value.replace(']]', ']]>') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): if ( self.valueOf_ is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='docCharType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): if self.char is not None: showIndent(outfile, level) outfile.write('char = "%s",\n' % (self.char,)) + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) @@ -8197,22 +9379,26 @@ class docCharType(GeneratedsSuper): for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): if attrs.get('char'): self.char = attrs.get('char').value + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: - self.valueOf_ += '![CDATA['+child_.nodeValue+']]' + self.valueOf_ += '![CDATA[' + child_.nodeValue + ']]' # end class docCharType class docEmptyType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, valueOf_=''): self.valueOf_ = valueOf_ + def factory(*args_, **kwargs_): if docEmptyType.subclass: return docEmptyType.subclass(*args_, **kwargs_) @@ -8221,6 +9407,7 @@ class docEmptyType(GeneratedsSuper): factory = staticmethod(factory) def getValueOf_(self): return self.valueOf_ def setValueOf_(self, valueOf_): self.valueOf_ = valueOf_ + def export(self, outfile, level, namespace_='', name_='docEmptyType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) @@ -8232,33 +9419,40 @@ class docEmptyType(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='docEmptyType'): pass + def exportChildren(self, outfile, level, namespace_='', name_='docEmptyType'): - if self.valueOf_.find('![CDATA')>-1: - value=quote_xml('%s' % self.valueOf_) - value=value.replace('![CDATA','<![CDATA') - value=value.replace(']]',']]>') + if self.valueOf_.find('![CDATA') > -1: + value = quote_xml('%s' % self.valueOf_) + value = value.replace('![CDATA', '<![CDATA') + value = value.replace(']]', ']]>') outfile.write(value) else: outfile.write(quote_xml('%s' % self.valueOf_)) + def hasContent_(self): if ( self.valueOf_ is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='docEmptyType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): pass + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('valueOf_ = "%s",\n' % (self.valueOf_,)) + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) @@ -8266,13 +9460,15 @@ class docEmptyType(GeneratedsSuper): for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): pass + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.TEXT_NODE: self.valueOf_ += child_.nodeValue elif child_.nodeType == Node.CDATA_SECTION_NODE: - self.valueOf_ += '![CDATA['+child_.nodeValue+']]' + self.valueOf_ += '![CDATA[' + child_.nodeValue + ']]' # end class docEmptyType @@ -8282,6 +9478,7 @@ Options: -s Use the SAX parser, not the minidom parser. """ + def usage(): print(USAGE_TEXT) sys.exit(1) @@ -8296,7 +9493,7 @@ def parse(inFileName): doc = None sys.stdout.write('<?xml version="1.0" ?>\n') rootObj.export(sys.stdout, 0, name_="doxygen", - namespacedef_='') + namespacedef_='') return rootObj @@ -8309,7 +9506,7 @@ def parseString(inString): doc = None sys.stdout.write('<?xml version="1.0" ?>\n') rootObj.export(sys.stdout, 0, name_="doxygen", - namespacedef_='') + namespacedef_='') return rootObj @@ -8338,4 +9535,4 @@ def main(): if __name__ == '__main__': main() #import pdb - #pdb.run('main()') + # pdb.run('main()') diff --git a/gr-utils/modtool/templates/gr-newmod/docs/doxygen/doxyxml/generated/index.py b/gr-utils/modtool/templates/gr-newmod/docs/doxygen/doxyxml/generated/index.py index 8a817e15f1..7ffbdf191a 100644 --- a/gr-utils/modtool/templates/gr-newmod/docs/doxygen/doxyxml/generated/index.py +++ b/gr-utils/modtool/templates/gr-newmod/docs/doxygen/doxyxml/generated/index.py @@ -12,6 +12,7 @@ from . import compound from . import indexsuper as supermod + class DoxygenTypeSub(supermod.DoxygenType): def __init__(self, version=None, compound=None): supermod.DoxygenType.__init__(self, version, compound) @@ -32,6 +33,7 @@ class DoxygenTypeSub(supermod.DoxygenType): return results + supermod.DoxygenType.subclass = DoxygenTypeSub # end class DoxygenTypeSub @@ -53,6 +55,7 @@ class CompoundTypeSub(supermod.CompoundType): return results + supermod.CompoundType.subclass = CompoundTypeSub # end class CompoundTypeSub @@ -62,6 +65,7 @@ class MemberTypeSub(supermod.MemberType): def __init__(self, kind=None, refid=None, name=''): supermod.MemberType.__init__(self, kind, refid, name) + supermod.MemberType.subclass = MemberTypeSub # end class MemberTypeSub diff --git a/gr-utils/modtool/templates/gr-newmod/docs/doxygen/doxyxml/generated/indexsuper.py b/gr-utils/modtool/templates/gr-newmod/docs/doxygen/doxyxml/generated/indexsuper.py index cc2c112418..b30e062ae7 100644 --- a/gr-utils/modtool/templates/gr-newmod/docs/doxygen/doxyxml/generated/indexsuper.py +++ b/gr-utils/modtool/templates/gr-newmod/docs/doxygen/doxyxml/generated/indexsuper.py @@ -24,12 +24,16 @@ except ImportError as exp: class GeneratedsSuper(object): def format_string(self, input_data, input_name=''): return input_data + def format_integer(self, input_data, input_name=''): return '%d' % input_data + def format_float(self, input_data, input_name=''): return '%f' % input_data + def format_double(self, input_data, input_name=''): return '%e' % input_data + def format_boolean(self, input_data, input_name=''): return '%s' % input_data @@ -41,9 +45,9 @@ except ImportError as exp: ## from IPython.Shell import IPShellEmbed ## args = '' -## ipshell = IPShellEmbed(args, +# ipshell = IPShellEmbed(args, ## banner = 'Dropping into IPython', -## exit_msg = 'Leaving Interpreter, back to program.') +# exit_msg = 'Leaving Interpreter, back to program.') # Then use the following line where and when you want to drop into the # IPython shell: @@ -59,10 +63,12 @@ ExternalEncoding = 'ascii' # Support/utility functions. # + def showIndent(outfile, level): for idx in range(level): outfile.write(' ') + def quote_xml(inStr): s1 = (isinstance(inStr, str) and inStr or '%s' % inStr) @@ -71,6 +77,7 @@ def quote_xml(inStr): s1 = s1.replace('>', '>') return s1 + def quote_attrib(inStr): s1 = (isinstance(inStr, str) and inStr or '%s' % inStr) @@ -86,6 +93,7 @@ def quote_attrib(inStr): s1 = '"%s"' % s1 return s1 + def quote_python(inStr): s1 = inStr if s1.find("'") == -1: @@ -117,26 +125,33 @@ class MixedContainer(object): TypeDecimal = 5 TypeDouble = 6 TypeBoolean = 7 + def __init__(self, category, content_type, name, value): self.category = category self.content_type = content_type self.name = name self.value = value + def getCategory(self): return self.category + def getContenttype(self, content_type): return self.content_type + def getValue(self): return self.value + def getName(self): return self.name + def export(self, outfile, level, name, namespace): if self.category == MixedContainer.CategoryText: outfile.write(self.value) elif self.category == MixedContainer.CategorySimple: self.exportSimple(outfile, level, name) else: # category == MixedContainer.CategoryComplex - self.value.export(outfile, level, namespace,name) + self.value.export(outfile, level, namespace, name) + def exportSimple(self, outfile, level, name): if self.content_type == MixedContainer.TypeString: outfile.write('<%s>%s</%s>' % (self.name, self.value, self.name)) @@ -148,19 +163,20 @@ class MixedContainer(object): outfile.write('<%s>%f</%s>' % (self.name, self.value, self.name)) elif self.content_type == MixedContainer.TypeDouble: outfile.write('<%s>%g</%s>' % (self.name, self.value, self.name)) + def exportLiteral(self, outfile, level, name): if self.category == MixedContainer.CategoryText: showIndent(outfile, level) - outfile.write('MixedContainer(%d, %d, "%s", "%s"),\n' % \ - (self.category, self.content_type, self.name, self.value)) + outfile.write('MixedContainer(%d, %d, "%s", "%s"),\n' % + (self.category, self.content_type, self.name, self.value)) elif self.category == MixedContainer.CategorySimple: showIndent(outfile, level) - outfile.write('MixedContainer(%d, %d, "%s", "%s"),\n' % \ - (self.category, self.content_type, self.name, self.value)) + outfile.write('MixedContainer(%d, %d, "%s", "%s"),\n' % + (self.category, self.content_type, self.name, self.value)) else: # category == MixedContainer.CategoryComplex showIndent(outfile, level) - outfile.write('MixedContainer(%d, %d, "%s",\n' % \ - (self.category, self.content_type, self.name,)) + outfile.write('MixedContainer(%d, %d, "%s",\n' % + (self.category, self.content_type, self.name,)) self.value.exportLiteral(outfile, level + 1) showIndent(outfile, level) outfile.write(')\n') @@ -171,6 +187,7 @@ class _MemberSpec(object): self.name = name self.data_type = data_type self.container = container + def set_name(self, name): self.name = name def get_name(self): return self.name def set_data_type(self, data_type): self.data_type = data_type @@ -186,12 +203,14 @@ class _MemberSpec(object): class DoxygenType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, version=None, compound=None): self.version = version if compound is None: self.compound = [] else: self.compound = compound + def factory(*args_, **kwargs_): if DoxygenType.subclass: return DoxygenType.subclass(*args_, **kwargs_) @@ -204,6 +223,7 @@ class DoxygenType(GeneratedsSuper): def insert_compound(self, index, value): self.compound[index] = value def get_version(self): return self.version def set_version(self, version): self.version = version + def export(self, outfile, level, namespace_='', name_='DoxygenType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) @@ -215,27 +235,34 @@ class DoxygenType(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='DoxygenType'): - outfile.write(' version=%s' % (self.format_string(quote_attrib(self.version).encode(ExternalEncoding), input_name='version'), )) + outfile.write(' version=%s' % (self.format_string(quote_attrib( + self.version).encode(ExternalEncoding), input_name='version'), )) + def exportChildren(self, outfile, level, namespace_='', name_='DoxygenType'): for compound_ in self.compound: compound_.export(outfile, level, namespace_, name_='compound') + def hasContent_(self): if ( self.compound is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='DoxygenType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): if self.version is not None: showIndent(outfile, level) outfile.write('version = %s,\n' % (self.version,)) + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) outfile.write('compound=[\n') @@ -249,18 +276,21 @@ class DoxygenType(GeneratedsSuper): level -= 1 showIndent(outfile, level) outfile.write('],\n') + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): if attrs.get('version'): self.version = attrs.get('version').value + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'compound': + nodeName_ == 'compound': obj_ = CompoundType.factory() obj_.build(child_) self.compound.append(obj_) @@ -270,6 +300,7 @@ class DoxygenType(GeneratedsSuper): class CompoundType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, kind=None, refid=None, name=None, member=None): self.kind = kind self.refid = refid @@ -278,6 +309,7 @@ class CompoundType(GeneratedsSuper): self.member = [] else: self.member = member + def factory(*args_, **kwargs_): if CompoundType.subclass: return CompoundType.subclass(*args_, **kwargs_) @@ -294,6 +326,7 @@ class CompoundType(GeneratedsSuper): def set_kind(self, kind): self.kind = kind def get_refid(self): return self.refid def set_refid(self, refid): self.refid = refid + def export(self, outfile, level, namespace_='', name_='CompoundType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) @@ -305,28 +338,35 @@ class CompoundType(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='CompoundType'): outfile.write(' kind=%s' % (quote_attrib(self.kind), )) - outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), )) + outfile.write(' refid=%s' % (self.format_string(quote_attrib( + self.refid).encode(ExternalEncoding), input_name='refid'), )) + def exportChildren(self, outfile, level, namespace_='', name_='CompoundType'): if self.name is not None: showIndent(outfile, level) - outfile.write('<%sname>%s</%sname>\n' % (namespace_, self.format_string(quote_xml(self.name).encode(ExternalEncoding), input_name='name'), namespace_)) + outfile.write('<%sname>%s</%sname>\n' % (namespace_, self.format_string( + quote_xml(self.name).encode(ExternalEncoding), input_name='name'), namespace_)) for member_ in self.member: member_.export(outfile, level, namespace_, name_='member') + def hasContent_(self): if ( self.name is not None or self.member is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='CompoundType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): if self.kind is not None: showIndent(outfile, level) @@ -334,9 +374,11 @@ class CompoundType(GeneratedsSuper): if self.refid is not None: showIndent(outfile, level) outfile.write('refid = %s,\n' % (self.refid,)) + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) - outfile.write('name=%s,\n' % quote_python(self.name).encode(ExternalEncoding)) + outfile.write('name=%s,\n' % quote_python( + self.name).encode(ExternalEncoding)) showIndent(outfile, level) outfile.write('member=[\n') level += 1 @@ -349,26 +391,29 @@ class CompoundType(GeneratedsSuper): level -= 1 showIndent(outfile, level) outfile.write('],\n') + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): if attrs.get('kind'): self.kind = attrs.get('kind').value if attrs.get('refid'): self.refid = attrs.get('refid').value + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'name': + nodeName_ == 'name': name_ = '' for text__content_ in child_.childNodes: name_ += text__content_.nodeValue self.name = name_ elif child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'member': + nodeName_ == 'member': obj_ = MemberType.factory() obj_.build(child_) self.member.append(obj_) @@ -378,10 +423,12 @@ class CompoundType(GeneratedsSuper): class MemberType(GeneratedsSuper): subclass = None superclass = None + def __init__(self, kind=None, refid=None, name=None): self.kind = kind self.refid = refid self.name = name + def factory(*args_, **kwargs_): if MemberType.subclass: return MemberType.subclass(*args_, **kwargs_) @@ -394,6 +441,7 @@ class MemberType(GeneratedsSuper): def set_kind(self, kind): self.kind = kind def get_refid(self): return self.refid def set_refid(self, refid): self.refid = refid + def export(self, outfile, level, namespace_='', name_='MemberType', namespacedef_=''): showIndent(outfile, level) outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, )) @@ -405,25 +453,32 @@ class MemberType(GeneratedsSuper): outfile.write('</%s%s>\n' % (namespace_, name_)) else: outfile.write(' />\n') + def exportAttributes(self, outfile, level, namespace_='', name_='MemberType'): outfile.write(' kind=%s' % (quote_attrib(self.kind), )) - outfile.write(' refid=%s' % (self.format_string(quote_attrib(self.refid).encode(ExternalEncoding), input_name='refid'), )) + outfile.write(' refid=%s' % (self.format_string(quote_attrib( + self.refid).encode(ExternalEncoding), input_name='refid'), )) + def exportChildren(self, outfile, level, namespace_='', name_='MemberType'): if self.name is not None: showIndent(outfile, level) - outfile.write('<%sname>%s</%sname>\n' % (namespace_, self.format_string(quote_xml(self.name).encode(ExternalEncoding), input_name='name'), namespace_)) + outfile.write('<%sname>%s</%sname>\n' % (namespace_, self.format_string( + quote_xml(self.name).encode(ExternalEncoding), input_name='name'), namespace_)) + def hasContent_(self): if ( self.name is not None - ): + ): return True else: return False + def exportLiteral(self, outfile, level, name_='MemberType'): level += 1 self.exportLiteralAttributes(outfile, level, name_) if self.hasContent_(): self.exportLiteralChildren(outfile, level, name_) + def exportLiteralAttributes(self, outfile, level, name_): if self.kind is not None: showIndent(outfile, level) @@ -431,23 +486,28 @@ class MemberType(GeneratedsSuper): if self.refid is not None: showIndent(outfile, level) outfile.write('refid = %s,\n' % (self.refid,)) + def exportLiteralChildren(self, outfile, level, name_): showIndent(outfile, level) - outfile.write('name=%s,\n' % quote_python(self.name).encode(ExternalEncoding)) + outfile.write('name=%s,\n' % quote_python( + self.name).encode(ExternalEncoding)) + def build(self, node_): attrs = node_.attributes self.buildAttributes(attrs) for child_ in node_.childNodes: nodeName_ = child_.nodeName.split(':')[-1] self.buildChildren(child_, nodeName_) + def buildAttributes(self, attrs): if attrs.get('kind'): self.kind = attrs.get('kind').value if attrs.get('refid'): self.refid = attrs.get('refid').value + def buildChildren(self, child_, nodeName_): if child_.nodeType == Node.ELEMENT_NODE and \ - nodeName_ == 'name': + nodeName_ == 'name': name_ = '' for text__content_ in child_.childNodes: name_ += text__content_.nodeValue @@ -461,6 +521,7 @@ Options: -s Use the SAX parser, not the minidom parser. """ + def usage(): print(USAGE_TEXT) sys.exit(1) @@ -475,7 +536,7 @@ def parse(inFileName): doc = None sys.stdout.write('<?xml version="1.0" ?>\n') rootObj.export(sys.stdout, 0, name_="doxygenindex", - namespacedef_='') + namespacedef_='') return rootObj @@ -488,7 +549,7 @@ def parseString(inString): doc = None sys.stdout.write('<?xml version="1.0" ?>\n') rootObj.export(sys.stdout, 0, name_="doxygenindex", - namespacedef_='') + namespacedef_='') return rootObj @@ -514,9 +575,7 @@ def main(): usage() - - if __name__ == '__main__': main() #import pdb - #pdb.run('main()') + # pdb.run('main()') diff --git a/gr-utils/modtool/templates/gr-newmod/docs/doxygen/doxyxml/text.py b/gr-utils/modtool/templates/gr-newmod/docs/doxygen/doxyxml/text.py index 8d8c7b4301..dbc7170ab2 100644 --- a/gr-utils/modtool/templates/gr-newmod/docs/doxygen/doxyxml/text.py +++ b/gr-utils/modtool/templates/gr-newmod/docs/doxygen/doxyxml/text.py @@ -11,6 +11,7 @@ Utilities for extracting text from generated classes. """ + def is_string(txt): if isinstance(txt, str): return True @@ -21,11 +22,13 @@ def is_string(txt): pass return False + def description(obj): if obj is None: return None return description_bit(obj).strip() + def description_bit(obj): if hasattr(obj, 'content'): contents = [description_bit(item) for item in obj.content] @@ -38,7 +41,8 @@ def description_bit(obj): elif is_string(obj): return obj else: - raise Exception('Expecting a string or something with content, content_ or value attribute') + raise Exception( + 'Expecting a string or something with content, content_ or value attribute') # If this bit is a paragraph then add one some line breaks. if hasattr(obj, 'name') and obj.name == 'para': result += "\n\n" diff --git a/gr-utils/modtool/templates/gr-newmod/docs/doxygen/update_pydoc.py b/gr-utils/modtool/templates/gr-newmod/docs/doxygen/update_pydoc.py index dd2fba79f2..b65e168ae5 100644 --- a/gr-utils/modtool/templates/gr-newmod/docs/doxygen/update_pydoc.py +++ b/gr-utils/modtool/templates/gr-newmod/docs/doxygen/update_pydoc.py @@ -16,16 +16,23 @@ python docstrings. """ -import os, sys, time, glob, re, json +import os +import sys +import time +import glob +import re +import json from argparse import ArgumentParser from doxyxml import DoxyIndex, DoxyClass, DoxyFriend, DoxyFunction, DoxyFile from doxyxml import DoxyOther, base + def py_name(name): bits = name.split('_') return '_'.join(bits[1:]) + def make_name(name): bits = name.split('_') return bits[0] + '_make_' + '_'.join(bits[1:]) @@ -50,6 +57,7 @@ class Block(object): is_a_block = di.has_member(friendname, DoxyFunction) return is_a_block + class Block2(object): """ Checks if doxyxml produced objects correspond to a new style @@ -63,7 +71,8 @@ class Block2(object): # Check for a parsing error. if item.error(): return False - is_a_block2 = item.has_member('make', DoxyFunction) and item.has_member('sptr', DoxyOther) + is_a_block2 = item.has_member( + 'make', DoxyFunction) and item.has_member('sptr', DoxyOther) return is_a_block2 @@ -94,6 +103,7 @@ def combine_descriptions(obj): description.append(dd) return utoascii('\n\n'.join(description)).strip() + def format_params(parameteritems): output = ['Args:'] template = ' {0} : {1}' @@ -101,7 +111,10 @@ def format_params(parameteritems): output.append(template.format(pi.name, pi.description)) return '\n'.join(output) + entry_templ = '%feature("docstring") {name} "{docstring}"' + + def make_entry(obj, name=None, templ="{description}", description=None, params=[]): """ Create a docstring key/value pair, where the key is the object name. @@ -114,9 +127,9 @@ def make_entry(obj, name=None, templ="{description}", description=None, params=[ used as the description instead of extracting it from obj. """ if name is None: - name=obj.name() - if hasattr(obj,'_parse_data') and hasattr(obj._parse_data,'definition'): - name=obj._parse_data.definition.split(' ')[-1] + name = obj.name() + if hasattr(obj, '_parse_data') and hasattr(obj._parse_data, 'definition'): + name = obj._parse_data.definition.split(' ')[-1] if "operator " in name: return '' if description is None: @@ -174,9 +187,10 @@ def make_block_entry(di, block): output = {} output.update(make_class_entry(block, description=super_description)) output.update(make_entry(make_func, description=super_description, - params=block.params)) + params=block.params)) return output + def make_block2_entry(di, block): """ Create class and function docstrings of a new style gnuradio block @@ -186,19 +200,21 @@ def make_block2_entry(di, block): class_description = combine_descriptions(block) make_func = block.get_member('make', DoxyFunction) make_description = combine_descriptions(make_func) - description = class_description + "\n\nConstructor Specific Documentation:\n\n" + make_description + description = class_description + \ + "\n\nConstructor Specific Documentation:\n\n" + make_description # Associate the combined description with the class and # the make function. output = {} output.update(make_class_entry( - block, description=description, - ignored_methods=['make'], params=make_func.params)) + block, description=description, + ignored_methods=['make'], params=make_func.params)) makename = block.name() + '::make' output.update(make_entry( - make_func, name=makename, description=description, - params=make_func.params)) + make_func, name=makename, description=description, + params=make_func.params)) return output + def get_docstrings_dict(di, custom_output=None): output = {} @@ -218,19 +234,21 @@ def get_docstrings_dict(di, custom_output=None): make_funcs.add(make_func.name()) output.update(make_block_entry(di, block)) except block.ParsingError: - sys.stderr.write('Parsing error for block {0}\n'.format(block.name())) + sys.stderr.write( + 'Parsing error for block {0}\n'.format(block.name())) raise for block in blocks2: try: make_func = block.get_member('make', DoxyFunction) - make_func_name = block.name() +'::make' + make_func_name = block.name() + '::make' # Don't want to risk writing to output twice. if make_func_name not in make_funcs: make_funcs.add(make_func_name) output.update(make_block2_entry(di, block)) except block.ParsingError: - sys.stderr.write('Parsing error for block {0}\n'.format(block.name())) + sys.stderr.write( + 'Parsing error for block {0}\n'.format(block.name())) raise # Create docstrings for functions @@ -241,7 +259,8 @@ def get_docstrings_dict(di, custom_output=None): try: output.update(make_entry(f)) except f.ParsingError: - sys.stderr.write('Parsing error for function {0}\n'.format(f.name())) + sys.stderr.write( + 'Parsing error for function {0}\n'.format(f.name())) # Create docstrings for classes block_names = [block.name() for block in blocks] @@ -259,22 +278,24 @@ def get_docstrings_dict(di, custom_output=None): return output + def sub_docstring_in_pydoc_h(pydoc_files, docstrings_dict, output_dir, filter_str=None): if filter_str: - docstrings_dict = {k: v for k, v in docstrings_dict.items() if k.startswith(filter_str)} + docstrings_dict = { + k: v for k, v in docstrings_dict.items() if k.startswith(filter_str)} - with open(os.path.join(output_dir,'docstring_status'),'w') as status_file: + with open(os.path.join(output_dir, 'docstring_status'), 'w') as status_file: for pydoc_file in pydoc_files: if filter_str: - filter_str2 = "::".join((filter_str,os.path.split(pydoc_file)[-1].split('_pydoc_template.h')[0])) - docstrings_dict2 = {k: v for k, v in docstrings_dict.items() if k.startswith(filter_str2)} + filter_str2 = "::".join((filter_str, os.path.split( + pydoc_file)[-1].split('_pydoc_template.h')[0])) + docstrings_dict2 = { + k: v for k, v in docstrings_dict.items() if k.startswith(filter_str2)} else: docstrings_dict2 = docstrings_dict - - - file_in = open(pydoc_file,'r').read() + file_in = open(pydoc_file, 'r').read() for key, value in docstrings_dict2.items(): file_in_tmp = file_in try: @@ -282,37 +303,44 @@ def sub_docstring_in_pydoc_h(pydoc_files, docstrings_dict, output_dir, filter_st # if 'gr' in doc_key: # doc_key.remove('gr') doc_key = '_'.join(doc_key) - regexp = r'(__doc_{} =\sR\"doc\()[^)]*(\)doc\")'.format(doc_key) + regexp = r'(__doc_{} =\sR\"doc\()[^)]*(\)doc\")'.format( + doc_key) regexp = re.compile(regexp, re.MULTILINE) - (file_in, nsubs) = regexp.subn(r'\1'+value+r'\2', file_in, count=1) + (file_in, nsubs) = regexp.subn( + r'\1' + value + r'\2', file_in, count=1) if nsubs == 1: status_file.write("PASS: " + pydoc_file + "\n") except KeyboardInterrupt: raise KeyboardInterrupt - except: # be permissive, TODO log, but just leave the docstring blank + except: # be permissive, TODO log, but just leave the docstring blank status_file.write("FAIL: " + pydoc_file + "\n") file_in = file_in_tmp - output_pathname = os.path.join(output_dir, os.path.basename(pydoc_file).replace('_template.h','.h')) - with open(output_pathname,'w') as file_out: + output_pathname = os.path.join(output_dir, os.path.basename( + pydoc_file).replace('_template.h', '.h')) + with open(output_pathname, 'w') as file_out: file_out.write(file_in) + def copy_docstring_templates(pydoc_files, output_dir): - with open(os.path.join(output_dir,'docstring_status'),'w') as status_file: + with open(os.path.join(output_dir, 'docstring_status'), 'w') as status_file: for pydoc_file in pydoc_files: - file_in = open(pydoc_file,'r').read() - output_pathname = os.path.join(output_dir, os.path.basename(pydoc_file).replace('_template.h','.h')) - with open(output_pathname,'w') as file_out: + file_in = open(pydoc_file, 'r').read() + output_pathname = os.path.join(output_dir, os.path.basename( + pydoc_file).replace('_template.h', '.h')) + with open(output_pathname, 'w') as file_out: file_out.write(file_in) status_file.write("DONE") + def argParse(): """Parses commandline args.""" - desc='Scrape the doxygen generated xml for docstrings to insert into python bindings' + desc = 'Scrape the doxygen generated xml for docstrings to insert into python bindings' parser = ArgumentParser(description=desc) - parser.add_argument("function", help="Operation to perform on docstrings", choices=["scrape","sub","copy"]) + parser.add_argument("function", help="Operation to perform on docstrings", choices=[ + "scrape", "sub", "copy"]) parser.add_argument("--xml_path") parser.add_argument("--bindings_dir") @@ -322,6 +350,7 @@ def argParse(): return parser.parse_args() + if __name__ == "__main__": # Parse command line options and set up doxyxml. args = argParse() @@ -333,8 +362,11 @@ if __name__ == "__main__": elif args.function.lower() == 'sub': with open(args.json_path, 'r') as fp: docstrings_dict = json.load(fp) - pydoc_files = glob.glob(os.path.join(args.bindings_dir,'*_pydoc_template.h')) - sub_docstring_in_pydoc_h(pydoc_files, docstrings_dict, args.output_dir, args.filter) + pydoc_files = glob.glob(os.path.join( + args.bindings_dir, '*_pydoc_template.h')) + sub_docstring_in_pydoc_h( + pydoc_files, docstrings_dict, args.output_dir, args.filter) elif args.function.lower() == 'copy': - pydoc_files = glob.glob(os.path.join(args.bindings_dir,'*_pydoc_template.h')) + pydoc_files = glob.glob(os.path.join( + args.bindings_dir, '*_pydoc_template.h')) copy_docstring_templates(pydoc_files, args.output_dir) diff --git a/gr-utils/modtool/templates/gr-newmod/python/howto/bindings/bind_oot_file.py b/gr-utils/modtool/templates/gr-newmod/python/howto/bindings/bind_oot_file.py index 9673ceb68d..5bc3ff63e2 100644 --- a/gr-utils/modtool/templates/gr-newmod/python/howto/bindings/bind_oot_file.py +++ b/gr-utils/modtool/templates/gr-newmod/python/howto/bindings/bind_oot_file.py @@ -14,13 +14,13 @@ parser.add_argument('--output_dir', default=tempfile.gettempdir(), help='Output directory of generated bindings') parser.add_argument('--prefix', help='Prefix of Installed GNU Radio') parser.add_argument('--src', help='Directory of gnuradio source tree', - default=os.path.dirname(os.path.abspath(__file__))+'/../../..') + default=os.path.dirname(os.path.abspath(__file__)) + '/../../..') parser.add_argument( '--filename', help="File to be parsed") parser.add_argument( - '--defines', help='Set additional defines for precompiler',default=(), nargs='*') + '--defines', help='Set additional defines for precompiler', default=(), nargs='*') parser.add_argument( '--include', help='Additional Include Dirs, separated', default=(), nargs='*') diff --git a/gr-utils/modtool/templates/gr-newmod/python/howto/bindings/header_utils.py b/gr-utils/modtool/templates/gr-newmod/python/howto/bindings/header_utils.py index 2150a76a25..7c26fe022b 100644 --- a/gr-utils/modtool/templates/gr-newmod/python/howto/bindings/header_utils.py +++ b/gr-utils/modtool/templates/gr-newmod/python/howto/bindings/header_utils.py @@ -6,7 +6,7 @@ import re class PybindHeaderParser: def __init__(self, pathname): - with open(pathname,'r') as f: + with open(pathname, 'r') as f: self.file_txt = f.read() def get_flag_automatic(self): @@ -49,17 +49,19 @@ class PybindHeaderParser: return f'{self.get_flag_automatic()};{self.get_flag_pygccxml()};{self.get_header_filename()};{self.get_header_file_hash()};' - def argParse(): """Parses commandline args.""" - desc='Reads the parameters from the comment block in the pybind files' + desc = 'Reads the parameters from the comment block in the pybind files' parser = ArgumentParser(description=desc) - parser.add_argument("function", help="Operation to perform on comment block of pybind file", choices=["flag_auto","flag_pygccxml","header_filename","header_file_hash","all"]) - parser.add_argument("pathname", help="Pathname of pybind c++ file to read, e.g. blockname_python.cc") + parser.add_argument("function", help="Operation to perform on comment block of pybind file", choices=[ + "flag_auto", "flag_pygccxml", "header_filename", "header_file_hash", "all"]) + parser.add_argument( + "pathname", help="Pathname of pybind c++ file to read, e.g. blockname_python.cc") return parser.parse_args() + if __name__ == "__main__": # Parse command line options and set up doxyxml. args = argParse() diff --git a/gr-utils/modtool/templates/templates.py b/gr-utils/modtool/templates/templates.py index 4ccfc229eb..558ef6a68d 100644 --- a/gr-utils/modtool/templates/templates.py +++ b/gr-utils/modtool/templates/templates.py @@ -389,7 +389,7 @@ class ${blockname}(${parenttype}): # ninputs is the number of input connections # setup size of input_items[i] for work call # the required number of input items is returned - # in a list where each element represents the + # in a list where each element represents the # number of required items for each input ninput_items_required = [noutput_items] * ninputs return ninput_items_required @@ -599,7 +599,7 @@ outputs: file_format: 1 ''' -## Old stuff +# Old stuff # C++ file of a GR block Templates['block_cpp36'] = '''/* -*- c++ -*- */ ${str_to_fancyc_comment(license)} diff --git a/gr-utils/modtool/tests/test_modtool.py b/gr-utils/modtool/tests/test_modtool.py index 37b39f9314..a022275f19 100644 --- a/gr-utils/modtool/tests/test_modtool.py +++ b/gr-utils/modtool/tests/test_modtool.py @@ -20,7 +20,7 @@ try: except: skip_pylint_test = True -try: # for debugging, full path must be given +try: # for debugging, full path must be given from gnuradio.modtool.core import ModToolNewModule from gnuradio.modtool.core import ModToolAdd from gnuradio.modtool.core import ModToolDisable @@ -35,15 +35,18 @@ except: from modtool.core import ModToolException from modtool.core import ModToolMakeYAML from modtool.core import ModToolRename - from modtool.core import ModToolRemove + from modtool.core import ModToolRemove + class TestModToolCore(unittest.TestCase): """ The tests for the modtool core """ + def __init__(self, *args, **kwargs): super(TestModToolCore, self).__init__(*args, **kwargs) self.f_add = False self.f_newmod = False - self.srcdir = path.abspath(path.join(path.dirname(path.realpath(__file__)), '../templates/gr-newmod')) + self.srcdir = path.abspath(path.join(path.dirname( + path.realpath(__file__)), '../templates/gr-newmod')) @classmethod def setUpClass(cls): @@ -59,7 +62,7 @@ class TestModToolCore(unittest.TestCase): """ create a new module and block before every test """ try: warnings.simplefilter("ignore", ResourceWarning) - args = {'module_name':'howto', + args = {'module_name': 'howto', 'directory': self.test_dir, 'srcdir': self.srcdir} ModToolNewModule(**args).run() @@ -67,8 +70,8 @@ class TestModToolCore(unittest.TestCase): self.f_newmod = True else: try: - args = {'blockname':'square_ff', 'block_type':'general', - 'lang':'cpp', 'directory': self.test_dir + '/gr-howto', + args = {'blockname': 'square_ff', 'block_type': 'general', + 'lang': 'cpp', 'directory': self.test_dir + '/gr-howto', 'add_python_qa': True} ModToolAdd(**args).run() except (TypeError, ModToolException): @@ -78,7 +81,7 @@ class TestModToolCore(unittest.TestCase): """ removes the created module """ # Required, else the new-module directory command # in setup will throw exception after first test - ## cannot remove if directory is not created + # cannot remove if directory is not created if not self.f_newmod: rmdir = self.test_dir + '/gr-howto' shutil.rmtree(rmdir) @@ -86,8 +89,8 @@ class TestModToolCore(unittest.TestCase): def test_newmod(self): """ Tests for the API function newmod """ ## Tests for proper exceptions ## - test_dict = { 'directory': self.test_dir, - 'srcdir': self.srcdir} + test_dict = {'directory': self.test_dir, + 'srcdir': self.srcdir} # module name not specified self.assertRaises(ModToolException, ModToolNewModule(**test_dict).run) test_dict['module_name'] = 'howto' @@ -110,7 +113,7 @@ class TestModToolCore(unittest.TestCase): self.assertTrue(path.exists(path.join(module_dir, 'CMakeLists.txt'))) ## The check for object instantiation ## - test_obj = ModToolNewModule(srcdir = self.srcdir) + test_obj = ModToolNewModule(srcdir=self.srcdir) # module name not specified with self.assertRaises(ModToolException) as context_manager: test_obj.run() @@ -120,9 +123,10 @@ class TestModToolCore(unittest.TestCase): self.assertRaises(ModToolException, test_obj.run) test_obj.info['modname'] = 'test1' test_obj.run() - self.assertTrue(path.isdir(self.test_dir+'/gr-test1')) - self.assertTrue(path.isdir(self.test_dir+'/gr-test1/lib')) - self.assertTrue(path.exists(self.test_dir+'/gr-test1/CMakeLists.txt')) + self.assertTrue(path.isdir(self.test_dir + '/gr-test1')) + self.assertTrue(path.isdir(self.test_dir + '/gr-test1/lib')) + self.assertTrue(path.exists( + self.test_dir + '/gr-test1/CMakeLists.txt')) @unittest.skipIf(skip_pylint_test, 'pylint dependency missing, skip test') def test_pylint_newmod(self): @@ -131,15 +135,17 @@ class TestModToolCore(unittest.TestCase): ## pylint tests ## python_dir = path.join(module_dir, 'python', 'test') py_module = path.join(python_dir, 'mul_ff.py') - (pylint_stdout, pylint_stderr) = py_run(py_module+' --errors-only --disable=E0602', return_std=True) + (pylint_stdout, pylint_stderr) = py_run(py_module + + ' --errors-only --disable=E0602', return_std=True) print(pylint_stdout.getvalue(), end='') py_module = path.join(python_dir, 'qa_mul_ff.py') - (pylint_stdout, pylint_stderr) = py_run(py_module+' --errors-only', return_std=True) + (pylint_stdout, pylint_stderr) = py_run( + py_module + ' --errors-only', return_std=True) print(pylint_stdout.getvalue(), end='') def test_add(self): """ Tests for the API function add """ - ## skip tests if newmod command wasn't successful + # skip tests if newmod command wasn't successful if self.f_newmod: raise unittest.SkipTest("setUp for API function 'add' failed") module_dir = path.join(self.test_dir, 'gr-howto') @@ -176,10 +182,14 @@ class TestModToolCore(unittest.TestCase): ## Some tests for checking the created directory, sub-directories and files ## test_dict['skip_lib'] = False ModToolAdd(**test_dict).run() - self.assertTrue(path.exists(path.join(module_dir, 'lib', 'qa_add_ff.cc'))) - self.assertTrue(path.exists(path.join(module_dir, 'lib', 'add_ff_impl.cc'))) - self.assertTrue(path.exists(path.join(module_dir, 'grc', 'howto_add_ff.block.yml'))) - self.assertTrue(path.exists(path.join(module_dir, 'include', 'gnuradio', 'howto', 'add_ff.h'))) + self.assertTrue(path.exists( + path.join(module_dir, 'lib', 'qa_add_ff.cc'))) + self.assertTrue(path.exists( + path.join(module_dir, 'lib', 'add_ff_impl.cc'))) + self.assertTrue(path.exists( + path.join(module_dir, 'grc', 'howto_add_ff.block.yml'))) + self.assertTrue(path.exists( + path.join(module_dir, 'include', 'gnuradio', 'howto', 'add_ff.h'))) ## The check for object instantiation ## test_obj = ModToolAdd() @@ -193,14 +203,17 @@ class TestModToolCore(unittest.TestCase): test_obj.info['blockname'] = 'mul_ff' test_obj.add_py_qa = True test_obj.run() - self.assertTrue(path.exists(path.join(module_dir, 'python', 'howto', 'mul_ff.py'))) - self.assertTrue(path.exists(path.join(module_dir, 'python', 'howto', 'qa_mul_ff.py'))) - self.assertTrue(path.exists(path.join(module_dir, 'grc', 'howto_mul_ff.block.yml'))) + self.assertTrue(path.exists( + path.join(module_dir, 'python', 'howto', 'mul_ff.py'))) + self.assertTrue(path.exists( + path.join(module_dir, 'python', 'howto', 'qa_mul_ff.py'))) + self.assertTrue(path.exists( + path.join(module_dir, 'grc', 'howto_mul_ff.block.yml'))) @unittest.skipIf(skip_pylint_test, 'pylint dependency missing, skip test') def test_pylint_add(self): """ Pylint tests for API function add """ - ## skip tests if newmod command wasn't successful + # skip tests if newmod command wasn't successful if self.f_newmod: raise unittest.SkipTest("setUp for API function 'add' failed") module_dir = path.join(self.test_dir, 'gr-howto') @@ -217,16 +230,20 @@ class TestModToolCore(unittest.TestCase): test_obj.info['blockname'] = 'mul_ff' test_obj.add_py_qa = True test_obj.run() - self.assertTrue(path.exists(path.join(module_dir, 'python', 'howto', 'mul_ff.py'))) - self.assertTrue(path.exists(path.join(module_dir, 'python', 'howto', 'qa_mul_ff.py'))) + self.assertTrue(path.exists( + path.join(module_dir, 'python', 'howto', 'mul_ff.py'))) + self.assertTrue(path.exists( + path.join(module_dir, 'python', 'howto', 'qa_mul_ff.py'))) ## pylint tests ## python_dir = path.join(module_dir, 'python', 'howto') py_module = path.join(python_dir, 'mul_ff.py') - (pylint_stdout, pylint_stderr) = py_run(py_module+' --errors-only --disable=E0602', return_std=True) + (pylint_stdout, pylint_stderr) = py_run(py_module + + ' --errors-only --disable=E0602', return_std=True) print(pylint_stdout.getvalue(), end='') py_module = path.join(python_dir, 'qa_mul_ff.py') - (pylint_stdout, pylint_stderr) = py_run(py_module+' --errors-only', return_std=True) + (pylint_stdout, pylint_stderr) = py_run( + py_module + ' --errors-only', return_std=True) print(pylint_stdout.getvalue(), end='') def test_rename(self): @@ -247,7 +264,8 @@ class TestModToolCore(unittest.TestCase): test_dict['new_name'] = '//#' # Invalid new block name! expected_message = "Invalid new block name '//#': names can only contain letters, numbers and underscores" - self.assertRaisesRegex(ModToolException, expected_message, ModToolRename(**test_dict).run) + self.assertRaisesRegex( + ModToolException, expected_message, ModToolRename(**test_dict).run) test_dict['new_name'] = 'non-alpha-chars-like-hyphen-are-not-allowed' # Invalid new block name! @@ -260,20 +278,28 @@ class TestModToolCore(unittest.TestCase): ## Some tests for checking the renamed files ## test_dict['new_name'] = 'div_ff' ModToolRename(**test_dict).run() - self.assertTrue(path.exists(path.join(module_dir, 'lib', 'div_ff_impl.h'))) - self.assertTrue(path.exists(path.join(module_dir, 'lib', 'div_ff_impl.cc'))) - self.assertTrue(path.exists(path.join(module_dir, 'python', 'howto', 'qa_div_ff.py'))) - self.assertTrue(path.exists(path.join(module_dir, 'grc', 'howto_div_ff.block.yml'))) + self.assertTrue(path.exists( + path.join(module_dir, 'lib', 'div_ff_impl.h'))) + self.assertTrue(path.exists( + path.join(module_dir, 'lib', 'div_ff_impl.cc'))) + self.assertTrue(path.exists( + path.join(module_dir, 'python', 'howto', 'qa_div_ff.py'))) + self.assertTrue(path.exists( + path.join(module_dir, 'grc', 'howto_div_ff.block.yml'))) ## The check for object instantiation ## test_obj = ModToolRename() test_obj.info['oldname'] = 'div_ff' test_obj.info['newname'] = 'sub_ff' test_obj.run() - self.assertTrue(path.exists(path.join(module_dir, 'lib', 'sub_ff_impl.h'))) - self.assertTrue(path.exists(path.join(module_dir, 'lib', 'sub_ff_impl.cc'))) - self.assertTrue(path.exists(path.join(module_dir, 'python', 'howto', 'qa_sub_ff.py'))) - self.assertTrue(path.exists(path.join(module_dir, 'grc', 'howto_sub_ff.block.yml'))) + self.assertTrue(path.exists( + path.join(module_dir, 'lib', 'sub_ff_impl.h'))) + self.assertTrue(path.exists( + path.join(module_dir, 'lib', 'sub_ff_impl.cc'))) + self.assertTrue(path.exists( + path.join(module_dir, 'python', 'howto', 'qa_sub_ff.py'))) + self.assertTrue(path.exists( + path.join(module_dir, 'grc', 'howto_sub_ff.block.yml'))) def test_remove(self): """ Tests for the API function remove """ @@ -289,18 +315,26 @@ class TestModToolCore(unittest.TestCase): ## Some tests to check blocks are not removed with different blocknames ## test_dict['blockname'] = 'div_ff' ModToolRemove(**test_dict).run() - self.assertTrue(path.exists(path.join(module_dir, 'lib', 'square_ff_impl.h'))) - self.assertTrue(path.exists(path.join(module_dir, 'lib', 'square_ff_impl.cc'))) - self.assertTrue(path.exists(path.join(module_dir, 'python', 'howto', 'qa_square_ff.py'))) - self.assertTrue(path.exists(path.join(module_dir, 'grc', 'howto_square_ff.block.yml'))) + self.assertTrue(path.exists( + path.join(module_dir, 'lib', 'square_ff_impl.h'))) + self.assertTrue(path.exists( + path.join(module_dir, 'lib', 'square_ff_impl.cc'))) + self.assertTrue(path.exists( + path.join(module_dir, 'python', 'howto', 'qa_square_ff.py'))) + self.assertTrue(path.exists( + path.join(module_dir, 'grc', 'howto_square_ff.block.yml'))) ## Some tests for checking the non-existence of removed files ## test_dict['blockname'] = 'square_ff' ModToolRemove(**test_dict).run() - self.assertTrue(not path.exists(path.join(module_dir, 'lib', 'square_ff_impl.h'))) - self.assertTrue(not path.exists(path.join(module_dir, 'lib', 'square_ff_impl.cc'))) - self.assertTrue(not path.exists(path.join(module_dir, 'python', 'howto', 'qa_square_ff.py'))) - self.assertTrue(not path.exists(path.join(module_dir, 'grc', 'howto_square_ff.block.yml'))) + self.assertTrue(not path.exists( + path.join(module_dir, 'lib', 'square_ff_impl.h'))) + self.assertTrue(not path.exists( + path.join(module_dir, 'lib', 'square_ff_impl.cc'))) + self.assertTrue(not path.exists( + path.join(module_dir, 'python', 'howto', 'qa_square_ff.py'))) + self.assertTrue(not path.exists( + path.join(module_dir, 'grc', 'howto_square_ff.block.yml'))) def test_makeyaml(self): """ Tests for the API function makeyaml """ @@ -332,5 +366,6 @@ class TestModToolCore(unittest.TestCase): test_dict['blockname'] = 'square_ff' ModToolDisable(**test_dict).run() + if __name__ == '__main__': unittest.main() diff --git a/gr-utils/modtool/tools/cmakefile_editor.py b/gr-utils/modtool/tools/cmakefile_editor.py index ce97b95919..5632eef254 100644 --- a/gr-utils/modtool/tools/cmakefile_editor.py +++ b/gr-utils/modtool/tools/cmakefile_editor.py @@ -17,6 +17,7 @@ logger = logging.getLogger(__name__) class CMakeFileEditor(object): """A tool for editing CMakeLists.txt files. """ + def __init__(self, filename, separator='\n ', indent=' '): self.filename = filename with open(filename, 'r') as f: @@ -60,10 +61,10 @@ class CMakeFileEditor(object): else: regexp = r'^\s*({entry}\(\s*{to_ignore_start}[^()]*?\s+){value}\s*([^()]*{to_ignore_end}\s*\))' regexp = regexp.format( - entry=entry, - to_ignore_start=to_ignore_start, - value=value, - to_ignore_end=to_ignore_end, + entry=entry, + to_ignore_start=to_ignore_start, + value=value, + to_ignore_end=to_ignore_end, ) regexp = re.compile(regexp, re.MULTILINE) (self.cfile, nsubs) = re.subn(regexp, r'\1\2', self.cfile, count=1) @@ -83,7 +84,8 @@ class CMakeFileEditor(object): def remove_double_newlines(self): """Simply clear double newlines from the file buffer.""" - self.cfile = re.compile('\n\n\n+', re.MULTILINE).sub('\n\n', self.cfile) + self.cfile = re.compile( + '\n\n\n+', re.MULTILINE).sub('\n\n', self.cfile) def find_filenames_match(self, regex): """ Find the filenames that match a certain regex @@ -112,27 +114,30 @@ class CMakeFileEditor(object): for line in self.cfile.splitlines(): if len(line.strip()) == 0 or line.strip()[0] == '#': continue - if re.search(r'\b'+fname+r'\b', line): + if re.search(r'\b' + fname + r'\b', line): if re.match(fname, line.lstrip()): starts_line = True break comment_out_re = r'#\1' + '\n' + self.indent if not starts_line: comment_out_re = r'\n' + self.indent + comment_out_re - (self.cfile, nsubs) = re.subn(r'(\b'+fname+r'\b)\s*', comment_out_re, self.cfile) + (self.cfile, nsubs) = re.subn( + r'(\b' + fname + r'\b)\s*', comment_out_re, self.cfile) if nsubs == 0: - logger.warning(f"Warning: A replacement failed when commenting out {fname}. Check the CMakeFile.txt manually.") + logger.warning( + f"Warning: A replacement failed when commenting out {fname}. Check the CMakeFile.txt manually.") elif nsubs > 1: - logger.warning(f"Warning: Replaced {fname} {nsubs} times (instead of once). Check the CMakeFile.txt manually.") + logger.warning( + f"Warning: Replaced {fname} {nsubs} times (instead of once). Check the CMakeFile.txt manually.") def comment_out_lines(self, pattern, comment_str='#'): """ Comments out all lines that match with pattern """ for line in self.cfile.splitlines(): if re.search(pattern, line): - self.cfile = self.cfile.replace(line, comment_str+line) + self.cfile = self.cfile.replace(line, comment_str + line) def check_for_glob(self, globstr): """ Returns true if a glob as in globstr is found in the cmake file """ str_ = globstr.replace('*', r'\*') glob_re = fr'GLOB\s[a-z_]+\s"{str_}"' - return re.search(glob_re, self.cfile, flags=re.MULTILINE|re.IGNORECASE) is not None + return re.search(glob_re, self.cfile, flags=re.MULTILINE | re.IGNORECASE) is not None diff --git a/gr-utils/modtool/tools/code_generator.py b/gr-utils/modtool/tools/code_generator.py index 8140e06e28..08f4fcdccd 100644 --- a/gr-utils/modtool/tools/code_generator.py +++ b/gr-utils/modtool/tools/code_generator.py @@ -29,6 +29,7 @@ GRTYPELIST = { 'noblock': '' } + def render_template(tpl_id, **kwargs): """ Return the parsed and rendered template given by tpl_id """ # Choose template @@ -46,4 +47,3 @@ def render_template(tpl_id, **kwargs): kwargs['include_dir_prefix'] = kwargs['modname'] # Render and return return tpl.render(**kwargs) - diff --git a/gr-utils/modtool/tools/cppfile_editor.py b/gr-utils/modtool/tools/cppfile_editor.py index 418547c9b7..5b44bc3dbf 100644 --- a/gr-utils/modtool/tools/cppfile_editor.py +++ b/gr-utils/modtool/tools/cppfile_editor.py @@ -17,6 +17,7 @@ logger = logging.getLogger(__name__) class CPPFileEditor(object): """A tool for editing CMakeLists.txt files. """ + def __init__(self, filename, separator='\n ', indent=' '): self.filename = filename with open(filename, 'r') as f: @@ -35,36 +36,43 @@ class CPPFileEditor(object): def append_value(self, start_tag, end_tag, value): """ Add a value to an entry. """ cfile_lines = self.cfile.splitlines() - start_line_idx = [cfile_lines.index(s) for s in cfile_lines if start_tag in s][0] - end_line_idx = [cfile_lines.index(s) for s in cfile_lines if end_tag in s][0] + start_line_idx = [cfile_lines.index( + s) for s in cfile_lines if start_tag in s][0] + end_line_idx = [cfile_lines.index(s) + for s in cfile_lines if end_tag in s][0] - self.cfile = '\n'.join((cfile_lines[0:end_line_idx]+[self.indent + value]+cfile_lines[end_line_idx:])) + self.cfile = '\n'.join( + (cfile_lines[0:end_line_idx] + [self.indent + value] + cfile_lines[end_line_idx:])) return 1 - def remove_value(self, start_tag, end_tag, value): - + cfile_lines = self.cfile.splitlines() try: - start_line_idx = [cfile_lines.index(s) for s in cfile_lines if start_tag in s][0] - end_line_idx = [cfile_lines.index(s) for s in cfile_lines if end_tag in s][0] + start_line_idx = [cfile_lines.index( + s) for s in cfile_lines if start_tag in s][0] + end_line_idx = [cfile_lines.index( + s) for s in cfile_lines if end_tag in s][0] except: logger.warning("Could not find start or end tags in search") return 0 - try: - lines_between_tags = cfile_lines[(start_line_idx+1):end_line_idx] - remove_index = [lines_between_tags.index(s) for s in cfile_lines if value in s][0] + try: + lines_between_tags = cfile_lines[(start_line_idx + 1):end_line_idx] + remove_index = [lines_between_tags.index( + s) for s in cfile_lines if value in s][0] lines_between_tags.pop(remove_index) except: return 0 - self.cfile = '\n'.join((cfile_lines[0:(start_line_idx+1)]+lines_between_tags+cfile_lines[end_line_idx:])) + self.cfile = '\n'.join((cfile_lines[0:( + start_line_idx + 1)] + lines_between_tags + cfile_lines[end_line_idx:])) return 1 def delete_entry(self, entry, value_pattern=''): """Remove an entry from the current buffer.""" - regexp = r'{}\s*\([^()]*{}[^()]*\)[^\n]*\n'.format(entry, value_pattern) + regexp = r'{}\s*\([^()]*{}[^()]*\)[^\n]*\n'.format(entry, + value_pattern) regexp = re.compile(regexp, re.MULTILINE) (self.cfile, nsubs) = re.subn(regexp, '', self.cfile, count=1) return nsubs @@ -76,7 +84,8 @@ class CPPFileEditor(object): def remove_double_newlines(self): """Simply clear double newlines from the file buffer.""" - self.cfile = re.compile('\n\n\n+', re.MULTILINE).sub('\n\n', self.cfile) + self.cfile = re.compile( + '\n\n\n+', re.MULTILINE).sub('\n\n', self.cfile) def find_filenames_match(self, regex): """ Find the filenames that match a certain regex @@ -105,26 +114,29 @@ class CPPFileEditor(object): for line in self.cfile.splitlines(): if len(line.strip()) == 0 or line.strip()[0] == '#': continue - if re.search(r'\b'+fname+r'\b', line): + if re.search(r'\b' + fname + r'\b', line): if re.match(fname, line.lstrip()): starts_line = True break comment_out_re = r'#\1' + '\n' + self.indent if not starts_line: comment_out_re = r'\n' + self.indent + comment_out_re - (self.cfile, nsubs) = re.subn(r'(\b'+fname+r'\b)\s*', comment_out_re, self.cfile) + (self.cfile, nsubs) = re.subn( + r'(\b' + fname + r'\b)\s*', comment_out_re, self.cfile) if nsubs == 0: - logger.warning("Warning: A replacement failed when commenting out {}. Check the CMakeFile.txt manually.".format(fname)) + logger.warning( + "Warning: A replacement failed when commenting out {}. Check the CMakeFile.txt manually.".format(fname)) elif nsubs > 1: - logger.warning("Warning: Replaced {} {} times (instead of once). Check the CMakeFile.txt manually.".format(fname, nsubs)) + logger.warning( + "Warning: Replaced {} {} times (instead of once). Check the CMakeFile.txt manually.".format(fname, nsubs)) def comment_out_lines(self, pattern, comment_str='#'): """ Comments out all lines that match with pattern """ for line in self.cfile.splitlines(): if re.search(pattern, line): - self.cfile = self.cfile.replace(line, comment_str+line) + self.cfile = self.cfile.replace(line, comment_str + line) def check_for_glob(self, globstr): """ Returns true if a glob as in globstr is found in the cmake file """ glob_re = r'GLOB\s[a-z_]+\s"{}"'.format(globstr.replace('*', r'\*')) - return re.search(glob_re, self.cfile, flags=re.MULTILINE|re.IGNORECASE) is not None + return re.search(glob_re, self.cfile, flags=re.MULTILINE | re.IGNORECASE) is not None diff --git a/gr-utils/modtool/tools/grc_yaml_generator.py b/gr-utils/modtool/tools/grc_yaml_generator.py index 188b917d1f..2ecee8ca76 100644 --- a/gr-utils/modtool/tools/grc_yaml_generator.py +++ b/gr-utils/modtool/tools/grc_yaml_generator.py @@ -23,6 +23,7 @@ from .util_functions import is_number ## setup dumper for dumping OrderedDict ## _mapping_tag = yaml.resolver.BaseResolver.DEFAULT_MAPPING_TAG + def dict_representer(dumper, data): """ Representer to represent special OrderedDict """ return dumper.represent_dict(data.items()) @@ -32,24 +33,27 @@ def dict_constructor(loader, node): """ Construct an OrderedDict for dumping """ return OrderedDict(loader.construct_pairs(node)) + Dumper.add_representer(OrderedDict, dict_representer) Loader.add_constructor(_mapping_tag, dict_constructor) class GRCYAMLGenerator(object): """ Create and write the YAML bindings for a GRC block. """ + def __init__(self, modname=None, blockname=None, doc=None, params=None, iosig=None): """docstring for __init__""" - params_list = ['${'+s['key']+'}' for s in params if s['in_constructor']] + params_list = [ + '${' + s['key'] + '}' for s in params if s['in_constructor']] # Can't make a dict 'cause order matters str_ = ', '.join(params_list) self._header = (('id', f'{modname}_{blockname}'), ('label', blockname.replace('_', ' ')), (f'category', f'[{modname.capitalize()}]') - ) + ) self._templates = (('imports', f'import {modname}'), ('make', f'{modname}.{blockname}({str_})') - ) + ) self.params = params self.iosig = iosig self.doc = doc @@ -97,13 +101,13 @@ class GRCYAMLGenerator(object): if is_number(vlen): s_obj['vlen'] = vlen else: - s_obj['vlen'] = '${ '+vlen+' }' - if i == len(iosig[inout]['type'])-1: + s_obj['vlen'] = '${ ' + vlen + ' }' + if i == len(iosig[inout]['type']) - 1: if not is_number(iosig[inout]['max_ports']): s_obj['multiplicity'] = iosig[inout]['max_ports'] elif len(iosig[inout]['type']) < int(iosig[inout]['max_ports']): s_obj['multiplicity'] = str(int(iosig[inout]['max_ports']) - - len(iosig[inout]['type'])+1) + len(iosig[inout]['type']) + 1) if s_type == 'input': inputs.append(s_obj) elif s_type == 'output': diff --git a/gr-utils/modtool/tools/parser_cc_block.py b/gr-utils/modtool/tools/parser_cc_block.py index d4e261cac7..c53f655357 100644 --- a/gr-utils/modtool/tools/parser_cc_block.py +++ b/gr-utils/modtool/tools/parser_cc_block.py @@ -15,17 +15,20 @@ import logging logger = logging.getLogger(__name__) + def dummy_translator(the_type, default_v=None): """ Doesn't really translate. """ return the_type + class ParserCCBlock(object): """ Class to read blocks written in C++ """ + def __init__(self, filename_cc, filename_h, blockname, version, type_trans=dummy_translator): with open(filename_cc) as f: self.code_cc = f.read() with open(filename_h) as f: - self.code_h = f.read() + self.code_h = f.read() self.blockname = blockname self.type_trans = type_trans self.version = version @@ -40,14 +43,16 @@ class ParserCCBlock(object): logger.error('tbi') raise ValueError return {'type': [_typestr_to_iotype(x) for x in typestr.split(',')], - 'vlen': [_typestr_to_vlen(x) for x in typestr.split(',')] - } + 'vlen': [_typestr_to_vlen(x) for x in typestr.split(',')] + } + def _typestr_to_iotype(typestr): """ Convert a type string (e.g. sizeof(int) * vlen) to the type (e.g. 'int'). """ type_match = re.search(r'sizeof\s*\(([^)]*)\)', typestr) if type_match is None: return self.type_trans('char') return self.type_trans(type_match.group(1)) + def _typestr_to_vlen(typestr): """ From a type identifier, returns the vector length of the block's input/out. E.g., for 'sizeof(int) * 10', it returns 10. For @@ -71,7 +76,8 @@ class ParserCCBlock(object): r'\s*(?P<intype>(\([^\)]*\)|[^)])+)\),\s*' + \ r'(?P<outcall>gr::io_signature::make[23v]?)\s*\(\s*(?P<outmin>[^,]+),\s*(?P<outmax>[^,]+),' + \ r'\s*(?P<outtype>(\([^\)]*\)|[^)])+)\)' - iosig_match = re.compile(iosig_regex, re.MULTILINE).search(self.code_cc) + iosig_match = re.compile( + iosig_regex, re.MULTILINE).search(self.code_cc) try: iosig['in'] = _figure_out_iotype_and_vlen(iosig_match.group('incall'), iosig_match.group('intype')) @@ -88,7 +94,6 @@ class ParserCCBlock(object): logger.error("Error: Can't parse output signature.") return iosig - def read_params(self): """ Read the parameters required to initialize the block """ def _scan_param_list(start_idx): @@ -104,8 +109,8 @@ class ParserCCBlock(object): param_list = [] read_state = 'type' in_string = False - parens_count = 0 # Counts () - brackets_count = 0 # Counts <> + parens_count = 0 # Counts () + brackets_count = 0 # Counts <> end_of_list = False this_type = '' this_name = '' @@ -118,12 +123,13 @@ class ParserCCBlock(object): if parens_count == 0: if read_state == 'type' and len(this_type): raise ValueError( - 'Found closing parentheses before finishing ' - 'last argument (this is how far I got: {})'.format \ - (str(param_list)) + 'Found closing parentheses before finishing ' + 'last argument (this is how far I got: {})'.format + (str(param_list)) ) if len(this_type): - param_list.append((this_type, this_name, this_defv)) + param_list.append( + (this_type, this_name, this_defv)) end_of_list = True break else: @@ -143,9 +149,9 @@ class ParserCCBlock(object): while c[i] in WHITESPACE: i += 1 continue - if this_type == 'const' or this_type == '': # Ignore this + if this_type == 'const' or this_type == '': # Ignore this this_type = '' - elif this_type == 'unsigned': # Continue + elif this_type == 'unsigned': # Continue this_type += ' ' continue else: @@ -161,16 +167,16 @@ class ParserCCBlock(object): elif c[i] == '=': if parens_count != 0: raise ValueError( - 'While parsing argument {} ({}): name finished but no closing parentheses.'.format \ - (len(param_list)+1, this_type + ' ' + this_name) + 'While parsing argument {} ({}): name finished but no closing parentheses.'.format + (len(param_list) + 1, this_type + ' ' + this_name) ) read_state = 'defv' i += 1 elif c[i] == ',': if parens_count: raise ValueError( - 'While parsing argument {} ({}): name finished but no closing parentheses.'.format \ - (len(param_list)+1, this_type + ' ' + this_name) + 'While parsing argument {} ({}): name finished but no closing parentheses.'.format + (len(param_list) + 1, this_type + ' ' + this_name) ) read_state = 'defv' else: @@ -180,15 +186,15 @@ class ParserCCBlock(object): # Default value if read_state == 'defv': if in_string: - if c[i] == '"' and c[i-1] != '\\': + if c[i] == '"' and c[i - 1] != '\\': in_string = False else: this_defv += c[i] elif c[i] == ',': if parens_count: raise ValueError( - 'While parsing argument {} ({}): default value finished but no closing parentheses.'.format \ - (len(param_list)+1, this_type + ' ' + this_name) + 'While parsing argument {} ({}): default value finished but no closing parentheses.'.format + (len(param_list) + 1, this_type + ' ' + this_name) ) read_state = 'type' param_list.append((this_type, this_name, this_defv)) diff --git a/gr-utils/modtool/tools/scm.py b/gr-utils/modtool/tools/scm.py index a92be88de6..005eb7c1f3 100644 --- a/gr-utils/modtool/tools/scm.py +++ b/gr-utils/modtool/tools/scm.py @@ -22,15 +22,20 @@ except ImportError: # GitPython is a bit too unstable currently HAS_GITPYTHON = False + class InvalidSCMError(Exception): """ Exception for when trying to access a repo of wrong type. """ + def __init__(self): Exception.__init__(self) ### Base class ############################################################### + + class SCMRepository(object): """ Base class to handle interactions with source code management systems. """ handles_scm_type = '*' + def __init__(self, path_to_repo, is_empty=False): self.path_to_repo = path_to_repo self.is_empty = is_empty @@ -84,6 +89,7 @@ class SCMRepository(object): ### Git ##################################################################### class GitManagerGitPython(object): """ Manage git through GitPython (preferred way). """ + def __init__(self, path_to_repo, init=False): if init: self.repo = git.Repo.init(path_to_repo, mkdir=False) @@ -108,11 +114,13 @@ class GitManagerGitPython(object): class GitManagerShell(object): """ Call the git executable through a shell. """ + def __init__(self, path_to_repo, init=False, git_executable=None): self.path_to_repo = path_to_repo if git_executable is None: try: - self.git_executable = subprocess.check_output('which git', shell=True).strip() + self.git_executable = subprocess.check_output( + 'which git', shell=True).strip() except (OSError, subprocess.CalledProcessError): raise InvalidSCMError try: @@ -127,16 +135,19 @@ class GitManagerShell(object): def add_files(self, paths_to_files): """ Adds a tuple of files to the index of the current repository. Does not commit. """ - subprocess.check_output([self.git_executable, 'add'] + list(paths_to_files)) + subprocess.check_output( + [self.git_executable, 'add'] + list(paths_to_files)) def remove_files(self, paths_to_files): """ Removes a tuple of files from the index of the current repository. Does not commit. """ - subprocess.check_output([self.git_executable, 'rm', '--cached'] + list(paths_to_files)) + subprocess.check_output( + [self.git_executable, 'rm', '--cached'] + list(paths_to_files)) class GitRepository(SCMRepository): """ Specific to operating on git repositories. """ handles_scm_type = 'git' + def __init__(self, path_to_repo, is_empty=False): SCMRepository.__init__(self, path_to_repo, is_empty) if not is_empty: @@ -155,7 +166,8 @@ class GitRepository(SCMRepository): If add_file is True, all files in this dir are added to the index. """ SCMRepository.init_repo(self, path_to_repo, add_files) if HAS_GITPYTHON: - self.repo_manager = GitManagerGitPython(self.path_to_repo, init=True) + self.repo_manager = GitManagerGitPython( + self.path_to_repo, init=True) else: self.repo_manager = GitManagerShell(self.path_to_repo, init=True) if add_files: @@ -182,6 +194,7 @@ class GitRepository(SCMRepository): ### Factory ################################################################## class SCMRepoFactory(object): """ Factory object to create the correct SCM class from the given options and dir. """ + def __init__(self, options, path_to_repo): self.path_to_repo = path_to_repo self.options = options @@ -195,7 +208,8 @@ class SCMRepoFactory(object): if issubclass(glbl, SCMRepository): the_scm = glbl(self.path_to_repo) if the_scm.is_active(): - logger.info('Found SCM of type:', the_scm.handles_scm_type) + logger.info('Found SCM of type:', + the_scm.handles_scm_type) return the_scm except (TypeError, AttributeError, InvalidSCMError): pass @@ -217,4 +231,3 @@ class SCMRepoFactory(object): if self.options == 'yes': return None return SCMRepository(self.path_to_repo) - diff --git a/gr-utils/modtool/tools/util_functions.py b/gr-utils/modtool/tools/util_functions.py index 52bd01384f..a5b368e32c 100644 --- a/gr-utils/modtool/tools/util_functions.py +++ b/gr-utils/modtool/tools/util_functions.py @@ -15,6 +15,7 @@ import readline # None of these must depend on other modtool stuff! + def append_re_line_sequence(filename, linepattern, newline): """ Detects the re 'linepattern' in the file. After its last occurrence, paste 'newline'. If the pattern does not exist, append the new line @@ -31,6 +32,7 @@ def append_re_line_sequence(filename, linepattern, newline): with open(filename, 'w') as f: f.write(newfile) + def remove_pattern_from_file(filename, pattern): """ Remove all occurrences of a given pattern from a file. """ with open(filename, 'r') as f: @@ -39,6 +41,7 @@ def remove_pattern_from_file(filename, pattern): with open(filename, 'w') as f: f.write(pattern.sub('', oldfile)) + def str_to_fancyc_comment(text): """ Return a string as a C formatted comment. """ l_lines = text.splitlines() @@ -54,6 +57,7 @@ def str_to_fancyc_comment(text): outstr += " */\n" return outstr + def str_to_python_comment(text): """ Return a string as a Python formatted comment. """ l_lines = text.splitlines() @@ -69,10 +73,12 @@ def str_to_python_comment(text): outstr += "#\n" return outstr + def strip_default_values(string): """ Strip default values from a C++ argument list. """ return re.sub(' *=[^,)]*', '', string) + def strip_arg_types(string): """" Strip the argument types from a list of arguments. @@ -83,8 +89,9 @@ def strip_arg_types(string): """ string = strip_default_values(string) return ", ".join( - [part.strip().split(' ')[-1] for part in string.split(',')] - ).replace('*','').replace('&','') + [part.strip().split(' ')[-1] for part in string.split(',')] + ).replace('*', '').replace('&', '') + def strip_arg_types_grc(string): """" Strip the argument types from a list of arguments for GRC make tag. @@ -95,6 +102,7 @@ def strip_arg_types_grc(string): string = strip_default_values(string) return ", ".join(['${' + part.strip().split(' ')[-1] + '}' for part in string.split(',')]) + def get_modname(): """ Grep the current module's name from gnuradio.project or CMakeLists.txt """ modname_trans = {'howto-write-a-block': 'howto'} @@ -110,13 +118,15 @@ def get_modname(): cmfile = f.read() regexp = r'(project\s*\(\s*|GR_REGISTER_COMPONENT\(")gr-(?P<modname>[a-zA-Z0-9-_]+)(\s*(CXX)?|" ENABLE)' try: - modname = re.search(regexp, cmfile, flags=re.MULTILINE).group('modname').strip() + modname = re.search(regexp, cmfile, flags=re.MULTILINE).group( + 'modname').strip() if modname in list(modname_trans.keys()): modname = modname_trans[modname] return modname except AttributeError: return None + def get_block_names(pattern, modname): """ Return a list of block names belonging to modname that matches the regex pattern. """ blocknames = [] @@ -131,6 +141,7 @@ def get_block_names(pattern, modname): blocknames.append(word.strip('.h')) return blocknames + def is_number(s): """ Return True if the string s contains a number. """ try: @@ -139,6 +150,7 @@ def is_number(s): except ValueError: return False + def ask_yes_no(question, default): """ Asks a binary question. Returns True for yes, False for no. default is given as a boolean. """ @@ -148,6 +160,7 @@ def ask_yes_no(question, default): else: return not default + class SequenceCompleter(object): """ A simple completer function wrapper to be used with readline, e.g. option_iterable = ("search", "seek", "destroy") @@ -165,7 +178,8 @@ class SequenceCompleter(object): if not text and state < len(self._seq): return self._seq[state] if not state: - self._tmp_matches = [candidate for candidate in self._seq if candidate.startswith(text)] + self._tmp_matches = [ + candidate for candidate in self._seq if candidate.startswith(text)] if state < len(self._tmp_matches): return self._tmp_matches[state] diff --git a/gr-utils/plot_tools/gr_plot b/gr-utils/plot_tools/gr_plot index 84601fda02..14fb3a4c86 100755 --- a/gr-utils/plot_tools/gr_plot +++ b/gr-utils/plot_tools/gr_plot @@ -16,9 +16,9 @@ def main(): args = parser.parse_args() plot_data(None, args.files, args) + if __name__ == "__main__": try: main() except KeyboardInterrupt: pass - diff --git a/gr-utils/plot_tools/gr_plot_const b/gr-utils/plot_tools/gr_plot_const index 18f781e516..aa4350eb5c 100755 --- a/gr-utils/plot_tools/gr_plot_const +++ b/gr-utils/plot_tools/gr_plot_const @@ -76,7 +76,8 @@ class draw_constellation: [0.45, 0.01, 0.05, 0.05], frameon=True ) self.button_left = Button(self.button_left_axes, "<") - self.button_left_callback = self.button_left.on_clicked(self.button_left_click) + self.button_left_callback = self.button_left.on_clicked( + self.button_left_click) self.button_right_axes = self.fig.add_axes( [0.50, 0.01, 0.05, 0.05], frameon=True @@ -112,7 +113,8 @@ class draw_constellation: self.imags = numpy.array([i.imag for i in iq]) self.time = numpy.array( - [i * (1 / self.sample_rate) for i in range(len(self.reals))] + [i * (1 / self.sample_rate) + for i in range(len(self.reals))] ) return True else: @@ -126,8 +128,10 @@ class draw_constellation: r = self.get_data() # Subplot for real and imaginary parts of signal - self.sp_iq = self.fig.add_subplot(2, 1, 1, position=[0.075, 0.2, 0.4, 0.6]) - self.sp_iq.set_title(("I&Q"), fontsize=self.title_font_size, fontweight="bold") + self.sp_iq = self.fig.add_subplot( + 2, 1, 1, position=[0.075, 0.2, 0.4, 0.6]) + self.sp_iq.set_title( + ("I&Q"), fontsize=self.title_font_size, fontweight="bold") self.sp_iq.set_xlabel( "Time (s)", fontsize=self.label_font_size, fontweight="bold" ) @@ -139,7 +143,8 @@ class draw_constellation: ) # Subplot for constellation plot - self.sp_const = self.fig.add_subplot(2, 2, 1, position=[0.575, 0.2, 0.4, 0.6]) + self.sp_const = self.fig.add_subplot( + 2, 2, 1, position=[0.575, 0.2, 0.4, 0.6]) self.sp_const.set_title( ("Constellation"), fontsize=self.title_font_size, fontweight="bold" ) @@ -219,8 +224,8 @@ class draw_constellation: curxlim = numpy.array(self.xlim) if newxlim[0] != curxlim[0] or newxlim[1] != curxlim[1]: self.xlim = newxlim - r = self.reals[int(ceil(self.xlim[0])) : int(ceil(self.xlim[1]))] - i = self.imags[int(ceil(self.xlim[0])) : int(ceil(self.xlim[1]))] + r = self.reals[int(ceil(self.xlim[0])): int(ceil(self.xlim[1]))] + i = self.imags[int(ceil(self.xlim[0])): int(ceil(self.xlim[1]))] self.plot_const[0].set_data(r, i) self.sp_const.axis([-2, 2, -2, 2]) @@ -297,7 +302,8 @@ def find(item_in, list_search): def main(): description = "Takes a GNU Radio complex binary file and displays the I&Q data versus time and the constellation plot (I vs. Q). You can set the block size to specify how many points to read in at a time and the start position in the file. By default, the system assumes a sample rate of 1, so in time, each sample is plotted versus the sample number. To set a true time axis, set the sample rate (-R or --sample-rate) to the sample rate used when capturing the samples." - parser = ArgumentParser(conflict_handler="resolve", description=description) + parser = ArgumentParser(conflict_handler="resolve", + description=description) parser.add_argument( "-B", "--block", @@ -319,7 +325,8 @@ def main(): default=1.0, help="Set the sampler rate of the data [default=%(default)r]", ) - parser.add_argument("file", metavar="FILE", help="Input file with complex samples") + parser.add_argument("file", metavar="FILE", + help="Input file with complex samples") args = parser.parse_args() dc = draw_constellation(args.file, args) diff --git a/gr-utils/plot_tools/gr_plot_fft b/gr-utils/plot_tools/gr_plot_fft index 9851c08007..e57eb234d1 100755 --- a/gr-utils/plot_tools/gr_plot_fft +++ b/gr-utils/plot_tools/gr_plot_fft @@ -13,12 +13,14 @@ from gnuradio.plot_fft_base import plot_fft_base # This is a wrapper program for plot_fft_base. It handles any data # type and defaults to complex64. + def main(): parser = plot_fft_base.setup_options() args = parser.parse_args() plot_fft_base(None, args.file, args) + if __name__ == "__main__": try: main() diff --git a/gr-utils/plot_tools/gr_plot_iq b/gr-utils/plot_tools/gr_plot_iq index ba3838c081..77833ee256 100755 --- a/gr-utils/plot_tools/gr_plot_iq +++ b/gr-utils/plot_tools/gr_plot_iq @@ -79,7 +79,8 @@ class draw_iq: [0.45, 0.01, 0.05, 0.05], frameon=True ) self.button_left = Button(self.button_left_axes, "<") - self.button_left_callback = self.button_left.on_clicked(self.button_left_click) + self.button_left_callback = self.button_left.on_clicked( + self.button_left_click) self.button_right_axes = self.fig.add_axes( [0.50, 0.01, 0.05, 0.05], frameon=True @@ -119,15 +120,18 @@ class draw_iq: self.get_data() # Subplot for real and imaginary parts of signal - self.sp_iq = self.fig.add_subplot(2, 1, 1, position=[0.075, 0.14, 0.85, 0.67]) - self.sp_iq.set_title(("I&Q"), fontsize=self.title_font_size, fontweight="bold") + self.sp_iq = self.fig.add_subplot( + 2, 1, 1, position=[0.075, 0.14, 0.85, 0.67]) + self.sp_iq.set_title( + ("I&Q"), fontsize=self.title_font_size, fontweight="bold") self.sp_iq.set_xlabel( "Time (s)", fontsize=self.label_font_size, fontweight="bold" ) self.sp_iq.set_ylabel( "Amplitude (V)", fontsize=self.label_font_size, fontweight="bold" ) - self.plot_iq = plot(self.time, self.reals, "bo-", self.time, self.imags, "ro-") + self.plot_iq = plot(self.time, self.reals, "bo-", + self.time, self.imags, "ro-") self.sp_iq.set_ylim( [ 1.5 * min([self.reals.min(), self.imags.min()]), @@ -189,7 +193,8 @@ def find(item_in, list_search): def main(): description = "Takes a GNU Radio complex binary file and displays the I&Q data versus time. You can set the block size to specify how many points to read in at a time and the start position in the file. By default, the system assumes a sample rate of 1, so in time, each sample is plotted versus the sample number. To set a true time axis, set the sample rate (-R or --sample-rate) to the sample rate used when capturing the samples." - parser = ArgumentParser(conflict_handler="resolve", description=description) + parser = ArgumentParser(conflict_handler="resolve", + description=description) parser.add_argument( "-B", "--block", @@ -211,7 +216,8 @@ def main(): default=1.0, help="Set the sampler rate of the data [default=%(default)r]", ) - parser.add_argument("file", metavar="FILE", help="Input file with complex samples") + parser.add_argument("file", metavar="FILE", + help="Input file with complex samples") args = parser.parse_args() diff --git a/gr-utils/plot_tools/gr_plot_psd b/gr-utils/plot_tools/gr_plot_psd index 9576eeac9b..f8c75bfe52 100755 --- a/gr-utils/plot_tools/gr_plot_psd +++ b/gr-utils/plot_tools/gr_plot_psd @@ -13,12 +13,14 @@ from gnuradio.plot_psd_base import plot_psd_base # This is a wrapper program for plot_psd_base. It handles any data # type and defaults to complex64. + def main(): parser = plot_psd_base.setup_options() args = parser.parse_args() plot_psd_base(None, args.file, args) + if __name__ == "__main__": try: main() diff --git a/gr-utils/plot_tools/gr_plot_qt b/gr-utils/plot_tools/gr_plot_qt index aada9e0bba..cd24270ab4 100755 --- a/gr-utils/plot_tools/gr_plot_qt +++ b/gr-utils/plot_tools/gr_plot_qt @@ -28,7 +28,8 @@ except ImportError: print("Could not import from pyqt_plot. Please build with \"pyuic4 pyqt_plot.ui -o pyqt_plot.py\"") raise SystemExit(1) -import sys, os +import sys +import os from optparse import OptionParser from gnuradio import eng_notation @@ -62,8 +63,8 @@ class SpectrogramData(Qwt.QwtRasterData): try: f = int(self.freq.searchsorted(x)) t = int(self.time.searchsorted(y)) - return self.sp[f][t-1] - except AttributeError: # if no file loaded yet + return self.sp[f][t - 1] + except AttributeError: # if no file loaded yet return 0 @@ -88,10 +89,14 @@ class gr_plot_qt(QtGui.QMainWindow): # Set up basic plot attributes self.gui.timePlot.setAxisTitle(self.gui.timePlot.xBottom, "Time (sec)") - self.gui.timePlot.setAxisTitle(self.gui.timePlot.yLeft, "Amplitude (V)") - self.gui.freqPlot.setAxisTitle(self.gui.freqPlot.xBottom, "Frequency (Hz)") - self.gui.freqPlot.setAxisTitle(self.gui.freqPlot.yLeft, "Magnitude (dB)") - self.gui.specPlot.setAxisTitle(self.gui.specPlot.xBottom, "Frequency (Hz)") + self.gui.timePlot.setAxisTitle( + self.gui.timePlot.yLeft, "Amplitude (V)") + self.gui.freqPlot.setAxisTitle( + self.gui.freqPlot.xBottom, "Frequency (Hz)") + self.gui.freqPlot.setAxisTitle( + self.gui.freqPlot.yLeft, "Magnitude (dB)") + self.gui.specPlot.setAxisTitle( + self.gui.specPlot.xBottom, "Frequency (Hz)") self.gui.specPlot.setAxisTitle(self.gui.specPlot.yLeft, "Time (sec)") # Set up FFT size combo box @@ -99,9 +104,11 @@ class gr_plot_qt(QtGui.QMainWindow): "4096", "8192", "16384", "32768"] self.gui.psdFFTComboBox.addItems(self.fftsizes) self.gui.specFFTComboBox.addItems(self.fftsizes) - pos = self.gui.psdFFTComboBox.findText(Qt.QString("%1").arg(self.psdfftsize)) + pos = self.gui.psdFFTComboBox.findText( + Qt.QString("%1").arg(self.psdfftsize)) self.gui.psdFFTComboBox.setCurrentIndex(pos) - pos = self.gui.specFFTComboBox.findText(Qt.QString("%1").arg(self.specfftsize)) + pos = self.gui.specFFTComboBox.findText( + Qt.QString("%1").arg(self.specfftsize)) self.gui.specFFTComboBox.setCurrentIndex(pos) self.connect(self.gui.psdFFTComboBox, @@ -112,10 +119,10 @@ class gr_plot_qt(QtGui.QMainWindow): self.specFFTComboBoxEdit) # Set up color scheme box - self.color_modes = {"Black on White" : self.color_black_on_white, - "White on Black" : self.color_white_on_black, - "Blue on Black" : self.color_blue_on_black, - "Green on Black" : self.color_green_on_black} + self.color_modes = {"Black on White": self.color_black_on_white, + "White on Black": self.color_white_on_black, + "Blue on Black": self.color_blue_on_black, + "Green on Black": self.color_green_on_black} self.gui.colorComboBox.addItems(self.color_modes.keys()) pos = self.gui.colorComboBox.findText("Blue on Black") self.gui.colorComboBox.setCurrentIndex(pos) @@ -123,12 +130,11 @@ class gr_plot_qt(QtGui.QMainWindow): Qt.SIGNAL("activated (const QString&)"), self.colorComboBoxEdit) - # Set up line style combo box - self.line_styles = {"None" : Qwt.QwtSymbol.NoSymbol, - "Circle" : Qwt.QwtSymbol.Ellipse, - "Diamond" : Qwt.QwtSymbol.Rect, - "Triangle" : Qwt.QwtSymbol.Triangle} + self.line_styles = {"None": Qwt.QwtSymbol.NoSymbol, + "Circle": Qwt.QwtSymbol.Ellipse, + "Diamond": Qwt.QwtSymbol.Rect, + "Triangle": Qwt.QwtSymbol.Triangle} self.gui.lineStyleComboBox.addItems(self.line_styles.keys()) pos = self.gui.lineStyleComboBox.findText("None") self.gui.lineStyleComboBox.setCurrentIndex(pos) @@ -220,7 +226,6 @@ class gr_plot_qt(QtGui.QMainWindow): self.rcurve.setSymbol(self.rsym) self.icurve.setSymbol(self.isym) - self.icurve.attach(self.gui.timePlot) self.rcurve.attach(self.gui.timePlot) @@ -264,7 +269,6 @@ class gr_plot_qt(QtGui.QMainWindow): self.gui.styleSizeSpinBox.setRange(1, 20) self.gui.styleSizeSpinBox.setValue(5) - # Connect a signal for when the sample rate changes self.set_sample_rate(self.sample_rate) self.connect(self.gui.sampleRateLineEdit, @@ -279,7 +283,7 @@ class gr_plot_qt(QtGui.QMainWindow): def open_file(self): filename = Qt.QFileDialog.getOpenFileName(self, "Open", ".") if(filename != ""): - #print(filename) + # print(filename) self.initialize(filename) def reload_file(self): @@ -305,8 +309,7 @@ class gr_plot_qt(QtGui.QMainWindow): self.get_psd() self.get_specgram() self.gui.plotHBar.setSliderPosition(0) - self.gui.plotHBar.setMaximum(self.signal_size-self.block_length) - + self.gui.plotHBar.setMaximum(self.signal_size - self.block_length) self.update_time_curves() self.update_psd_curves() @@ -314,26 +317,28 @@ class gr_plot_qt(QtGui.QMainWindow): def init_data_input(self): self.hfile.seek(0, os.SEEK_END) - self.signal_size = self.hfile.tell()/self.sizeof_data + self.signal_size = self.hfile.tell() / self.sizeof_data #print("Sizeof File: ", self.signal_size) self.hfile.seek(0, os.SEEK_SET) def get_data(self, start, end): if(end > start): - self.hfile.seek(start*self.sizeof_data, os.SEEK_SET) + self.hfile.seek(start * self.sizeof_data, os.SEEK_SET) self.position = start try: iq = numpy.fromfile(self.hfile, dtype=self.datatype, - count=end-start) + count=end - start) - if(len(iq) < (end-start)): + if(len(iq) < (end - start)): end = start + len(iq) - self.gui.filePosLengthLineEdit.setText(Qt.QString("%1").arg(len(iq))) + self.gui.filePosLengthLineEdit.setText( + Qt.QString("%1").arg(len(iq))) self.file_length_changed() tstep = 1.0 / self.sample_rate self.iq = iq - self.time = [tstep*(self.position + i) for i in range(len(self.iq))] + self.time = [tstep * (self.position + i) + for i in range(len(self.iq))] self.set_file_pos_box(start, end) except MemoryError: @@ -346,22 +351,22 @@ class gr_plot_qt(QtGui.QMainWindow): winpoints = self.winfunc(self.psdfftsize) iq_psd, freq = mlab.psd(self.iq, Fs=self.sample_rate, NFFT=self.psdfftsize, - noverlap=self.psdfftsize/4.0, + noverlap=self.psdfftsize / 4.0, window=winpoints, scale_by_freq=False) - self.iq_psd = 10.0*numpy.log10(abs(numpy.fft.fftshift(iq_psd))) - self.freq = freq - self.sample_rate/2.0 + self.iq_psd = 10.0 * numpy.log10(abs(numpy.fft.fftshift(iq_psd))) + self.freq = freq - self.sample_rate / 2.0 def get_specgram(self): winpoints = self.winfunc(self.specfftsize) iq_spec, f, t = mlab.specgram(self.iq, Fs=self.sample_rate, NFFT=self.specfftsize, - noverlap=self.specfftsize/4.0, + noverlap=self.specfftsize / 4.0, window=winpoints, scale_by_freq=False) - self.iq_spec = 10.0*numpy.log10(abs(iq_spec)) + self.iq_spec = 10.0 * numpy.log10(abs(iq_spec)) self.spec_f = f self.spec_t = t @@ -421,22 +426,25 @@ class gr_plot_qt(QtGui.QMainWindow): self.gui.filePosStartLineEdit.setText(Qt.QString("%1").arg(start)) self.gui.filePosStopLineEdit.setText(Qt.QString("%1").arg(end)) - self.gui.filePosLengthLineEdit.setText(Qt.QString("%1").arg(end-start)) + self.gui.filePosLengthLineEdit.setText( + Qt.QString("%1").arg(end - start)) self.gui.fileTimeStartLineEdit.setText(Qt.QString("%1").arg(tstart)) self.gui.fileTimeStopLineEdit.setText(Qt.QString("%1").arg(tend)) - self.gui.fileTimeLengthLineEdit.setText(Qt.QString("%1").arg(tend-tstart)) + self.gui.fileTimeLengthLineEdit.setText( + Qt.QString("%1").arg(tend - tstart)) def file_position_changed(self): - start = self.gui.filePosStartLineEdit.text().toInt() - end = self.gui.filePosStopLineEdit.text().toInt() + start = self.gui.filePosStartLineEdit.text().toInt() + end = self.gui.filePosStopLineEdit.text().toInt() if((start[1] == True) and (end[1] == True)): self.cur_start = start[0] self.cur_stop = end[0] tstart = self.cur_start / self.sample_rate tend = self.cur_stop / self.sample_rate - self.gui.fileTimeStartLineEdit.setText(Qt.QString("%1").arg(tstart)) + self.gui.fileTimeStartLineEdit.setText( + Qt.QString("%1").arg(tstart)) self.gui.fileTimeStopLineEdit.setText(Qt.QString("%1").arg(tend)) self.get_data(self.cur_start, self.cur_stop) @@ -452,17 +460,18 @@ class gr_plot_qt(QtGui.QMainWindow): except AttributeError: pass - def file_time_changed(self): tstart = self.gui.fileTimeStartLineEdit.text().toDouble() - tstop = self.gui.fileTimeStopLineEdit.text().toDouble() + tstop = self.gui.fileTimeStopLineEdit.text().toDouble() if((tstart[1] == True) and (tstop[1] == True)): self.cur_start = int(tstart[0] * self.sample_rate) self.cur_stop = int(tstop[0] * self.sample_rate) self.get_data(self.cur_start, self.cur_stop) - self.gui.filePosStartLineEdit.setText(Qt.QString("%1").arg(self.cur_start)) - self.gui.filePosStopLineEdit.setText(Qt.QString("%1").arg(self.cur_stop)) + self.gui.filePosStartLineEdit.setText( + Qt.QString("%1").arg(self.cur_start)) + self.gui.filePosStopLineEdit.setText( + Qt.QString("%1").arg(self.cur_stop)) self.update_time_curves() self.update_psd_curves() @@ -483,7 +492,8 @@ class gr_plot_qt(QtGui.QMainWindow): tstart = self.cur_start / self.sample_rate tend = self.cur_stop / self.sample_rate tlen = self.block_length / self.sample_rate - self.gui.fileTimeStartLineEdit.setText(Qt.QString("%1").arg(tstart)) + self.gui.fileTimeStartLineEdit.setText( + Qt.QString("%1").arg(tstart)) self.gui.fileTimeStopLineEdit.setText(Qt.QString("%1").arg(tend)) self.gui.fileTimeLengthLineEdit.setText(Qt.QString("%1").arg(tlen)) @@ -511,7 +521,8 @@ class gr_plot_qt(QtGui.QMainWindow): tstart = self.cur_start / self.sample_rate tend = self.cur_stop / self.sample_rate tlen = self.block_length / self.sample_rate - self.gui.fileTimeStartLineEdit.setText(Qt.QString("%1").arg(tstart)) + self.gui.fileTimeStartLineEdit.setText( + Qt.QString("%1").arg(tstart)) self.gui.fileTimeStopLineEdit.setText(Qt.QString("%1").arg(tend)) self.gui.fileTimeLengthLineEdit.setText(Qt.QString("%1").arg(tlen)) @@ -526,7 +537,6 @@ class gr_plot_qt(QtGui.QMainWindow): else: self.set_file_pos_box(self.cur_start, self.cur_stop) - def update_time_curves(self): self.icurve.setData(self.time, self.iq.imag) self.rcurve.setData(self.time, self.iq.real) @@ -645,7 +655,6 @@ class gr_plot_qt(QtGui.QMainWindow): self.gui.timePlot.replot() self.gui.freqPlot.replot() - def color_green_on_black(self): green = QtGui.qRgb(0x00, 0xFF, 0x00) red = QtGui.qRgb(0xFF, 0x00, 0x50) @@ -688,11 +697,13 @@ class gr_plot_qt(QtGui.QMainWindow): self.gui.timePlot.replot() self.gui.freqPlot.replot() + def setup_options(): - usage="%prog: [options] (input_filename)" + usage = "%prog: [options] (input_filename)" description = "" - parser = OptionParser(conflict_handler="resolve", usage=usage, description=description) + parser = OptionParser(conflict_handler="resolve", + usage=usage, description=description) parser.add_option("-B", "--block-length", type="int", default=8192, help="Specify the block size [default=%default]") parser.add_option("-s", "--start", type="int", default=0, @@ -706,9 +717,10 @@ def setup_options(): return parser + def main(args): parser = setup_options() - (options, args) = parser.parse_args () + (options, args) = parser.parse_args() if(len(args) == 1): filename = args[0] @@ -719,6 +731,6 @@ def main(args): gplt = gr_plot_qt(app, filename, options) app.exec_() + if __name__ == '__main__': main(sys.argv) - diff --git a/gr-utils/plot_tools/plot_data.py b/gr-utils/plot_tools/plot_data.py index 4a42659514..18e7ae87e4 100644 --- a/gr-utils/plot_tools/plot_data.py +++ b/gr-utils/plot_tools/plot_data.py @@ -33,6 +33,7 @@ datatype_lookup = { "int8": numpy.int8, } + class plot_data(object): def __init__(self, datatype, filenames, options): self.hfile = list() @@ -48,7 +49,8 @@ class plot_data(object): self.datatype = datatype if self.datatype is None: self.datatype = datatype_lookup[options.data_type] - self.sizeof_data = self.datatype().nbytes # number of bytes per sample in file + # number of bytes per sample in file + self.sizeof_data = self.datatype().nbytes self.axis_font_size = 16 self.label_font_size = 18 @@ -60,20 +62,25 @@ class plot_data(object): rcParams['xtick.labelsize'] = self.axis_font_size rcParams['ytick.labelsize'] = self.axis_font_size - self.text_file_pos = figtext(0.10, 0.88, "File Position: ", weight="heavy", size=self.text_size) - self.text_block = figtext(0.40, 0.88, ("Block Size: %d" % self.block_length), - weight="heavy", size=self.text_size) - self.text_sr = figtext(0.60, 0.88, ("Sample Rate: %.2f" % self.sample_rate), - weight="heavy", size=self.text_size) + self.text_file_pos = figtext( + 0.10, 0.88, "File Position: ", weight="heavy", size=self.text_size) + self.text_block = figtext(0.40, 0.88, ("Block Size: %d" % self.block_length), + weight="heavy", size=self.text_size) + self.text_sr = figtext(0.60, 0.88, ("Sample Rate: %.2f" % self.sample_rate), + weight="heavy", size=self.text_size) self.make_plots() - self.button_left_axes = self.fig.add_axes([0.45, 0.01, 0.05, 0.05], frameon=True) + self.button_left_axes = self.fig.add_axes( + [0.45, 0.01, 0.05, 0.05], frameon=True) self.button_left = Button(self.button_left_axes, "<") - self.button_left_callback = self.button_left.on_clicked(self.button_left_click) + self.button_left_callback = self.button_left.on_clicked( + self.button_left_click) - self.button_right_axes = self.fig.add_axes([0.50, 0.01, 0.05, 0.05], frameon=True) + self.button_right_axes = self.fig.add_axes( + [0.50, 0.01, 0.05, 0.05], frameon=True) self.button_right = Button(self.button_right_axes, ">") - self.button_right_callback = self.button_right.on_clicked(self.button_right_click) + self.button_right_callback = self.button_right.on_clicked( + self.button_right_click) self.xlim = self.sp_f.get_xlim() @@ -82,20 +89,27 @@ class plot_data(object): show() def get_data(self, hfile): - self.text_file_pos.set_text("File Position: %d" % (hfile.tell()//self.sizeof_data)) + self.text_file_pos.set_text( + "File Position: %d" % (hfile.tell() // self.sizeof_data)) try: - f = numpy.fromfile(hfile, dtype=self.datatype, count=self.block_length) + f = numpy.fromfile(hfile, dtype=self.datatype, + count=self.block_length) except MemoryError: print("End of File") else: self.f = numpy.array(f) - self.time = numpy.array([i*(1 / self.sample_rate) for i in range(len(self.f))]) + self.time = numpy.array([i * (1 / self.sample_rate) + for i in range(len(self.f))]) def make_plots(self): - self.sp_f = self.fig.add_subplot(2,1,1, position=[0.075, 0.2, 0.875, 0.6]) - self.sp_f.set_title(("Amplitude"), fontsize=self.title_font_size, fontweight="bold") - self.sp_f.set_xlabel("Time (s)", fontsize=self.label_font_size, fontweight="bold") - self.sp_f.set_ylabel("Amplitude (V)", fontsize=self.label_font_size, fontweight="bold") + self.sp_f = self.fig.add_subplot( + 2, 1, 1, position=[0.075, 0.2, 0.875, 0.6]) + self.sp_f.set_title( + ("Amplitude"), fontsize=self.title_font_size, fontweight="bold") + self.sp_f.set_xlabel( + "Time (s)", fontsize=self.label_font_size, fontweight="bold") + self.sp_f.set_ylabel( + "Amplitude (V)", fontsize=self.label_font_size, fontweight="bold") self.plot_f = list() maxval = -1e12 @@ -103,7 +117,7 @@ class plot_data(object): for hf in self.hfile: # if specified on the command-line, set file pointer - hf.seek(self.sizeof_data*self.start, 1) + hf.seek(self.sizeof_data * self.start, 1) self.get_data(hf) @@ -112,7 +126,7 @@ class plot_data(object): maxval = max(maxval, self.f.max()) minval = min(minval, self.f.min()) - self.sp_f.set_ylim([1.5*minval, 1.5*maxval]) + self.sp_f.set_ylim([1.5 * minval, 1.5 * maxval]) self.leg = self.sp_f.legend(self.plot_f, self.legend_text) @@ -121,13 +135,13 @@ class plot_data(object): def update_plots(self): maxval = -1e12 minval = 1e12 - for hf,p in zip(self.hfile,self.plot_f): + for hf, p in zip(self.hfile, self.plot_f): self.get_data(hf) p.set_data([self.time, self.f]) maxval = max(maxval, self.f.max()) minval = min(minval, self.f.min()) - self.sp_f.set_ylim([1.5*minval, 1.5*maxval]) + self.sp_f.set_ylim([1.5 * minval, 1.5 * maxval]) draw() @@ -153,31 +167,33 @@ class plot_data(object): def step_backward(self): for hf in self.hfile: # Step back in file position - if(hf.tell() >= 2*self.sizeof_data*self.block_length ): - hf.seek(-2*self.sizeof_data*self.block_length, 1) + if(hf.tell() >= 2 * self.sizeof_data * self.block_length): + hf.seek(-2 * self.sizeof_data * self.block_length, 1) else: - hf.seek(-hf.tell(),1) + hf.seek(-hf.tell(), 1) self.update_plots() @staticmethod def setup_options(): description = "Takes a GNU Radio binary file and displays the samples versus time. You can set the block size to specify how many points to read in at a time and the start position in the file. By default, the system assumes a sample rate of 1, so in time, each sample is plotted versus the sample number. To set a true time axis, set the sample rate (-R or --sample-rate) to the sample rate used when capturing the samples." - parser = ArgumentParser(conflict_handler="resolve", description=description) + parser = ArgumentParser( + conflict_handler="resolve", description=description) parser.add_argument("-d", "--data-type", default="complex64", - choices=("complex64", "float32", "uint32", "int32", "uint16", - "int16", "uint8", "int8"), - help="Specify the data type [default=%(default)r]") + choices=("complex64", "float32", "uint32", "int32", "uint16", + "int16", "uint8", "int8"), + help="Specify the data type [default=%(default)r]") parser.add_argument("-B", "--block", type=int, default=1000, - help="Specify the block size [default=%(default)r]") + help="Specify the block size [default=%(default)r]") parser.add_argument("-s", "--start", type=int, default=0, - help="Specify where to start in the file [default=%(default)r]") + help="Specify where to start in the file [default=%(default)r]") parser.add_argument("-R", "--sample-rate", type=float, default=1.0, - help="Set the sampler rate of the data [default=%(default)r]") + help="Set the sampler rate of the data [default=%(default)r]") parser.add_argument("files", metavar="FILE", nargs='+', - help="Input file with samples") + help="Input file with samples") return parser + def find(item_in, list_search): try: return list_search.index(item_in) != None diff --git a/gr-utils/plot_tools/plot_fft_base.py b/gr-utils/plot_tools/plot_fft_base.py index 9fa3611e14..8de668d4c4 100644 --- a/gr-utils/plot_tools/plot_fft_base.py +++ b/gr-utils/plot_tools/plot_fft_base.py @@ -31,7 +31,8 @@ class plot_fft_base(object): self.datatype = datatype if self.datatype is None: self.datatype = datatype_lookup[options.data_type] - self.sizeof_data = self.datatype().nbytes # number of bytes per sample in file + # number of bytes per sample in file + self.sizeof_data = self.datatype().nbytes self.axis_font_size = 16 self.label_font_size = 18 @@ -43,21 +44,27 @@ class plot_fft_base(object): rcParams['xtick.labelsize'] = self.axis_font_size rcParams['ytick.labelsize'] = self.axis_font_size - self.text_file = figtext(0.10, 0.94, ("File: %s" % filename), weight="heavy", size=self.text_size) - self.text_file_pos = figtext(0.10, 0.88, "File Position: ", weight="heavy", size=self.text_size) - self.text_block = figtext(0.35, 0.88, ("Block Size: %d" % self.block_length), - weight="heavy", size=self.text_size) - self.text_sr = figtext(0.60, 0.88, ("Sample Rate: %.2f" % self.sample_rate), - weight="heavy", size=self.text_size) + self.text_file = figtext( + 0.10, 0.94, ("File: %s" % filename), weight="heavy", size=self.text_size) + self.text_file_pos = figtext( + 0.10, 0.88, "File Position: ", weight="heavy", size=self.text_size) + self.text_block = figtext(0.35, 0.88, ("Block Size: %d" % self.block_length), + weight="heavy", size=self.text_size) + self.text_sr = figtext(0.60, 0.88, ("Sample Rate: %.2f" % self.sample_rate), + weight="heavy", size=self.text_size) self.make_plots() - self.button_left_axes = self.fig.add_axes([0.45, 0.01, 0.05, 0.05], frameon=True) + self.button_left_axes = self.fig.add_axes( + [0.45, 0.01, 0.05, 0.05], frameon=True) self.button_left = Button(self.button_left_axes, "<") - self.button_left_callback = self.button_left.on_clicked(self.button_left_click) + self.button_left_callback = self.button_left.on_clicked( + self.button_left_click) - self.button_right_axes = self.fig.add_axes([0.50, 0.01, 0.05, 0.05], frameon=True) + self.button_right_axes = self.fig.add_axes( + [0.50, 0.01, 0.05, 0.05], frameon=True) self.button_right = Button(self.button_right_axes, ">") - self.button_right_callback = self.button_right.on_clicked(self.button_right_click) + self.button_right_callback = self.button_right.on_clicked( + self.button_right_click) self.xlim = self.sp_iq.get_xlim() @@ -70,7 +77,8 @@ class plot_fft_base(object): self.position = self.hfile.tell() / self.sizeof_data self.text_file_pos.set_text("File Position: %d" % (self.position)) try: - self.iq = numpy.fromfile(self.hfile, dtype=self.datatype, count=self.block_length) + self.iq = numpy.fromfile( + self.hfile, dtype=self.datatype, count=self.block_length) except MemoryError: print("End of File") else: @@ -78,14 +86,16 @@ class plot_fft_base(object): tstep = 1.0 / self.sample_rate #self.time = numpy.array([tstep*(self.position + i) for i in range(len(self.iq))]) - self.time = numpy.array([tstep*(i) for i in range(len(self.iq))]) + self.time = numpy.array([tstep * (i) for i in range(len(self.iq))]) self.freq = self.calc_freq(self.time, self.sample_rate) def dofft(self, iq): N = len(iq) - iq_fft = numpy.fft.fftshift(numpy.fft.fft(iq)) # fft and shift axis - iq_fft = 20*numpy.log10(abs((iq_fft+1e-15) / N)) # convert to decibels, adjust power + iq_fft = numpy.fft.fftshift( + numpy.fft.fft(iq)) # fft and shift axis + # convert to decibels, adjust power + iq_fft = 20 * numpy.log10(abs((iq_fft + 1e-15) / N)) # adding 1e-15 (-300 dB) to protect against value errors if an item in iq_fft is 0 return iq_fft @@ -93,29 +103,37 @@ class plot_fft_base(object): N = len(time) Fs = 1.0 / (max(time) - min(time)) Fn = 0.5 * sample_rate - freq = numpy.array([-Fn + i*Fs for i in range(N)]) + freq = numpy.array([-Fn + i * Fs for i in range(N)]) return freq def make_plots(self): # if specified on the command-line, set file pointer - self.hfile.seek(self.sizeof_data*self.start, 1) + self.hfile.seek(self.sizeof_data * self.start, 1) # Subplot for real and imaginary parts of signal - self.sp_iq = self.fig.add_subplot(2,2,1, position=[0.075, 0.2, 0.4, 0.6]) - self.sp_iq.set_title(("I&Q"), fontsize=self.title_font_size, fontweight="bold") - self.sp_iq.set_xlabel("Time (s)", fontsize=self.label_font_size, fontweight="bold") - self.sp_iq.set_ylabel("Amplitude (V)", fontsize=self.label_font_size, fontweight="bold") + self.sp_iq = self.fig.add_subplot( + 2, 2, 1, position=[0.075, 0.2, 0.4, 0.6]) + self.sp_iq.set_title( + ("I&Q"), fontsize=self.title_font_size, fontweight="bold") + self.sp_iq.set_xlabel( + "Time (s)", fontsize=self.label_font_size, fontweight="bold") + self.sp_iq.set_ylabel( + "Amplitude (V)", fontsize=self.label_font_size, fontweight="bold") # Subplot for FFT plot - self.sp_fft = self.fig.add_subplot(2,2,2, position=[0.575, 0.2, 0.4, 0.6]) - self.sp_fft.set_title(("FFT"), fontsize=self.title_font_size, fontweight="bold") - self.sp_fft.set_xlabel("Frequency (Hz)", fontsize=self.label_font_size, fontweight="bold") - self.sp_fft.set_ylabel("Power Spectrum (dBm)", fontsize=self.label_font_size, fontweight="bold") + self.sp_fft = self.fig.add_subplot( + 2, 2, 2, position=[0.575, 0.2, 0.4, 0.6]) + self.sp_fft.set_title( + ("FFT"), fontsize=self.title_font_size, fontweight="bold") + self.sp_fft.set_xlabel( + "Frequency (Hz)", fontsize=self.label_font_size, fontweight="bold") + self.sp_fft.set_ylabel("Power Spectrum (dBm)", + fontsize=self.label_font_size, fontweight="bold") self.get_data() - self.plot_iq = self.sp_iq.plot([], 'bo-') # make plot for reals - self.plot_iq += self.sp_iq.plot([], 'ro-') # make plot for imags + self.plot_iq = self.sp_iq.plot([], 'bo-') # make plot for reals + self.plot_iq += self.sp_iq.plot([], 'ro-') # make plot for imags self.draw_time() # draw the plot self.plot_fft = self.sp_fft.plot([], 'bo-') # make plot for FFT @@ -129,13 +147,13 @@ class plot_fft_base(object): self.plot_iq[0].set_data([self.time, reals]) self.plot_iq[1].set_data([self.time, imags]) self.sp_iq.set_xlim(self.time.min(), self.time.max()) - self.sp_iq.set_ylim([1.5*min([reals.min(), imags.min()]), - 1.5*max([reals.max(), imags.max()])]) + self.sp_iq.set_ylim([1.5 * min([reals.min(), imags.min()]), + 1.5 * max([reals.max(), imags.max()])]) def draw_fft(self): self.plot_fft[0].set_data([self.freq, self.iq_fft]) self.sp_fft.set_xlim(self.freq.min(), self.freq.max()) - self.sp_fft.set_ylim([self.iq_fft.min()-10, self.iq_fft.max()+10]) + self.sp_fft.set_ylim([self.iq_fft.min() - 10, self.iq_fft.max() + 10]) def update_plots(self): self.draw_time() @@ -151,18 +169,19 @@ class plot_fft_base(object): self.xlim = newxlim #xmin = max(0, int(ceil(self.sample_rate*(self.xlim[0] - self.position)))) #xmax = min(int(ceil(self.sample_rate*(self.xlim[1] - self.position))), len(self.iq)) - xmin = max(0, int(ceil(self.sample_rate*(self.xlim[0])))) - xmax = min(int(ceil(self.sample_rate*(self.xlim[1]))), len(self.iq)) + xmin = max(0, int(ceil(self.sample_rate * (self.xlim[0])))) + xmax = min( + int(ceil(self.sample_rate * (self.xlim[1]))), len(self.iq)) - iq = self.iq[xmin : xmax] - time = self.time[xmin : xmax] + iq = self.iq[xmin: xmax] + time = self.time[xmin: xmax] iq_fft = self.dofft(iq) freq = self.calc_freq(time, self.sample_rate) self.plot_fft[0].set_data(freq, iq_fft) self.sp_fft.axis([freq.min(), freq.max(), - iq_fft.min()-10, iq_fft.max()+10]) + iq_fft.min() - 10, iq_fft.max() + 10]) draw() @@ -188,10 +207,10 @@ class plot_fft_base(object): def step_backward(self): # Step back in file position - if(self.hfile.tell() >= 2*self.sizeof_data*self.block_length ): - self.hfile.seek(-2*self.sizeof_data*self.block_length, 1) + if(self.hfile.tell() >= 2 * self.sizeof_data * self.block_length): + self.hfile.seek(-2 * self.sizeof_data * self.block_length, 1) else: - self.hfile.seek(-self.hfile.tell(),1) + self.hfile.seek(-self.hfile.tell(), 1) self.get_data() self.update_plots() @@ -199,33 +218,37 @@ class plot_fft_base(object): def setup_options(): description = "Takes a GNU Radio complex binary file and displays the I&Q data versus time as well as the frequency domain (FFT) plot. The y-axis values are plotted assuming volts as the amplitude of the I&Q streams and converted into dBm in the frequency domain (the 1/N power adjustment out of the FFT is performed internally). The script plots a certain block of data at a time, specified on the command line as -B or --block. This value defaults to 1000. The start position in the file can be set by specifying -s or --start and defaults to 0 (the start of the file). By default, the system assumes a sample rate of 1, so in time, each sample is plotted versus the sample number. To set a true time and frequency axis, set the sample rate (-R or --sample-rate) to the sample rate used when capturing the samples." - parser = ArgumentParser(conflict_handler="resolve", description=description) + parser = ArgumentParser( + conflict_handler="resolve", description=description) parser.add_argument("-d", "--data-type", default="complex64", - choices=("complex64", "float32", "uint32", "int32", "uint16", - "int16", "uint8", "int8"), - help="Specify the data type [default=%(default)r]") + choices=("complex64", "float32", "uint32", "int32", "uint16", + "int16", "uint8", "int8"), + help="Specify the data type [default=%(default)r]") parser.add_argument("-B", "--block", type=int, default=1000, - help="Specify the block size [default=%(default)r]") + help="Specify the block size [default=%(default)r]") parser.add_argument("-s", "--start", type=int, default=0, - help="Specify where to start in the file [default=%(default)r]") + help="Specify where to start in the file [default=%(default)r]") parser.add_argument("-R", "--sample-rate", type=float, default=1.0, - help="Set the sampler rate of the data [default=%(default)r]") + help="Set the sampler rate of the data [default=%(default)r]") parser.add_argument("file", metavar="FILE", - help="Input file with samples") + help="Input file with samples") return parser + def find(item_in, list_search): try: return list_search.index(item_in) != None except ValueError: return False + def main(): parser = plot_fft_base.setup_options() args = parser.parse_args() plot_fft_base(None, args.file, args) + if __name__ == "__main__": try: main() diff --git a/gr-utils/plot_tools/plot_psd_base.py b/gr-utils/plot_tools/plot_psd_base.py index 3d78af0dd1..88f86f5725 100644 --- a/gr-utils/plot_tools/plot_psd_base.py +++ b/gr-utils/plot_tools/plot_psd_base.py @@ -35,7 +35,8 @@ class plot_psd_base(object): self.datatype = datatype if self.datatype is None: self.datatype = datatype_lookup[options.data_type] - self.sizeof_data = self.datatype().nbytes # number of bytes per sample in file + # number of bytes per sample in file + self.sizeof_data = self.datatype().nbytes self.axis_font_size = 16 self.label_font_size = 18 @@ -47,23 +48,27 @@ class plot_psd_base(object): rcParams['xtick.labelsize'] = self.axis_font_size rcParams['ytick.labelsize'] = self.axis_font_size - self.text_file = figtext(0.10, 0.95, ("File: %s" % filename), - weight="heavy", size=self.text_size) + self.text_file = figtext(0.10, 0.95, ("File: %s" % filename), + weight="heavy", size=self.text_size) self.text_file_pos = figtext(0.10, 0.92, "File Position: ", weight="heavy", size=self.text_size) - self.text_block = figtext(0.35, 0.92, ("Block Size: %d" % self.block_length), - weight="heavy", size=self.text_size) - self.text_sr = figtext(0.60, 0.915, ("Sample Rate: %.2f" % self.sample_rate), - weight="heavy", size=self.text_size) + self.text_block = figtext(0.35, 0.92, ("Block Size: %d" % self.block_length), + weight="heavy", size=self.text_size) + self.text_sr = figtext(0.60, 0.915, ("Sample Rate: %.2f" % self.sample_rate), + weight="heavy", size=self.text_size) self.make_plots() - self.button_left_axes = self.fig.add_axes([0.45, 0.01, 0.05, 0.05], frameon=True) + self.button_left_axes = self.fig.add_axes( + [0.45, 0.01, 0.05, 0.05], frameon=True) self.button_left = Button(self.button_left_axes, "<") - self.button_left_callback = self.button_left.on_clicked(self.button_left_click) + self.button_left_callback = self.button_left.on_clicked( + self.button_left_click) - self.button_right_axes = self.fig.add_axes([0.50, 0.01, 0.05, 0.05], frameon=True) + self.button_right_axes = self.fig.add_axes( + [0.50, 0.01, 0.05, 0.05], frameon=True) self.button_right = Button(self.button_right_axes, ">") - self.button_right_callback = self.button_right.on_clicked(self.button_right_click) + self.button_right_callback = self.button_right.on_clicked( + self.button_right_click) self.xlim = numpy.array(self.sp_iq.get_xlim()) @@ -76,7 +81,8 @@ class plot_psd_base(object): self.position = self.hfile.tell() / self.sizeof_data self.text_file_pos.set_text("File Position: %d" % self.position) try: - self.iq = numpy.fromfile(self.hfile, dtype=self.datatype, count=self.block_length) + self.iq = numpy.fromfile( + self.hfile, dtype=self.datatype, count=self.block_length) except MemoryError: print("End of File") return False @@ -86,7 +92,8 @@ class plot_psd_base(object): if(len(self.iq) > 0): tstep = 1.0 / self.sample_rate #self.time = numpy.array([tstep*(self.position + i) for i in range(len(self.iq))]) - self.time = numpy.array([tstep*(i) for i in range(len(self.iq))]) + self.time = numpy.array([tstep * (i) + for i in range(len(self.iq))]) self.iq_psd, self.freq = self.dopsd(self.iq) return True @@ -98,48 +105,58 @@ class plot_psd_base(object): ''' Need to do this here and plot later so we can do the fftshift ''' overlap = self.psdfftsize / 4 winfunc = numpy.blackman - psd,freq = mlab.psd(iq, self.psdfftsize, self.sample_rate, - window = lambda d: d*winfunc(self.psdfftsize), - noverlap = overlap) - psd = 10.0*numpy.log10(abs(psd)) + psd, freq = mlab.psd(iq, self.psdfftsize, self.sample_rate, + window=lambda d: d * winfunc(self.psdfftsize), + noverlap=overlap) + psd = 10.0 * numpy.log10(abs(psd)) return (psd, freq) def make_plots(self): # if specified on the command-line, set file pointer - self.hfile.seek(self.sizeof_data*self.start, 1) + self.hfile.seek(self.sizeof_data * self.start, 1) iqdims = [[0.075, 0.2, 0.4, 0.6], [0.075, 0.55, 0.4, 0.3]] psddims = [[0.575, 0.2, 0.4, 0.6], [0.575, 0.55, 0.4, 0.3]] specdims = [0.2, 0.125, 0.6, 0.3] # Subplot for real and imaginary parts of signal - self.sp_iq = self.fig.add_subplot(2,2,1, position=iqdims[self.dospec]) - self.sp_iq.set_title(("I&Q"), fontsize=self.title_font_size, fontweight="bold") - self.sp_iq.set_xlabel("Time (s)", fontsize=self.label_font_size, fontweight="bold") - self.sp_iq.set_ylabel("Amplitude (V)", fontsize=self.label_font_size, fontweight="bold") + self.sp_iq = self.fig.add_subplot( + 2, 2, 1, position=iqdims[self.dospec]) + self.sp_iq.set_title( + ("I&Q"), fontsize=self.title_font_size, fontweight="bold") + self.sp_iq.set_xlabel( + "Time (s)", fontsize=self.label_font_size, fontweight="bold") + self.sp_iq.set_ylabel( + "Amplitude (V)", fontsize=self.label_font_size, fontweight="bold") # Subplot for PSD plot - self.sp_psd = self.fig.add_subplot(2,2,2, position=psddims[self.dospec]) - self.sp_psd.set_title(("PSD"), fontsize=self.title_font_size, fontweight="bold") - self.sp_psd.set_xlabel("Frequency (Hz)", fontsize=self.label_font_size, fontweight="bold") - self.sp_psd.set_ylabel("Power Spectrum (dBm)", fontsize=self.label_font_size, fontweight="bold") + self.sp_psd = self.fig.add_subplot( + 2, 2, 2, position=psddims[self.dospec]) + self.sp_psd.set_title( + ("PSD"), fontsize=self.title_font_size, fontweight="bold") + self.sp_psd.set_xlabel( + "Frequency (Hz)", fontsize=self.label_font_size, fontweight="bold") + self.sp_psd.set_ylabel("Power Spectrum (dBm)", + fontsize=self.label_font_size, fontweight="bold") r = self.get_data() - self.plot_iq = self.sp_iq.plot([], 'bo-') # make plot for reals - self.plot_iq += self.sp_iq.plot([], 'ro-') # make plot for imags + self.plot_iq = self.sp_iq.plot([], 'bo-') # make plot for reals + self.plot_iq += self.sp_iq.plot([], 'ro-') # make plot for imags self.draw_time(self.time, self.iq) # draw the plot self.plot_psd = self.sp_psd.plot([], 'b') # make plot for PSD self.draw_psd(self.freq, self.iq_psd) # draw the plot - if self.dospec: # Subplot for spectrogram plot - self.sp_spec = self.fig.add_subplot(2,2,3, position=specdims) - self.sp_spec.set_title(("Spectrogram"), fontsize=self.title_font_size, fontweight="bold") - self.sp_spec.set_xlabel("Time (s)", fontsize=self.label_font_size, fontweight="bold") - self.sp_spec.set_ylabel("Frequency (Hz)", fontsize=self.label_font_size, fontweight="bold") + self.sp_spec = self.fig.add_subplot(2, 2, 3, position=specdims) + self.sp_spec.set_title( + ("Spectrogram"), fontsize=self.title_font_size, fontweight="bold") + self.sp_spec.set_xlabel( + "Time (s)", fontsize=self.label_font_size, fontweight="bold") + self.sp_spec.set_ylabel( + "Frequency (Hz)", fontsize=self.label_font_size, fontweight="bold") self.draw_spec(self.time, self.iq) @@ -151,12 +168,12 @@ class plot_psd_base(object): self.plot_iq[0].set_data([t, reals]) self.plot_iq[1].set_data([t, imags]) self.sp_iq.set_xlim(t.min(), t.max()) - self.sp_iq.set_ylim([1.5*min([reals.min(), imags.min()]), - 1.5*max([reals.max(), imags.max()])]) + self.sp_iq.set_ylim([1.5 * min([reals.min(), imags.min()]), + 1.5 * max([reals.max(), imags.max()])]) def draw_psd(self, f, p): self.plot_psd[0].set_data([f, p]) - self.sp_psd.set_ylim([p.min()-10, p.max()+10]) + self.sp_psd.set_ylim([p.min() - 10, p.max() + 10]) self.sp_psd.set_xlim([f.min(), f.max()]) def draw_spec(self, t, s): @@ -164,8 +181,8 @@ class plot_psd_base(object): winfunc = numpy.blackman self.sp_spec.clear() self.sp_spec.specgram(s, self.specfftsize, self.sample_rate, - window = lambda d: d*winfunc(self.specfftsize), - noverlap = overlap, xextent=[t.min(), t.max()]) + window=lambda d: d * winfunc(self.specfftsize), + noverlap=overlap, xextent=[t.min(), t.max()]) def update_plots(self): self.draw_time(self.time, self.iq) @@ -174,7 +191,8 @@ class plot_psd_base(object): if self.dospec: self.draw_spec(self.time, self.iq) - self.xlim = numpy.array(self.sp_iq.get_xlim()) # so zoom doesn't get called + # so zoom doesn't get called + self.xlim = numpy.array(self.sp_iq.get_xlim()) draw() @@ -184,11 +202,12 @@ class plot_psd_base(object): if(newxlim[0] != curxlim[0] or newxlim[1] != curxlim[1]): #xmin = max(0, int(ceil(self.sample_rate*(newxlim[0] - self.position)))) #xmax = min(int(ceil(self.sample_rate*(newxlim[1] - self.position))), len(self.iq)) - xmin = max(0, int(ceil(self.sample_rate*(newxlim[0])))) - xmax = min(int(ceil(self.sample_rate*(newxlim[1]))), len(self.iq)) + xmin = max(0, int(ceil(self.sample_rate * (newxlim[0])))) + xmax = min( + int(ceil(self.sample_rate * (newxlim[1]))), len(self.iq)) - iq = numpy.array(self.iq[xmin : xmax]) - time = numpy.array(self.time[xmin : xmax]) + iq = numpy.array(self.iq[xmin: xmax]) + time = numpy.array(self.time[xmin: xmax]) iq_psd, freq = self.dopsd(iq) @@ -220,10 +239,10 @@ class plot_psd_base(object): def step_backward(self): # Step back in file position - if(self.hfile.tell() >= 2*self.sizeof_data*self.block_length ): - self.hfile.seek(-2*self.sizeof_data*self.block_length, 1) + if(self.hfile.tell() >= 2 * self.sizeof_data * self.block_length): + self.hfile.seek(-2 * self.sizeof_data * self.block_length, 1) else: - self.hfile.seek(-self.hfile.tell(),1) + self.hfile.seek(-self.hfile.tell(), 1) r = self.get_data() if(r): self.update_plots() @@ -232,40 +251,44 @@ class plot_psd_base(object): def setup_options(): description = "Takes a GNU Radio binary file (with specified data type using --data-type) and displays the I&Q data versus time as well as the power spectral density (PSD) plot. The y-axis values are plotted assuming volts as the amplitude of the I&Q streams and converted into dBm in the frequency domain (the 1/N power adjustment out of the FFT is performed internally). The script plots a certain block of data at a time, specified on the command line as -B or --block. The start position in the file can be set by specifying -s or --start and defaults to 0 (the start of the file). By default, the system assumes a sample rate of 1, so in time, each sample is plotted versus the sample number. To set a true time and frequency axis, set the sample rate (-R or --sample-rate) to the sample rate used when capturing the samples. Finally, the size of the FFT to use for the PSD and spectrogram plots can be set independently with --psd-size and --spec-size, respectively. The spectrogram plot does not display by default and is turned on with -S or --enable-spec." - parser = ArgumentParser(conflict_handler="resolve", description=description) + parser = ArgumentParser( + conflict_handler="resolve", description=description) parser.add_argument("-d", "--data-type", default="complex64", - choices=("complex64", "float32", "int32", "uint32", "int16", - "uint16", "int8", "uint8" ), - help="Specify the data type [default=%(default)r]") + choices=("complex64", "float32", "int32", "uint32", "int16", + "uint16", "int8", "uint8"), + help="Specify the data type [default=%(default)r]") parser.add_argument("-B", "--block", type=int, default=8192, - help="Specify the block size [default=%(default)r]") + help="Specify the block size [default=%(default)r]") parser.add_argument("-s", "--start", type=int, default=0, - help="Specify where to start in the file [default=%(default)r]") + help="Specify where to start in the file [default=%(default)r]") parser.add_argument("-R", "--sample-rate", type=eng_float, default=1.0, - help="Set the sampler rate of the data [default=%(default)r]") + help="Set the sampler rate of the data [default=%(default)r]") parser.add_argument("--psd-size", type=int, default=1024, - help="Set the size of the PSD FFT [default=%(default)r]") + help="Set the size of the PSD FFT [default=%(default)r]") parser.add_argument("--spec-size", type=int, default=256, - help="Set the size of the spectrogram FFT [default=%(default)r]") + help="Set the size of the spectrogram FFT [default=%(default)r]") parser.add_argument("-S", "--enable-spec", action="store_true", - help="Turn on plotting the spectrogram [default=%(default)r]") + help="Turn on plotting the spectrogram [default=%(default)r]") parser.add_argument("file", metavar="FILE", - help="Input file with samples") + help="Input file with samples") return parser + def find(item_in, list_search): try: return list_search.index(item_in) != None except ValueError: return False + def main(): parser = plot_psd_base.setup_options() args = parser.parse_args() plot_psd_base(None, args.file, args) + if __name__ == "__main__": try: main() diff --git a/gr-utils/plot_tools/pyqt_filter.py b/gr-utils/plot_tools/pyqt_filter.py index d56e45a056..3f4ee1e546 100644 --- a/gr-utils/plot_tools/pyqt_filter.py +++ b/gr-utils/plot_tools/pyqt_filter.py @@ -7,8 +7,10 @@ # # WARNING! All changes made in this file will be lost! +from PyQt5.Qwt import QwtPlot from PyQt5 import QtCore, QtGui + class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") @@ -46,22 +48,27 @@ class Ui_MainWindow(object): self.filterDesignTypeComboBox.addItem("") self.verticalLayout.addWidget(self.filterDesignTypeComboBox) self.globalParamsLayout = QtGui.QFormLayout() - self.globalParamsLayout.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow) + self.globalParamsLayout.setFieldGrowthPolicy( + QtGui.QFormLayout.AllNonFixedFieldsGrow) self.globalParamsLayout.setObjectName("globalParamsLayout") self.sampleRateLabel = QtGui.QLabel(self.filterFrame) self.sampleRateLabel.setMaximumSize(QtCore.QSize(16777215, 30)) self.sampleRateLabel.setObjectName("sampleRateLabel") - self.globalParamsLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.sampleRateLabel) + self.globalParamsLayout.setWidget( + 0, QtGui.QFormLayout.LabelRole, self.sampleRateLabel) self.sampleRateEdit = QtGui.QLineEdit(self.filterFrame) self.sampleRateEdit.setMaximumSize(QtCore.QSize(16777215, 30)) self.sampleRateEdit.setObjectName("sampleRateEdit") - self.globalParamsLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.sampleRateEdit) + self.globalParamsLayout.setWidget( + 0, QtGui.QFormLayout.FieldRole, self.sampleRateEdit) self.filterGainLabel = QtGui.QLabel(self.filterFrame) self.filterGainLabel.setObjectName("filterGainLabel") - self.globalParamsLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.filterGainLabel) + self.globalParamsLayout.setWidget( + 1, QtGui.QFormLayout.LabelRole, self.filterGainLabel) self.filterGainEdit = QtGui.QLineEdit(self.filterFrame) self.filterGainEdit.setObjectName("filterGainEdit") - self.globalParamsLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.filterGainEdit) + self.globalParamsLayout.setWidget( + 1, QtGui.QFormLayout.FieldRole, self.filterGainEdit) self.verticalLayout.addLayout(self.globalParamsLayout) self.filterTypeWidget = QtGui.QStackedWidget(self.filterFrame) self.filterTypeWidget.setObjectName("filterTypeWidget") @@ -71,28 +78,36 @@ class Ui_MainWindow(object): self.formLayout.setObjectName("formLayout") self.endofLpfPassBandLabel = QtGui.QLabel(self.firlpfPage) self.endofLpfPassBandLabel.setObjectName("endofLpfPassBandLabel") - self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.endofLpfPassBandLabel) + self.formLayout.setWidget( + 0, QtGui.QFormLayout.LabelRole, self.endofLpfPassBandLabel) self.endofLpfPassBandEdit = QtGui.QLineEdit(self.firlpfPage) self.endofLpfPassBandEdit.setObjectName("endofLpfPassBandEdit") - self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.endofLpfPassBandEdit) + self.formLayout.setWidget( + 0, QtGui.QFormLayout.FieldRole, self.endofLpfPassBandEdit) self.startofLpfStopBandLabel = QtGui.QLabel(self.firlpfPage) self.startofLpfStopBandLabel.setObjectName("startofLpfStopBandLabel") - self.formLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.startofLpfStopBandLabel) + self.formLayout.setWidget( + 1, QtGui.QFormLayout.LabelRole, self.startofLpfStopBandLabel) self.startofLpfStopBandEdit = QtGui.QLineEdit(self.firlpfPage) self.startofLpfStopBandEdit.setObjectName("startofLpfStopBandEdit") - self.formLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.startofLpfStopBandEdit) + self.formLayout.setWidget( + 1, QtGui.QFormLayout.FieldRole, self.startofLpfStopBandEdit) self.lpfStopBandAttenLabel = QtGui.QLabel(self.firlpfPage) self.lpfStopBandAttenLabel.setObjectName("lpfStopBandAttenLabel") - self.formLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.lpfStopBandAttenLabel) + self.formLayout.setWidget( + 2, QtGui.QFormLayout.LabelRole, self.lpfStopBandAttenLabel) self.lpfStopBandAttenEdit = QtGui.QLineEdit(self.firlpfPage) self.lpfStopBandAttenEdit.setObjectName("lpfStopBandAttenEdit") - self.formLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.lpfStopBandAttenEdit) + self.formLayout.setWidget( + 2, QtGui.QFormLayout.FieldRole, self.lpfStopBandAttenEdit) self.lpfPassBandRippleEdit = QtGui.QLineEdit(self.firlpfPage) self.lpfPassBandRippleEdit.setObjectName("lpfPassBandRippleEdit") - self.formLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.lpfPassBandRippleEdit) + self.formLayout.setWidget( + 3, QtGui.QFormLayout.FieldRole, self.lpfPassBandRippleEdit) self.lpfPassBandRippleLabel = QtGui.QLabel(self.firlpfPage) self.lpfPassBandRippleLabel.setObjectName("lpfPassBandRippleLabel") - self.formLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.lpfPassBandRippleLabel) + self.formLayout.setWidget( + 3, QtGui.QFormLayout.LabelRole, self.lpfPassBandRippleLabel) self.filterTypeWidget.addWidget(self.firlpfPage) self.firbpfPage = QtGui.QWidget() self.firbpfPage.setObjectName("firbpfPage") @@ -100,100 +115,130 @@ class Ui_MainWindow(object): self.formLayout_2.setObjectName("formLayout_2") self.startofBpfPassBandLabel = QtGui.QLabel(self.firbpfPage) self.startofBpfPassBandLabel.setObjectName("startofBpfPassBandLabel") - self.formLayout_2.setWidget(0, QtGui.QFormLayout.LabelRole, self.startofBpfPassBandLabel) + self.formLayout_2.setWidget( + 0, QtGui.QFormLayout.LabelRole, self.startofBpfPassBandLabel) self.startofBpfPassBandEdit = QtGui.QLineEdit(self.firbpfPage) self.startofBpfPassBandEdit.setObjectName("startofBpfPassBandEdit") - self.formLayout_2.setWidget(0, QtGui.QFormLayout.FieldRole, self.startofBpfPassBandEdit) + self.formLayout_2.setWidget( + 0, QtGui.QFormLayout.FieldRole, self.startofBpfPassBandEdit) self.endofBpfPassBandLabel = QtGui.QLabel(self.firbpfPage) self.endofBpfPassBandLabel.setObjectName("endofBpfPassBandLabel") - self.formLayout_2.setWidget(1, QtGui.QFormLayout.LabelRole, self.endofBpfPassBandLabel) + self.formLayout_2.setWidget( + 1, QtGui.QFormLayout.LabelRole, self.endofBpfPassBandLabel) self.endofBpfPassBandEdit = QtGui.QLineEdit(self.firbpfPage) self.endofBpfPassBandEdit.setObjectName("endofBpfPassBandEdit") - self.formLayout_2.setWidget(1, QtGui.QFormLayout.FieldRole, self.endofBpfPassBandEdit) + self.formLayout_2.setWidget( + 1, QtGui.QFormLayout.FieldRole, self.endofBpfPassBandEdit) self.bpfStopBandAttenEdit = QtGui.QLineEdit(self.firbpfPage) self.bpfStopBandAttenEdit.setObjectName("bpfStopBandAttenEdit") - self.formLayout_2.setWidget(3, QtGui.QFormLayout.FieldRole, self.bpfStopBandAttenEdit) + self.formLayout_2.setWidget( + 3, QtGui.QFormLayout.FieldRole, self.bpfStopBandAttenEdit) self.bpfStopBandAttenLabel = QtGui.QLabel(self.firbpfPage) self.bpfStopBandAttenLabel.setObjectName("bpfStopBandAttenLabel") - self.formLayout_2.setWidget(3, QtGui.QFormLayout.LabelRole, self.bpfStopBandAttenLabel) + self.formLayout_2.setWidget( + 3, QtGui.QFormLayout.LabelRole, self.bpfStopBandAttenLabel) self.bpfTransitionLabel = QtGui.QLabel(self.firbpfPage) self.bpfTransitionLabel.setObjectName("bpfTransitionLabel") - self.formLayout_2.setWidget(2, QtGui.QFormLayout.LabelRole, self.bpfTransitionLabel) + self.formLayout_2.setWidget( + 2, QtGui.QFormLayout.LabelRole, self.bpfTransitionLabel) self.bpfTransitionEdit = QtGui.QLineEdit(self.firbpfPage) self.bpfTransitionEdit.setObjectName("bpfTransitionEdit") - self.formLayout_2.setWidget(2, QtGui.QFormLayout.FieldRole, self.bpfTransitionEdit) + self.formLayout_2.setWidget( + 2, QtGui.QFormLayout.FieldRole, self.bpfTransitionEdit) self.bpfPassBandRippleEdit = QtGui.QLineEdit(self.firbpfPage) self.bpfPassBandRippleEdit.setObjectName("bpfPassBandRippleEdit") - self.formLayout_2.setWidget(4, QtGui.QFormLayout.FieldRole, self.bpfPassBandRippleEdit) + self.formLayout_2.setWidget( + 4, QtGui.QFormLayout.FieldRole, self.bpfPassBandRippleEdit) self.bpfPassBandRippleLabel = QtGui.QLabel(self.firbpfPage) self.bpfPassBandRippleLabel.setObjectName("bpfPassBandRippleLabel") - self.formLayout_2.setWidget(4, QtGui.QFormLayout.LabelRole, self.bpfPassBandRippleLabel) + self.formLayout_2.setWidget( + 4, QtGui.QFormLayout.LabelRole, self.bpfPassBandRippleLabel) self.filterTypeWidget.addWidget(self.firbpfPage) self.firbnfPage = QtGui.QWidget() self.firbnfPage.setObjectName("firbnfPage") self.formLayout_5 = QtGui.QFormLayout(self.firbnfPage) - self.formLayout_5.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow) + self.formLayout_5.setFieldGrowthPolicy( + QtGui.QFormLayout.AllNonFixedFieldsGrow) self.formLayout_5.setObjectName("formLayout_5") self.startofBnfStopBandLabel = QtGui.QLabel(self.firbnfPage) self.startofBnfStopBandLabel.setObjectName("startofBnfStopBandLabel") - self.formLayout_5.setWidget(0, QtGui.QFormLayout.LabelRole, self.startofBnfStopBandLabel) + self.formLayout_5.setWidget( + 0, QtGui.QFormLayout.LabelRole, self.startofBnfStopBandLabel) self.startofBnfStopBandEdit = QtGui.QLineEdit(self.firbnfPage) self.startofBnfStopBandEdit.setObjectName("startofBnfStopBandEdit") - self.formLayout_5.setWidget(0, QtGui.QFormLayout.FieldRole, self.startofBnfStopBandEdit) + self.formLayout_5.setWidget( + 0, QtGui.QFormLayout.FieldRole, self.startofBnfStopBandEdit) self.endofBnfStopBandLabel = QtGui.QLabel(self.firbnfPage) self.endofBnfStopBandLabel.setObjectName("endofBnfStopBandLabel") - self.formLayout_5.setWidget(1, QtGui.QFormLayout.LabelRole, self.endofBnfStopBandLabel) + self.formLayout_5.setWidget( + 1, QtGui.QFormLayout.LabelRole, self.endofBnfStopBandLabel) self.endofBnfStopBandEdit = QtGui.QLineEdit(self.firbnfPage) self.endofBnfStopBandEdit.setObjectName("endofBnfStopBandEdit") - self.formLayout_5.setWidget(1, QtGui.QFormLayout.FieldRole, self.endofBnfStopBandEdit) + self.formLayout_5.setWidget( + 1, QtGui.QFormLayout.FieldRole, self.endofBnfStopBandEdit) self.bnfTransitionLabel = QtGui.QLabel(self.firbnfPage) self.bnfTransitionLabel.setObjectName("bnfTransitionLabel") - self.formLayout_5.setWidget(2, QtGui.QFormLayout.LabelRole, self.bnfTransitionLabel) + self.formLayout_5.setWidget( + 2, QtGui.QFormLayout.LabelRole, self.bnfTransitionLabel) self.bnfTransitionEdit = QtGui.QLineEdit(self.firbnfPage) self.bnfTransitionEdit.setObjectName("bnfTransitionEdit") - self.formLayout_5.setWidget(2, QtGui.QFormLayout.FieldRole, self.bnfTransitionEdit) + self.formLayout_5.setWidget( + 2, QtGui.QFormLayout.FieldRole, self.bnfTransitionEdit) self.bnfStopBandAttenLabel = QtGui.QLabel(self.firbnfPage) self.bnfStopBandAttenLabel.setObjectName("bnfStopBandAttenLabel") - self.formLayout_5.setWidget(3, QtGui.QFormLayout.LabelRole, self.bnfStopBandAttenLabel) + self.formLayout_5.setWidget( + 3, QtGui.QFormLayout.LabelRole, self.bnfStopBandAttenLabel) self.bnfStopBandAttenEdit = QtGui.QLineEdit(self.firbnfPage) self.bnfStopBandAttenEdit.setObjectName("bnfStopBandAttenEdit") - self.formLayout_5.setWidget(3, QtGui.QFormLayout.FieldRole, self.bnfStopBandAttenEdit) + self.formLayout_5.setWidget( + 3, QtGui.QFormLayout.FieldRole, self.bnfStopBandAttenEdit) self.bnfPassBandRippleLabel = QtGui.QLabel(self.firbnfPage) self.bnfPassBandRippleLabel.setObjectName("bnfPassBandRippleLabel") - self.formLayout_5.setWidget(4, QtGui.QFormLayout.LabelRole, self.bnfPassBandRippleLabel) + self.formLayout_5.setWidget( + 4, QtGui.QFormLayout.LabelRole, self.bnfPassBandRippleLabel) self.bnfPassBandRippleEdit = QtGui.QLineEdit(self.firbnfPage) self.bnfPassBandRippleEdit.setObjectName("bnfPassBandRippleEdit") - self.formLayout_5.setWidget(4, QtGui.QFormLayout.FieldRole, self.bnfPassBandRippleEdit) + self.formLayout_5.setWidget( + 4, QtGui.QFormLayout.FieldRole, self.bnfPassBandRippleEdit) self.filterTypeWidget.addWidget(self.firbnfPage) self.firhpfPage = QtGui.QWidget() self.firhpfPage.setObjectName("firhpfPage") self.formLayout_3 = QtGui.QFormLayout(self.firhpfPage) - self.formLayout_3.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow) + self.formLayout_3.setFieldGrowthPolicy( + QtGui.QFormLayout.AllNonFixedFieldsGrow) self.formLayout_3.setObjectName("formLayout_3") self.endofHpfStopBandLabel = QtGui.QLabel(self.firhpfPage) self.endofHpfStopBandLabel.setObjectName("endofHpfStopBandLabel") - self.formLayout_3.setWidget(0, QtGui.QFormLayout.LabelRole, self.endofHpfStopBandLabel) + self.formLayout_3.setWidget( + 0, QtGui.QFormLayout.LabelRole, self.endofHpfStopBandLabel) self.endofHpfStopBandEdit = QtGui.QLineEdit(self.firhpfPage) self.endofHpfStopBandEdit.setObjectName("endofHpfStopBandEdit") - self.formLayout_3.setWidget(0, QtGui.QFormLayout.FieldRole, self.endofHpfStopBandEdit) + self.formLayout_3.setWidget( + 0, QtGui.QFormLayout.FieldRole, self.endofHpfStopBandEdit) self.startofHpfPassBandLabel = QtGui.QLabel(self.firhpfPage) self.startofHpfPassBandLabel.setObjectName("startofHpfPassBandLabel") - self.formLayout_3.setWidget(1, QtGui.QFormLayout.LabelRole, self.startofHpfPassBandLabel) + self.formLayout_3.setWidget( + 1, QtGui.QFormLayout.LabelRole, self.startofHpfPassBandLabel) self.startofHpfPassBandEdit = QtGui.QLineEdit(self.firhpfPage) self.startofHpfPassBandEdit.setObjectName("startofHpfPassBandEdit") - self.formLayout_3.setWidget(1, QtGui.QFormLayout.FieldRole, self.startofHpfPassBandEdit) + self.formLayout_3.setWidget( + 1, QtGui.QFormLayout.FieldRole, self.startofHpfPassBandEdit) self.hpfStopBandAttenLabel = QtGui.QLabel(self.firhpfPage) self.hpfStopBandAttenLabel.setObjectName("hpfStopBandAttenLabel") - self.formLayout_3.setWidget(2, QtGui.QFormLayout.LabelRole, self.hpfStopBandAttenLabel) + self.formLayout_3.setWidget( + 2, QtGui.QFormLayout.LabelRole, self.hpfStopBandAttenLabel) self.hpfStopBandAttenEdit = QtGui.QLineEdit(self.firhpfPage) self.hpfStopBandAttenEdit.setObjectName("hpfStopBandAttenEdit") - self.formLayout_3.setWidget(2, QtGui.QFormLayout.FieldRole, self.hpfStopBandAttenEdit) + self.formLayout_3.setWidget( + 2, QtGui.QFormLayout.FieldRole, self.hpfStopBandAttenEdit) self.hpfPassBandRippleLabel = QtGui.QLabel(self.firhpfPage) self.hpfPassBandRippleLabel.setObjectName("hpfPassBandRippleLabel") - self.formLayout_3.setWidget(3, QtGui.QFormLayout.LabelRole, self.hpfPassBandRippleLabel) + self.formLayout_3.setWidget( + 3, QtGui.QFormLayout.LabelRole, self.hpfPassBandRippleLabel) self.hpfPassBandRippleEdit = QtGui.QLineEdit(self.firhpfPage) self.hpfPassBandRippleEdit.setObjectName("hpfPassBandRippleEdit") - self.formLayout_3.setWidget(3, QtGui.QFormLayout.FieldRole, self.hpfPassBandRippleEdit) + self.formLayout_3.setWidget( + 3, QtGui.QFormLayout.FieldRole, self.hpfPassBandRippleEdit) self.filterTypeWidget.addWidget(self.firhpfPage) self.rrcPage = QtGui.QWidget() self.rrcPage.setObjectName("rrcPage") @@ -201,22 +246,28 @@ class Ui_MainWindow(object): self.formLayout_6.setObjectName("formLayout_6") self.rrcSymbolRateLabel = QtGui.QLabel(self.rrcPage) self.rrcSymbolRateLabel.setObjectName("rrcSymbolRateLabel") - self.formLayout_6.setWidget(0, QtGui.QFormLayout.LabelRole, self.rrcSymbolRateLabel) + self.formLayout_6.setWidget( + 0, QtGui.QFormLayout.LabelRole, self.rrcSymbolRateLabel) self.rrcAlphaLabel = QtGui.QLabel(self.rrcPage) self.rrcAlphaLabel.setObjectName("rrcAlphaLabel") - self.formLayout_6.setWidget(1, QtGui.QFormLayout.LabelRole, self.rrcAlphaLabel) + self.formLayout_6.setWidget( + 1, QtGui.QFormLayout.LabelRole, self.rrcAlphaLabel) self.rrcNumTapsLabel = QtGui.QLabel(self.rrcPage) self.rrcNumTapsLabel.setObjectName("rrcNumTapsLabel") - self.formLayout_6.setWidget(2, QtGui.QFormLayout.LabelRole, self.rrcNumTapsLabel) + self.formLayout_6.setWidget( + 2, QtGui.QFormLayout.LabelRole, self.rrcNumTapsLabel) self.rrcSymbolRateEdit = QtGui.QLineEdit(self.rrcPage) self.rrcSymbolRateEdit.setObjectName("rrcSymbolRateEdit") - self.formLayout_6.setWidget(0, QtGui.QFormLayout.FieldRole, self.rrcSymbolRateEdit) + self.formLayout_6.setWidget( + 0, QtGui.QFormLayout.FieldRole, self.rrcSymbolRateEdit) self.rrcAlphaEdit = QtGui.QLineEdit(self.rrcPage) self.rrcAlphaEdit.setObjectName("rrcAlphaEdit") - self.formLayout_6.setWidget(1, QtGui.QFormLayout.FieldRole, self.rrcAlphaEdit) + self.formLayout_6.setWidget( + 1, QtGui.QFormLayout.FieldRole, self.rrcAlphaEdit) self.rrcNumTapsEdit = QtGui.QLineEdit(self.rrcPage) self.rrcNumTapsEdit.setObjectName("rrcNumTapsEdit") - self.formLayout_6.setWidget(2, QtGui.QFormLayout.FieldRole, self.rrcNumTapsEdit) + self.formLayout_6.setWidget( + 2, QtGui.QFormLayout.FieldRole, self.rrcNumTapsEdit) self.filterTypeWidget.addWidget(self.rrcPage) self.gausPage = QtGui.QWidget() self.gausPage.setObjectName("gausPage") @@ -224,40 +275,49 @@ class Ui_MainWindow(object): self.formLayout_7.setObjectName("formLayout_7") self.gausSymbolRateLabel = QtGui.QLabel(self.gausPage) self.gausSymbolRateLabel.setObjectName("gausSymbolRateLabel") - self.formLayout_7.setWidget(0, QtGui.QFormLayout.LabelRole, self.gausSymbolRateLabel) + self.formLayout_7.setWidget( + 0, QtGui.QFormLayout.LabelRole, self.gausSymbolRateLabel) self.gausSymbolRateEdit = QtGui.QLineEdit(self.gausPage) self.gausSymbolRateEdit.setObjectName("gausSymbolRateEdit") - self.formLayout_7.setWidget(0, QtGui.QFormLayout.FieldRole, self.gausSymbolRateEdit) + self.formLayout_7.setWidget( + 0, QtGui.QFormLayout.FieldRole, self.gausSymbolRateEdit) self.gausBTLabel = QtGui.QLabel(self.gausPage) self.gausBTLabel.setObjectName("gausBTLabel") - self.formLayout_7.setWidget(1, QtGui.QFormLayout.LabelRole, self.gausBTLabel) + self.formLayout_7.setWidget( + 1, QtGui.QFormLayout.LabelRole, self.gausBTLabel) self.gausBTEdit = QtGui.QLineEdit(self.gausPage) self.gausBTEdit.setObjectName("gausBTEdit") - self.formLayout_7.setWidget(1, QtGui.QFormLayout.FieldRole, self.gausBTEdit) + self.formLayout_7.setWidget( + 1, QtGui.QFormLayout.FieldRole, self.gausBTEdit) self.gausNumTapsLabel = QtGui.QLabel(self.gausPage) self.gausNumTapsLabel.setObjectName("gausNumTapsLabel") - self.formLayout_7.setWidget(2, QtGui.QFormLayout.LabelRole, self.gausNumTapsLabel) + self.formLayout_7.setWidget( + 2, QtGui.QFormLayout.LabelRole, self.gausNumTapsLabel) self.gausNumTapsEdit = QtGui.QLineEdit(self.gausPage) self.gausNumTapsEdit.setObjectName("gausNumTapsEdit") - self.formLayout_7.setWidget(2, QtGui.QFormLayout.FieldRole, self.gausNumTapsEdit) + self.formLayout_7.setWidget( + 2, QtGui.QFormLayout.FieldRole, self.gausNumTapsEdit) self.filterTypeWidget.addWidget(self.gausPage) self.verticalLayout.addWidget(self.filterTypeWidget) self.filterPropsBox = QtGui.QGroupBox(self.filterFrame) self.filterPropsBox.setObjectName("filterPropsBox") self.formLayout_8 = QtGui.QFormLayout(self.filterPropsBox) - self.formLayout_8.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow) + self.formLayout_8.setFieldGrowthPolicy( + QtGui.QFormLayout.AllNonFixedFieldsGrow) self.formLayout_8.setObjectName("formLayout_8") self.nTapsLabel = QtGui.QLabel(self.filterPropsBox) self.nTapsLabel.setMinimumSize(QtCore.QSize(150, 0)) self.nTapsLabel.setObjectName("nTapsLabel") - self.formLayout_8.setWidget(1, QtGui.QFormLayout.LabelRole, self.nTapsLabel) + self.formLayout_8.setWidget( + 1, QtGui.QFormLayout.LabelRole, self.nTapsLabel) self.nTapsEdit = QtGui.QLabel(self.filterPropsBox) self.nTapsEdit.setMaximumSize(QtCore.QSize(100, 16777215)) self.nTapsEdit.setFrameShape(QtGui.QFrame.Box) self.nTapsEdit.setFrameShadow(QtGui.QFrame.Raised) self.nTapsEdit.setText("") self.nTapsEdit.setObjectName("nTapsEdit") - self.formLayout_8.setWidget(1, QtGui.QFormLayout.FieldRole, self.nTapsEdit) + self.formLayout_8.setWidget( + 1, QtGui.QFormLayout.FieldRole, self.nTapsEdit) self.verticalLayout.addWidget(self.filterPropsBox) self.sysParamsBox = QtGui.QGroupBox(self.filterFrame) self.sysParamsBox.setObjectName("sysParamsBox") @@ -265,11 +325,13 @@ class Ui_MainWindow(object): self.formLayout_4.setObjectName("formLayout_4") self.nfftEdit = QtGui.QLineEdit(self.sysParamsBox) self.nfftEdit.setObjectName("nfftEdit") - self.formLayout_4.setWidget(1, QtGui.QFormLayout.FieldRole, self.nfftEdit) + self.formLayout_4.setWidget( + 1, QtGui.QFormLayout.FieldRole, self.nfftEdit) self.nfftLabel = QtGui.QLabel(self.sysParamsBox) self.nfftLabel.setMinimumSize(QtCore.QSize(150, 0)) self.nfftLabel.setObjectName("nfftLabel") - self.formLayout_4.setWidget(1, QtGui.QFormLayout.LabelRole, self.nfftLabel) + self.formLayout_4.setWidget( + 1, QtGui.QFormLayout.LabelRole, self.nfftLabel) self.verticalLayout.addWidget(self.sysParamsBox) self.designButton = QtGui.QPushButton(self.filterFrame) self.designButton.setMinimumSize(QtCore.QSize(0, 0)) @@ -339,30 +401,51 @@ class Ui_MainWindow(object): self.retranslateUi(MainWindow) self.filterTypeWidget.setCurrentIndex(5) self.tabGroup.setCurrentIndex(0) - QtCore.QObject.connect(self.action_exit, QtCore.SIGNAL("activated()"), MainWindow.close) + QtCore.QObject.connect(self.action_exit, QtCore.SIGNAL( + "activated()"), MainWindow.close) QtCore.QMetaObject.connectSlotsByName(MainWindow) - MainWindow.setTabOrder(self.filterTypeComboBox, self.filterDesignTypeComboBox) - MainWindow.setTabOrder(self.filterDesignTypeComboBox, self.sampleRateEdit) + MainWindow.setTabOrder(self.filterTypeComboBox, + self.filterDesignTypeComboBox) + MainWindow.setTabOrder( + self.filterDesignTypeComboBox, self.sampleRateEdit) MainWindow.setTabOrder(self.sampleRateEdit, self.filterGainEdit) MainWindow.setTabOrder(self.filterGainEdit, self.endofLpfPassBandEdit) - MainWindow.setTabOrder(self.endofLpfPassBandEdit, self.startofLpfStopBandEdit) - MainWindow.setTabOrder(self.startofLpfStopBandEdit, self.lpfStopBandAttenEdit) - MainWindow.setTabOrder(self.lpfStopBandAttenEdit, self.lpfPassBandRippleEdit) - MainWindow.setTabOrder(self.lpfPassBandRippleEdit, self.startofBpfPassBandEdit) - MainWindow.setTabOrder(self.startofBpfPassBandEdit, self.endofBpfPassBandEdit) - MainWindow.setTabOrder(self.endofBpfPassBandEdit, self.bpfTransitionEdit) - MainWindow.setTabOrder(self.bpfTransitionEdit, self.bpfStopBandAttenEdit) - MainWindow.setTabOrder(self.bpfStopBandAttenEdit, self.bpfPassBandRippleEdit) - MainWindow.setTabOrder(self.bpfPassBandRippleEdit, self.startofBnfStopBandEdit) - MainWindow.setTabOrder(self.startofBnfStopBandEdit, self.endofBnfStopBandEdit) - MainWindow.setTabOrder(self.endofBnfStopBandEdit, self.bnfTransitionEdit) - MainWindow.setTabOrder(self.bnfTransitionEdit, self.bnfStopBandAttenEdit) - MainWindow.setTabOrder(self.bnfStopBandAttenEdit, self.bnfPassBandRippleEdit) - MainWindow.setTabOrder(self.bnfPassBandRippleEdit, self.endofHpfStopBandEdit) - MainWindow.setTabOrder(self.endofHpfStopBandEdit, self.startofHpfPassBandEdit) - MainWindow.setTabOrder(self.startofHpfPassBandEdit, self.hpfStopBandAttenEdit) - MainWindow.setTabOrder(self.hpfStopBandAttenEdit, self.hpfPassBandRippleEdit) - MainWindow.setTabOrder(self.hpfPassBandRippleEdit, self.rrcSymbolRateEdit) + MainWindow.setTabOrder(self.endofLpfPassBandEdit, + self.startofLpfStopBandEdit) + MainWindow.setTabOrder(self.startofLpfStopBandEdit, + self.lpfStopBandAttenEdit) + MainWindow.setTabOrder(self.lpfStopBandAttenEdit, + self.lpfPassBandRippleEdit) + MainWindow.setTabOrder(self.lpfPassBandRippleEdit, + self.startofBpfPassBandEdit) + MainWindow.setTabOrder(self.startofBpfPassBandEdit, + self.endofBpfPassBandEdit) + MainWindow.setTabOrder(self.endofBpfPassBandEdit, + self.bpfTransitionEdit) + MainWindow.setTabOrder(self.bpfTransitionEdit, + self.bpfStopBandAttenEdit) + MainWindow.setTabOrder(self.bpfStopBandAttenEdit, + self.bpfPassBandRippleEdit) + MainWindow.setTabOrder(self.bpfPassBandRippleEdit, + self.startofBnfStopBandEdit) + MainWindow.setTabOrder(self.startofBnfStopBandEdit, + self.endofBnfStopBandEdit) + MainWindow.setTabOrder(self.endofBnfStopBandEdit, + self.bnfTransitionEdit) + MainWindow.setTabOrder(self.bnfTransitionEdit, + self.bnfStopBandAttenEdit) + MainWindow.setTabOrder(self.bnfStopBandAttenEdit, + self.bnfPassBandRippleEdit) + MainWindow.setTabOrder(self.bnfPassBandRippleEdit, + self.endofHpfStopBandEdit) + MainWindow.setTabOrder(self.endofHpfStopBandEdit, + self.startofHpfPassBandEdit) + MainWindow.setTabOrder(self.startofHpfPassBandEdit, + self.hpfStopBandAttenEdit) + MainWindow.setTabOrder(self.hpfStopBandAttenEdit, + self.hpfPassBandRippleEdit) + MainWindow.setTabOrder( + self.hpfPassBandRippleEdit, self.rrcSymbolRateEdit) MainWindow.setTabOrder(self.rrcSymbolRateEdit, self.rrcAlphaEdit) MainWindow.setTabOrder(self.rrcAlphaEdit, self.rrcNumTapsEdit) MainWindow.setTabOrder(self.rrcNumTapsEdit, self.gausSymbolRateEdit) @@ -373,63 +456,118 @@ class Ui_MainWindow(object): MainWindow.setTabOrder(self.designButton, self.tabGroup) def retranslateUi(self, MainWindow): - MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "GNU Radio Filter Design Tool", None, QtGui.QApplication.UnicodeUTF8)) - self.filterTypeComboBox.setItemText(0, QtGui.QApplication.translate("MainWindow", "Low Pass", None, QtGui.QApplication.UnicodeUTF8)) - self.filterTypeComboBox.setItemText(1, QtGui.QApplication.translate("MainWindow", "Band Pass", None, QtGui.QApplication.UnicodeUTF8)) - self.filterTypeComboBox.setItemText(2, QtGui.QApplication.translate("MainWindow", "Complex Band Pass", None, QtGui.QApplication.UnicodeUTF8)) - self.filterTypeComboBox.setItemText(3, QtGui.QApplication.translate("MainWindow", "Band Notch", None, QtGui.QApplication.UnicodeUTF8)) - self.filterTypeComboBox.setItemText(4, QtGui.QApplication.translate("MainWindow", "High Pass", None, QtGui.QApplication.UnicodeUTF8)) - self.filterTypeComboBox.setItemText(5, QtGui.QApplication.translate("MainWindow", "Root Raised Cosine", None, QtGui.QApplication.UnicodeUTF8)) - self.filterTypeComboBox.setItemText(6, QtGui.QApplication.translate("MainWindow", "Gaussian", None, QtGui.QApplication.UnicodeUTF8)) - self.filterDesignTypeComboBox.setItemText(0, QtGui.QApplication.translate("MainWindow", "Hamming Window", None, QtGui.QApplication.UnicodeUTF8)) - self.filterDesignTypeComboBox.setItemText(1, QtGui.QApplication.translate("MainWindow", "Hann Window", None, QtGui.QApplication.UnicodeUTF8)) - self.filterDesignTypeComboBox.setItemText(2, QtGui.QApplication.translate("MainWindow", "Blackman Window", None, QtGui.QApplication.UnicodeUTF8)) - self.filterDesignTypeComboBox.setItemText(3, QtGui.QApplication.translate("MainWindow", "Rectangular Window", None, QtGui.QApplication.UnicodeUTF8)) - self.filterDesignTypeComboBox.setItemText(4, QtGui.QApplication.translate("MainWindow", "Kaiser Window", None, QtGui.QApplication.UnicodeUTF8)) - self.filterDesignTypeComboBox.setItemText(5, QtGui.QApplication.translate("MainWindow", "Blackman-harris Window", None, QtGui.QApplication.UnicodeUTF8)) - self.filterDesignTypeComboBox.setItemText(6, QtGui.QApplication.translate("MainWindow", "Equiripple", None, QtGui.QApplication.UnicodeUTF8)) - self.sampleRateLabel.setText(QtGui.QApplication.translate("MainWindow", "Sample Rate (sps)", None, QtGui.QApplication.UnicodeUTF8)) - self.filterGainLabel.setText(QtGui.QApplication.translate("MainWindow", "Filter Gain", None, QtGui.QApplication.UnicodeUTF8)) - self.endofLpfPassBandLabel.setText(QtGui.QApplication.translate("MainWindow", "End of Pass Band (Hz)", None, QtGui.QApplication.UnicodeUTF8)) - self.startofLpfStopBandLabel.setText(QtGui.QApplication.translate("MainWindow", "Start of Stop Band (Hz)", None, QtGui.QApplication.UnicodeUTF8)) - self.lpfStopBandAttenLabel.setText(QtGui.QApplication.translate("MainWindow", "Stop Band Attenuation (dB)", None, QtGui.QApplication.UnicodeUTF8)) - self.lpfPassBandRippleLabel.setText(QtGui.QApplication.translate("MainWindow", "Pass Band Ripple (dB)", None, QtGui.QApplication.UnicodeUTF8)) - self.startofBpfPassBandLabel.setText(QtGui.QApplication.translate("MainWindow", "Start of Pass Band (Hz)", None, QtGui.QApplication.UnicodeUTF8)) - self.endofBpfPassBandLabel.setText(QtGui.QApplication.translate("MainWindow", "End of Pass Band (Hz)", None, QtGui.QApplication.UnicodeUTF8)) - self.bpfStopBandAttenLabel.setText(QtGui.QApplication.translate("MainWindow", "Stop Band Attenuation (dB)", None, QtGui.QApplication.UnicodeUTF8)) - self.bpfTransitionLabel.setText(QtGui.QApplication.translate("MainWindow", "Transition Width (Hz)", None, QtGui.QApplication.UnicodeUTF8)) - self.bpfPassBandRippleLabel.setText(QtGui.QApplication.translate("MainWindow", "Pass Band Ripple (dB)", None, QtGui.QApplication.UnicodeUTF8)) - self.startofBnfStopBandLabel.setText(QtGui.QApplication.translate("MainWindow", "Start of Stop Band (Hz)", None, QtGui.QApplication.UnicodeUTF8)) - self.endofBnfStopBandLabel.setText(QtGui.QApplication.translate("MainWindow", "End of Stop Band (Hz)", None, QtGui.QApplication.UnicodeUTF8)) - self.bnfTransitionLabel.setText(QtGui.QApplication.translate("MainWindow", "Transition Width (Hz)", None, QtGui.QApplication.UnicodeUTF8)) - self.bnfStopBandAttenLabel.setText(QtGui.QApplication.translate("MainWindow", "Stop Band Attenuation (dB)", None, QtGui.QApplication.UnicodeUTF8)) - self.bnfPassBandRippleLabel.setText(QtGui.QApplication.translate("MainWindow", "Pass Band Ripple (dB)", None, QtGui.QApplication.UnicodeUTF8)) - self.endofHpfStopBandLabel.setText(QtGui.QApplication.translate("MainWindow", "End of Stop Band (Hz)", None, QtGui.QApplication.UnicodeUTF8)) - self.startofHpfPassBandLabel.setText(QtGui.QApplication.translate("MainWindow", "Start of Pass Band (Hz)", None, QtGui.QApplication.UnicodeUTF8)) - self.hpfStopBandAttenLabel.setText(QtGui.QApplication.translate("MainWindow", "Stop Band Attenuation (dB)", None, QtGui.QApplication.UnicodeUTF8)) - self.hpfPassBandRippleLabel.setText(QtGui.QApplication.translate("MainWindow", "Pass Band Ripple (dB)", None, QtGui.QApplication.UnicodeUTF8)) - self.rrcSymbolRateLabel.setText(QtGui.QApplication.translate("MainWindow", "Symbol Rate (sps)", None, QtGui.QApplication.UnicodeUTF8)) - self.rrcAlphaLabel.setText(QtGui.QApplication.translate("MainWindow", "Roll-off Factor", None, QtGui.QApplication.UnicodeUTF8)) - self.rrcNumTapsLabel.setText(QtGui.QApplication.translate("MainWindow", "Number of Taps", None, QtGui.QApplication.UnicodeUTF8)) - self.gausSymbolRateLabel.setText(QtGui.QApplication.translate("MainWindow", "Symbol Rate (sps)", None, QtGui.QApplication.UnicodeUTF8)) - self.gausBTLabel.setText(QtGui.QApplication.translate("MainWindow", "Roll-off Factor", None, QtGui.QApplication.UnicodeUTF8)) - self.gausNumTapsLabel.setText(QtGui.QApplication.translate("MainWindow", "Number of Taps", None, QtGui.QApplication.UnicodeUTF8)) - self.filterPropsBox.setTitle(QtGui.QApplication.translate("MainWindow", "Filter Properties", None, QtGui.QApplication.UnicodeUTF8)) - self.nTapsLabel.setText(QtGui.QApplication.translate("MainWindow", "Number of Taps:", None, QtGui.QApplication.UnicodeUTF8)) - self.sysParamsBox.setTitle(QtGui.QApplication.translate("MainWindow", "System Parameters", None, QtGui.QApplication.UnicodeUTF8)) - self.nfftLabel.setText(QtGui.QApplication.translate("MainWindow", "Num FFT points", None, QtGui.QApplication.UnicodeUTF8)) - self.designButton.setText(QtGui.QApplication.translate("MainWindow", "Design", None, QtGui.QApplication.UnicodeUTF8)) - self.tabGroup.setTabText(self.tabGroup.indexOf(self.freqTab), QtGui.QApplication.translate("MainWindow", "Frequency Domain", None, QtGui.QApplication.UnicodeUTF8)) - self.tabGroup.setTabText(self.tabGroup.indexOf(self.timeTab), QtGui.QApplication.translate("MainWindow", "Time Domain", None, QtGui.QApplication.UnicodeUTF8)) - self.tabGroup.setTabText(self.tabGroup.indexOf(self.phaseTab), QtGui.QApplication.translate("MainWindow", "Phase", None, QtGui.QApplication.UnicodeUTF8)) - self.tabGroup.setTabText(self.tabGroup.indexOf(self.groupTab), QtGui.QApplication.translate("MainWindow", "Group Delay", None, QtGui.QApplication.UnicodeUTF8)) - self.menu_File.setTitle(QtGui.QApplication.translate("MainWindow", "&File", None, QtGui.QApplication.UnicodeUTF8)) - self.action_exit.setText(QtGui.QApplication.translate("MainWindow", "E&xit", None, QtGui.QApplication.UnicodeUTF8)) - self.action_save.setText(QtGui.QApplication.translate("MainWindow", "&Save", None, QtGui.QApplication.UnicodeUTF8)) - self.action_save.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+S", None, QtGui.QApplication.UnicodeUTF8)) - self.action_open.setText(QtGui.QApplication.translate("MainWindow", "&Open", None, QtGui.QApplication.UnicodeUTF8)) - self.action_open.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+O", None, QtGui.QApplication.UnicodeUTF8)) + MainWindow.setWindowTitle(QtGui.QApplication.translate( + "MainWindow", "GNU Radio Filter Design Tool", None, QtGui.QApplication.UnicodeUTF8)) + self.filterTypeComboBox.setItemText(0, QtGui.QApplication.translate( + "MainWindow", "Low Pass", None, QtGui.QApplication.UnicodeUTF8)) + self.filterTypeComboBox.setItemText(1, QtGui.QApplication.translate( + "MainWindow", "Band Pass", None, QtGui.QApplication.UnicodeUTF8)) + self.filterTypeComboBox.setItemText(2, QtGui.QApplication.translate( + "MainWindow", "Complex Band Pass", None, QtGui.QApplication.UnicodeUTF8)) + self.filterTypeComboBox.setItemText(3, QtGui.QApplication.translate( + "MainWindow", "Band Notch", None, QtGui.QApplication.UnicodeUTF8)) + self.filterTypeComboBox.setItemText(4, QtGui.QApplication.translate( + "MainWindow", "High Pass", None, QtGui.QApplication.UnicodeUTF8)) + self.filterTypeComboBox.setItemText(5, QtGui.QApplication.translate( + "MainWindow", "Root Raised Cosine", None, QtGui.QApplication.UnicodeUTF8)) + self.filterTypeComboBox.setItemText(6, QtGui.QApplication.translate( + "MainWindow", "Gaussian", None, QtGui.QApplication.UnicodeUTF8)) + self.filterDesignTypeComboBox.setItemText(0, QtGui.QApplication.translate( + "MainWindow", "Hamming Window", None, QtGui.QApplication.UnicodeUTF8)) + self.filterDesignTypeComboBox.setItemText(1, QtGui.QApplication.translate( + "MainWindow", "Hann Window", None, QtGui.QApplication.UnicodeUTF8)) + self.filterDesignTypeComboBox.setItemText(2, QtGui.QApplication.translate( + "MainWindow", "Blackman Window", None, QtGui.QApplication.UnicodeUTF8)) + self.filterDesignTypeComboBox.setItemText(3, QtGui.QApplication.translate( + "MainWindow", "Rectangular Window", None, QtGui.QApplication.UnicodeUTF8)) + self.filterDesignTypeComboBox.setItemText(4, QtGui.QApplication.translate( + "MainWindow", "Kaiser Window", None, QtGui.QApplication.UnicodeUTF8)) + self.filterDesignTypeComboBox.setItemText(5, QtGui.QApplication.translate( + "MainWindow", "Blackman-harris Window", None, QtGui.QApplication.UnicodeUTF8)) + self.filterDesignTypeComboBox.setItemText(6, QtGui.QApplication.translate( + "MainWindow", "Equiripple", None, QtGui.QApplication.UnicodeUTF8)) + self.sampleRateLabel.setText(QtGui.QApplication.translate( + "MainWindow", "Sample Rate (sps)", None, QtGui.QApplication.UnicodeUTF8)) + self.filterGainLabel.setText(QtGui.QApplication.translate( + "MainWindow", "Filter Gain", None, QtGui.QApplication.UnicodeUTF8)) + self.endofLpfPassBandLabel.setText(QtGui.QApplication.translate( + "MainWindow", "End of Pass Band (Hz)", None, QtGui.QApplication.UnicodeUTF8)) + self.startofLpfStopBandLabel.setText(QtGui.QApplication.translate( + "MainWindow", "Start of Stop Band (Hz)", None, QtGui.QApplication.UnicodeUTF8)) + self.lpfStopBandAttenLabel.setText(QtGui.QApplication.translate( + "MainWindow", "Stop Band Attenuation (dB)", None, QtGui.QApplication.UnicodeUTF8)) + self.lpfPassBandRippleLabel.setText(QtGui.QApplication.translate( + "MainWindow", "Pass Band Ripple (dB)", None, QtGui.QApplication.UnicodeUTF8)) + self.startofBpfPassBandLabel.setText(QtGui.QApplication.translate( + "MainWindow", "Start of Pass Band (Hz)", None, QtGui.QApplication.UnicodeUTF8)) + self.endofBpfPassBandLabel.setText(QtGui.QApplication.translate( + "MainWindow", "End of Pass Band (Hz)", None, QtGui.QApplication.UnicodeUTF8)) + self.bpfStopBandAttenLabel.setText(QtGui.QApplication.translate( + "MainWindow", "Stop Band Attenuation (dB)", None, QtGui.QApplication.UnicodeUTF8)) + self.bpfTransitionLabel.setText(QtGui.QApplication.translate( + "MainWindow", "Transition Width (Hz)", None, QtGui.QApplication.UnicodeUTF8)) + self.bpfPassBandRippleLabel.setText(QtGui.QApplication.translate( + "MainWindow", "Pass Band Ripple (dB)", None, QtGui.QApplication.UnicodeUTF8)) + self.startofBnfStopBandLabel.setText(QtGui.QApplication.translate( + "MainWindow", "Start of Stop Band (Hz)", None, QtGui.QApplication.UnicodeUTF8)) + self.endofBnfStopBandLabel.setText(QtGui.QApplication.translate( + "MainWindow", "End of Stop Band (Hz)", None, QtGui.QApplication.UnicodeUTF8)) + self.bnfTransitionLabel.setText(QtGui.QApplication.translate( + "MainWindow", "Transition Width (Hz)", None, QtGui.QApplication.UnicodeUTF8)) + self.bnfStopBandAttenLabel.setText(QtGui.QApplication.translate( + "MainWindow", "Stop Band Attenuation (dB)", None, QtGui.QApplication.UnicodeUTF8)) + self.bnfPassBandRippleLabel.setText(QtGui.QApplication.translate( + "MainWindow", "Pass Band Ripple (dB)", None, QtGui.QApplication.UnicodeUTF8)) + self.endofHpfStopBandLabel.setText(QtGui.QApplication.translate( + "MainWindow", "End of Stop Band (Hz)", None, QtGui.QApplication.UnicodeUTF8)) + self.startofHpfPassBandLabel.setText(QtGui.QApplication.translate( + "MainWindow", "Start of Pass Band (Hz)", None, QtGui.QApplication.UnicodeUTF8)) + self.hpfStopBandAttenLabel.setText(QtGui.QApplication.translate( + "MainWindow", "Stop Band Attenuation (dB)", None, QtGui.QApplication.UnicodeUTF8)) + self.hpfPassBandRippleLabel.setText(QtGui.QApplication.translate( + "MainWindow", "Pass Band Ripple (dB)", None, QtGui.QApplication.UnicodeUTF8)) + self.rrcSymbolRateLabel.setText(QtGui.QApplication.translate( + "MainWindow", "Symbol Rate (sps)", None, QtGui.QApplication.UnicodeUTF8)) + self.rrcAlphaLabel.setText(QtGui.QApplication.translate( + "MainWindow", "Roll-off Factor", None, QtGui.QApplication.UnicodeUTF8)) + self.rrcNumTapsLabel.setText(QtGui.QApplication.translate( + "MainWindow", "Number of Taps", None, QtGui.QApplication.UnicodeUTF8)) + self.gausSymbolRateLabel.setText(QtGui.QApplication.translate( + "MainWindow", "Symbol Rate (sps)", None, QtGui.QApplication.UnicodeUTF8)) + self.gausBTLabel.setText(QtGui.QApplication.translate( + "MainWindow", "Roll-off Factor", None, QtGui.QApplication.UnicodeUTF8)) + self.gausNumTapsLabel.setText(QtGui.QApplication.translate( + "MainWindow", "Number of Taps", None, QtGui.QApplication.UnicodeUTF8)) + self.filterPropsBox.setTitle(QtGui.QApplication.translate( + "MainWindow", "Filter Properties", None, QtGui.QApplication.UnicodeUTF8)) + self.nTapsLabel.setText(QtGui.QApplication.translate( + "MainWindow", "Number of Taps:", None, QtGui.QApplication.UnicodeUTF8)) + self.sysParamsBox.setTitle(QtGui.QApplication.translate( + "MainWindow", "System Parameters", None, QtGui.QApplication.UnicodeUTF8)) + self.nfftLabel.setText(QtGui.QApplication.translate( + "MainWindow", "Num FFT points", None, QtGui.QApplication.UnicodeUTF8)) + self.designButton.setText(QtGui.QApplication.translate( + "MainWindow", "Design", None, QtGui.QApplication.UnicodeUTF8)) + self.tabGroup.setTabText(self.tabGroup.indexOf(self.freqTab), QtGui.QApplication.translate( + "MainWindow", "Frequency Domain", None, QtGui.QApplication.UnicodeUTF8)) + self.tabGroup.setTabText(self.tabGroup.indexOf(self.timeTab), QtGui.QApplication.translate( + "MainWindow", "Time Domain", None, QtGui.QApplication.UnicodeUTF8)) + self.tabGroup.setTabText(self.tabGroup.indexOf(self.phaseTab), QtGui.QApplication.translate( + "MainWindow", "Phase", None, QtGui.QApplication.UnicodeUTF8)) + self.tabGroup.setTabText(self.tabGroup.indexOf(self.groupTab), QtGui.QApplication.translate( + "MainWindow", "Group Delay", None, QtGui.QApplication.UnicodeUTF8)) + self.menu_File.setTitle(QtGui.QApplication.translate( + "MainWindow", "&File", None, QtGui.QApplication.UnicodeUTF8)) + self.action_exit.setText(QtGui.QApplication.translate( + "MainWindow", "E&xit", None, QtGui.QApplication.UnicodeUTF8)) + self.action_save.setText(QtGui.QApplication.translate( + "MainWindow", "&Save", None, QtGui.QApplication.UnicodeUTF8)) + self.action_save.setShortcut(QtGui.QApplication.translate( + "MainWindow", "Ctrl+S", None, QtGui.QApplication.UnicodeUTF8)) + self.action_open.setText(QtGui.QApplication.translate( + "MainWindow", "&Open", None, QtGui.QApplication.UnicodeUTF8)) + self.action_open.setShortcut(QtGui.QApplication.translate( + "MainWindow", "Ctrl+O", None, QtGui.QApplication.UnicodeUTF8)) -#from qwt_plot import QwtPlot -from PyQt5.Qwt import QwtPlot +#from qwt_plot import QwtPlot diff --git a/gr-utils/plot_tools/pyqt_plot.py b/gr-utils/plot_tools/pyqt_plot.py index 2d4df6c5a7..f102fe50e4 100644 --- a/gr-utils/plot_tools/pyqt_plot.py +++ b/gr-utils/plot_tools/pyqt_plot.py @@ -6,6 +6,7 @@ # # WARNING! All changes made in this file will be lost! +from PyQt5 import Qwt from PyQt5 import QtCore, QtGui try: @@ -16,12 +17,14 @@ except AttributeError: try: _encoding = QtGui.QApplication.UnicodeUTF8 + def _translate(context, text, disambig): return QtGui.QApplication.translate(context, text, disambig, _encoding) except AttributeError: def _translate(context, text, disambig): return QtGui.QApplication.translate(context, text, disambig) + class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName(_fromUtf8("MainWindow")) @@ -44,54 +47,73 @@ class Ui_MainWindow(object): self.filePosStartLineEdit = QtGui.QLineEdit(self.filePosBox) self.filePosStartLineEdit.setMinimumSize(QtCore.QSize(50, 0)) self.filePosStartLineEdit.setMaximumSize(QtCore.QSize(100, 16777215)) - self.filePosStartLineEdit.setObjectName(_fromUtf8("filePosStartLineEdit")) - self.filePosLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.filePosStartLineEdit) + self.filePosStartLineEdit.setObjectName( + _fromUtf8("filePosStartLineEdit")) + self.filePosLayout.setWidget( + 0, QtGui.QFormLayout.FieldRole, self.filePosStartLineEdit) self.filePosStopLabel = QtGui.QLabel(self.filePosBox) self.filePosStopLabel.setObjectName(_fromUtf8("filePosStopLabel")) - self.filePosLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.filePosStopLabel) + self.filePosLayout.setWidget( + 1, QtGui.QFormLayout.LabelRole, self.filePosStopLabel) self.filePosStopLineEdit = QtGui.QLineEdit(self.filePosBox) self.filePosStopLineEdit.setMinimumSize(QtCore.QSize(50, 0)) self.filePosStopLineEdit.setMaximumSize(QtCore.QSize(100, 16777215)) - self.filePosStopLineEdit.setObjectName(_fromUtf8("filePosStopLineEdit")) - self.filePosLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.filePosStopLineEdit) + self.filePosStopLineEdit.setObjectName( + _fromUtf8("filePosStopLineEdit")) + self.filePosLayout.setWidget( + 1, QtGui.QFormLayout.FieldRole, self.filePosStopLineEdit) self.filePosLengthLabel = QtGui.QLabel(self.filePosBox) self.filePosLengthLabel.setObjectName(_fromUtf8("filePosLengthLabel")) - self.filePosLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.filePosLengthLabel) + self.filePosLayout.setWidget( + 2, QtGui.QFormLayout.LabelRole, self.filePosLengthLabel) self.filePosLengthLineEdit = QtGui.QLineEdit(self.filePosBox) self.filePosLengthLineEdit.setMinimumSize(QtCore.QSize(50, 0)) self.filePosLengthLineEdit.setMaximumSize(QtCore.QSize(100, 16777215)) - self.filePosLengthLineEdit.setObjectName(_fromUtf8("filePosLengthLineEdit")) - self.filePosLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.filePosLengthLineEdit) + self.filePosLengthLineEdit.setObjectName( + _fromUtf8("filePosLengthLineEdit")) + self.filePosLayout.setWidget( + 2, QtGui.QFormLayout.FieldRole, self.filePosLengthLineEdit) self.filePosStartLabel = QtGui.QLabel(self.filePosBox) self.filePosStartLabel.setObjectName(_fromUtf8("filePosStartLabel")) - self.filePosLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.filePosStartLabel) + self.filePosLayout.setWidget( + 0, QtGui.QFormLayout.LabelRole, self.filePosStartLabel) self.gridLayout_4.addLayout(self.filePosLayout, 0, 0, 1, 1) self.fileTimeLayout = QtGui.QFormLayout() self.fileTimeLayout.setObjectName(_fromUtf8("fileTimeLayout")) self.fileTimeStartLabel = QtGui.QLabel(self.filePosBox) self.fileTimeStartLabel.setObjectName(_fromUtf8("fileTimeStartLabel")) - self.fileTimeLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.fileTimeStartLabel) + self.fileTimeLayout.setWidget( + 0, QtGui.QFormLayout.LabelRole, self.fileTimeStartLabel) self.fileTimeStartLineEdit = QtGui.QLineEdit(self.filePosBox) self.fileTimeStartLineEdit.setMinimumSize(QtCore.QSize(50, 0)) self.fileTimeStartLineEdit.setMaximumSize(QtCore.QSize(100, 16777215)) - self.fileTimeStartLineEdit.setObjectName(_fromUtf8("fileTimeStartLineEdit")) - self.fileTimeLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.fileTimeStartLineEdit) + self.fileTimeStartLineEdit.setObjectName( + _fromUtf8("fileTimeStartLineEdit")) + self.fileTimeLayout.setWidget( + 0, QtGui.QFormLayout.FieldRole, self.fileTimeStartLineEdit) self.fileTimeStopLabel = QtGui.QLabel(self.filePosBox) self.fileTimeStopLabel.setObjectName(_fromUtf8("fileTimeStopLabel")) - self.fileTimeLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.fileTimeStopLabel) + self.fileTimeLayout.setWidget( + 1, QtGui.QFormLayout.LabelRole, self.fileTimeStopLabel) self.fileTimeStopLineEdit = QtGui.QLineEdit(self.filePosBox) self.fileTimeStopLineEdit.setMinimumSize(QtCore.QSize(50, 0)) self.fileTimeStopLineEdit.setMaximumSize(QtCore.QSize(100, 16777215)) - self.fileTimeStopLineEdit.setObjectName(_fromUtf8("fileTimeStopLineEdit")) - self.fileTimeLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.fileTimeStopLineEdit) + self.fileTimeStopLineEdit.setObjectName( + _fromUtf8("fileTimeStopLineEdit")) + self.fileTimeLayout.setWidget( + 1, QtGui.QFormLayout.FieldRole, self.fileTimeStopLineEdit) self.fileTimeLengthLabel = QtGui.QLabel(self.filePosBox) - self.fileTimeLengthLabel.setObjectName(_fromUtf8("fileTimeLengthLabel")) - self.fileTimeLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.fileTimeLengthLabel) + self.fileTimeLengthLabel.setObjectName( + _fromUtf8("fileTimeLengthLabel")) + self.fileTimeLayout.setWidget( + 2, QtGui.QFormLayout.LabelRole, self.fileTimeLengthLabel) self.fileTimeLengthLineEdit = QtGui.QLineEdit(self.filePosBox) self.fileTimeLengthLineEdit.setMinimumSize(QtCore.QSize(50, 0)) self.fileTimeLengthLineEdit.setMaximumSize(QtCore.QSize(100, 16777215)) - self.fileTimeLengthLineEdit.setObjectName(_fromUtf8("fileTimeLengthLineEdit")) - self.fileTimeLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.fileTimeLengthLineEdit) + self.fileTimeLengthLineEdit.setObjectName( + _fromUtf8("fileTimeLengthLineEdit")) + self.fileTimeLayout.setWidget( + 2, QtGui.QFormLayout.FieldRole, self.fileTimeLengthLineEdit) self.gridLayout_4.addLayout(self.fileTimeLayout, 0, 1, 1, 1) self.gridLayout.addWidget(self.filePosBox, 2, 0, 1, 1) self.displayGroupBox = QtGui.QGroupBox(self.centralwidget) @@ -131,16 +153,19 @@ class Ui_MainWindow(object): self.sysGroupBox.setMinimumSize(QtCore.QSize(200, 0)) self.sysGroupBox.setObjectName(_fromUtf8("sysGroupBox")) self.formLayout = QtGui.QFormLayout(self.sysGroupBox) - self.formLayout.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow) + self.formLayout.setFieldGrowthPolicy( + QtGui.QFormLayout.AllNonFixedFieldsGrow) self.formLayout.setObjectName(_fromUtf8("formLayout")) self.sampleRateLabel = QtGui.QLabel(self.sysGroupBox) self.sampleRateLabel.setObjectName(_fromUtf8("sampleRateLabel")) - self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.sampleRateLabel) + self.formLayout.setWidget( + 0, QtGui.QFormLayout.LabelRole, self.sampleRateLabel) self.sampleRateLineEdit = QtGui.QLineEdit(self.sysGroupBox) self.sampleRateLineEdit.setMinimumSize(QtCore.QSize(50, 0)) self.sampleRateLineEdit.setMaximumSize(QtCore.QSize(100, 16777215)) self.sampleRateLineEdit.setObjectName(_fromUtf8("sampleRateLineEdit")) - self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.sampleRateLineEdit) + self.formLayout.setWidget( + 0, QtGui.QFormLayout.FieldRole, self.sampleRateLineEdit) self.gridLayout.addWidget(self.sysGroupBox, 2, 1, 1, 1) self.frame = QtGui.QFrame(self.centralwidget) self.frame.setFrameShape(QtGui.QFrame.StyledPanel) @@ -170,16 +195,19 @@ class Ui_MainWindow(object): self.fftPropBox.setMinimumSize(QtCore.QSize(160, 0)) self.fftPropBox.setObjectName(_fromUtf8("fftPropBox")) self.formLayout_4 = QtGui.QFormLayout(self.fftPropBox) - self.formLayout_4.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow) + self.formLayout_4.setFieldGrowthPolicy( + QtGui.QFormLayout.AllNonFixedFieldsGrow) self.formLayout_4.setObjectName(_fromUtf8("formLayout_4")) self.psdFFTSizeLabel = QtGui.QLabel(self.fftPropBox) self.psdFFTSizeLabel.setObjectName(_fromUtf8("psdFFTSizeLabel")) - self.formLayout_4.setWidget(0, QtGui.QFormLayout.LabelRole, self.psdFFTSizeLabel) + self.formLayout_4.setWidget( + 0, QtGui.QFormLayout.LabelRole, self.psdFFTSizeLabel) self.psdFFTComboBox = QtGui.QComboBox(self.fftPropBox) self.psdFFTComboBox.setMinimumSize(QtCore.QSize(96, 0)) self.psdFFTComboBox.setMaximumSize(QtCore.QSize(96, 16777215)) self.psdFFTComboBox.setObjectName(_fromUtf8("psdFFTComboBox")) - self.formLayout_4.setWidget(0, QtGui.QFormLayout.FieldRole, self.psdFFTComboBox) + self.formLayout_4.setWidget( + 0, QtGui.QFormLayout.FieldRole, self.psdFFTComboBox) self.psdFFTSizeLabel.raise_() self.psdFFTComboBox.raise_() self.horizontalLayout_2.addWidget(self.fftPropBox) @@ -198,12 +226,14 @@ class Ui_MainWindow(object): self.formLayout_3.setObjectName(_fromUtf8("formLayout_3")) self.specFFTLabel = QtGui.QLabel(self.groupBox) self.specFFTLabel.setObjectName(_fromUtf8("specFFTLabel")) - self.formLayout_3.setWidget(1, QtGui.QFormLayout.LabelRole, self.specFFTLabel) + self.formLayout_3.setWidget( + 1, QtGui.QFormLayout.LabelRole, self.specFFTLabel) self.specFFTComboBox = QtGui.QComboBox(self.groupBox) self.specFFTComboBox.setMinimumSize(QtCore.QSize(96, 0)) self.specFFTComboBox.setMaximumSize(QtCore.QSize(96, 16777215)) self.specFFTComboBox.setObjectName(_fromUtf8("specFFTComboBox")) - self.formLayout_3.setWidget(1, QtGui.QFormLayout.FieldRole, self.specFFTComboBox) + self.formLayout_3.setWidget( + 1, QtGui.QFormLayout.FieldRole, self.specFFTComboBox) self.horizontalLayout_3.addWidget(self.groupBox) self.specPlot = Qwt5.QwtPlot(self.specTab) self.specPlot.setObjectName(_fromUtf8("specPlot")) @@ -237,35 +267,51 @@ class Ui_MainWindow(object): self.retranslateUi(MainWindow) self.tabGroup.setCurrentIndex(0) - QtCore.QObject.connect(self.action_exit, QtCore.SIGNAL(_fromUtf8("activated()")), MainWindow.close) + QtCore.QObject.connect(self.action_exit, QtCore.SIGNAL( + _fromUtf8("activated()")), MainWindow.close) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow", None)) - self.filePosBox.setTitle(_translate("MainWindow", "File Position", None)) + self.filePosBox.setTitle(_translate( + "MainWindow", "File Position", None)) self.filePosStopLabel.setText(_translate("MainWindow", "Stop", None)) - self.filePosLengthLabel.setText(_translate("MainWindow", "Length", None)) + self.filePosLengthLabel.setText( + _translate("MainWindow", "Length", None)) self.filePosStartLabel.setText(_translate("MainWindow", "Start", None)) - self.fileTimeStartLabel.setText(_translate("MainWindow", "time start (sec)", None)) - self.fileTimeStopLabel.setText(_translate("MainWindow", "time stop (sec)", None)) - self.fileTimeLengthLabel.setText(_translate("MainWindow", "time length (sec)", None)) - self.displayGroupBox.setTitle(_translate("MainWindow", "Display Properties", None)) - self.lineWidthLabel.setText(_translate("MainWindow", "Line Width", None)) - self.lineStyleLabel.setText(_translate("MainWindow", "Line Style", None)) - self.styleSizeLabel.setText(_translate("MainWindow", "Style Size", None)) - self.sysGroupBox.setTitle(_translate("MainWindow", "System Properties", None)) - self.sampleRateLabel.setText(_translate("MainWindow", "Sample Rate", None)) - self.tabGroup.setTabText(self.tabGroup.indexOf(self.timeTab), _translate("MainWindow", "Time Domain", None)) - self.fftPropBox.setTitle(_translate("MainWindow", "FFT Properties", None)) - self.psdFFTSizeLabel.setText(_translate("MainWindow", "FFT Size", None)) - self.tabGroup.setTabText(self.tabGroup.indexOf(self.freqTab), _translate("MainWindow", "Frequency Domain", None)) - self.groupBox.setTitle(_translate("MainWindow", "Spectrogram Properties", None)) + self.fileTimeStartLabel.setText(_translate( + "MainWindow", "time start (sec)", None)) + self.fileTimeStopLabel.setText(_translate( + "MainWindow", "time stop (sec)", None)) + self.fileTimeLengthLabel.setText(_translate( + "MainWindow", "time length (sec)", None)) + self.displayGroupBox.setTitle(_translate( + "MainWindow", "Display Properties", None)) + self.lineWidthLabel.setText( + _translate("MainWindow", "Line Width", None)) + self.lineStyleLabel.setText( + _translate("MainWindow", "Line Style", None)) + self.styleSizeLabel.setText( + _translate("MainWindow", "Style Size", None)) + self.sysGroupBox.setTitle(_translate( + "MainWindow", "System Properties", None)) + self.sampleRateLabel.setText( + _translate("MainWindow", "Sample Rate", None)) + self.tabGroup.setTabText(self.tabGroup.indexOf( + self.timeTab), _translate("MainWindow", "Time Domain", None)) + self.fftPropBox.setTitle(_translate( + "MainWindow", "FFT Properties", None)) + self.psdFFTSizeLabel.setText( + _translate("MainWindow", "FFT Size", None)) + self.tabGroup.setTabText(self.tabGroup.indexOf( + self.freqTab), _translate("MainWindow", "Frequency Domain", None)) + self.groupBox.setTitle(_translate( + "MainWindow", "Spectrogram Properties", None)) self.specFFTLabel.setText(_translate("MainWindow", "FFT Size", None)) - self.tabGroup.setTabText(self.tabGroup.indexOf(self.specTab), _translate("MainWindow", "Spectrogram", None)) + self.tabGroup.setTabText(self.tabGroup.indexOf( + self.specTab), _translate("MainWindow", "Spectrogram", None)) self.menu_File.setTitle(_translate("MainWindow", "&File", None)) self.action_open.setText(_translate("MainWindow", "&Open", None)) self.action_open.setShortcut(_translate("MainWindow", "Ctrl+O", None)) self.action_exit.setText(_translate("MainWindow", "E&xit", None)) self.action_reload.setText(_translate("MainWindow", "&Reload", None)) - -from PyQt5 import Qwt diff --git a/gr-utils/read_file_metadata/gr_read_file_metadata b/gr-utils/read_file_metadata/gr_read_file_metadata index a3b851b0d0..6bacfac0ae 100755 --- a/gr-utils/read_file_metadata/gr_read_file_metadata +++ b/gr-utils/read_file_metadata/gr_read_file_metadata @@ -14,6 +14,7 @@ from argparse import ArgumentParser import pmt from gnuradio.blocks import parse_file_metadata + def main(filename, detached=False): handle = open(filename, "rb") @@ -30,7 +31,8 @@ def main(filename, detached=False): try: header = pmt.deserialize_str(header_str) except RuntimeError: - sys.stderr.write("Could not deserialize header: invalid or corrupt data file.\n") + sys.stderr.write( + "Could not deserialize header: invalid or corrupt data file.\n") sys.exit(1) print("HEADER {0}".format(nheaders)) @@ -44,11 +46,13 @@ def main(filename, detached=False): try: extra = pmt.deserialize_str(extra_str) except RuntimeError: - sys.stderr.write("Could not deserialize extras: invalid or corrupt data file.\n") + sys.stderr.write( + "Could not deserialize extras: invalid or corrupt data file.\n") sys.exit(1) print("\nExtra Header:") - extra_info = parse_file_metadata.parse_extra_dict(extra, info, True) + extra_info = parse_file_metadata.parse_extra_dict( + extra, info, True) nheaders += 1 nread += parse_file_metadata.HEADER_LENGTH + info["extra_len"] @@ -61,11 +65,12 @@ def main(filename, detached=False): if __name__ == "__main__": description = "Read in a GNU Radio file with meta data, extracts the header and prints it." - parser = ArgumentParser(conflict_handler="resolve", description=description) + parser = ArgumentParser(conflict_handler="resolve", + description=description) parser.add_argument("-D", "--detached", action="store_true", - help="Used if header is detached.") + help="Used if header is detached.") parser.add_argument("file", metavar="FILE", - help="Input file"); + help="Input file") args = parser.parse_args() main(args.file, args.detached) |