in shelldocs/src/main/python/shelldocs.py [0:0]
def process_file(self):
""" stuff all of the functions into an array """
self.functions = []
mapping = {
'## @description': '_process_description',
'## @audience': '_process_audience',
'## @stability': '_process_stability',
'## @replaceable': '_process_replaceable',
'## @param': '_process_param',
'## @return': '_process_return',
}
if self.isignored():
return
try:
with open(self.filename, "r") as shellcode: #pylint: disable=unspecified-encoding
# if the file contains a comment containing
# only "SHELLDOC-IGNORE" then skip that file
funcdef = ShellFunction(self.filename)
linenum = 0
for line in shellcode:
linenum = linenum + 1
for text, method in mapping.items():
if line.startswith(text):
getattr(self, method)(funcdef, text=line)
if line.startswith(
'function') or ProcessFile.FUNCTIONRE.match(line):
self._process_function(funcdef,
text=line,
linenum=linenum)
if self.skipsuperprivate and funcdef.isprivateandnotreplaceable(
):
pass
else:
self.functions.append(funcdef)
funcdef = ShellFunction(self.filename)
except OSError as err:
logging.error("ERROR: Failed to read from file: %s. Skipping.",
err.filename)
self.functions = []