fic: Make pep8 happy

pull/227/head
Raphaël Vinot 2020-01-30 11:38:56 +01:00
parent 8d01493a97
commit 620ac3600c
1 changed files with 16 additions and 12 deletions

View File

@ -39,6 +39,7 @@ argParser = argparse.ArgumentParser(description='Generate documentation from MIS
argParser.add_argument('-v', action='store_true', help='Verbose mode') argParser.add_argument('-v', action='store_true', help='Verbose mode')
args = argParser.parse_args() args = argParser.parse_args()
def header(adoc=False): def header(adoc=False):
if adoc is False: if adoc is False:
return False return False
@ -66,6 +67,7 @@ def header(adoc=False):
doc = doc + "= MISP objects\n" doc = doc + "= MISP objects\n"
return doc return doc
def asciidoc(content=False, adoc=None, t='title', title=''): def asciidoc(content=False, adoc=None, t='title', title=''):
adoc = adoc + "\n" adoc = adoc + "\n"
@ -73,14 +75,14 @@ def asciidoc(content=False, adoc=None, t='title',title=''):
if t == 'title': if t == 'title':
output = '== ' + content output = '== ' + content
elif t == 'info': elif t == 'info':
content = content.rstrip('\.') content = content.rstrip('.')
output = "\n{}.\n\n{} {} {}{}/definition.json[*this location*] {}.\n".format(content, 'NOTE: ', title, 'is a MISP object available in JSON format at https://github.com/MISP/misp-objects/blob/master/objects/', title.lower(), ' The JSON format can be freely reused in your application or automatically enabled in https://www.github.com/MISP/MISP[MISP]') output = "\n{}.\n\n{} {} {}{}/definition.json[*this location*] {}.\n".format(content, 'NOTE: ', title, 'is a MISP object available in JSON format at https://github.com/MISP/misp-objects/blob/master/objects/', title.lower(), ' The JSON format can be freely reused in your application or automatically enabled in https://www.github.com/MISP/MISP[MISP]')
elif t == 'author': elif t == 'author':
output = '\nauthors:: {}\n'.format(' - '.join(content)) output = '\nauthors:: {}\n'.format(' - '.join(content))
elif t == 'value': elif t == 'value':
output = '=== ' + content output = '=== ' + content
elif t == 'description': elif t == 'description':
content = content.rstrip('\.') content = content.rstrip('.')
output = '\n{}\n'.format(content) output = '\n{}\n'.format(content)
elif t == 'attributes': elif t == 'attributes':
# output = '\n{}\n'.format # output = '\n{}\n'.format
@ -113,6 +115,7 @@ def asciidoc(content=False, adoc=None, t='title',title=''):
adoc = adoc + output adoc = adoc + output
return adoc return adoc
adoc = "" adoc = ""
print(header(adoc=adoc)) print(header(adoc=adoc))
@ -138,4 +141,5 @@ with open('../relationships/definition.json') as filerelationships:
output = output + '\n|===\n' output = output + '\n|===\n'
adoc = adoc + output adoc = adoc + output
print(adoc) print(adoc)