Exemplo n.º 1
0
 def test_doc_schemas(self):
     os.makedirs(self._docs_path, 0o755, exist_ok=True)
     result = ''
     categories = {
         'ipmi': [FruRecordType.ipmi_area, FruRecordType.ipmi_multirecord],
         'picmg':
         [FruRecordType.picmg_multirecord, FruRecordType.picmg_secondary],
         'fmc':
         [FruRecordType.fmc_multirecord, FruRecordType.fmc_secondary],
     }
     for category in categories:
         result = f'\n# {category.upper()} records\n\n'
         for rec_type in categories[category]:
             rec_list = rec_enumerate(rec_type)
             if len(rec_list) != 0:
                 for r in rec_list:
                     name, doc = rec_info(r)
                     schema_doc = self.doc_record_schema_md(name)
                     if len(schema_doc) == 0:
                         continue
                     result += f'\n## {name}\n{doc}\n\n'
                     result += schema_doc
         with open(os.path.join(self._docs_path, f'{category}.md'),
                   'w') as f:
             f.write(result)
Exemplo n.º 2
0
 def doc_supported_records_md(self):
     w1 = 36
     w2 = 80
     result = '# Supported records\n'
     for rec_type in list(FruRecordType):
         rec_list = rec_enumerate(rec_type)
         if len(rec_list) != 0:
             result += f'\n## {rec_type.name}\n\n'
             result += '|' + 'Name'.ljust(w1) + '|' + 'Definition'.ljust(
                 w2) + '|\n'
             result += '|' + '-' * w1 + '|' + '-' * w2 + '|\n'
             for r in rec_list:
                 result += f'|{r.__name__.ljust(w1)}|{str(r.__doc__).strip().ljust(w2)}|\n'
     return result
Exemplo n.º 3
0
def list_supported_records():
    width = 108
    separator = '#' * width
    lf = f"#".ljust(width-1) + '#'
    print(separator)
    for rec_type in list(FruRecordType):
        rec_list = rec_enumerate(rec_type)
        if len(rec_list) != 0:
            print(lf)
            print(f'# type: {rec_type.name}'.ljust(width-1) + '#')
            print(lf)
            for r in rec_list:
                print(f'# {r.__name__.ljust(33)} {str(r.__doc__).strip()}'.ljust(width-1) + '#')
            print(lf)
            print(separator)
Exemplo n.º 4
0
 def doc_supported_records_md(self):
     w1 = 36
     w2 = 80
     result = '# Supported records\n'
     for rec_type in list(FruRecordType):
         rec_list = rec_enumerate(rec_type)
         if len(rec_list) != 0:
             result += f'\n## {rec_type.name}\n\n'
             result += '|' + 'Name'.ljust(w1) + '|' + 'Definition'.ljust(
                 w2) + '|\n'
             result += '|' + '-' * w1 + '|' + '-' * w2 + '|\n'
             for r in rec_list:
                 name, doc = rec_info(r)
                 result += f'|{name.ljust(w1)}|{doc.ljust(w2)}|\n'
             result += '\n<br>\n\n'
     return result
Exemplo n.º 5
0
def list_supported_records():
    width = 108
    separator = '+' + '-' * (width-2) + '+'
    lf = f"|".ljust(width-1) + '|'
    print(separator)
    for rec_type in list(FruRecordType):
        rec_list = rec_enumerate(rec_type)
        if len(rec_list) != 0:
            print(lf)
            print(f'| type: {rec_type.name}'.ljust(width-1) + '|')
            print(lf)
            for r in rec_list:
                name, doc = rec_info(r)
                print(f'| {name.ljust(33)} {doc}'.ljust(width-1) + '|')
            print(lf)
            print(separator)