Skip to content
Extraits de code Groupes Projets
Valider a4dcb8bc rédigé par Louis Navarre's avatar Louis Navarre
Parcourir les fichiers

Format

parent b76de88c
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -34,7 +34,7 @@ def ntf_parse(args): ...@@ -34,7 +34,7 @@ def ntf_parse(args):
node_a = mapping.setdefault(node_a, len(mapping)) node_a = mapping.setdefault(node_a, len(mapping))
node_b = mapping.setdefault(node_b, len(mapping)) node_b = mapping.setdefault(node_b, len(mapping))
c_ab = int(tab[2]) c_ab = int(tab[2])
nodes.setdefault(node_a, list()).append((node_b, c_ab)) nodes.setdefault(node_a, list()).append((node_b, c_ab))
...@@ -45,10 +45,11 @@ def to_header_file(nodes, nb_links, output): ...@@ -45,10 +45,11 @@ def to_header_file(nodes, nb_links, output):
# Check that the extension is correct. # Check that the extension is correct.
_, file_extension = os.path.splitext(output) _, file_extension = os.path.splitext(output)
if file_extension != ".h": if file_extension != ".h":
warnings.warn(f'The extension of the output file is not ".h": {output}') warnings.warn(
f'The extension of the output file is not ".h": {output}')
s = "" s = ""
# Create the array containing the links. # Create the array containing the links.
for node_id, neighs in nodes.items(): for node_id, neighs in nodes.items():
for (neigh_id, cost) in neighs: for (neigh_id, cost) in neighs:
...@@ -84,7 +85,8 @@ if __name__ == "__main__": ...@@ -84,7 +85,8 @@ if __name__ == "__main__":
help="Number of nodes. Unused if '--ntf'", default=5) help="Number of nodes. Unused if '--ntf'", default=5)
parser.add_argument("-l", "--links", type=int, parser.add_argument("-l", "--links", type=int,
help="Number of links. Unused if '--ntf'", default=10) help="Number of links. Unused if '--ntf'", default=10)
parser.add_argument("--c-header", action="store_true", help="Writes the graph as a C header file (.h) instead of a binary file") parser.add_argument("--c-header", action="store_true",
help="Writes the graph as a C header file (.h) instead of a binary file")
args = parser.parse_args() args = parser.parse_args()
if args.ntf: if args.ntf:
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter