mirror of
https://gitee.com/xiaohuolufeihua/bizhang_-obav.git
synced 2026-05-22 01:12:31 +00:00
px4modulesdoc: move to Python3
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
#! /usr/bin/env python3
|
||||||
"""
|
"""
|
||||||
Class to generate Markdown documentation pages from parsed module doc strings
|
Class to generate Markdown documentation pages from parsed module doc strings
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#! /usr/bin/env python3
|
||||||
import sys
|
import sys
|
||||||
import re
|
import re
|
||||||
import math
|
import math
|
||||||
@@ -369,9 +370,9 @@ class SourceParser(object):
|
|||||||
failed = True
|
failed = True
|
||||||
|
|
||||||
if failed:
|
if failed:
|
||||||
print("Warning: documentation inconsistency in %s:" % scope)
|
print(("Warning: documentation inconsistency in %s:" % scope))
|
||||||
print(" Documented options : %s" % sorted_module_options)
|
print((" Documented options : %s" % sorted_module_options))
|
||||||
print(" Options found in getopt(): %s" % sorted_getopt_args)
|
print((" Options found in getopt(): %s" % sorted_getopt_args))
|
||||||
self._consistency_checks_failure = True
|
self._consistency_checks_failure = True
|
||||||
|
|
||||||
|
|
||||||
@@ -393,7 +394,7 @@ class SourceParser(object):
|
|||||||
continue # handled in the base class
|
continue # handled in the base class
|
||||||
|
|
||||||
if not command in doc_commands:
|
if not command in doc_commands:
|
||||||
print("Warning: undocumented command '%s' in %s" %(command, scope))
|
print(("Warning: undocumented command '%s' in %s" %(command, scope)))
|
||||||
self._consistency_checks_failure = True
|
self._consistency_checks_failure = True
|
||||||
|
|
||||||
# limit the maximum line length in the module doc string
|
# limit the maximum line length in the module doc string
|
||||||
@@ -409,8 +410,8 @@ class SourceParser(object):
|
|||||||
elif not verbatim_mode:
|
elif not verbatim_mode:
|
||||||
if not 'www.' in line and not 'http' in line:
|
if not 'www.' in line and not 'http' in line:
|
||||||
if len(line) > max_line_length:
|
if len(line) > max_line_length:
|
||||||
print('Line too long (%i > %i) in %s:' % (len(line), max_line_length, scope))
|
print(('Line too long (%i > %i) in %s:' % (len(line), max_line_length, scope)))
|
||||||
print(' '+line)
|
print((' '+line))
|
||||||
self._consistency_checks_failure = True
|
self._consistency_checks_failure = True
|
||||||
|
|
||||||
|
|
||||||
@@ -442,7 +443,7 @@ class SourceParser(object):
|
|||||||
while next_position < len(contents):
|
while next_position < len(contents):
|
||||||
if contents[next_position] == '\\': # escaping
|
if contents[next_position] == '\\': # escaping
|
||||||
if contents[next_position + 1] != '\n': # skip if continued on next line
|
if contents[next_position + 1] != '\n': # skip if continued on next line
|
||||||
string += contents[next_position:next_position+2].decode('string_escape')
|
string += contents[next_position:next_position+2].encode().decode('unicode_escape')
|
||||||
next_position += 2
|
next_position += 2
|
||||||
elif contents[next_position] == '"':
|
elif contents[next_position] == '"':
|
||||||
next_position += 1
|
next_position += 1
|
||||||
@@ -519,4 +520,3 @@ class SourceParser(object):
|
|||||||
for subcategory in group:
|
for subcategory in group:
|
||||||
group[subcategory] = sorted(group[subcategory], key=lambda x: x.name())
|
group[subcategory] = sorted(group[subcategory], key=lambda x: x.name())
|
||||||
return groups
|
return groups
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#! /usr/bin/env python3
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import codecs
|
import codecs
|
||||||
@@ -24,7 +25,7 @@ class SourceScanner(object):
|
|||||||
if not self.ScanFile(path, parser):
|
if not self.ScanFile(path, parser):
|
||||||
return False
|
return False
|
||||||
except:
|
except:
|
||||||
print("Exception in file %s" % path)
|
print(("Exception in file %s" % path))
|
||||||
raise
|
raise
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@@ -44,6 +45,6 @@ class SourceScanner(object):
|
|||||||
contents = f.read()
|
contents = f.read()
|
||||||
except:
|
except:
|
||||||
contents = ''
|
contents = ''
|
||||||
print('Failed reading file: %s, skipping content.' % path)
|
print(('Failed reading file: %s, skipping content.' % path))
|
||||||
pass
|
pass
|
||||||
return parser.Parse(scope, contents)
|
return parser.Parse(scope, contents)
|
||||||
|
|||||||
Reference in New Issue
Block a user