Example #1
0
 def fix_file(self, args):
     input_path, self.xml_dir, out_path = args.input, args.xml_doc_directory, args.output
     with open(input_path) as f:
         self.lines = split_oneliner_comments_and_remove_property_docstrings(
             f.readlines())
     self.xml_tree = doxygen_utils.load_xml_for_module(
         self.xml_dir, args.module)
     out = []
     while len(self.lines) > 0:
         line = self.next()
         if line.startswith("def "):
             self.push_front(line)
             with indenter_t():
                 out.extend(self.generate_function_pydoc())
         elif line.startswith("class "):
             self.push_front(line)
             with indenter_t():
                 out.extend(self.generate_class_pydoc())
         else:
             m = self.SIMPLE_ASSIGNMENT_RE.match(line)
             if m:
                 self.push_front(line)
                 with indenter_t():
                     self.fix_assignment(out, m)
             else:
                 out.append(line)
     out = list(map(lambda l: l.replace("NONNULL_", ""), out))
     with open(out_path, "w") as o:
         o.write("\n".join(out))
Example #2
0
 def fix_file(self, args):
     input_path, xml_dir_path, out_path = args.input, args.xml_doc_directory, args.output
     with open(input_path) as f:
         self.lines = split_oneliner_comments_and_remove_property_docstrings(
             f.readlines())
     self.xml_tree = doxygen_utils.load_xml_for_module(
         xml_dir_path, args.module)
     out = []
     while len(self.lines) > 0:
         line = self.next()
         if line.startswith("def "):
             self.push_front(line)
             self.fix_fun(out)
         elif line.startswith("class "):
             self.push_front(line)
             self.fix_class(out)
         else:
             m = self.SIMPLE_ASSIGNMENT_RE.match(line)
             if m:
                 self.push_front(line)
                 self.fix_assignment(out, m)
             else:
                 out.append(line)
     with open(out_path, "w") as o:
         o.write("\n".join(out))
Example #3
0
 def fix_file(self, args):
     input_path, xml_dir_path, out_path = args.input, args.xml_doc_directory, args.output
     with open(input_path, "rt") as f:
         self.lines = split_oneliner_comments(f.readlines())
     self.xml_tree = doxygen_utils.load_xml_for_module(xml_dir_path, args.module)
     out = []
     while len(self.lines) > 0:
         line = next(self)
         if line.startswith("def "):
             self.push_front(line)
             self.fix_fun(out)
         elif line.startswith("class "):
             self.push_front(line)
             self.fix_class(out)
         else:
             m = self.SIMPLE_ASSIGNMENT_RE.match(line)
             if m:
                 self.push_front(line)
                 self.fix_assignment(out, m)
             else:
                 out.append(line)
     with open(out_path, "wt") as o:
         o.write("\n".join(out))
Example #4
0
                    default=False,
                    action="store_true")
parser.add_argument("-v", "--verbose", default=False, action="store_true")
parser.add_argument("-b", "--bc695", default=False, action="store_true")
parser.add_argument("-x", "--xml-doc-directory", required=True)
args = parser.parse_args()

this_dir, _ = os.path.split(__file__)
sys.path.append(this_dir)
import doxygen_utils

typemaps = []

# generate typemaps that will have to be injected for additional checks
xml_tree = doxygen_utils.load_xml_for_module(args.xml_doc_directory,
                                             args.module,
                                             or_dummy=False)
if xml_tree is not None:
    all_functions = doxygen_utils.get_toplevel_functions(xml_tree)
    for fun_node in all_functions:
        fun_name = doxygen_utils.get_single_child_element_text_contents(
            fun_node, "name")
        params = []

        def reg_param(*args):
            params.append(args)

        doxygen_utils.for_each_param(fun_node, reg_param)

        def relevant_and_non_null(ptyp, desc):
            if ptyp.strip().startswith("qstring"):
Example #5
0
parser.add_argument("-w", "--pywraps", required=True)
parser.add_argument("-d", "--interface-dependencies", type=str, required=True)
parser.add_argument("-l", "--lifecycle-aware", default=False, action="store_true")
parser.add_argument("-v", "--verbose", default=False, action="store_true")
parser.add_argument("-b", "--bc695", default=False, action="store_true")
parser.add_argument("-x", "--xml-doc-directory", required=True)
args = parser.parse_args()

this_dir, _ = os.path.split(__file__)
sys.path.append(this_dir)
import doxygen_utils

typemaps = []

# generate typemaps that will have to be injected for additional checks
xml_tree = doxygen_utils.load_xml_for_module(args.xml_doc_directory, args.module, or_dummy=False)
if xml_tree is not None:
    all_functions = doxygen_utils.get_toplevel_functions(xml_tree)
    for fun_node in all_functions:
        fun_name = doxygen_utils.get_single_child_element_text_contents(fun_node, "name")
        params = []
        def reg_param(*args):
            params.append(args)
        doxygen_utils.for_each_param(fun_node, reg_param)
        def relevant_and_non_null(ptyp, desc):
            if ptyp.strip().startswith("qstring"):
                return False
            return (desc or "").lower().find("not be null") > -1

        for name, ptyp, desc in params:
            if relevant_and_non_null(ptyp, desc):